fix: ImGui-internal shortcuts not working correctly with native macOS menu bar enabled

This commit is contained in:
WerWolv
2025-12-29 19:31:54 +01:00
parent f76ea2a677
commit f0f6a22391
2 changed files with 11 additions and 6 deletions

View File

@@ -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()) {

View File

@@ -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 {