From 6edb399b2b91647969f91338baa31b74221ca790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 30 May 2022 23:20:37 +0200 Subject: [PATCH] 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: --- 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 f2b88c6ba..9793897d1 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 */