mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -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::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F);
|
||||||
ImGui::SetNextWindowScroll(ImVec2(0, 0));
|
ImGui::SetNextWindowScroll(ImVec2(0, 0));
|
||||||
|
|
||||||
auto window = ImHexApi::System::getMainWindowHandle();
|
|
||||||
|
|
||||||
#if defined(OS_MACOS)
|
#if defined(OS_MACOS)
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetStyle().FramePadding.x, 8_scaled));
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetStyle().FramePadding.x, 8_scaled));
|
||||||
ON_SCOPE_EXIT { ImGui::PopStyleVar(); };
|
ON_SCOPE_EXIT { ImGui::PopStyleVar(); };
|
||||||
@@ -412,39 +410,10 @@ namespace hex::plugin::builtin {
|
|||||||
if (ImGui::BeginMainMenuBar()) {
|
if (ImGui::BeginMainMenuBar()) {
|
||||||
drawTitleBarBackDrop();
|
drawTitleBarBackDrop();
|
||||||
ImGui::Dummy({});
|
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();
|
ImGui::EndMainMenuBar();
|
||||||
} else {
|
|
||||||
ImGui::PopStyleVar(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto window = ImHexApi::System::getMainWindowHandle();
|
||||||
menu::enableNativeMenuBar(s_useNativeMenuBar);
|
menu::enableNativeMenuBar(s_useNativeMenuBar);
|
||||||
if (menu::beginMainMenuBar()) {
|
if (menu::beginMainMenuBar()) {
|
||||||
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
||||||
@@ -484,6 +453,41 @@ namespace hex::plugin::builtin {
|
|||||||
menu::endMainMenuBar();
|
menu::endMainMenuBar();
|
||||||
}
|
}
|
||||||
menu::enableNativeMenuBar(false);
|
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() {
|
void drawToolbar() {
|
||||||
|
|||||||
Reference in New Issue
Block a user