Skip to content

Commit ca3ba28

Browse files
committed
Internals: made MousePos an argument of UpdateHoveredWindowAndCaptureFlags(). (#8431, #1152)
1 parent f5003af commit ca3ba28

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

imgui.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5058,7 +5058,7 @@ static bool IsWindowActiveAndVisible(ImGuiWindow* window)
50585058
}
50595059

50605060
// The reason this is exposed in imgui_internal.h is: on touch-based system that don't have hovering, we want to dispatch inputs to the right target (imgui vs imgui+app)
5061-
void ImGui::UpdateHoveredWindowAndCaptureFlags()
5061+
void ImGui::UpdateHoveredWindowAndCaptureFlags(const ImVec2& mouse_pos)
50625062
{
50635063
ImGuiContext& g = *GImGui;
50645064
ImGuiIO& io = g.IO;
@@ -5072,7 +5072,7 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags()
50725072
// - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame.
50735073
// - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.
50745074
bool clear_hovered_windows = false;
5075-
FindHoveredWindowEx(g.IO.MousePos, false, &g.HoveredWindow, &g.HoveredWindowUnderMovingWindow);
5075+
FindHoveredWindowEx(mouse_pos, false, &g.HoveredWindow, &g.HoveredWindowUnderMovingWindow);
50765076
g.HoveredWindowBeforeClear = g.HoveredWindow;
50775077

50785078
// Modal windows prevents mouse from hovering behind them.
@@ -5343,7 +5343,7 @@ void ImGui::NewFrame()
53435343
// Find hovered window
53445344
// (needs to be before UpdateMouseMovingWindowNewFrame so we fill g.HoveredWindowUnderMovingWindow on the mouse release frame)
53455345
// (currently needs to be done after the WasActive=Active loop and FindHoveredWindowEx uses ->Active)
5346-
UpdateHoveredWindowAndCaptureFlags();
5346+
UpdateHoveredWindowAndCaptureFlags(g.IO.MousePos);
53475347

53485348
// Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering)
53495349
UpdateMouseMovingWindowNewFrame();

imgui_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,7 @@ namespace ImGui
30493049

30503050
// NewFrame
30513051
IMGUI_API void UpdateInputEvents(bool trickle_fast_inputs);
3052-
IMGUI_API void UpdateHoveredWindowAndCaptureFlags();
3052+
IMGUI_API void UpdateHoveredWindowAndCaptureFlags(const ImVec2& mouse_pos);
30533053
IMGUI_API void FindHoveredWindowEx(const ImVec2& pos, bool find_first_and_in_any_viewport, ImGuiWindow** out_hovered_window, ImGuiWindow** out_hovered_window_under_moving_window);
30543054
IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window);
30553055
IMGUI_API void UpdateMouseMovingWindowNewFrame();

0 commit comments

Comments
 (0)