diff --git a/main/gui/include/window.hpp b/main/gui/include/window.hpp index 4ce99635c..bdbd40f89 100644 --- a/main/gui/include/window.hpp +++ b/main/gui/include/window.hpp @@ -32,7 +32,7 @@ namespace hex { void setupNativeWindow(); void beginNativeWindowFrame(); void endNativeWindowFrame(); - void drawTitleBar() const; + void drawTitleBar(); void frameBegin(); void frame(); @@ -61,6 +61,8 @@ namespace hex { bool m_unlockFrameRate = false; ImGuiExt::ImHexCustomData m_imguiCustomData; + + u32 m_searchBarPosition; }; } \ No newline at end of file diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index 2caae6b63..da47df750 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -250,7 +250,7 @@ namespace hex { } } - void Window::drawTitleBar() const { + void Window::drawTitleBar() { auto titleBarHeight = ImGui::GetCurrentWindowRead()->MenuBarHeight(); auto buttonSize = ImVec2(titleBarHeight * 1.5F, titleBarHeight - 1); @@ -260,9 +260,11 @@ namespace hex { ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetColorU32(ImGuiCol_ScrollbarGrabHovered)); const auto windowSize = ImHexApi::System::getMainWindowSize(); - const auto searchBoxSize = ImVec2(std::sqrt(windowSize.x) * 14_scaled, titleBarHeight - 3_scaled); + const auto searchBoxSize = ImVec2(windowSize.x / 2.5, titleBarHeight - 3_scaled); const auto searchBoxPos = ImVec2((windowSize / 2 - searchBoxSize / 2).x, 3_scaled); + m_searchBarPosition = searchBoxPos.x; + // Custom titlebar buttons implementation for borderless window mode auto &titleBarButtons = ContentRegistry::Interface::impl::getTitleBarButtons(); @@ -519,9 +521,11 @@ namespace hex { } }; - const auto windowWidth = ImHexApi::System::getMainWindowSize().x; - if (windowWidth > 1200_scaled) { + static u32 menuEndPos = 0; + + if (menuEndPos < m_searchBarPosition) { drawMenu(); + menuEndPos = ImGui::GetCursorPosX(); } else { if (ImGui::BeginMenu(ICON_VS_MENU)) { drawMenu();