From e85457815e8dace920612206420e36ec251e7bd2 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 29 Mar 2024 21:56:54 +0100 Subject: [PATCH] Conditional framerate limiting on Wayland. --- profiler/src/BackendWayland.cpp | 6 +++++- profiler/src/main.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/profiler/src/BackendWayland.cpp b/profiler/src/BackendWayland.cpp index 4891c541..6d2bcca0 100644 --- a/profiler/src/BackendWayland.cpp +++ b/profiler/src/BackendWayland.cpp @@ -30,6 +30,7 @@ #include "Backend.hpp" #include "RunQueue.hpp" +#include "profiler/TracyConfig.hpp" constexpr ImGuiKey s_keyTable[] = { /* 0 */ ImGuiKey_None, @@ -224,6 +225,9 @@ static uint64_t s_time; static wl_fixed_t s_wheelAxisX, s_wheelAxisY; static bool s_wheel; +extern tracy::Config s_config; + + static void RecomputeScale() { if( s_fracSurf ) return; @@ -876,7 +880,7 @@ void Backend::Run() { while( s_running && wl_display_dispatch( s_dpy ) != -1 ) { - if( !s_hasFocus ) std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) ); + if( s_config.focusLostLimit && !s_hasFocus ) std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) ); s_redraw(); s_mainThreadTasks->Run(); } diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 78e71dd7..0888f81a 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -116,7 +116,7 @@ void* zigzagTex; static Backend* bptr; static bool s_customTitle = false; static bool s_isElevated = false; -static tracy::Config s_config; +tracy::Config s_config; static void SetWindowTitleCallback( const char* title ) {