fix: Hex editor right click menu not working on macOS
This commit is contained in:
parent
baa3cfb354
commit
fd0635cb82
@ -28,6 +28,7 @@ namespace hex::plugin::builtin {
|
|||||||
ImGuiExt::Texture s_logoTexture;
|
ImGuiExt::Texture s_logoTexture;
|
||||||
bool s_showSearchBar = true;
|
bool s_showSearchBar = true;
|
||||||
bool s_displayShortcutHighlights = 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) {
|
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();
|
const auto &name = menuItems.front();
|
||||||
@ -377,6 +378,7 @@ namespace hex::plugin::builtin {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto window = ImHexApi::System::getMainWindowHandle();
|
auto window = ImHexApi::System::getMainWindowHandle();
|
||||||
|
menu::enableNativeMenuBar(s_useNativeMenuBar);
|
||||||
if (menu::beginMainMenuBar()) {
|
if (menu::beginMainMenuBar()) {
|
||||||
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
||||||
#if defined(OS_WINDOWS)
|
#if defined(OS_WINDOWS)
|
||||||
@ -414,6 +416,8 @@ namespace hex::plugin::builtin {
|
|||||||
drawMenu();
|
drawMenu();
|
||||||
menu::endMainMenuBar();
|
menu::endMainMenuBar();
|
||||||
}
|
}
|
||||||
|
menu::enableNativeMenuBar(false);
|
||||||
|
|
||||||
if (ImGui::BeginMainMenuBar()) {
|
if (ImGui::BeginMainMenuBar()) {
|
||||||
ImGui::Dummy({});
|
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) {
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,9 +29,6 @@ namespace hex::menu {
|
|||||||
#if !defined (OS_MACOS)
|
#if !defined (OS_MACOS)
|
||||||
std::ignore = enabled;
|
std::ignore = enabled;
|
||||||
#else
|
#else
|
||||||
if (!enabled) {
|
|
||||||
macosClearMenu();
|
|
||||||
}
|
|
||||||
s_useNativeMenuBar = enabled;
|
s_useNativeMenuBar = enabled;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -50,6 +47,8 @@ namespace hex::menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return macosBeginMainMenuBar();
|
return macosBeginMainMenuBar();
|
||||||
|
} else {
|
||||||
|
macosClearMenu();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::ignore = s_initialized;
|
std::ignore = s_initialized;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user