From 311c0ca9e54c950cfc21730a918b98c05c491a05 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 3 Feb 2015 10:35:43 +0000 Subject: [PATCH] If mouse was first clicked outside of ImGui bounds we also cancel out hovering. --- imgui.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 1a133091..b4746035 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1700,7 +1700,6 @@ void ImGui::NewFrame() // Are we using inputs? Tell user so they can capture/discard the inputs away from the rest of their application. // When clicking outside of a window we assume the click is owned by the application and won't request capture. - // FIXME: For completeness we should completely disregard the mouse when 'mouse_owned_by_application' is set. int mouse_earliest_button_down = -1; for (size_t i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++) { @@ -1714,6 +1713,10 @@ void ImGui::NewFrame() g.IO.WantCaptureMouse = (!mouse_owned_by_application && g.HoveredWindow != NULL) || (g.ActiveId != 0); g.IO.WantCaptureKeyboard = (g.ActiveId != 0); + // If mouse was first clicked outside of ImGui bounds we also cancel out hovering. + if (mouse_owned_by_application) + g.HoveredWindow = g.HoveredRootWindow = NULL; + // Scale & Scrolling if (g.HoveredWindow && g.IO.MouseWheel != 0.0f) {