1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-01 13:13:53 +00:00

Fix welcome window resizes.

This commit is contained in:
Bartosz Taudul 2024-03-15 20:25:00 +01:00
parent 55f9341aec
commit 8ebe62ed85
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -99,6 +99,7 @@ static float dpiScale = 1.f;
static bool dpiScaleOverriddenFromEnv = false; static bool dpiScaleOverriddenFromEnv = false;
static float userScale = 1.f; static float userScale = 1.f;
static float prevScale = 1.f; static float prevScale = 1.f;
static int dpiChanged = 0;
static Filters* filt; static Filters* filt;
static RunQueue mainThreadTasks; static RunQueue mainThreadTasks;
static uint32_t updateVersion = 0; static uint32_t updateVersion = 0;
@ -150,6 +151,7 @@ static void SetupDPIScale()
auto scale = dpiScale * userScale; auto scale = dpiScale * userScale;
if( prevScale == scale ) return; if( prevScale == scale ) return;
dpiChanged = 2;
LoadFonts( scale ); LoadFonts( scale );
if( view ) view->UpdateFont( s_fixedWidth, s_smallFont, s_bigFont ); if( view ) view->UpdateFont( s_fixedWidth, s_smallFont, s_bigFont );
@ -610,10 +612,13 @@ static void DrawContents()
ImGui::PushFont( s_bigFont ); ImGui::PushFont( s_bigFont );
tracy::TextCentered( buf ); tracy::TextCentered( buf );
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine( ImGui::GetWindowContentRegionMax().x - ImGui::CalcTextSize( ICON_FA_WRENCH ).x - ImGui::GetStyle().FramePadding.x * 2 ); if( dpiChanged == 0 )
if( ImGui::Button( ICON_FA_WRENCH ) )
{ {
ImGui::OpenPopup( "About Tracy" ); ImGui::SameLine( ImGui::GetWindowContentRegionMax().x - ImGui::CalcTextSize( ICON_FA_WRENCH ).x - ImGui::GetStyle().FramePadding.x * 2 );
if( ImGui::Button( ICON_FA_WRENCH ) )
{
ImGui::OpenPopup( "About Tracy" );
}
} }
bool keepOpenAbout = true; bool keepOpenAbout = true;
if( ImGui::BeginPopupModal( "About Tracy", &keepOpenAbout, ImGuiWindowFlags_AlwaysAutoResize ) ) if( ImGui::BeginPopupModal( "About Tracy", &keepOpenAbout, ImGuiWindowFlags_AlwaysAutoResize ) )
@ -1161,4 +1166,5 @@ static void DrawContents()
} }
bptr->EndFrame(); bptr->EndFrame();
if( dpiChanged > 0 ) dpiChanged--;
} }