From 5af85f24f67be88dce98bcad8b9cf1f732f3d110 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 27 Dec 2024 23:53:55 +0100 Subject: [PATCH] impr: Allow command palette to be closed by clicking on the menu bar --- main/gui/source/window/win_window.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main/gui/source/window/win_window.cpp b/main/gui/source/window/win_window.cpp index 42493b18b..cbb5f71eb 100644 --- a/main/gui/source/window/win_window.cpp +++ b/main/gui/source/window/win_window.cpp @@ -256,10 +256,17 @@ namespace hex { RegionTop * (cursor.y < (window.top + border.y)) | RegionBottom * (cursor.y >= (window.bottom - border.y)); - if (result != 0 && (ImGui::IsAnyItemHovered() || ImGui::IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId))) { + if (result != 0 && (ImGui::IsAnyItemHovered())) { break; } + if (ImGui::IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId)) { + if (result == RegionClient) + return HTCLIENT; + else + return HTCAPTION; + } + std::string_view hoveredWindowName = GImGui->HoveredWindow == nullptr ? "" : GImGui->HoveredWindow->Name; if (!ImHexApi::System::impl::isWindowResizable()) {