diff --git a/profiler/src/BackendEmscripten.cpp b/profiler/src/BackendEmscripten.cpp index 1947d751..9c35b653 100644 --- a/profiler/src/BackendEmscripten.cpp +++ b/profiler/src/BackendEmscripten.cpp @@ -20,7 +20,7 @@ static EGLDisplay s_eglDpy; static EGLContext s_eglCtx; static EGLSurface s_eglSurf; -static float s_prevScale; +static float s_prevScale = -1; static int s_width, s_height; static uint64_t s_time; static const char* s_prevCursor = nullptr; diff --git a/profiler/src/BackendGlfw.cpp b/profiler/src/BackendGlfw.cpp index b68a0c86..04369994 100644 --- a/profiler/src/BackendGlfw.cpp +++ b/profiler/src/BackendGlfw.cpp @@ -17,9 +17,11 @@ static GLFWwindow* s_window; static std::function s_redraw; +static std::function s_scaleChanged; static RunQueue* s_mainThreadTasks; static WindowPosition* s_winPos; static bool s_iconified; +static float s_prevScale = -1; extern tracy::Config s_config; @@ -95,6 +97,7 @@ Backend::Backend( const char* title, const std::function& redraw, const ImGui_ImplOpenGL3_Init( "#version 150" ); s_redraw = redraw; + s_scaleChanged = scaleChanged; s_mainThreadTasks = mainThreadTasks; s_winPos = &m_winPos; s_iconified = false; @@ -152,6 +155,13 @@ void Backend::Attention() void Backend::NewFrame( int& w, int& h ) { + const auto scale = GetDpiScale(); + if( scale != s_prevScale ) + { + s_prevScale = scale; + s_scaleChanged( scale ); + } + glfwGetFramebufferSize( s_window, &w, &h ); m_w = w; m_h = h; diff --git a/profiler/src/BackendWayland.cpp b/profiler/src/BackendWayland.cpp index a3ca9d9d..0bf6d1b9 100644 --- a/profiler/src/BackendWayland.cpp +++ b/profiler/src/BackendWayland.cpp @@ -222,7 +222,7 @@ struct Output }; static std::unordered_map> s_output; static int s_maxScale = 120; -static int s_prevScale = 120; +static int s_prevScale = -1; static bool s_running = true; static int s_width, s_height;