From ce9406ce90632bfab57454218620b5407ff1547a 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 6050c21b..4d8170bc 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -367,6 +367,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); } @@ -1027,6 +1029,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) @@ -1078,6 +1089,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++;