mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Refactor EndFrame() code that process focusing window with left mouse button. This commit should be no-op.
This commit is contained in:
parent
2a32a2e662
commit
5f7299e15a
31
imgui.cpp
31
imgui.cpp
@ -2771,25 +2771,28 @@ void ImGui::EndFrame()
|
|||||||
g.CurrentWindow->Active = false;
|
g.CurrentWindow->Active = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
// Click to focus window and start moving (after we're done with all our widgets)
|
if (g.ActiveId == 0 && g.HoveredId == 0)
|
||||||
if (g.ActiveId == 0 && g.HoveredId == 0 && g.IO.MouseClicked[0])
|
|
||||||
{
|
{
|
||||||
if (!(g.NavWindow && !g.NavWindow->WasActive && g.NavWindow->Active)) // Unless we just made a popup appear
|
if (!g.NavWindow || g.NavWindow->WasActive || !g.NavWindow->Active) // Unless we just made a popup appear
|
||||||
{
|
{
|
||||||
if (g.HoveredRootWindow != NULL)
|
// Click to focus window and start moving (after we're done with all our widgets)
|
||||||
|
if (g.IO.MouseClicked[0])
|
||||||
{
|
{
|
||||||
FocusWindow(g.HoveredWindow);
|
if (g.HoveredRootWindow != NULL)
|
||||||
if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove))
|
|
||||||
{
|
{
|
||||||
g.MovedWindow = g.HoveredWindow;
|
FocusWindow(g.HoveredWindow);
|
||||||
g.MovedWindowMoveId = g.HoveredWindow->MoveId;
|
if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||||
SetActiveID(g.MovedWindowMoveId, g.HoveredRootWindow);
|
{
|
||||||
|
g.MovedWindow = g.HoveredWindow;
|
||||||
|
g.MovedWindowMoveId = g.HoveredWindow->MoveId;
|
||||||
|
SetActiveID(g.MovedWindowMoveId, g.HoveredRootWindow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
|
||||||
|
{
|
||||||
|
// Clicking on void disable focus
|
||||||
|
FocusWindow(NULL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
|
|
||||||
{
|
|
||||||
// Clicking on void disable focus
|
|
||||||
FocusWindow(NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user