screen: use stack tracker for initial window query
In meta_screen_manage_all_windows() we can use our own stack tracker to get the list of windows - no need to query X again. A copy is needed because the stack gets modified as part of the loop. Specifically, meta_stack_tracker_get_stack() at this time returns the predicted stack, and meta_window_new() performs a few operations (e.g. framing) which cause immediate changes to the predicted stack. https://bugzilla.gnome.org/show_bug.cgi?id=721345
This commit is contained in:
parent
7bfc9109f7
commit
39d26be941
@ -883,9 +883,9 @@ meta_screen_free (MetaScreen *screen,
|
|||||||
void
|
void
|
||||||
meta_screen_manage_all_windows (MetaScreen *screen)
|
meta_screen_manage_all_windows (MetaScreen *screen)
|
||||||
{
|
{
|
||||||
Window ignored1, ignored2;
|
MetaStackWindow *_children;
|
||||||
Window *children;
|
MetaStackWindow *children;
|
||||||
guint n_children, i;
|
int n_children, i;
|
||||||
|
|
||||||
meta_display_grab (screen->display);
|
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_screen_create_guard_window (screen->display->xdisplay, screen);
|
||||||
|
|
||||||
meta_stack_freeze (screen->stack);
|
meta_stack_freeze (screen->stack);
|
||||||
|
meta_stack_tracker_get_stack (screen->stack_tracker, &_children, &n_children);
|
||||||
|
|
||||||
XQueryTree (screen->display->xdisplay,
|
/* Copy the stack as it will be modified as part of the loop */
|
||||||
screen->xroot,
|
children = g_memdup (_children, sizeof (MetaStackWindow) * n_children);
|
||||||
&ignored1, &ignored2, &children, &n_children);
|
|
||||||
|
|
||||||
for (i = 0; i < n_children; ++i)
|
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);
|
META_COMP_EFFECT_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (children)
|
g_free (children);
|
||||||
XFree (children);
|
|
||||||
|
|
||||||
meta_stack_thaw (screen->stack);
|
meta_stack_thaw (screen->stack);
|
||||||
|
|
||||||
meta_display_ungrab (screen->display);
|
meta_display_ungrab (screen->display);
|
||||||
|
Loading…
Reference in New Issue
Block a user