summaryrefslogtreecommitdiff
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorKenny Levinsen <[email protected]>2021-02-12 23:22:51 +0100
committerTudor Brindus <[email protected]>2021-02-16 22:05:00 -0500
commita047b5ee4a2a67d30d93641ff86531d54b8e0879 (patch)
tree271666c6254e4fabf943c1153224059411a5ce56 /sway/input/cursor.c
parent28cadf558090854ace1df1a0a64f5fbc059541c0 (diff)
container: Move pending state to state struct
Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index b40e0299..cbb5c6e9 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -824,8 +824,8 @@ static void check_constraint_region(struct sway_cursor *cursor) {
struct sway_container *con = view->container;
- double sx = cursor->cursor->x - con->content_x + view->geometry.x;
- double sy = cursor->cursor->y - con->content_y + view->geometry.y;
+ double sx = cursor->cursor->x - con->pending.content_x + view->geometry.x;
+ double sy = cursor->cursor->y - con->pending.content_y + view->geometry.y;
if (!pixman_region32_contains_point(region,
floor(sx), floor(sy), NULL)) {
@@ -836,8 +836,8 @@ static void check_constraint_region(struct sway_cursor *cursor) {
double sy = (boxes[0].y1 + boxes[0].y2) / 2.;
wlr_cursor_warp_closest(cursor->cursor, NULL,
- sx + con->content_x - view->geometry.x,
- sy + con->content_y - view->geometry.y);
+ sx + con->pending.content_x - view->geometry.x,
+ sy + con->pending.content_y - view->geometry.y);
cursor_rebase(cursor);
}
@@ -1157,8 +1157,8 @@ void cursor_warp_to_container(struct sway_cursor *cursor,
return;
}
- double x = container->x + container->width / 2.0;
- double y = container->y + container->height / 2.0;
+ double x = container->pending.x + container->pending.width / 2.0;
+ double y = container->pending.y + container->pending.height / 2.0;
wlr_cursor_warp(cursor->cursor, NULL, x, y);
cursor_unhide(cursor);
@@ -1271,8 +1271,8 @@ static void warp_to_constraint_cursor_hint(struct sway_cursor *cursor) {
struct sway_view *view = view_from_wlr_surface(constraint->surface);
struct sway_container *con = view->container;
- double lx = sx + con->content_x - view->geometry.x;
- double ly = sy + con->content_y - view->geometry.y;
+ double lx = sx + con->pending.content_x - view->geometry.x;
+ double ly = sy + con->pending.content_y - view->geometry.y;
wlr_cursor_warp(cursor->cursor, NULL, lx, ly);