Internals: Moved unnecessary MovingWindowMoveId field.

This commit is contained in:
omar 2018-01-22 14:30:49 +01:00
parent 5097368bd5
commit 1acb155419
2 changed files with 1 additions and 9 deletions

View File

@ -2393,11 +2393,10 @@ void ImGui::NewFrame()
g.IO.Framerate = 1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame)); g.IO.Framerate = 1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame));
// Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering). // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering).
if (g.MovingWindowMoveId && g.MovingWindowMoveId == g.ActiveId) if (g.MovingWindow && g.MovingWindow->MoveId == g.ActiveId)
{ {
KeepAliveID(g.ActiveId); KeepAliveID(g.ActiveId);
IM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow); IM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow);
IM_ASSERT(g.MovingWindow->MoveId == g.MovingWindowMoveId);
if (g.IO.MouseDown[0]) if (g.IO.MouseDown[0])
{ {
// MovingWindow = window we clicked on, could be a child window. We track it to preserve Focus and so that ActiveIdWindow == MovingWindow and ActiveId == MovingWindow->MoveId for consistency. // MovingWindow = window we clicked on, could be a child window. We track it to preserve Focus and so that ActiveIdWindow == MovingWindow and ActiveId == MovingWindow->MoveId for consistency.
@ -2414,7 +2413,6 @@ void ImGui::NewFrame()
{ {
ClearActiveID(); ClearActiveID();
g.MovingWindow = NULL; g.MovingWindow = NULL;
g.MovingWindowMoveId = 0;
} }
} }
else else
@ -2427,7 +2425,6 @@ void ImGui::NewFrame()
ClearActiveID(); ClearActiveID();
} }
g.MovingWindow = NULL; g.MovingWindow = NULL;
g.MovingWindowMoveId = 0;
} }
// Delay saving settings so we don't spam disk too much // Delay saving settings so we don't spam disk too much
@ -2994,10 +2991,7 @@ void ImGui::EndFrame()
SetActiveID(g.HoveredWindow->MoveId, g.HoveredWindow); SetActiveID(g.HoveredWindow->MoveId, g.HoveredWindow);
g.ActiveIdClickOffset = g.IO.MousePos - g.HoveredRootWindow->Pos; g.ActiveIdClickOffset = g.IO.MousePos - g.HoveredRootWindow->Pos;
if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove)) if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove))
{
g.MovingWindow = g.HoveredWindow; g.MovingWindow = g.HoveredWindow;
g.MovingWindowMoveId = g.MovingWindow->MoveId;
}
} }
else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL) else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
{ {

View File

@ -530,7 +530,6 @@ struct ImGuiContext
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior) ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
ImGuiWindow* ActiveIdWindow; ImGuiWindow* ActiveIdWindow;
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow. ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
ImGuiID MovingWindowMoveId; // == MovingWindow->MoveId
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor() ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar() ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont() ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont()
@ -625,7 +624,6 @@ struct ImGuiContext
ActiveIdClickOffset = ImVec2(-1,-1); ActiveIdClickOffset = ImVec2(-1,-1);
ActiveIdWindow = NULL; ActiveIdWindow = NULL;
MovingWindow = NULL; MovingWindow = NULL;
MovingWindowMoveId = 0;
NextTreeNodeOpenVal = false; NextTreeNodeOpenVal = false;
NextTreeNodeOpenCond = 0; NextTreeNodeOpenCond = 0;