mirror of
https://github.com/ocornut/imgui.git
synced 2026-05-25 18:15:25 +08:00
Windows: clicking on a window's empty-space to move/focus a window checks for lack of mouse button ownership. (#9382)
This commit is contained in:
@@ -43,6 +43,11 @@ Breaking Changes:
|
||||
|
||||
Other Changes:
|
||||
|
||||
- Windows:
|
||||
- Clicking on a window's empty-space to move/focus a window checks
|
||||
for lack of mouse button ownership. This gives an additional opportunity
|
||||
for user code to bypass it without using a clickable item. (#9382)
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.92.8 (Released 2026-05-12)
|
||||
|
||||
@@ -5357,7 +5357,7 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
||||
|
||||
// Click on empty space to focus window and start moving
|
||||
// (after we're done with all our widgets)
|
||||
if (g.IO.MouseClicked[0])
|
||||
if (IsMouseClicked(0, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner))
|
||||
{
|
||||
// Handle the edge case of a popup being closed while clicking in its empty space.
|
||||
// If we try to focus it, FocusWindow() > ClosePopupsOverWindow() will accidentally close any parent popups because they are not linked together any more.
|
||||
@@ -5395,7 +5395,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] && g.HoveredId == 0)
|
||||
if (g.HoveredId == 0 && IsMouseClicked(1, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner))
|
||||
{
|
||||
// Find the top-most window between HoveredWindow and the top-most Modal Window.
|
||||
// This is where we can trim the popup stack.
|
||||
|
||||
Reference in New Issue
Block a user