diff --git a/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h b/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h index 270b416d3..577436cdc 100644 --- a/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h +++ b/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h @@ -159,6 +159,8 @@ namespace ImGuiExt { void OpenPopupInWindow(const char *window_name, const char *popup_name); + void DisableWindowResize(ImGuiDir dir); + struct ImHexCustomData { ImVec4 Colors[ImGuiCustomCol_COUNT]; diff --git a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp index b20e81c15..2be888a8a 100644 --- a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp +++ b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp @@ -743,6 +743,17 @@ namespace ImGuiExt { End(); } + void DisableWindowResize(ImGuiDir dir) { + const auto window = GetCurrentWindow(); + const auto borderId = GetWindowResizeBorderID(window, dir); + if (borderId == GetHoveredID()) { + GImGui->ActiveIdMouseButton = 0; + SetHoveredID(0); + } + if (borderId == GetActiveID()) + SetActiveID(0, window); + } + bool TitleBarButton(const char *label, ImVec2 size_arg) { ImGuiWindow *window = GetCurrentWindow(); diff --git a/plugins/builtin/source/content/window_decoration.cpp b/plugins/builtin/source/content/window_decoration.cpp index 51c7ef6ae..ff9021467 100644 --- a/plugins/builtin/source/content/window_decoration.cpp +++ b/plugins/builtin/source/content/window_decoration.cpp @@ -125,7 +125,6 @@ namespace hex::plugin::builtin { bool open = static_cast(openWindow) == index; if (open) { - ImGui::SetNextWindowPos(ImGui::GetWindowPos() + sidebarPos + ImVec2(sidebarWidth - 1_scaled, -1_scaled)); ImGui::SetNextWindowSizeConstraints(ImVec2(0, dockSpaceSize.y + 5_scaled), ImVec2(FLT_MAX, dockSpaceSize.y + 5_scaled)); @@ -140,6 +139,11 @@ namespace hex::plugin::builtin { if (!ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && !sideBarFocused) { openWindow = -1; } + + ImGuiExt::DisableWindowResize(ImGuiDir_Up); + ImGuiExt::DisableWindowResize(ImGuiDir_Down); + ImGuiExt::DisableWindowResize(ImGuiDir_Left); + } ImGui::End(); ImGui::PopStyleVar();