summaryrefslogtreecommitdiff
path: root/src/x11/meta-x11-display.c
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2023-04-19 17:56:17 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2023-05-15 19:06:37 +0200
commit8039b584109d8e5920caebf2af6b516e6770e822 (patch)
treeeaa1b01d823e744f168f818852e48729af0580d7 /src/x11/meta-x11-display.c
parentc653f302831a5804ddf11dd75e8e77ebffd93488 (diff)
downloadmutter-8039b584109d8e5920caebf2af6b516e6770e822.tar.gz
x11/x11-display: Always set the compositor manager selection on init
Set the compositor manager selection during the initialization phase as we do with the window manager selection Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2970>
Diffstat (limited to 'src/x11/meta-x11-display.c')
-rw-r--r--src/x11/meta-x11-display.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 903309269..a1048f56e 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -1166,6 +1166,7 @@ meta_x11_display_new (MetaDisplay *display,
Window new_wm_sn_owner;
gboolean replace_current_wm;
Atom wm_sn_atom;
+ Atom wm_cm_atom;
char buf[128];
guint32 timestamp;
Atom atom_restart_helper;
@@ -1434,21 +1435,21 @@ meta_x11_display_new (MetaDisplay *display,
x11_display->wm_sn_atom = wm_sn_atom;
x11_display->wm_sn_timestamp = timestamp;
-#ifdef HAVE_XWAYLAND
- if (meta_is_wayland_compositor ())
- {
- meta_x11_display_set_cm_selection (x11_display, timestamp);
+ g_snprintf (buf, sizeof (buf), "_NET_WM_CM_S%d", number);
+ wm_cm_atom = XInternAtom (x11_display->xdisplay, buf, False);
- if (x11_display->wm_cm_selection_window == None)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Failed to acquire compositor ownership");
+ x11_display->wm_cm_selection_window =
+ take_manager_selection (x11_display, xroot, wm_cm_atom, timestamp,
+ replace_current_wm);
- g_object_run_dispose (G_OBJECT (x11_display));
- return NULL;
- }
+ if (x11_display->wm_cm_selection_window == None)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to acquire compositor ownership");
+
+ g_object_run_dispose (G_OBJECT (x11_display));
+ return NULL;
}
-#endif
init_event_masks (x11_display);
@@ -1873,23 +1874,6 @@ on_monitors_changed_internal (MetaMonitorManager *monitor_manager,
x11_display->has_xinerama_indices = FALSE;
}
-void
-meta_x11_display_set_cm_selection (MetaX11Display *x11_display,
- uint32_t timestamp)
-{
- char selection[32];
- Atom a;
-
- if (timestamp == CurrentTime)
- timestamp = meta_x11_display_get_current_time_roundtrip (x11_display);
-
- g_snprintf (selection, sizeof (selection), "_NET_WM_CM_S%d",
- DefaultScreen (x11_display->xdisplay));
- a = XInternAtom (x11_display->xdisplay, selection, False);
-
- x11_display->wm_cm_selection_window = take_manager_selection (x11_display, x11_display->xroot, a, timestamp, TRUE);
-}
-
static Bool
find_timestamp_predicate (Display *xdisplay,
XEvent *ev,