Conditional framerate limiting on Wayland.

This commit is contained in:
Bartosz Taudul 2024-03-29 21:56:54 +01:00
parent c21170cc01
commit e85457815e
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 6 additions and 2 deletions

View File

@ -30,6 +30,7 @@
#include "Backend.hpp" #include "Backend.hpp"
#include "RunQueue.hpp" #include "RunQueue.hpp"
#include "profiler/TracyConfig.hpp"
constexpr ImGuiKey s_keyTable[] = { constexpr ImGuiKey s_keyTable[] = {
/* 0 */ ImGuiKey_None, /* 0 */ ImGuiKey_None,
@ -224,6 +225,9 @@ static uint64_t s_time;
static wl_fixed_t s_wheelAxisX, s_wheelAxisY; static wl_fixed_t s_wheelAxisX, s_wheelAxisY;
static bool s_wheel; static bool s_wheel;
extern tracy::Config s_config;
static void RecomputeScale() static void RecomputeScale()
{ {
if( s_fracSurf ) return; if( s_fracSurf ) return;
@ -876,7 +880,7 @@ void Backend::Run()
{ {
while( s_running && wl_display_dispatch( s_dpy ) != -1 ) 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_redraw();
s_mainThreadTasks->Run(); s_mainThreadTasks->Run();
} }

View File

@ -116,7 +116,7 @@ void* zigzagTex;
static Backend* bptr; static Backend* bptr;
static bool s_customTitle = false; static bool s_customTitle = false;
static bool s_isElevated = false; static bool s_isElevated = false;
static tracy::Config s_config; tracy::Config s_config;
static void SetWindowTitleCallback( const char* title ) static void SetWindowTitleCallback( const char* title )
{ {