From 17d6c290374e42c822c2ff8cfd4cd747ef403fd4 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:25:50 +0100 Subject: [PATCH] xwayland: sync always-on-top to X11 --- include/xwayland.h | 6 ++++++ src/xwayland.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/xwayland.h b/include/xwayland.h index dad4689d..f313e165 100644 --- a/include/xwayland.h +++ b/include/xwayland.h @@ -59,6 +59,12 @@ struct xwayland_view { /* Not (yet) implemented */ /* struct wl_listener set_role; */ /* struct wl_listener set_hints; */ + + /* Events coming in from the view itself */ + struct { + struct wl_listener always_on_top; + } on_view; + }; void xwayland_unmanaged_create(struct server *server, diff --git a/src/xwayland.c b/src/xwayland.c index a60edf64..da78871d 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -368,6 +368,8 @@ handle_destroy(struct wl_listener *listener, void *data) wl_list_remove(&xwayland_view->focus_in.link); wl_list_remove(&xwayland_view->map_request.link); + wl_list_remove(&xwayland_view->on_view.always_on_top.link); + view_destroy(view); } @@ -1032,6 +1034,15 @@ static const struct view_impl xwayland_view_impl = { .get_pid = xwayland_view_get_pid, }; +static void +handle_always_on_top(struct wl_listener *listener, void *data) +{ + struct xwayland_view *xwayland_view = + wl_container_of(listener, xwayland_view, on_view.always_on_top); + wlr_xwayland_surface_set_above(xwayland_view->xwayland_surface, + xwayland_view->base.layer == VIEW_LAYER_ALWAYS_ON_TOP); +} + void xwayland_view_create(struct server *server, struct wlr_xwayland_surface *xsurface, bool mapped) @@ -1083,6 +1094,9 @@ xwayland_view_create(struct server *server, CONNECT_SIGNAL(xsurface, xwayland_view, focus_in); CONNECT_SIGNAL(xsurface, xwayland_view, map_request); + /* Events from the view itself */ + CONNECT_SIGNAL(view, &xwayland_view->on_view, always_on_top); + wl_list_insert(&view->server->views, &view->link); view->creation_id = view->server->next_view_creation_id++;