mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 12:53:51 +00:00
Merge pull request #1037 from simonvanbernem/per-monitor-dpi
Adding per-monitor DPI awareness
This commit is contained in:
commit
cc0c53496d
@ -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 )
|
# if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 4 )
|
||||||
glfwWindowHint( GLFW_WIN32_KEYBOARD_MENU, 1 );
|
glfwWindowHint( GLFW_WIN32_KEYBOARD_MENU, 1 );
|
||||||
# endif
|
# endif
|
||||||
|
# if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3 )
|
||||||
|
glfwWindowHint( GLFW_SCALE_TO_MONITOR, 1 );
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
s_window = glfwCreateWindow( m_winPos.w, m_winPos.h, title, NULL, NULL );
|
s_window = glfwCreateWindow( m_winPos.w, m_winPos.h, title, NULL, NULL );
|
||||||
if( !s_window ) exit( 1 );
|
if( !s_window ) exit( 1 );
|
||||||
@ -200,14 +203,10 @@ void Backend::SetTitle( const char* title )
|
|||||||
float Backend::GetDpiScale()
|
float Backend::GetDpiScale()
|
||||||
{
|
{
|
||||||
#if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3 )
|
#if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3 )
|
||||||
auto monitor = glfwGetWindowMonitor( s_window );
|
float x, y;
|
||||||
if( !monitor ) monitor = glfwGetPrimaryMonitor();
|
glfwGetWindowContentScale( s_window, &x, &y );
|
||||||
if( monitor )
|
return x;
|
||||||
{
|
#else
|
||||||
float x, y;
|
|
||||||
glfwGetMonitorContentScale( monitor, &x, &y );
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user