From 722f6315c44144907853766b7e336c2def2fb367 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 31 Mar 2023 11:07:53 +0200 Subject: [PATCH] impr: Make sure shortcuts can't be used when popups are open --- main/source/window/window.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index 17d6632fe..eaa1963a9 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -539,6 +539,8 @@ namespace hex { void Window::frame() { auto &io = ImGui::GetIO(); + const bool popupOpen = ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId); + // Loop through all views and draw them for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) { ImGui::GetCurrentContext()->NextWindowData.ClearFlags(); @@ -557,7 +559,7 @@ namespace hex { } // Handle per-view shortcuts - if (view->getWindowOpenState()) { + if (view->getWindowOpenState() && !popupOpen) { auto window = ImGui::FindWindowByName(view->getName().c_str()); bool hasWindow = window != nullptr; bool focused = false; @@ -578,8 +580,10 @@ namespace hex { } // Handle global shortcuts - for (const auto &key : this->m_pressedKeys) { - ShortcutManager::processGlobals(io.KeyCtrl, io.KeyAlt, io.KeyShift, io.KeySuper, key); + if (!popupOpen) { + for (const auto &key : this->m_pressedKeys) { + ShortcutManager::processGlobals(io.KeyCtrl, io.KeyAlt, io.KeyShift, io.KeySuper, key); + } } this->m_pressedKeys.clear();