Don't restack windows while we are unmanaging them

Restacking the frame for a window while unmanaging the window is
harmless, but for undecorated (in particular, client-side-decorated)
windows, this causes problems because the window is typically
destroyed by the client immediately after withredrawing the window.

Skip windows flagged as being unmanaged when assembling the new
stack and when comparing the old order to the new stack.

Add a stacking test for this.
This commit is contained in:
Owen W. Taylor 2014-09-16 13:40:30 -04:00
parent d6624b0a75
commit 21f123c69f
3 changed files with 28 additions and 2 deletions

View File

@ -1063,7 +1063,8 @@ meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
for (old_pos = n_windows - 1; old_pos >= 0; old_pos--) for (old_pos = n_windows - 1; old_pos >= 0; old_pos--)
{ {
MetaWindow *old_window = meta_display_lookup_stack_id (tracker->screen->display, windows[old_pos]); MetaWindow *old_window = meta_display_lookup_stack_id (tracker->screen->display, windows[old_pos]);
if ((old_window && !old_window->override_redirect) || windows[old_pos] == tracker->screen->guard_window) if ((old_window && !old_window->override_redirect && !old_window->unmanaging) ||
windows[old_pos] == tracker->screen->guard_window)
break; break;
} }
g_assert (old_pos >= 0); g_assert (old_pos >= 0);
@ -1093,7 +1094,7 @@ meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
} }
MetaWindow *old_window = meta_display_lookup_stack_id (tracker->screen->display, windows[old_pos]); MetaWindow *old_window = meta_display_lookup_stack_id (tracker->screen->display, windows[old_pos]);
if (!old_window || old_window->override_redirect) if (!old_window || old_window->override_redirect || old_window->unmanaging)
{ {
old_pos--; old_pos--;
continue; continue;

View File

@ -1069,6 +1069,9 @@ stack_sync_to_xserver (MetaStack *stack)
Window top_level_window; Window top_level_window;
guint64 stack_id; guint64 stack_id;
if (w->unmanaging)
continue;
meta_topic (META_DEBUG_STACK, "%u:%d - %s ", meta_topic (META_DEBUG_STACK, "%u:%d - %s ",
w->layer, w->stack_position, w->desc); w->layer, w->stack_position, w->desc);

View File

@ -0,0 +1,22 @@
new_client 1 x11
create 1/1
show 1/1
create 1/2 csd
show 1/2
wait
assert_stacking 1/1 1/2
destroy 1/2
wait
assert_stacking 1/1
create 1/2 csd
show 1/2
create 1/3 csd
show 1/3
wait
assert_stacking 1/1 1/2 1/3
destroy 1/2
wait
assert_stacking 1/1 1/3