diff options
author | Daniel Drake <drake@endlessm.com> | 2013-12-30 14:26:10 -0600 |
---|---|---|
committer | Daniel Drake <drake@endlessm.com> | 2014-01-06 16:16:15 -0600 |
commit | 1066c19e6700fd012acf0c5db54f2c8602ec69bd (patch) | |
tree | 999bb0f36a84182d49e301067ce2278650eee079 | |
parent | d654c93ed2a804642d5eda9f4dce7ecc62442609 (diff) |
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
-rw-r--r-- | src/core/screen.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/screen.c b/src/core/screen.c index c9817789..0bfe2d9d 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -880,9 +880,9 @@ meta_screen_free (MetaScreen *screen, void meta_screen_manage_all_windows (MetaScreen *screen) { - Window ignored1, ignored2; + Window *_children; Window *children; - guint n_children, i; + int n_children, i; meta_display_grab (screen->display); @@ -891,10 +891,10 @@ meta_screen_manage_all_windows (MetaScreen *screen) 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 (Window) * n_children); for (i = 0; i < n_children; ++i) { @@ -902,9 +902,7 @@ meta_screen_manage_all_windows (MetaScreen *screen) META_COMP_EFFECT_NONE); } - if (children) - XFree (children); - + g_free (children); meta_stack_thaw (screen->stack); meta_display_ungrab (screen->display); |