From 0734a12d25693355db3c1e1801fe63a24723142b Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 6 Apr 2018 23:05:53 +0200 Subject: [PATCH] IO: ImGuiConfigFlags_NoMouse disable hovering so it is not destructive. Amend 2464e62a1ad9a7c8f2d9f898f54484af8ca3a524 --- imgui.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index e5631274c..69fdea6a8 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3294,11 +3294,6 @@ static void ImGui::NewFrameUpdateMovingWindow() static void ImGui::NewFrameUpdateMouseInputs() { ImGuiContext& g = *GImGui; - if (g.IO.ConfigFlags & ImGuiConfigFlags_NoMouse) - { - g.IO.MousePos = ImVec2(-FLT_MAX, -FLT_MAX); - memset(g.IO.MouseDown, 0, sizeof(g.IO.MouseDown)); - } // If mouse just appeared or disappeared (usually denoted by -FLT_MAX component, but in reality we test for -256000.0f) we cancel out movement in MouseDelta if (ImGui::IsMousePosValid(&g.IO.MousePos) && ImGui::IsMousePosValid(&g.IO.MousePosPrev)) @@ -3362,6 +3357,10 @@ void ImGui::NewFrameUpdateHoveredWindowAndCaptureFlags() if (g.HoveredRootWindow && !IsWindowChildOf(g.HoveredRootWindow, modal_window)) g.HoveredRootWindow = g.HoveredWindow = NULL; + // Disabled mouse? + if (g.IO.ConfigFlags & ImGuiConfigFlags_NoMouse) + g.HoveredWindow = g.HoveredRootWindow = NULL; + // We track click ownership. When clicked outside of a window the click is owned by the application and won't report hovering nor request capture even while dragging over our windows afterward. int mouse_earliest_button_down = -1; bool mouse_any_down = false;