summaryrefslogtreecommitdiff
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
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>
-rw-r--r--src/compositor/meta-compositor-x11.c2
-rw-r--r--src/x11/meta-x11-display-private.h3
-rw-r--r--src/x11/meta-x11-display.c42
3 files changed, 13 insertions, 34 deletions
diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c
index 333cb60f3..bb425c31a 100644
--- a/src/compositor/meta-compositor-x11.c
+++ b/src/compositor/meta-compositor-x11.c
@@ -171,8 +171,6 @@ meta_compositor_x11_manage (MetaCompositor *compositor,
determine_server_clock_source (compositor_x11);
- meta_x11_display_set_cm_selection (display->x11_display, CurrentTime);
-
compositor_x11->output = display->x11_display->composite_overlay_window;
xwindow = meta_backend_x11_get_xwindow (META_BACKEND_X11 (backend));
diff --git a/src/x11/meta-x11-display-private.h b/src/x11/meta-x11-display-private.h
index ef9c7e11a..8f9ec1e6e 100644
--- a/src/x11/meta-x11-display-private.h
+++ b/src/x11/meta-x11-display-private.h
@@ -292,9 +292,6 @@ int meta_x11_display_get_screen_number (MetaX11Display *x11_display);
int meta_x11_display_get_damage_event_base (MetaX11Display *x11_display);
-void meta_x11_display_set_cm_selection (MetaX11Display *x11_display,
- uint32_t timestamp);
-
gboolean meta_x11_display_xwindow_is_a_no_focus_window (MetaX11Display *x11_display,
Window xwindow);
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,