aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-11-15 11:56:45 +0100
committerKirill Primak <vyivel@eclair.cafe>2022-11-15 13:41:09 +0000
commit258bf9be1e44d8a2fb953d727ff4ffcf9ebd6503 (patch)
tree9bd6ed2293425edd82bb71ca91a2fdeed0b7f51b
parenta40ba16a6414f72ae0224164bb08cd8479dc52ee (diff)
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.
-rw-r--r--include/wlr/types/wlr_compositor.h4
-rw-r--r--types/scene/drag_icon.c7
-rw-r--r--types/wlr_compositor.c2
3 files changed, 3 insertions, 10 deletions
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index f3da622b..194c4e37 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -99,10 +99,6 @@ struct wlr_surface {
*/
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
* `wlr_surface_state.surface_damage` and `wlr_surface_state.buffer_damage`.
diff --git a/types/scene/drag_icon.c b/types/scene/drag_icon.c
index 8c28e1a0..15b6b45b 100644
--- a/types/scene/drag_icon.c
+++ b/types/scene/drag_icon.c
@@ -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;
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index d5e5fd0e..3362777f 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -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);