wayland: remove manual CSD geometry offset from scene positioning
wlr_scene_xdg_surface_create handles geometry offset internally. Our manual subtraction of geometry.x/y in handle_toplevel_commit, handle_toplevel_map, and wl_window_move was double-subtracting, causing client surfaces to render behind their frames. Remove all manual geometry offset from scene node positioning.
This commit is contained in:
parent
09b1ed5edf
commit
9f86c6091c
|
|
@ -207,16 +207,10 @@ void wl_window_move(WNativeWindow win, int x, int y)
|
||||||
v->x = x; v->y = y;
|
v->x = x; v->y = y;
|
||||||
}
|
}
|
||||||
if (v->scene_node) {
|
if (v->scene_node) {
|
||||||
/* Scene node position must account for CSD geometry offset */
|
|
||||||
int gx = 0, gy = 0;
|
|
||||||
if (v->xdg_surface) {
|
|
||||||
gx = v->xdg_surface->geometry.x;
|
|
||||||
gy = v->xdg_surface->geometry.y;
|
|
||||||
}
|
|
||||||
if (v->frame_id)
|
if (v->frame_id)
|
||||||
wlr_scene_node_set_position(&v->scene_node->node, x - gx, y - gy);
|
wlr_scene_node_set_position(&v->scene_node->node, x, y);
|
||||||
else
|
else
|
||||||
wlr_scene_node_set_position(&v->scene_node->node, v->x - gx, v->y - gy);
|
wlr_scene_node_set_position(&v->scene_node->node, v->x, v->y);
|
||||||
}
|
}
|
||||||
if (v->xw_surface)
|
if (v->xw_surface)
|
||||||
wlr_xwayland_surface_configure(v->xw_surface,
|
wlr_xwayland_surface_configure(v->xw_surface,
|
||||||
|
|
|
||||||
|
|
@ -324,21 +324,17 @@ handle_toplevel_map(struct wl_listener *listener, void *data)
|
||||||
view_attach_scene_destroy_listener(view);
|
view_attach_scene_destroy_listener(view);
|
||||||
/* Deferred reparent: move client surface under its
|
/* Deferred reparent: move client surface under its
|
||||||
* frame grouping tree now that the node exists. */
|
* frame grouping tree now that the node exists. */
|
||||||
struct wlr_box geo = view->xdg_surface->geometry;
|
|
||||||
if (view->frame_id) {
|
if (view->frame_id) {
|
||||||
struct wl_frame_buf *_pfb = frame_buf_find(view->frame_id);
|
struct wl_frame_buf *_pfb = frame_buf_find(view->frame_id);
|
||||||
if (_pfb && _pfb->tree)
|
if (_pfb && _pfb->tree)
|
||||||
wlr_scene_node_reparent(&view->scene_node->node,
|
wlr_scene_node_reparent(&view->scene_node->node,
|
||||||
_pfb->tree);
|
_pfb->tree);
|
||||||
/* Position at relative offset within frame tree,
|
|
||||||
* adjusted for CSD geometry offset (shadows). */
|
|
||||||
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,
|
||||||
view->frame_rel_y - geo.y);
|
view->frame_rel_y);
|
||||||
} else {
|
} else {
|
||||||
wlr_scene_node_set_position(&view->scene_node->node,
|
wlr_scene_node_set_position(&view->scene_node->node,
|
||||||
view->x - geo.x,
|
view->x, view->y);
|
||||||
view->y - geo.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -588,17 +584,16 @@ handle_toplevel_commit(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep scene node offset in sync with CSD geometry (may change between commits) */
|
/* Keep scene node position in sync with WM-assigned coordinates.
|
||||||
if (view->scene_node && view->xdg_surface) {
|
* wlr_scene_xdg_surface_create handles geometry offset internally. */
|
||||||
struct wlr_box geo = view->xdg_surface->geometry;
|
if (view->scene_node) {
|
||||||
if (view->frame_id)
|
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,
|
||||||
view->frame_rel_y - geo.y);
|
view->frame_rel_y);
|
||||||
else
|
else
|
||||||
wlr_scene_node_set_position(&view->scene_node->node,
|
wlr_scene_node_set_position(&view->scene_node->node,
|
||||||
view->x - geo.x,
|
view->x, view->y);
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue