From 0757930521bbd67ddd2a4582248afc7b6f6ec531 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 18 Aug 2018 02:12:34 +0200 Subject: [PATCH] Only display "go to parent" if there is a parent. --- server/TracyView.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index ed07f992..f4983291 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3461,15 +3461,15 @@ void View::DrawZoneInfoWindow() { ZoomToZone( ev ); } - ImGui::SameLine(); -#ifdef TRACY_EXTENDED_FONT - if( ImGui::Button( ICON_FA_ARROW_UP " Go to parent" ) ) -#else - if( ImGui::Button( "Go to parent" ) ) -#endif + auto parent = GetZoneParent( ev ); + if( parent ) { - auto parent = GetZoneParent( ev ); - if( parent ) + ImGui::SameLine(); +#ifdef TRACY_EXTENDED_FONT + if( ImGui::Button( ICON_FA_ARROW_UP " Go to parent" ) ) +#else + if( ImGui::Button( "Go to parent" ) ) +#endif { ShowZoneInfo( *parent ); } @@ -3693,7 +3693,6 @@ void View::DrawZoneInfoWindow() ImGui::Separator(); std::vector zoneTrace; - auto parent = GetZoneParent( ev ); while( parent ) { zoneTrace.emplace_back( parent ); @@ -3811,15 +3810,15 @@ void View::DrawGpuInfoWindow() { ZoomToZone( ev ); } - ImGui::SameLine(); -#ifdef TRACY_EXTENDED_FONT - if( ImGui::Button( ICON_FA_ARROW_UP " Go to parent" ) ) -#else - if( ImGui::Button( "Go to parent" ) ) -#endif + auto parent = GetZoneParent( ev ); + if( parent ) { - auto parent = GetZoneParent( ev ); - if( parent ) + ImGui::SameLine(); +#ifdef TRACY_EXTENDED_FONT + if( ImGui::Button( ICON_FA_ARROW_UP " Go to parent" ) ) +#else + if( ImGui::Button( "Go to parent" ) ) +#endif { ShowZoneInfo( *parent, m_gpuInfoWindowThread ); } @@ -3924,7 +3923,6 @@ void View::DrawGpuInfoWindow() ImGui::Separator(); std::vector zoneTrace; - auto parent = GetZoneParent( ev ); while( parent ) { zoneTrace.emplace_back( parent );