From f0f6a22391672d3a1c0a97281b008acbc2e1d7dd Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 29 Dec 2025 19:31:54 +0100 Subject: [PATCH] fix: ImGui-internal shortcuts not working correctly with native macOS menu bar enabled --- lib/libimhex/source/api/shortcut_manager.cpp | 11 ++++++----- plugins/builtin/source/content/window_decoration.cpp | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/libimhex/source/api/shortcut_manager.cpp b/lib/libimhex/source/api/shortcut_manager.cpp index ee6b7d0ba..a6d7049b5 100644 --- a/lib/libimhex/source/api/shortcut_manager.cpp +++ b/lib/libimhex/source/api/shortcut_manager.cpp @@ -329,12 +329,13 @@ namespace hex { if (ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId)) return true; - const bool currentlyTyping = ImGui::GetIO().WantTextInput; - - auto it = shortcuts.find(shortcut + AllowWhileTyping); - if (!currentlyTyping && it == shortcuts.end()) { + auto it = shortcuts.end(); + if (ImGui::GetIO().WantTextInput) { + it = shortcuts.find(shortcut + AllowWhileTyping); + } else { + it = shortcuts.find(shortcut); if (it == shortcuts.end()) - it = shortcuts.find(shortcut); + it = shortcuts.find(shortcut + AllowWhileTyping); } if (it != shortcuts.end()) { diff --git a/plugins/builtin/source/content/window_decoration.cpp b/plugins/builtin/source/content/window_decoration.cpp index f46ae274b..cdefeb180 100644 --- a/plugins/builtin/source/content/window_decoration.cpp +++ b/plugins/builtin/source/content/window_decoration.cpp @@ -68,7 +68,11 @@ namespace hex::plugin::builtin { callback(); } } else if (menuItems.size() == 1) { - if (menu::menuItemEx(Lang(name), icon, shortcut, selectedCallback(), enabledCallback())) { + bool enabled = enabledCallback(); + if (!shortcut.has(AllowWhileTyping) && ImGui::GetIO().WantTextInput) + enabled = false; + + if (menu::menuItemEx(Lang(name), icon, shortcut, selectedCallback(), enabled)) { if (shortcut == Shortcut::None) callback(); else {