diff --git a/src/core/screen.c b/src/core/screen.c index d006b4349..2fc9bfef2 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -883,9 +883,9 @@ meta_screen_free (MetaScreen *screen, void meta_screen_manage_all_windows (MetaScreen *screen) { - Window ignored1, ignored2; - Window *children; - guint n_children, i; + MetaStackWindow *_children; + MetaStackWindow *children; + int n_children, i; meta_display_grab (screen->display); @@ -894,20 +894,18 @@ meta_screen_manage_all_windows (MetaScreen *screen) meta_screen_create_guard_window (screen->display->xdisplay, screen); meta_stack_freeze (screen->stack); + meta_stack_tracker_get_stack (screen->stack_tracker, &_children, &n_children); - XQueryTree (screen->display->xdisplay, - screen->xroot, - &ignored1, &ignored2, &children, &n_children); + /* Copy the stack as it will be modified as part of the loop */ + children = g_memdup (_children, sizeof (MetaStackWindow) * n_children); for (i = 0; i < n_children; ++i) { - meta_window_new (screen->display, children[i], TRUE, + meta_window_new (screen->display, children[i].x11.xwindow, TRUE, META_COMP_EFFECT_NONE); } - if (children) - XFree (children); - + g_free (children); meta_stack_thaw (screen->stack); meta_display_ungrab (screen->display);