mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Support DPI scaling on Linux.
This commit is contained in:
parent
24c834bf8c
commit
4a33dcc1bc
@ -275,10 +275,17 @@ int main( int argc, char** argv )
|
|||||||
typedef UINT(*GDFS)(void);
|
typedef UINT(*GDFS)(void);
|
||||||
GDFS getDpiForSystem = nullptr;
|
GDFS getDpiForSystem = nullptr;
|
||||||
HMODULE dll = GetModuleHandleW(L"user32.dll");
|
HMODULE dll = GetModuleHandleW(L"user32.dll");
|
||||||
if (dll != INVALID_HANDLE_VALUE)
|
if( dll != INVALID_HANDLE_VALUE ) getDpiForSystem = (GDFS)GetProcAddress(dll, "GetDpiForSystem");
|
||||||
getDpiForSystem = (GDFS)GetProcAddress(dll, "GetDpiForSystem");
|
if( getDpiForSystem ) dpiScale = getDpiForSystem() / 96.f;
|
||||||
if (getDpiForSystem)
|
#elif defined __linux__
|
||||||
dpiScale = getDpiForSystem() / 96.f;
|
auto monitor = glfwGetWindowMonitor( window );
|
||||||
|
if( !monitor ) monitor = glfwGetPrimaryMonitor();
|
||||||
|
if( monitor )
|
||||||
|
{
|
||||||
|
float x, y;
|
||||||
|
glfwGetMonitorContentScale( monitor, &x, &y );
|
||||||
|
dpiScale = x;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user