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
This commit is contained in:
Jonas Ådahl 2018-09-14 19:06:55 +02:00 committed by Florian Müllner
parent e2e7296612
commit 7d82cdeea3

View File

@ -57,6 +57,8 @@ struct _MetaWindowWayland
int last_sent_y; int last_sent_y;
int last_sent_width; int last_sent_width;
int last_sent_height; int last_sent_height;
gboolean has_been_shown;
}; };
struct _MetaWindowWaylandClass struct _MetaWindowWaylandClass
@ -538,6 +540,19 @@ appears_focused_changed (GObject *object,
surface_state_changed (window); 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 static void
meta_window_wayland_init (MetaWindowWayland *wl_window) 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_signal_connect (window, "notify::appears-focused",
G_CALLBACK (appears_focused_changed), NULL); G_CALLBACK (appears_focused_changed), NULL);
g_signal_connect (window, "shown",
G_CALLBACK (on_window_shown), NULL);
} }
static void static void
@ -576,7 +593,9 @@ meta_window_wayland_is_stackable (MetaWindow *window)
static gboolean static gboolean
meta_window_wayland_are_updates_frozen (MetaWindow *window) 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 static void