From b367965f6c66bcbbd8b1c8daddc550d3d0fed231 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 28 Mar 2014 13:50:45 -0400 Subject: [PATCH] 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. --- src/core/window-private.h | 10 +++++++++- src/core/window.c | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/window-private.h b/src/core/window-private.h index ebda724b9..374bca7d7 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -220,10 +220,18 @@ struct _MetaWindow */ 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; + /* 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 * tell the compositor to perform. */ diff --git a/src/core/window.c b/src/core/window.c index 29050234e..1deece0db 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -867,6 +867,7 @@ _meta_window_shared_new (MetaDisplay *display, window->iconic = FALSE; window->mapped = attrs->map_state != IsUnmapped; window->hidden = FALSE; + window->known_to_compositor = FALSE; window->visible_to_compositor = FALSE; window->pending_compositor_effect = effect; /* 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); + window->known_to_compositor = TRUE; /* Sync stack changes */ meta_stack_thaw (window->screen->stack); @@ -1476,6 +1478,7 @@ meta_window_unmanage (MetaWindow *window, } meta_compositor_remove_window (window->display->compositor, window); + window->known_to_compositor = FALSE; 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, window->user_rect.x, window->user_rect.y, 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, window, did_placement);