|
@@ -4875,12 +4875,13 @@ void ImGui::UpdateMouseMovingWindowNewFrame()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// Initiate moving window when clicking on empty space or title bar.
|
|
|
+// Initiate focusing and moving window when clicking on empty space or title bar.
|
|
|
+// Initiate focusing window when clicking on a disabled item.
|
|
|
// Handle left-click and right-click focus.
|
|
|
void ImGui::UpdateMouseMovingWindowEndFrame()
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- if (g.ActiveId != 0 || g.HoveredId != 0)
|
|
|
+ if (g.ActiveId != 0 || (g.HoveredId != 0 && !g.HoveredIdIsDisabled))
|
|
|
return;
|
|
|
|
|
|
// Unless we just made a window/popup appear
|
|
@@ -4906,7 +4907,8 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
|
|
if (!root_window->TitleBarRect().Contains(g.IO.MouseClickedPos[0]))
|
|
|
g.MovingWindow = NULL;
|
|
|
|
|
|
- // Cancel moving if clicked over an item which was disabled or inhibited by popups (note that we know HoveredId == 0 already)
|
|
|
+ // Cancel moving if clicked over an item which was disabled or inhibited by popups
|
|
|
+ // (when g.HoveredIdIsDisabled == true && g.HoveredId == 0 we are inhibited by popups, when g.HoveredIdIsDisabled == true && g.HoveredId != 0 we are over a disabled item)0 already)
|
|
|
if (g.HoveredIdIsDisabled)
|
|
|
g.MovingWindow = NULL;
|
|
|
}
|
|
@@ -4920,7 +4922,7 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
|
|
// With right mouse button we close popups without changing focus based on where the mouse is aimed
|
|
|
// Instead, focus will be restored to the window under the bottom-most closed popup.
|
|
|
// (The left mouse button path calls FocusWindow on the hovered window, which will lead NewFrame->ClosePopupsOverWindow to trigger)
|
|
|
- if (g.IO.MouseClicked[1])
|
|
|
+ if (g.IO.MouseClicked[1] && g.HoveredId == 0)
|
|
|
{
|
|
|
// Find the top-most window between HoveredWindow and the top-most Modal Window.
|
|
|
// This is where we can trim the popup stack.
|