aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_resize_floating.c
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-02-12 23:22:51 +0100
committerLibravatar Tudor Brindus <me@tbrindus.ca>2021-02-16 22:05:00 -0500
commita047b5ee4a2a67d30d93641ff86531d54b8e0879 (patch)
tree271666c6254e4fabf943c1153224059411a5ce56 /sway/input/seatop_resize_floating.c
parentAdd missing transaction commits to seatop_default (diff)
downloadsway-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/seatop_resize_floating.c')
-rw-r--r--sway/input/seatop_resize_floating.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c
index 78dfe29f..8400a4b3 100644
--- a/sway/input/seatop_resize_floating.c
+++ b/sway/input/seatop_resize_floating.c
@@ -118,21 +118,21 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) {
118 118
119 // Determine the amounts we need to bump everything relative to the current 119 // Determine the amounts we need to bump everything relative to the current
120 // size. 120 // size.
121 int relative_grow_width = width - con->width; 121 int relative_grow_width = width - con->pending.width;
122 int relative_grow_height = height - con->height; 122 int relative_grow_height = height - con->pending.height;
123 int relative_grow_x = (e->ref_con_lx + grow_x) - con->x; 123 int relative_grow_x = (e->ref_con_lx + grow_x) - con->pending.x;
124 int relative_grow_y = (e->ref_con_ly + grow_y) - con->y; 124 int relative_grow_y = (e->ref_con_ly + grow_y) - con->pending.y;
125 125
126 // Actually resize stuff 126 // Actually resize stuff
127 con->x += relative_grow_x; 127 con->pending.x += relative_grow_x;
128 con->y += relative_grow_y; 128 con->pending.y += relative_grow_y;
129 con->width += relative_grow_width; 129 con->pending.width += relative_grow_width;
130 con->height += relative_grow_height; 130 con->pending.height += relative_grow_height;
131 131
132 con->content_x += relative_grow_x; 132 con->pending.content_x += relative_grow_x;
133 con->content_y += relative_grow_y; 133 con->pending.content_y += relative_grow_y;
134 con->content_width += relative_grow_width; 134 con->pending.content_width += relative_grow_width;
135 con->content_height += relative_grow_height; 135 con->pending.content_height += relative_grow_height;
136 136
137 arrange_container(con); 137 arrange_container(con);
138 transaction_commit_dirty(); 138 transaction_commit_dirty();
@@ -169,10 +169,10 @@ void seatop_begin_resize_floating(struct sway_seat *seat,
169 e->edge = edge == WLR_EDGE_NONE ? WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT : edge; 169 e->edge = edge == WLR_EDGE_NONE ? WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT : edge;
170 e->ref_lx = seat->cursor->cursor->x; 170 e->ref_lx = seat->cursor->cursor->x;
171 e->ref_ly = seat->cursor->cursor->y; 171 e->ref_ly = seat->cursor->cursor->y;
172 e->ref_con_lx = con->x; 172 e->ref_con_lx = con->pending.x;
173 e->ref_con_ly = con->y; 173 e->ref_con_ly = con->pending.y;
174 e->ref_width = con->width; 174 e->ref_width = con->pending.width;
175 e->ref_height = con->height; 175 e->ref_height = con->pending.height;
176 176
177 seat->seatop_impl = &seatop_impl; 177 seat->seatop_impl = &seatop_impl;
178 seat->seatop_data = e; 178 seat->seatop_data = e;