wayland: sync scene node geometry offset on every commit

CSD clients like Firefox may not set window_geometry until after the
initial map.  Update the scene node offset on every surface commit so
the content stays aligned with the frame as geometry changes.
This commit is contained in:
lkn 2026-06-21 19:19:54 +02:00
parent bb95bd52cd
commit d7b2c70c7c
1 changed files with 11 additions and 2 deletions

View File

@ -562,12 +562,21 @@ handle_toplevel_commit(struct wl_listener *listener, void *data)
if (view->scene_node && view->frame_id) { if (view->scene_node && view->frame_id) {
struct wl_frame_buf *ffb = frame_buf_find(view->frame_id); struct wl_frame_buf *ffb = frame_buf_find(view->frame_id);
if (ffb && ffb->tree && view->scene_node->node.parent != ffb->tree) { if (ffb && ffb->tree && view->scene_node->node.parent != ffb->tree) {
struct wlr_box geo = view->xdg_surface->geometry;
wlr_scene_node_reparent(&view->scene_node->node, ffb->tree); wlr_scene_node_reparent(&view->scene_node->node, ffb->tree);
}
}
/* Keep scene node offset in sync with CSD geometry (may change between commits) */
if (view->scene_node && view->xdg_surface) {
struct wlr_box geo = view->xdg_surface->geometry;
if (view->frame_id)
wlr_scene_node_set_position(&view->scene_node->node, wlr_scene_node_set_position(&view->scene_node->node,
view->frame_rel_x - geo.x, view->frame_rel_x - geo.x,
view->frame_rel_y - geo.y); view->frame_rel_y - geo.y);
} else
wlr_scene_node_set_position(&view->scene_node->node,
view->x - geo.x,
view->y - geo.y);
} }
/* When the client commits a buffer at a new size (e.g. after interactive /* When the client commits a buffer at a new size (e.g. after interactive