[mutter] x11-display: Keep track ourself if we're restarting



commit 6edb399b2b91647969f91338baa31b74221ca790
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Mon May 30 23:20:37 2022 +0200

    x11-display: Keep track ourself if we're restarting
    
    We still set the global state, so that e.g. GNOME Shell can continue
    consuming it, but it looks a bit awkward to rely on a global state
    inside a single function.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2619>

 src/x11/meta-x11-display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index f2b88c6baf..9793897d11 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -1137,6 +1137,7 @@ meta_x11_display_new (MetaDisplay  *display,
   guint32 timestamp;
   Atom atom_restart_helper;
   Window restart_helper_window = None;
+  gboolean is_restart = FALSE;
   GdkDisplay *gdk_display;
   MetaBackend *backend = meta_get_backend ();
   MetaMonitorManager *monitor_manager =
@@ -1202,7 +1203,10 @@ meta_x11_display_new (MetaDisplay  *display,
   atom_restart_helper = XInternAtom (xdisplay, "_MUTTER_RESTART_HELPER", False);
   restart_helper_window = XGetSelectionOwner (xdisplay, atom_restart_helper);
   if (restart_helper_window)
-    meta_set_is_restart (TRUE);
+    {
+      is_restart = TRUE;
+      meta_set_is_restart (TRUE);
+    }
 
   x11_display = g_object_new (META_TYPE_X11_DISPLAY, NULL);
   x11_display->gdk_display = gdk_display;
@@ -1299,7 +1303,7 @@ meta_x11_display_new (MetaDisplay  *display,
 
   /* Now that we've gotten taken a reference count on the COW, we
    * can close the helper that is holding on to it */
-  if (meta_is_restart ())
+  if (is_restart)
     XSetSelectionOwner (xdisplay, atom_restart_helper, None, META_CURRENT_TIME);
 
   /* Handle creating a no_focus_window for this screen */


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