From 3259c7e150d07e7933cd7c7c98e9a911f2a680b6 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 13 Aug 2019 20:56:32 +0200 Subject: [PATCH] wayland: Start up the grace Xwayland period right after starting Xwayland There may be cases where a X11 client does not spawn any X11 windows (eg. simple clients like xinput --list, or xlsclients), in this case the Xwayland server would remain running until X11 windows happen to come and go in the future. Firing the shutdown timeout on restart caters for this, and would be undone if the client maps X11 windows. https://gitlab.gnome.org/GNOME/mutter/merge_requests/728 --- src/wayland/meta-xwayland.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index fec8662cc..a25e645bb 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -683,6 +683,16 @@ xdisplay_connection_activity_cb (gint fd, return G_SOURCE_REMOVE; } +static void +meta_xwayland_stop_xserver_timeout (MetaXWaylandManager *manager) +{ + if (manager->xserver_grace_period_id) + return; + + manager->xserver_grace_period_id = + g_timeout_add_seconds (10, shutdown_xwayland_cb, manager); +} + static void window_unmanaged_cb (MetaWindow *window, MetaXWaylandManager *manager) @@ -694,8 +704,7 @@ window_unmanaged_cb (MetaWindow *window, if (!manager->x11_windows) { meta_verbose ("All X11 windows gone, setting shutdown timeout"); - manager->xserver_grace_period_id = - g_timeout_add_seconds (10, shutdown_xwayland_cb, manager); + meta_xwayland_stop_xserver_timeout (manager); } } @@ -799,6 +808,7 @@ meta_xwayland_complete_init (MetaDisplay *display) if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND) { + meta_xwayland_stop_xserver_timeout (manager); g_signal_connect (meta_get_display (), "window-created", G_CALLBACK (window_created_cb), manager); }