mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-25 00:56:35 +00:00
Fix to allow opening popup from a left-click on void or another window (because left-click would normally override focus immediately) (#126)
Neither appears to be really useful frankly.
This commit is contained in:
parent
1cb6a294b0
commit
235cca4f97
21
imgui.cpp
21
imgui.cpp
@ -2377,16 +2377,19 @@ void ImGui::Render()
|
|||||||
// Click to focus window and start moving (after we're done with all our widgets)
|
// Click to focus window and start moving (after we're done with all our widgets)
|
||||||
if (g.ActiveId == 0 && g.HoveredId == 0 && g.IO.MouseClicked[0])
|
if (g.ActiveId == 0 && g.HoveredId == 0 && g.IO.MouseClicked[0])
|
||||||
{
|
{
|
||||||
if (g.HoveredRootWindow != NULL)
|
if (!(g.FocusedWindow && !g.FocusedWindow->WasActive && g.FocusedWindow->Active)) // Unless we just made a popup appear
|
||||||
{
|
{
|
||||||
IM_ASSERT(g.MovedWindow == NULL);
|
if (g.HoveredRootWindow != NULL)
|
||||||
g.MovedWindow = g.HoveredWindow;
|
{
|
||||||
SetActiveId(g.HoveredRootWindow->MoveID, g.HoveredRootWindow);
|
IM_ASSERT(g.MovedWindow == NULL);
|
||||||
}
|
g.MovedWindow = g.HoveredWindow;
|
||||||
else if (g.FocusedWindow != NULL)
|
SetActiveId(g.HoveredRootWindow->MoveID, g.HoveredRootWindow);
|
||||||
{
|
}
|
||||||
// Clicking on void disable focus
|
else if (g.FocusedWindow != NULL)
|
||||||
FocusWindow(NULL);
|
{
|
||||||
|
// Clicking on void disable focus
|
||||||
|
FocusWindow(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user