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 ()) + g_snprintf (buf, sizeof (buf), "_NET_WM_CM_S%d", number); + wm_cm_atom = XInternAtom (x11_display->xdisplay, buf, False); + + x11_display->wm_cm_selection_window = + take_manager_selection (x11_display, xroot, wm_cm_atom, timestamp, + replace_current_wm); + + if (x11_display->wm_cm_selection_window == None) { - meta_x11_display_set_cm_selection (x11_display, timestamp); + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Failed to acquire compositor ownership"); - 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; - } + 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,