diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2022-10-26 20:33:04 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2022-10-26 20:33:04 +0300 |
commit | 0eef0a8313d5fb9c91178907d2d39e8d2c97bbdf (patch) | |
tree | d78690ec424f4339b49ded5c10f609be043aef32 | |
parent | 7eba104e127f3172722fa385b0e3e1fe9c220409 (diff) |
Fix window focus issues when navigating with WSAD.
-rw-r--r-- | server/TracyView.hpp | 1 | ||||
-rw-r--r-- | server/TracyView_Timeline.cpp | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/server/TracyView.hpp b/server/TracyView.hpp index ad37c0b5..8b07740a 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -277,6 +277,7 @@ private: void HandleRange( Range& range, int64_t timespan, const ImVec2& wpos, float w ); void HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns ); + void HandleTimelineKeyboard( int64_t timespan, const ImVec2& wpos, float w ); void AddAnnotation( int64_t start, int64_t end ); diff --git a/server/TracyView_Timeline.cpp b/server/TracyView_Timeline.cpp index 3e39ec7d..d7a3f996 100644 --- a/server/TracyView_Timeline.cpp +++ b/server/TracyView_Timeline.cpp @@ -155,6 +155,12 @@ void View::HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w, d } ZoomToRange( t0, t1, !m_worker.IsConnected() || m_viewMode == ViewMode::Paused ); } +} + +void View::HandleTimelineKeyboard( int64_t timespan, const ImVec2& wpos, float w ) +{ + assert( timespan > 0 ); + auto& io = ImGui::GetIO(); int64_t nextTimelineRangeStart, nextTimelineRangeEnd; bool anyDeltaApplied = false; @@ -280,6 +286,10 @@ void View::DrawTimeline() } HandleTimelineMouse( timespan, ImGui::GetCursorScreenPos(), w, pxns ); } + if( ImGui::IsWindowFocused( ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem ) ) + { + HandleTimelineKeyboard( timespan, ImGui::GetCursorScreenPos(), w ); + } { const auto tbegin = 0; |