window: Track known_to_compositor and visible_to_compositor separately

Really, visible_to_compositor means that the window is shown, e.g.
not minimized. We need to be using a boolean tracking whether we've
called meta_compositor_add_window / meta_compositor_remove_window.

This fixes a jump during window placement when a window appears.
This commit is contained in:
Jasper St. Pierre 2014-03-28 13:50:45 -04:00
parent ed9dbf6aa2
commit b367965f6c
2 changed files with 13 additions and 2 deletions

View File

@ -220,10 +220,18 @@ struct _MetaWindow
*/ */
guint hidden : 1; guint hidden : 1;
/* Whether the compositor thinks the window is visible /* Whether the compositor thinks the window is visible.
* This should match up with calls to meta_compositor_show_window /
* meta_compositor_hide_window.
*/ */
guint visible_to_compositor : 1; guint visible_to_compositor : 1;
/* Whether the compositor knows about the window.
* This should match up with calls to meta_compositor_add_window /
* meta_compositor_remove_window.
*/
guint known_to_compositor : 1;
/* When we next show or hide the window, what effect we should /* When we next show or hide the window, what effect we should
* tell the compositor to perform. * tell the compositor to perform.
*/ */

View File

@ -867,6 +867,7 @@ _meta_window_shared_new (MetaDisplay *display,
window->iconic = FALSE; window->iconic = FALSE;
window->mapped = attrs->map_state != IsUnmapped; window->mapped = attrs->map_state != IsUnmapped;
window->hidden = FALSE; window->hidden = FALSE;
window->known_to_compositor = FALSE;
window->visible_to_compositor = FALSE; window->visible_to_compositor = FALSE;
window->pending_compositor_effect = effect; window->pending_compositor_effect = effect;
/* if already mapped, no need to worry about focus-on-first-time-showing */ /* if already mapped, no need to worry about focus-on-first-time-showing */
@ -1195,6 +1196,7 @@ _meta_window_shared_new (MetaDisplay *display,
} }
meta_compositor_add_window (screen->display->compositor, window); meta_compositor_add_window (screen->display->compositor, window);
window->known_to_compositor = TRUE;
/* Sync stack changes */ /* Sync stack changes */
meta_stack_thaw (window->screen->stack); meta_stack_thaw (window->screen->stack);
@ -1476,6 +1478,7 @@ meta_window_unmanage (MetaWindow *window,
} }
meta_compositor_remove_window (window->display->compositor, window); meta_compositor_remove_window (window->display->compositor, window);
window->known_to_compositor = FALSE;
if (window->display->window_with_menu == window) if (window->display->window_with_menu == window)
{ {
@ -4331,7 +4334,7 @@ meta_window_move_resize_internal (MetaWindow *window,
newx, newy, window->rect.width, window->rect.height, newx, newy, window->rect.width, window->rect.height,
window->user_rect.x, window->user_rect.y, window->user_rect.x, window->user_rect.y,
window->user_rect.width, window->user_rect.height); window->user_rect.width, window->user_rect.height);
if (window->visible_to_compositor) if (window->known_to_compositor)
meta_compositor_sync_window_geometry (window->display->compositor, meta_compositor_sync_window_geometry (window->display->compositor,
window, window,
did_placement); did_placement);