mirror of
https://github.com/ocornut/imgui.git
synced 2026-02-28 06:15:13 +00:00
Viewports: fixed an issue where the implicit "Debug" window would erroneously be targeted for mouse inputs while hidden. (#9254)
This commit is contained in:
@@ -16648,7 +16648,7 @@ void ImGui::ScaleWindowsInViewport(ImGuiViewportP* viewport, float scale)
|
||||
}
|
||||
}
|
||||
|
||||
// If the backend doesn't set MouseLastHoveredViewport or doesn't honor ImGuiViewportFlags_NoInputs, we do a search ourselves.
|
||||
// If the backend doesn't support ImGuiBackendFlags_HasMouseHoveredViewport or doesn't honor ImGuiViewportFlags_NoInputs for it, we do a search ourselves.
|
||||
// A) It won't take account of the possibility that non-imgui windows may be in-between our dragged window and our target window.
|
||||
// B) It requires Platform_GetWindowFocus to be implemented by backend.
|
||||
ImGuiViewportP* ImGui::FindHoveredViewportFromPlatformWindowStack(const ImVec2& mouse_platform_pos)
|
||||
@@ -16658,7 +16658,8 @@ ImGuiViewportP* ImGui::FindHoveredViewportFromPlatformWindowStack(const ImVec2&
|
||||
for (ImGuiViewportP* viewport : g.Viewports)
|
||||
if (!(viewport->Flags & (ImGuiViewportFlags_NoInputs | ImGuiViewportFlags_IsMinimized)) && viewport->GetMainRect().Contains(mouse_platform_pos))
|
||||
if (best_candidate == NULL || best_candidate->LastFocusedStampCount < viewport->LastFocusedStampCount)
|
||||
best_candidate = viewport;
|
||||
if (viewport->PlatformWindowCreated)
|
||||
best_candidate = viewport;
|
||||
return best_candidate;
|
||||
}
|
||||
|
||||
@@ -16880,7 +16881,7 @@ static void ImGui::UpdateViewportsNewFrame()
|
||||
// If the backend doesn't know how to honor ImGuiViewportFlags_NoInputs, we do a search ourselves. Note that this search:
|
||||
// A) won't take account of the possibility that non-imgui windows may be in-between our dragged window and our target window.
|
||||
// B) won't take account of how the backend apply parent<>child relationship to secondary viewports, which affects their Z order.
|
||||
// C) uses LastFrameAsRefViewport as a flawed replacement for the last time a window was focused (we could/should fix that by introducing Focus functions in PlatformIO)
|
||||
// C) uses LastFocusedStampCount as a flawed replacement for the last time a window was focused (we could/should fix that by introducing Focus functions in PlatformIO)
|
||||
viewport_hovered = FindHoveredViewportFromPlatformWindowStack(g.IO.MousePos);
|
||||
}
|
||||
if (viewport_hovered != NULL)
|
||||
|
||||
Reference in New Issue
Block a user