From 184a6f11985212f442934d9bbed9b7ae8203e5eb Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 27 Feb 2018 22:56:22 +0100 Subject: [PATCH] Internals: Moving window: test mouse validity while translating window + using SetWindowPos(). --- imgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index e05811a7..6555f6d9 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3234,13 +3234,13 @@ static void ImGui::UpdateMovingWindow() KeepAliveID(g.ActiveId); IM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow); ImGuiWindow* moving_window = g.MovingWindow->RootWindow; - if (g.IO.MouseDown[0]) + if (g.IO.MouseDown[0] && IsMousePosValid(&g.IO.MousePos)) { ImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset; if (moving_window->PosFloat.x != pos.x || moving_window->PosFloat.y != pos.y) { MarkIniSettingsDirty(moving_window); - moving_window->PosFloat = pos; + SetWindowPos(moving_window, pos, ImGuiCond_Always); } FocusWindow(g.MovingWindow); }