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
This commit is contained in:
Carlos Garnacho 2019-08-13 20:56:32 +02:00
parent e9e28baab7
commit 3259c7e150

View File

@ -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);
}