[mutter/gnome-3-38] wayland: start Xwayland on connection to either public X11 socket



commit 7b2815077fa1053069e00c0a21b2c3038f4b0d1c
Author: James Henstridge <james jamesh id au>
Date:   Sat Oct 17 12:01:44 2020 +0800

    wayland: start Xwayland on connection to either public X11 socket
    
    Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1454
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1508

 src/wayland/meta-wayland-private.h |  3 +++
 src/wayland/meta-xwayland.c        | 13 +++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h
index 727009b07e..da0b56571d 100644
--- a/src/wayland/meta-wayland-private.h
+++ b/src/wayland/meta-wayland-private.h
@@ -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;
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 4a9d07ea99..fc184426ad 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -716,11 +716,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;
 }
 
@@ -817,8 +822,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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]