mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Merge pull request #715 from YaLTeR/fix-wayland-scale
Fix and update Wayland scale handling
This commit is contained in:
+16
-2
@@ -95,6 +95,7 @@ static ConnectionHistory* connHist;
|
||||
static std::atomic<ViewShutdown> viewShutdown { ViewShutdown::False };
|
||||
static double animTime = 0;
|
||||
static float dpiScale = 1.f;
|
||||
static bool dpiScaleOverriddenFromEnv = false;
|
||||
static Filters* filt;
|
||||
static RunQueue mainThreadTasks;
|
||||
static uint32_t updateVersion = 0;
|
||||
@@ -197,6 +198,15 @@ static bool SaveConfig()
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ScaleChanged( float scale )
|
||||
{
|
||||
if ( dpiScaleOverriddenFromEnv ) return;
|
||||
if ( dpiScale == scale ) return;
|
||||
|
||||
dpiScale = scale;
|
||||
SetupDPIScale( dpiScale, s_fixedWidth, s_bigFont, s_smallFont );
|
||||
}
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
sprintf( title, "Tracy Profiler %i.%i.%i", tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch );
|
||||
@@ -297,7 +307,7 @@ int main( int argc, char** argv )
|
||||
LoadConfig();
|
||||
|
||||
ImGuiTracyContext imguiContext;
|
||||
Backend backend( title, DrawContents, &mainThreadTasks );
|
||||
Backend backend( title, DrawContents, ScaleChanged, &mainThreadTasks );
|
||||
tracy::InitTexture();
|
||||
iconTex = tracy::MakeTexture();
|
||||
zigzagTex = tracy::MakeTexture( true );
|
||||
@@ -310,7 +320,11 @@ int main( int argc, char** argv )
|
||||
if( envDpiScale )
|
||||
{
|
||||
const auto cnv = atof( envDpiScale );
|
||||
if( cnv != 0 ) dpiScale = cnv;
|
||||
if( cnv != 0 )
|
||||
{
|
||||
dpiScale = cnv;
|
||||
dpiScaleOverriddenFromEnv = true;
|
||||
}
|
||||
}
|
||||
|
||||
SetupDPIScale( dpiScale, s_fixedWidth, s_bigFont, s_smallFont );
|
||||
|
||||
Reference in New Issue
Block a user