From 7d82cdeea307608c9f4e6442eb4ea64d7dee0c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 14 Sep 2018 19:06:55 +0200 Subject: [PATCH] window/wayland: Freeze updates until shown Not until the window is shown do we know what monitor it's on, thus the size, so freeze updates (shape etc) until the window is shown. https://gitlab.gnome.org/GNOME/mutter/merge_requests/229 --- src/wayland/meta-window-wayland.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index 46ee78095..c71cc9a0b 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -57,6 +57,8 @@ struct _MetaWindowWayland int last_sent_y; int last_sent_width; int last_sent_height; + + gboolean has_been_shown; }; struct _MetaWindowWaylandClass @@ -538,6 +540,19 @@ appears_focused_changed (GObject *object, surface_state_changed (window); } +static void +on_window_shown (MetaWindow *window) +{ + MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window); + gboolean has_been_shown; + + has_been_shown = wl_window->has_been_shown; + wl_window->has_been_shown = TRUE; + + if (!has_been_shown) + meta_compositor_sync_updates_frozen (window->display->compositor, window); +} + static void meta_window_wayland_init (MetaWindowWayland *wl_window) { @@ -547,6 +562,8 @@ meta_window_wayland_init (MetaWindowWayland *wl_window) g_signal_connect (window, "notify::appears-focused", G_CALLBACK (appears_focused_changed), NULL); + g_signal_connect (window, "shown", + G_CALLBACK (on_window_shown), NULL); } static void @@ -576,7 +593,9 @@ meta_window_wayland_is_stackable (MetaWindow *window) static gboolean meta_window_wayland_are_updates_frozen (MetaWindow *window) { - return FALSE; + MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window); + + return !wl_window->has_been_shown; } static void