mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
impr: Make title bar backdrop actually a backdrop and not an overlay
This commit is contained in:
@@ -407,6 +407,42 @@ namespace hex::plugin::builtin {
|
||||
ON_SCOPE_EXIT { ImGui::PopStyleVar(); };
|
||||
#endif
|
||||
|
||||
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()) {
|
||||
@@ -447,42 +483,6 @@ namespace hex::plugin::builtin {
|
||||
menu::endMainMenuBar();
|
||||
}
|
||||
menu::enableNativeMenuBar(false);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void drawToolbar() {
|
||||
|
||||
Reference in New Issue
Block a user