[mutter] xwayland: Start Xwayland on connection to either public X11 socket



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

    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>

 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 46a2470a79..82a256f60f 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 783a58d354..1343a7d057 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -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;


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