mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: Menu bar being gone on the Web build
This commit is contained in:
@@ -402,8 +402,6 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F);
|
||||
ImGui::SetNextWindowScroll(ImVec2(0, 0));
|
||||
|
||||
auto window = ImHexApi::System::getMainWindowHandle();
|
||||
|
||||
#if defined(OS_MACOS)
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetStyle().FramePadding.x, 8_scaled));
|
||||
ON_SCOPE_EXIT { ImGui::PopStyleVar(); };
|
||||
@@ -412,39 +410,10 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::BeginMainMenuBar()) {
|
||||
drawTitleBarBackDrop();
|
||||
ImGui::Dummy({});
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
drawTitleBar();
|
||||
|
||||
#if defined(OS_MACOS)
|
||||
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
||||
const auto windowSize = ImHexApi::System::getMainWindowSize();
|
||||
const auto menuUnderlaySize = ImVec2(windowSize.x, ImGui::GetCurrentWindowRead()->MenuBarHeight);
|
||||
|
||||
ImGui::SetCursorPos(ImVec2());
|
||||
|
||||
// Prevent window from being moved unless title bar is hovered
|
||||
|
||||
if (!ImGui::IsAnyItemHovered()) {
|
||||
const auto cursorPos = ImGui::GetCursorScreenPos();
|
||||
if (ImGui::IsMouseHoveringRect(cursorPos, cursorPos + menuUnderlaySize) && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
|
||||
macosHandleTitlebarDoubleClickGesture(window);
|
||||
}
|
||||
|
||||
macosSetWindowMovable(window, true);
|
||||
} else {
|
||||
macosSetWindowMovable(window, false);
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
} else {
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
|
||||
auto window = ImHexApi::System::getMainWindowHandle();
|
||||
menu::enableNativeMenuBar(s_useNativeMenuBar);
|
||||
if (menu::beginMainMenuBar()) {
|
||||
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
||||
@@ -484,6 +453,41 @@ namespace hex::plugin::builtin {
|
||||
menu::endMainMenuBar();
|
||||
}
|
||||
menu::enableNativeMenuBar(false);
|
||||
|
||||
if (ImGui::BeginMainMenuBar()) {
|
||||
ImGui::Dummy({});
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
drawTitleBar();
|
||||
|
||||
#if defined(OS_MACOS)
|
||||
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
||||
const auto windowSize = ImHexApi::System::getMainWindowSize();
|
||||
const auto menuUnderlaySize = ImVec2(windowSize.x, ImGui::GetCurrentWindowRead()->MenuBarHeight);
|
||||
|
||||
ImGui::SetCursorPos(ImVec2());
|
||||
|
||||
// Prevent window from being moved unless title bar is hovered
|
||||
|
||||
if (!ImGui::IsAnyItemHovered()) {
|
||||
const auto cursorPos = ImGui::GetCursorScreenPos();
|
||||
if (ImGui::IsMouseHoveringRect(cursorPos, cursorPos + menuUnderlaySize) && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
|
||||
macosHandleTitlebarDoubleClickGesture(window);
|
||||
}
|
||||
|
||||
macosSetWindowMovable(window, true);
|
||||
} else {
|
||||
macosSetWindowMovable(window, false);
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
} else {
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
}
|
||||
|
||||
void drawToolbar() {
|
||||
|
||||
Reference in New Issue
Block a user