diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index 41f42df2..b48be85a 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -32,6 +32,14 @@ namespace tracy draw->AddCircleFilled( wpos + ImVec2( w * 0.5f + ty, h ), ty * ( 0.15f + 0.2f * ( pow( cos( time * 3.5f - 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 ); } + static inline bool SmallCheckbox( const char* label, bool* var ) + { + ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) ); + auto ret = ImGui::Checkbox( label, var ); + ImGui::PopStyleVar(); + return ret; + } + } #endif diff --git a/server/TracyView.cpp b/server/TracyView.cpp index c6f2ce39..98f2ee4b 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -4046,7 +4046,7 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B if( !expand ) return; ImGui::SameLine(); - if( ImGui::SmallButton( showUnknownFrames ? "Hide unknown frames" : "Show unknown frames" ) ) showUnknownFrames = !showUnknownFrames; + SmallCheckbox( "Show unknown frames", &showUnknownFrames ); int fidx = 1; TextDisabledUnformatted( "0." ); @@ -4514,7 +4514,7 @@ void View::DrawZoneInfoWindow() const auto ty = ImGui::GetTextLineHeight(); ImGui::SameLine(); - if( ImGui::SmallButton( m_groupChildrenLocations ? "Display all children separate" : "Group children locations" ) ) m_groupChildrenLocations = !m_groupChildrenLocations; + SmallCheckbox( "Group children locations", &m_groupChildrenLocations ); if( m_groupChildrenLocations ) { @@ -4916,7 +4916,7 @@ void View::DrawGpuInfoWindow() const auto ty = ImGui::GetTextLineHeight(); ImGui::SameLine(); - if( ImGui::SmallButton( m_groupChildrenLocations ? "Display all children separate" : "Group children locations" ) ) m_groupChildrenLocations = !m_groupChildrenLocations; + SmallCheckbox( "Group children locations", &m_groupChildrenLocations ); if( m_groupChildrenLocations ) {