Skip to content

Commit

Permalink
Fix to allow opening popup from a left-click on void or another windo…
Browse files Browse the repository at this point in the history
…w (because left-click would normally override focus immediately) (#126)

Neither appears to be really useful frankly.
  • Loading branch information
ocornut committed May 27, 2015
1 parent 1cb6a29 commit 235cca4
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2377,16 +2377,19 @@ void ImGui::Render()
// 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.HoveredRootWindow != NULL)
if (!(g.FocusedWindow && !g.FocusedWindow->WasActive && g.FocusedWindow->Active)) // Unless we just made a popup appear
{
IM_ASSERT(g.MovedWindow == NULL);
g.MovedWindow = g.HoveredWindow;
SetActiveId(g.HoveredRootWindow->MoveID, g.HoveredRootWindow);
}
else if (g.FocusedWindow != NULL)
{
// Clicking on void disable focus
FocusWindow(NULL);
if (g.HoveredRootWindow != NULL)
{
IM_ASSERT(g.MovedWindow == NULL);
g.MovedWindow = g.HoveredWindow;
SetActiveId(g.HoveredRootWindow->MoveID, g.HoveredRootWindow);
}
else if (g.FocusedWindow != NULL)
{
// Clicking on void disable focus
FocusWindow(NULL);
}
}
}

Expand Down

0 comments on commit 235cca4

Please sign in to comment.