From 10249924931cc1af66b32084f64fcdb95bce4f01 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 17 Aug 2019 22:01:06 +0200 Subject: [PATCH] React to enter key in "go to frame" dialog. --- server/TracyView.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 012ee287..c917c44d 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -10024,14 +10024,16 @@ void View::DrawGoToFrame() const auto numFrames = mainFrameSet ? m_frames->frames.size() - 1 : m_frames->frames.size(); const auto frameOffset = mainFrameSet ? 0 : 1; + bool goClicked = false; ImGui::Begin( "Go to frame", &m_goToFrame, ImGuiWindowFlags_AlwaysAutoResize ); - ImGui::InputInt( "Frame", &frameNum ); + goClicked |= ImGui::InputInt( "Frame", &frameNum, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue ); frameNum = std::min( std::max( frameNum, 1 ), int( numFrames ) ); #ifdef TRACY_EXTENDED_FONT - if( ImGui::Button( ICON_FA_CROSSHAIRS " Go to" ) ) + goClicked |= ImGui::Button( ICON_FA_CROSSHAIRS " Go to" ); #else - if( ImGui::Button( "Go to" ) ) + goClicked |= ImGui::Button( "Go to" ); #endif + if( goClicked ) { ZoomToRange( m_worker.GetFrameBegin( *m_frames, frameNum - frameOffset ), m_worker.GetFrameEnd( *m_frames, frameNum - frameOffset ) ); }