mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
compositor: drop wlr_surface.{sx,sy}
The concept of a persistent accumulated surface offset is wrong from a protocol point-of-view. wl_surface.offset is tied to a commit, its interpretation depends on the surface role. For example, with the following sequence: wl_surface@1.offset(1, 1) wl_surface@1.commit() wl_pointer@2.set_cursor(wl_surface@1, 42, 42) The final cursor hotspot is (42, 42): the commit which happened before the set_cursor request has no impact on the hotspot computation. The wlr_output_cursor logic already uses wlr_surface.current.{dx,dy}. wlr_scene's drag icon doesn't, update it accordingly.
This commit is contained in:
parent
a40ba16a64
commit
258bf9be1e
3 changed files with 3 additions and 10 deletions
|
@ -98,10 +98,6 @@ struct wlr_surface {
|
|||
* or something went wrong with uploading the buffer.
|
||||
*/
|
||||
struct wlr_client_buffer *buffer;
|
||||
/**
|
||||
* The buffer position, in surface-local units.
|
||||
*/
|
||||
int sx, sy;
|
||||
/**
|
||||
* The last commit's buffer damage, in buffer-local coordinates. This
|
||||
* contains both the damage accumulated by the client via
|
||||
|
|
|
@ -18,8 +18,9 @@ static void drag_icon_handle_surface_commit(struct wl_listener *listener, void *
|
|||
struct wlr_scene_drag_icon *icon =
|
||||
wl_container_of(listener, icon, drag_icon_surface_commit);
|
||||
struct wlr_surface *surface = icon->drag_icon->surface;
|
||||
wlr_scene_node_set_position(&icon->surface_tree->node,
|
||||
surface->sx, surface->sy);
|
||||
struct wlr_scene_node *node = &icon->surface_tree->node;
|
||||
wlr_scene_node_set_position(node,
|
||||
node->x + surface->current.dx, node->y + surface->current.dy);
|
||||
}
|
||||
|
||||
static void drag_icon_handle_map(struct wl_listener *listener, void *data) {
|
||||
|
@ -74,8 +75,6 @@ struct wlr_scene_tree *wlr_scene_drag_icon_create(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
wlr_scene_node_set_position(&icon->surface_tree->node,
|
||||
drag_icon->surface->sx, drag_icon->surface->sy);
|
||||
wlr_scene_node_set_enabled(&icon->tree->node, drag_icon->mapped);
|
||||
|
||||
icon->tree_destroy.notify = drag_icon_handle_tree_destroy;
|
||||
|
|
|
@ -439,8 +439,6 @@ static void surface_commit_state(struct wlr_surface *surface,
|
|||
|
||||
bool invalid_buffer = next->committed & WLR_SURFACE_STATE_BUFFER;
|
||||
|
||||
surface->sx += next->dx;
|
||||
surface->sy += next->dy;
|
||||
surface_update_damage(&surface->buffer_damage, &surface->current, next);
|
||||
|
||||
pixman_region32_clear(&surface->external_damage);
|
||||
|
|
Loading…
Reference in a new issue