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>
This commit is contained in:
Marco Trevisan (Treviño) 2023-04-19 17:56:17 +02:00
parent c653f30283
commit 8039b58410
3 changed files with 13 additions and 34 deletions

View File

@ -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));

View File

@ -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);

View File

@ -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,10 +1435,12 @@ 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);
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)
{
@ -1447,8 +1450,6 @@ meta_x11_display_new (MetaDisplay *display,
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,