xwayland: Start Xwayland on connection to either public X11 socket

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1454
(cherry picked from commit 7b2815077fa1053069e00c0a21b2c3038f4b0d1c)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1669>
This commit is contained in:
James Henstridge 2020-10-17 12:01:44 +08:00 committed by Olivier Fourdan
parent df4b6d4ca5
commit 063db30c50
2 changed files with 14 additions and 2 deletions

View File

@ -56,6 +56,9 @@ typedef struct
MetaXWaylandConnection private_connection;
MetaXWaylandConnection public_connection;
guint abstract_fd_watch_id;
guint unix_fd_watch_id;
guint xserver_grace_period_id;
struct wl_display *wayland_display;
struct wl_client *client;

View File

@ -990,11 +990,16 @@ xdisplay_connection_activity_cb (gint fd,
GIOCondition cond,
gpointer user_data)
{
MetaXWaylandManager *manager = user_data;
MetaDisplay *display = meta_get_display ();
meta_display_init_x11 (display, NULL,
(GAsyncReadyCallback) on_init_x11_cb, NULL);
/* Stop watching both file descriptors */
g_clear_handle_id (&manager->abstract_fd_watch_id, g_source_remove);
g_clear_handle_id (&manager->unix_fd_watch_id, g_source_remove);
return G_SOURCE_REMOVE;
}
@ -1098,8 +1103,12 @@ meta_xwayland_init (MetaXWaylandManager *manager,
if (policy == META_DISPLAY_POLICY_ON_DEMAND)
{
g_unix_fd_add (manager->public_connection.abstract_fd, G_IO_IN,
xdisplay_connection_activity_cb, manager);
manager->abstract_fd_watch_id =
g_unix_fd_add (manager->public_connection.abstract_fd, G_IO_IN,
xdisplay_connection_activity_cb, manager);
manager->unix_fd_watch_id =
g_unix_fd_add (manager->public_connection.unix_fd, G_IO_IN,
xdisplay_connection_activity_cb, manager);
}
return TRUE;