From 0f3e8564388cd29b7f68dc38b6ccacdffcd80dba Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sun, 27 Mar 2022 00:09:18 +0100 Subject: [PATCH] BugFix WorkspaceWindow clear on ESC and Transition view --- TransitionView.cpp | 4 +++- UserInterfaceManager.cpp | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/TransitionView.cpp b/TransitionView.cpp index 31d3b90..acd242a 100644 --- a/TransitionView.cpp +++ b/TransitionView.cpp @@ -157,8 +157,10 @@ void TransitionView::update(float dt) // request update transition_source_->touch(); - if (d > 0.2f) + if (d > 0.2f) { Mixer::manager().setView(View::MIXING); + WorkspaceWindow::restoreWorkspace(); + } } diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index e3a109f..8fa6cf9 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -231,6 +231,8 @@ uint64_t UserInterface::Runtime() const void UserInterface::handleKeyboard() { + static bool esc_repeat_ = false; + const ImGuiIO& io = ImGui::GetIO(); alt_modifier_active = io.KeyAlt; shift_modifier_active = io.KeyShift; @@ -383,10 +385,17 @@ void UserInterface::handleKeyboard() navigator.hidePannel(); // toggle clear workspace WorkspaceWindow::toggleClearRestoreWorkspace(); + // ESC key is not yet maintained pressed + esc_repeat_ = false; } - else if ( WorkspaceWindow::clear() && ImGui::IsKeyReleased( GLFW_KEY_ESCAPE )) { - // toggle clear workspace - WorkspaceWindow::toggleClearRestoreWorkspace(); + else if (ImGui::IsKeyPressed( GLFW_KEY_ESCAPE, true )) { + // ESC key is maintained pressed + esc_repeat_ = true; + } + else if ( esc_repeat_ && WorkspaceWindow::clear() && ImGui::IsKeyReleased( GLFW_KEY_ESCAPE )) { + // restore cleared workspace when releasing ESC after maintain + WorkspaceWindow::restoreWorkspace(); + esc_repeat_ = false; } else if (ImGui::IsKeyPressed( GLFW_KEY_END, false )) { Settings::application.render.disabled = !Settings::application.render.disabled; @@ -1982,7 +1991,7 @@ void WorkspaceWindow::toggleClearRestoreWorkspace() { // do not toggle if an animation is ongoing for(auto it = windows_.cbegin(); it != windows_.cend(); ++it) { - if ( (*it)->Visible() && (*it)->impl_ && (*it)->impl_->animation ) + if ( (*it)->impl_ && (*it)->impl_->animation ) return; }