1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Merge pull request #1037 from simonvanbernem/per-monitor-dpi

Adding per-monitor DPI awareness
This commit is contained in:
Bartosz Taudul 2025-04-25 21:37:55 +02:00 committed by GitHub
commit cc0c53496d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,6 +80,9 @@ Backend::Backend( const char* title, const std::function<void()>& redraw, const
# if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 4 )
glfwWindowHint( GLFW_WIN32_KEYBOARD_MENU, 1 );
# endif
# if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3 )
glfwWindowHint( GLFW_SCALE_TO_MONITOR, 1 );
# endif
#endif
s_window = glfwCreateWindow( m_winPos.w, m_winPos.h, title, NULL, NULL );
if( !s_window ) exit( 1 );
@ -200,14 +203,10 @@ void Backend::SetTitle( const char* title )
float Backend::GetDpiScale()
{
#if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3 )
auto monitor = glfwGetWindowMonitor( s_window );
if( !monitor ) monitor = glfwGetPrimaryMonitor();
if( monitor )
{
float x, y;
glfwGetMonitorContentScale( monitor, &x, &y );
return x;
}
#endif
float x, y;
glfwGetWindowContentScale( s_window, &x, &y );
return x;
#else
return 1;
#endif
}