Skip to content

Commit

Permalink
Fixed|UI|Client: Relocate popups when UI composition mode changes
Browse files Browse the repository at this point in the history
If the compositor is activated, open popups must be relocated to
the compositor instead of staying in the root widget.
  • Loading branch information
skyjake committed Dec 22, 2013
1 parent ecef8cd commit 5e88826
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions doomsday/client/src/ui/clientwindow.cpp
Expand Up @@ -544,6 +544,16 @@ DENG2_OBSERVES(App, StartupComplete)

Widget::Children additional;

// Relocate all popups to the new container (which need to stay on top).
foreach(Widget *w, container().children())
{
if(PopupWidget *pop = w->maybeAs<PopupWidget>())
{
additional.append(pop);
container().remove(*pop);
}
}

if(enable && !compositor)
{
LOG_MSG("Offscreen UI composition enabled");
Expand All @@ -555,15 +565,7 @@ DENG2_OBSERVES(App, StartupComplete)
else
{
DENG2_ASSERT(compositor != 0);

// Anything remaining in the compositor also needs to be relocated; there could be
// some hidden popups. We are about to do delete the compositor, which means all its
// remaining children will be deleted, too.
additional = compositor->childWidgets();
foreach(Widget *w, additional)
{
compositor->remove(*w);
}
DENG2_ASSERT(!compositor->childCount());

root.remove(*compositor);
compositor->guiDeleteLater();
Expand All @@ -577,14 +579,16 @@ DENG2_OBSERVES(App, StartupComplete)
if(sidebar) container().add(sidebar);
container().add(notifications);
container().add(taskBar);
container().add(cursor);

// Also the other widgets.
foreach(Widget *w, additional)
{
container().add(w);
}

// Fake cursor must be on top.
container().add(cursor);

if(mode == Normal)
{
root.update();
Expand Down

0 comments on commit 5e88826

Please sign in to comment.