1
0
mirror of synced 2025-01-10 21:41:53 +01:00

fix: Hex editor right click menu not working on macOS

This commit is contained in:
WerWolv 2025-01-04 19:08:37 +01:00
parent baa3cfb354
commit fd0635cb82
2 changed files with 7 additions and 4 deletions

View File

@ -28,6 +28,7 @@ namespace hex::plugin::builtin {
ImGuiExt::Texture s_logoTexture;
bool s_showSearchBar = true;
bool s_displayShortcutHighlights = true;
bool s_useNativeMenuBar = false;
void createNestedMenu(std::span<const UnlocalizedString> menuItems, const char *icon, const Shortcut &shortcut, const ContentRegistry::Interface::impl::MenuCallback &callback, const ContentRegistry::Interface::impl::EnabledCallback &enabledCallback, const ContentRegistry::Interface::impl::SelectedCallback &selectedCallback) {
const auto &name = menuItems.front();
@ -377,6 +378,7 @@ namespace hex::plugin::builtin {
#endif
auto window = ImHexApi::System::getMainWindowHandle();
menu::enableNativeMenuBar(s_useNativeMenuBar);
if (menu::beginMainMenuBar()) {
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
#if defined(OS_WINDOWS)
@ -414,6 +416,8 @@ namespace hex::plugin::builtin {
drawMenu();
menu::endMainMenuBar();
}
menu::enableNativeMenuBar(false);
if (ImGui::BeginMainMenuBar()) {
ImGui::Dummy({});
@ -624,7 +628,7 @@ namespace hex::plugin::builtin {
});
ContentRegistry::Settings::onChange("hex.builtin.setting.interface", "hex.builtin.setting.interface.use_native_menu_bar", [](const ContentRegistry::Settings::SettingsValue &value) {
menu::enableNativeMenuBar(value.get<bool>(true));
s_useNativeMenuBar = value.get<bool>(true);
});
}

View File

@ -29,9 +29,6 @@ namespace hex::menu {
#if !defined (OS_MACOS)
std::ignore = enabled;
#else
if (!enabled) {
macosClearMenu();
}
s_useNativeMenuBar = enabled;
#endif
}
@ -50,6 +47,8 @@ namespace hex::menu {
}
return macosBeginMainMenuBar();
} else {
macosClearMenu();
}
#else
std::ignore = s_initialized;