mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 15:50:25 +01:00
Minor renaming.
This commit is contained in:
parent
a6ff14d66e
commit
c432fcf2bb
34
imgui.cpp
34
imgui.cpp
@ -2328,29 +2328,29 @@ 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). Only valid for root windows.
|
// Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
|
||||||
if (g.MovedWindowMoveId && g.MovedWindowMoveId == g.ActiveId)
|
if (g.MovingWindowMoveId && g.MovingWindowMoveId == g.ActiveId)
|
||||||
{
|
{
|
||||||
KeepAliveID(g.MovedWindowMoveId);
|
KeepAliveID(g.MovingWindowMoveId);
|
||||||
IM_ASSERT(g.MovedWindow && g.MovedWindow->RootWindow);
|
IM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow);
|
||||||
IM_ASSERT(g.MovedWindow->MoveId == g.MovedWindowMoveId);
|
IM_ASSERT(g.MovingWindow->MoveId == g.MovingWindowMoveId);
|
||||||
if (g.IO.MouseDown[0])
|
if (g.IO.MouseDown[0])
|
||||||
{
|
{
|
||||||
g.MovedWindow->RootWindow->PosFloat += g.IO.MouseDelta;
|
g.MovingWindow->RootWindow->PosFloat += g.IO.MouseDelta;
|
||||||
if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)
|
if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)
|
||||||
MarkIniSettingsDirty(g.MovedWindow->RootWindow);
|
MarkIniSettingsDirty(g.MovingWindow->RootWindow);
|
||||||
FocusWindow(g.MovedWindow);
|
FocusWindow(g.MovingWindow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
g.MovedWindow = NULL;
|
g.MovingWindow = NULL;
|
||||||
g.MovedWindowMoveId = 0;
|
g.MovingWindowMoveId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g.MovedWindow = NULL;
|
g.MovingWindow = NULL;
|
||||||
g.MovedWindowMoveId = 0;
|
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
|
||||||
@ -2362,11 +2362,11 @@ void ImGui::NewFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the window we are hovering. Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow
|
// Find the window we are hovering. Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow
|
||||||
g.HoveredWindow = g.MovedWindow ? g.MovedWindow : FindHoveredWindow(g.IO.MousePos, false);
|
g.HoveredWindow = g.MovingWindow ? g.MovingWindow : FindHoveredWindow(g.IO.MousePos, false);
|
||||||
if (g.HoveredWindow && (g.HoveredWindow->Flags & ImGuiWindowFlags_ChildWindow))
|
if (g.HoveredWindow && (g.HoveredWindow->Flags & ImGuiWindowFlags_ChildWindow))
|
||||||
g.HoveredRootWindow = g.HoveredWindow->RootWindow;
|
g.HoveredRootWindow = g.HoveredWindow->RootWindow;
|
||||||
else
|
else
|
||||||
g.HoveredRootWindow = g.MovedWindow ? g.MovedWindow->RootWindow : FindHoveredWindow(g.IO.MousePos, true);
|
g.HoveredRootWindow = g.MovingWindow ? g.MovingWindow->RootWindow : FindHoveredWindow(g.IO.MousePos, true);
|
||||||
|
|
||||||
if (ImGuiWindow* modal_window = GetFrontMostModalRootWindow())
|
if (ImGuiWindow* modal_window = GetFrontMostModalRootWindow())
|
||||||
{
|
{
|
||||||
@ -2504,7 +2504,7 @@ void ImGui::Shutdown()
|
|||||||
g.HoveredWindow = NULL;
|
g.HoveredWindow = NULL;
|
||||||
g.HoveredRootWindow = NULL;
|
g.HoveredRootWindow = NULL;
|
||||||
g.ActiveIdWindow = NULL;
|
g.ActiveIdWindow = NULL;
|
||||||
g.MovedWindow = NULL;
|
g.MovingWindow = NULL;
|
||||||
for (int i = 0; i < g.Settings.Size; i++)
|
for (int i = 0; i < g.Settings.Size; i++)
|
||||||
ImGui::MemFree(g.Settings[i].Name);
|
ImGui::MemFree(g.Settings[i].Name);
|
||||||
g.Settings.clear();
|
g.Settings.clear();
|
||||||
@ -2799,9 +2799,9 @@ void ImGui::EndFrame()
|
|||||||
FocusWindow(g.HoveredWindow);
|
FocusWindow(g.HoveredWindow);
|
||||||
if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove))
|
if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||||
{
|
{
|
||||||
g.MovedWindow = g.HoveredWindow;
|
g.MovingWindow = g.HoveredWindow;
|
||||||
g.MovedWindowMoveId = g.HoveredWindow->MoveId;
|
g.MovingWindowMoveId = g.MovingWindow->MoveId;
|
||||||
SetActiveID(g.MovedWindowMoveId, g.HoveredRootWindow);
|
SetActiveID(g.MovingWindowMoveId, g.HoveredRootWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
|
else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
|
||||||
|
@ -435,8 +435,8 @@ struct ImGuiContext
|
|||||||
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
|
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
|
||||||
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* MovedWindow; // Track the child window we clicked on to move a window.
|
ImGuiWindow* MovingWindow; // Track the child window we clicked on to move a window.
|
||||||
ImGuiID MovedWindowMoveId; // == MovedWindow->RootWindow->MoveId
|
ImGuiID MovingWindowMoveId; // == MovingWindow->MoveId
|
||||||
ImVector<ImGuiIniData> Settings; // .ini Settings
|
ImVector<ImGuiIniData> Settings; // .ini Settings
|
||||||
float SettingsDirtyTimer; // Save .ini Settings on disk when time reaches zero
|
float SettingsDirtyTimer; // Save .ini Settings on disk when time reaches zero
|
||||||
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
||||||
@ -527,8 +527,8 @@ struct ImGuiContext
|
|||||||
ActiveIdAllowOverlap = false;
|
ActiveIdAllowOverlap = false;
|
||||||
ActiveIdClickOffset = ImVec2(-1,-1);
|
ActiveIdClickOffset = ImVec2(-1,-1);
|
||||||
ActiveIdWindow = NULL;
|
ActiveIdWindow = NULL;
|
||||||
MovedWindow = NULL;
|
MovingWindow = NULL;
|
||||||
MovedWindowMoveId = 0;
|
MovingWindowMoveId = 0;
|
||||||
SettingsDirtyTimer = 0.0f;
|
SettingsDirtyTimer = 0.0f;
|
||||||
|
|
||||||
SetNextWindowPosVal = ImVec2(0.0f, 0.0f);
|
SetNextWindowPosVal = ImVec2(0.0f, 0.0f);
|
||||||
|
Loading…
Reference in New Issue
Block a user