From 0c9aaf26dbfa695bbeb1ab70d8404ef840c93ec2 Mon Sep 17 00:00:00 2001 From: IoIxD Date: Mon, 28 Sep 2026 14:51:18 -0700 Subject: [PATCH] layer surface fix --- src/backend/wayland/wayland.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/wayland/wayland.c b/src/backend/wayland/wayland.c index 2cf42049..4373af62 100644 --- a/src/backend/wayland/wayland.c +++ b/src/backend/wayland/wayland.c @@ -616,9 +616,12 @@ static void setup_popup(MwLL r, int x, int y, MwLL parent) { r->wayland.popup->xdg_positioner = xdg_wm_base_create_positioner(r->wayland.popup->xdg_wm_base); xdg_positioner_set_size(r->wayland.popup->xdg_positioner, r->wayland.ww, r->wayland.wh); + /* the anchor rect is relative to the parent surface, so a layer surface's position on screen doesn't apply */ xdg_positioner_set_anchor_rect( r->wayland.popup->xdg_positioner, - topmost_parent->wayland.x, topmost_parent->wayland.y, r->wayland.ww, r->wayland.wh); + topmost_parent->wayland.type == MwLL_WAYLAND_LAYER_SURFACE ? 0 : topmost_parent->wayland.x, + topmost_parent->wayland.type == MwLL_WAYLAND_LAYER_SURFACE ? 0 : topmost_parent->wayland.y, + r->wayland.ww, r->wayland.wh); xdg_positioner_set_offset( r->wayland.popup->xdg_positioner, r->wayland.x, r->wayland.y); @@ -1772,7 +1775,8 @@ static void MwLLDetachImpl(MwLL handle, MwPoint* point) { int x = 0, y = 0; while(p != NULL) { - if(p->wayland.type != MwLL_WAYLAND_TOPLEVEL) { + /* a layer surface's x/y is its position on screen, which like a toplevel's isn't part of the offset */ + if(p->wayland.type != MwLL_WAYLAND_TOPLEVEL && p->wayland.type != MwLL_WAYLAND_LAYER_SURFACE) { x += p->wayland.x; y += p->wayland.y; } else {