@@ -2378,10 +2378,10 @@ void ImGui::NewFrame()
2378
2378
g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);
2379
2379
g.IO.Framerate = 1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame));
2380
2380
2381
- // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
2381
+ // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering).
2382
2382
if (g.MovingWindowMoveId && g.MovingWindowMoveId == g.ActiveId)
2383
2383
{
2384
- KeepAliveID(g.MovingWindowMoveId );
2384
+ KeepAliveID(g.ActiveId );
2385
2385
IM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow);
2386
2386
IM_ASSERT(g.MovingWindow->MoveId == g.MovingWindowMoveId);
2387
2387
if (g.IO.MouseDown[0])
@@ -2401,6 +2401,13 @@ void ImGui::NewFrame()
2401
2401
}
2402
2402
else
2403
2403
{
2404
+ // When clicking/dragging from a window that has the _NoMove flag, we still set the ActiveId in order to prevent hovering others.
2405
+ if (g.ActiveIdWindow && g.ActiveIdWindow->MoveId == g.ActiveId)
2406
+ {
2407
+ KeepAliveID(g.ActiveId);
2408
+ if (!g.IO.MouseDown[0])
2409
+ ClearActiveID();
2410
+ }
2404
2411
g.MovingWindow = NULL;
2405
2412
g.MovingWindowMoveId = 0;
2406
2413
}
@@ -2934,13 +2941,14 @@ void ImGui::EndFrame()
2934
2941
{
2935
2942
if (g.HoveredRootWindow != NULL)
2936
2943
{
2944
+ // Set ActiveId even if the _NoMove flag is set, without it dragging away from a window with _NoMove would activate hover on other windows.
2937
2945
FocusWindow(g.HoveredWindow);
2946
+ SetActiveID(g.HoveredWindow->MoveId, g.HoveredWindow);
2947
+ g.ActiveIdClickOffset = g.IO.MousePos - g.HoveredRootWindow->Pos;
2938
2948
if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove))
2939
2949
{
2940
2950
g.MovingWindow = g.HoveredWindow;
2941
2951
g.MovingWindowMoveId = g.MovingWindow->MoveId;
2942
- SetActiveID(g.MovingWindowMoveId, g.HoveredRootWindow);
2943
- g.ActiveIdClickOffset = g.IO.MousePos - g.MovingWindow->RootWindow->Pos;
2944
2952
}
2945
2953
}
2946
2954
else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
0 commit comments