From b040b5c7fe53235b333f7a91d0b6c2d06d0a50fe Mon Sep 17 00:00:00 2001 From: Window Maker Date: Sun, 24 May 2026 18:58:07 +0200 Subject: [PATCH] wmaker-popup-v1: raise popup above parent and track parent moves Two issues: 1. Popups rendered behind their parent toplevel because the scene node wasn't raised on apply. Add wlr_scene_node_raise_to_top so popups appear above the parent. 2. When the parent toplevel moved, popups stayed at their old screen position. In wl_window_move (compositor-side), after a regular toplevel's position changes, iterate all popups and re-apply those whose popup_parent is this toplevel so they track the parent. --- src/backend/wayland/wl_backend.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index e5fdadc..a4ebc41 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -1470,16 +1470,21 @@ wmaker_popup_apply(struct wl_toplevel_view *view) if (fb) { fb->x += dx; fb->y += dy; - if (fb->tree) + if (fb->tree) { wlr_scene_node_set_position(&fb->tree->node, fb->x, fb->y); - else if (fb->scene_buf) + /* Raise above siblings so popups appear over their parent */ + wlr_scene_node_raise_to_top(&fb->tree->node); + } else if (fb->scene_buf) { wlr_scene_node_set_position(&fb->scene_buf->node, fb->x, fb->y); + wlr_scene_node_raise_to_top(&fb->scene_buf->node); + } view->frame_rel_x = 0; view->frame_rel_y = 0; } } else if (view->scene_node) { wlr_scene_node_set_position(&view->scene_node->node, view->x, view->y); + wlr_scene_node_raise_to_top(&view->scene_node->node); } } @@ -6980,6 +6985,15 @@ static void wl_window_move(WNativeWindow win, int x, int y) wlr_xwayland_surface_configure(v->xw_surface, (int16_t)v->x, (int16_t)v->y, v->xw_surface->width, v->xw_surface->height); + /* Re-apply any popups whose parent is this toplevel so they + * track the parent's position. */ + struct wl_toplevel_view *p; + wl_list_for_each(p, &wl_state.toplevel_list, link) { + if (p->popup && p->popup_parent + && wl_find_view_by_xdg_surface(p->popup_parent->base) == v) { + wmaker_popup_apply(p); + } + } return; } struct wl_frame_buf *fb = frame_buf_find(win);