xwayland: remove atom synchronization

It was used to get window icon via _NET_WM_ICON, which is now
implemented by wlroots 0.20. Anyone who needs another atom can revert
this commit and add atoms in the `atoms` array.
This commit is contained in:
tokyo4j 2026-03-30 18:33:58 +09:00 committed by Consolatis
parent cdee4ba5f1
commit 3128f50a25

View file

@ -25,18 +25,6 @@
#include "window-rules.h" #include "window-rules.h"
#include "workspaces.h" #include "workspaces.h"
enum atoms {
ATOM_COUNT,
};
static const char * const atom_names[] = {
};
static_assert(ARRAY_SIZE(atom_names) == ATOM_COUNT, "atom names out of sync");
static xcb_atom_t atoms[ATOM_COUNT] = {0};
static void set_surface(struct view *view, struct wlr_surface *surface); static void set_surface(struct view *view, struct wlr_surface *surface);
static void handle_map(struct wl_listener *listener, void *data); static void handle_map(struct wl_listener *listener, void *data);
static void handle_unmap(struct wl_listener *listener, void *data); static void handle_unmap(struct wl_listener *listener, void *data);
@ -1081,81 +1069,11 @@ handle_new_surface(struct wl_listener *listener, void *data)
} }
} }
static struct xwayland_view *
xwayland_view_from_window_id(xcb_window_t id)
{
struct view *view;
wl_list_for_each(view, &server.views, link) {
if (view->type != LAB_XWAYLAND_VIEW) {
continue;
}
struct xwayland_view *xwayland_view = xwayland_view_from_view(view);
if (xwayland_view->xwayland_surface
&& xwayland_view->xwayland_surface->window_id == id) {
return xwayland_view;
}
}
return NULL;
}
#define XCB_EVENT_RESPONSE_TYPE_MASK 0x7f
static bool
handle_x11_event(struct wlr_xwayland *wlr_xwayland, xcb_generic_event_t *event)
{
switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) {
case XCB_PROPERTY_NOTIFY: {
xcb_property_notify_event_t *ev = (void *)event;
break;
}
default:
break;
}
return false;
}
static void
sync_atoms(void)
{
xcb_connection_t *xcb_conn =
wlr_xwayland_get_xwm_connection(server.xwayland);
assert(xcb_conn);
wlr_log(WLR_DEBUG, "Syncing X11 atoms");
xcb_intern_atom_cookie_t cookies[ATOM_COUNT];
/* First request everything and then loop over the results to reduce latency */
for (size_t i = 0; i < ATOM_COUNT; i++) {
cookies[i] = xcb_intern_atom(xcb_conn, 0,
strlen(atom_names[i]), atom_names[i]);
}
for (size_t i = 0; i < ATOM_COUNT; i++) {
xcb_generic_error_t *err = NULL;
xcb_intern_atom_reply_t *reply =
xcb_intern_atom_reply(xcb_conn, cookies[i], &err);
if (reply) {
atoms[i] = reply->atom;
wlr_log(WLR_DEBUG, "Got X11 atom for %s: %u",
atom_names[i], reply->atom);
}
if (err) {
atoms[i] = XCB_ATOM_NONE;
wlr_log(WLR_INFO, "Failed to get X11 atom for %s",
atom_names[i]);
}
free(reply);
free(err);
}
}
static void static void
handle_server_ready(struct wl_listener *listener, void *data) handle_server_ready(struct wl_listener *listener, void *data)
{ {
/* Fire an Xwayland startup script if one (or many) can be found */ /* Fire an Xwayland startup script if one (or many) can be found */
session_run_script("xinitrc"); session_run_script("xinitrc");
sync_atoms();
} }
static void static void
@ -1188,8 +1106,6 @@ xwayland_server_init(struct wlr_compositor *compositor)
wl_signal_add(&server.xwayland->events.ready, wl_signal_add(&server.xwayland->events.ready,
&server.xwayland_xwm_ready); &server.xwayland_xwm_ready);
server.xwayland->user_event_handler = handle_x11_event;
if (setenv("DISPLAY", server.xwayland->display_name, true) < 0) { if (setenv("DISPLAY", server.xwayland->display_name, true) < 0) {
wlr_log_errno(WLR_ERROR, "unable to set DISPLAY for xwayland"); wlr_log_errno(WLR_ERROR, "unable to set DISPLAY for xwayland");
} else { } else {