diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-02-12 23:22:51 +0100 |
---|---|---|
committer | Tudor Brindus <me@tbrindus.ca> | 2021-02-16 22:05:00 -0500 |
commit | a047b5ee4a2a67d30d93641ff86531d54b8e0879 (patch) | |
tree | 271666c6254e4fabf943c1153224059411a5ce56 /sway/input/cursor.c | |
parent | Add missing transaction commits to seatop_default (diff) | |
download | sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.tar.gz sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.tar.zst sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.zip |
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.c | 16 |
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) { | |||
824 | 824 | ||
825 | struct sway_container *con = view->container; | 825 | struct sway_container *con = view->container; |
826 | 826 | ||
827 | double sx = cursor->cursor->x - con->content_x + view->geometry.x; | 827 | double sx = cursor->cursor->x - con->pending.content_x + view->geometry.x; |
828 | double sy = cursor->cursor->y - con->content_y + view->geometry.y; | 828 | double sy = cursor->cursor->y - con->pending.content_y + view->geometry.y; |
829 | 829 | ||
830 | if (!pixman_region32_contains_point(region, | 830 | if (!pixman_region32_contains_point(region, |
831 | floor(sx), floor(sy), NULL)) { | 831 | floor(sx), floor(sy), NULL)) { |
@@ -836,8 +836,8 @@ static void check_constraint_region(struct sway_cursor *cursor) { | |||
836 | double sy = (boxes[0].y1 + boxes[0].y2) / 2.; | 836 | double sy = (boxes[0].y1 + boxes[0].y2) / 2.; |
837 | 837 | ||
838 | wlr_cursor_warp_closest(cursor->cursor, NULL, | 838 | wlr_cursor_warp_closest(cursor->cursor, NULL, |
839 | sx + con->content_x - view->geometry.x, | 839 | sx + con->pending.content_x - view->geometry.x, |
840 | sy + con->content_y - view->geometry.y); | 840 | sy + con->pending.content_y - view->geometry.y); |
841 | 841 | ||
842 | cursor_rebase(cursor); | 842 | cursor_rebase(cursor); |
843 | } | 843 | } |
@@ -1157,8 +1157,8 @@ void cursor_warp_to_container(struct sway_cursor *cursor, | |||
1157 | return; | 1157 | return; |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | double x = container->x + container->width / 2.0; | 1160 | double x = container->pending.x + container->pending.width / 2.0; |
1161 | double y = container->y + container->height / 2.0; | 1161 | double y = container->pending.y + container->pending.height / 2.0; |
1162 | 1162 | ||
1163 | wlr_cursor_warp(cursor->cursor, NULL, x, y); | 1163 | wlr_cursor_warp(cursor->cursor, NULL, x, y); |
1164 | cursor_unhide(cursor); | 1164 | cursor_unhide(cursor); |
@@ -1271,8 +1271,8 @@ static void warp_to_constraint_cursor_hint(struct sway_cursor *cursor) { | |||
1271 | struct sway_view *view = view_from_wlr_surface(constraint->surface); | 1271 | struct sway_view *view = view_from_wlr_surface(constraint->surface); |
1272 | struct sway_container *con = view->container; | 1272 | struct sway_container *con = view->container; |
1273 | 1273 | ||
1274 | double lx = sx + con->content_x - view->geometry.x; | 1274 | double lx = sx + con->pending.content_x - view->geometry.x; |
1275 | double ly = sy + con->content_y - view->geometry.y; | 1275 | double ly = sy + con->pending.content_y - view->geometry.y; |
1276 | 1276 | ||
1277 | wlr_cursor_warp(cursor->cursor, NULL, lx, ly); | 1277 | wlr_cursor_warp(cursor->cursor, NULL, lx, ly); |
1278 | 1278 | ||