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 | |
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')
-rw-r--r-- | sway/input/cursor.c | 16 | ||||
-rw-r--r-- | sway/input/seat.c | 20 | ||||
-rw-r--r-- | sway/input/seatop_default.c | 32 | ||||
-rw-r--r-- | sway/input/seatop_move_floating.c | 6 | ||||
-rw-r--r-- | sway/input/seatop_move_tiling.c | 38 | ||||
-rw-r--r-- | sway/input/seatop_resize_floating.c | 32 | ||||
-rw-r--r-- | sway/input/seatop_resize_tiling.c | 24 |
7 files changed, 84 insertions, 84 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 | ||
diff --git a/sway/input/seat.c b/sway/input/seat.c index 3c0d9a29..e6e1d4fb 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -309,8 +309,8 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) { | |||
309 | // Setting focus_inactive | 309 | // Setting focus_inactive |
310 | focus = seat_get_focus_inactive(seat, &root->node); | 310 | focus = seat_get_focus_inactive(seat, &root->node); |
311 | seat_set_raw_focus(seat, next_focus); | 311 | seat_set_raw_focus(seat, next_focus); |
312 | if (focus->type == N_CONTAINER && focus->sway_container->workspace) { | 312 | if (focus->type == N_CONTAINER && focus->sway_container->pending.workspace) { |
313 | seat_set_raw_focus(seat, &focus->sway_container->workspace->node); | 313 | seat_set_raw_focus(seat, &focus->sway_container->pending.workspace->node); |
314 | } | 314 | } |
315 | seat_set_raw_focus(seat, focus); | 315 | seat_set_raw_focus(seat, focus); |
316 | } | 316 | } |
@@ -1086,7 +1086,7 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { | |||
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | struct sway_workspace *new_workspace = node->type == N_WORKSPACE ? | 1088 | struct sway_workspace *new_workspace = node->type == N_WORKSPACE ? |
1089 | node->sway_workspace : node->sway_container->workspace; | 1089 | node->sway_workspace : node->sway_container->pending.workspace; |
1090 | struct sway_container *container = node->type == N_CONTAINER ? | 1090 | struct sway_container *container = node->type == N_CONTAINER ? |
1091 | node->sway_container : NULL; | 1091 | node->sway_container : NULL; |
1092 | 1092 | ||
@@ -1135,10 +1135,10 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { | |||
1135 | // Put the container parents on the focus stack, then the workspace, then | 1135 | // Put the container parents on the focus stack, then the workspace, then |
1136 | // the focused container. | 1136 | // the focused container. |
1137 | if (container) { | 1137 | if (container) { |
1138 | struct sway_container *parent = container->parent; | 1138 | struct sway_container *parent = container->pending.parent; |
1139 | while (parent) { | 1139 | while (parent) { |
1140 | seat_set_raw_focus(seat, &parent->node); | 1140 | seat_set_raw_focus(seat, &parent->node); |
1141 | parent = parent->parent; | 1141 | parent = parent->pending.parent; |
1142 | } | 1142 | } |
1143 | } | 1143 | } |
1144 | if (new_workspace) { | 1144 | if (new_workspace) { |
@@ -1327,7 +1327,7 @@ struct sway_container *seat_get_focus_inactive_tiling(struct sway_seat *seat, | |||
1327 | struct sway_node *node = current->node; | 1327 | struct sway_node *node = current->node; |
1328 | if (node->type == N_CONTAINER && | 1328 | if (node->type == N_CONTAINER && |
1329 | !container_is_floating_or_child(node->sway_container) && | 1329 | !container_is_floating_or_child(node->sway_container) && |
1330 | node->sway_container->workspace == workspace) { | 1330 | node->sway_container->pending.workspace == workspace) { |
1331 | return node->sway_container; | 1331 | return node->sway_container; |
1332 | } | 1332 | } |
1333 | } | 1333 | } |
@@ -1344,7 +1344,7 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, | |||
1344 | struct sway_node *node = current->node; | 1344 | struct sway_node *node = current->node; |
1345 | if (node->type == N_CONTAINER && | 1345 | if (node->type == N_CONTAINER && |
1346 | container_is_floating_or_child(node->sway_container) && | 1346 | container_is_floating_or_child(node->sway_container) && |
1347 | node->sway_container->workspace == workspace) { | 1347 | node->sway_container->pending.workspace == workspace) { |
1348 | return node->sway_container; | 1348 | return node->sway_container; |
1349 | } | 1349 | } |
1350 | } | 1350 | } |
@@ -1392,7 +1392,7 @@ struct sway_workspace *seat_get_focused_workspace(struct sway_seat *seat) { | |||
1392 | return NULL; | 1392 | return NULL; |
1393 | } | 1393 | } |
1394 | if (focus->type == N_CONTAINER) { | 1394 | if (focus->type == N_CONTAINER) { |
1395 | return focus->sway_container->workspace; | 1395 | return focus->sway_container->pending.workspace; |
1396 | } | 1396 | } |
1397 | if (focus->type == N_WORKSPACE) { | 1397 | if (focus->type == N_WORKSPACE) { |
1398 | return focus->sway_workspace; | 1398 | return focus->sway_workspace; |
@@ -1405,8 +1405,8 @@ struct sway_workspace *seat_get_last_known_workspace(struct sway_seat *seat) { | |||
1405 | wl_list_for_each(current, &seat->focus_stack, link) { | 1405 | wl_list_for_each(current, &seat->focus_stack, link) { |
1406 | struct sway_node *node = current->node; | 1406 | struct sway_node *node = current->node; |
1407 | if (node->type == N_CONTAINER && | 1407 | if (node->type == N_CONTAINER && |
1408 | node->sway_container->workspace) { | 1408 | node->sway_container->pending.workspace) { |
1409 | return node->sway_container->workspace; | 1409 | return node->sway_container->pending.workspace; |
1410 | } else if (node->type == N_WORKSPACE) { | 1410 | } else if (node->type == N_WORKSPACE) { |
1411 | return node->sway_workspace; | 1411 | return node->sway_workspace; |
1412 | } | 1412 | } |
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 10d97309..f9eb8c8a 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c | |||
@@ -60,7 +60,7 @@ static bool edge_is_external(struct sway_container *cont, enum wlr_edges edge) { | |||
60 | return false; | 60 | return false; |
61 | } | 61 | } |
62 | } | 62 | } |
63 | cont = cont->parent; | 63 | cont = cont->pending.parent; |
64 | } | 64 | } |
65 | return true; | 65 | return true; |
66 | } | 66 | } |
@@ -70,25 +70,25 @@ static enum wlr_edges find_edge(struct sway_container *cont, | |||
70 | if (!cont->view || (surface && cont->view->surface != surface)) { | 70 | if (!cont->view || (surface && cont->view->surface != surface)) { |
71 | return WLR_EDGE_NONE; | 71 | return WLR_EDGE_NONE; |
72 | } | 72 | } |
73 | if (cont->border == B_NONE || !cont->border_thickness || | 73 | if (cont->pending.border == B_NONE || !cont->pending.border_thickness || |
74 | cont->border == B_CSD) { | 74 | cont->pending.border == B_CSD) { |
75 | return WLR_EDGE_NONE; | 75 | return WLR_EDGE_NONE; |
76 | } | 76 | } |
77 | if (cont->fullscreen_mode) { | 77 | if (cont->pending.fullscreen_mode) { |
78 | return WLR_EDGE_NONE; | 78 | return WLR_EDGE_NONE; |
79 | } | 79 | } |
80 | 80 | ||
81 | enum wlr_edges edge = 0; | 81 | enum wlr_edges edge = 0; |
82 | if (cursor->cursor->x < cont->x + cont->border_thickness) { | 82 | if (cursor->cursor->x < cont->pending.x + cont->pending.border_thickness) { |
83 | edge |= WLR_EDGE_LEFT; | 83 | edge |= WLR_EDGE_LEFT; |
84 | } | 84 | } |
85 | if (cursor->cursor->y < cont->y + cont->border_thickness) { | 85 | if (cursor->cursor->y < cont->pending.y + cont->pending.border_thickness) { |
86 | edge |= WLR_EDGE_TOP; | 86 | edge |= WLR_EDGE_TOP; |
87 | } | 87 | } |
88 | if (cursor->cursor->x >= cont->x + cont->width - cont->border_thickness) { | 88 | if (cursor->cursor->x >= cont->pending.x + cont->pending.width - cont->pending.border_thickness) { |
89 | edge |= WLR_EDGE_RIGHT; | 89 | edge |= WLR_EDGE_RIGHT; |
90 | } | 90 | } |
91 | if (cursor->cursor->y >= cont->y + cont->height - cont->border_thickness) { | 91 | if (cursor->cursor->y >= cont->pending.y + cont->pending.height - cont->pending.border_thickness) { |
92 | edge |= WLR_EDGE_BOTTOM; | 92 | edge |= WLR_EDGE_BOTTOM; |
93 | } | 93 | } |
94 | 94 | ||
@@ -251,7 +251,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
251 | 251 | ||
252 | // Handle moving a tiling container | 252 | // Handle moving a tiling container |
253 | if (config->tiling_drag && mod_pressed && !is_floating_or_child && | 253 | if (config->tiling_drag && mod_pressed && !is_floating_or_child && |
254 | cont->fullscreen_mode == FULLSCREEN_NONE) { | 254 | cont->pending.fullscreen_mode == FULLSCREEN_NONE) { |
255 | seatop_begin_move_tiling(seat, cont); | 255 | seatop_begin_move_tiling(seat, cont); |
256 | return; | 256 | return; |
257 | } | 257 | } |
@@ -386,7 +386,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
386 | struct sway_container *cont_to_focus = cont; | 386 | struct sway_container *cont_to_focus = cont; |
387 | enum sway_container_layout layout = container_parent_layout(cont); | 387 | enum sway_container_layout layout = container_parent_layout(cont); |
388 | if (layout == L_TABBED || layout == L_STACKED) { | 388 | if (layout == L_TABBED || layout == L_STACKED) { |
389 | cont_to_focus = seat_get_focus_inactive_view(seat, &cont->parent->node); | 389 | cont_to_focus = seat_get_focus_inactive_view(seat, &cont->pending.parent->node); |
390 | } | 390 | } |
391 | 391 | ||
392 | seat_set_focus_container(seat, cont_to_focus); | 392 | seat_set_focus_container(seat, cont_to_focus); |
@@ -402,9 +402,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
402 | BTN_LEFT : BTN_RIGHT; | 402 | BTN_LEFT : BTN_RIGHT; |
403 | if (button == btn_resize) { | 403 | if (button == btn_resize) { |
404 | edge = 0; | 404 | edge = 0; |
405 | edge |= cursor->cursor->x > cont->x + cont->width / 2 ? | 405 | edge |= cursor->cursor->x > cont->pending.x + cont->pending.width / 2 ? |
406 | WLR_EDGE_RIGHT : WLR_EDGE_LEFT; | 406 | WLR_EDGE_RIGHT : WLR_EDGE_LEFT; |
407 | edge |= cursor->cursor->y > cont->y + cont->height / 2 ? | 407 | edge |= cursor->cursor->y > cont->pending.y + cont->pending.height / 2 ? |
408 | WLR_EDGE_BOTTOM : WLR_EDGE_TOP; | 408 | WLR_EDGE_BOTTOM : WLR_EDGE_TOP; |
409 | 409 | ||
410 | const char *image = NULL; | 410 | const char *image = NULL; |
@@ -451,9 +451,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
451 | if (mod_pressed && button == btn_resize) { | 451 | if (mod_pressed && button == btn_resize) { |
452 | struct sway_container *floater = container_toplevel_ancestor(cont); | 452 | struct sway_container *floater = container_toplevel_ancestor(cont); |
453 | edge = 0; | 453 | edge = 0; |
454 | edge |= cursor->cursor->x > floater->x + floater->width / 2 ? | 454 | edge |= cursor->cursor->x > floater->pending.x + floater->pending.width / 2 ? |
455 | WLR_EDGE_RIGHT : WLR_EDGE_LEFT; | 455 | WLR_EDGE_RIGHT : WLR_EDGE_LEFT; |
456 | edge |= cursor->cursor->y > floater->y + floater->height / 2 ? | 456 | edge |= cursor->cursor->y > floater->pending.y + floater->pending.height / 2 ? |
457 | WLR_EDGE_BOTTOM : WLR_EDGE_TOP; | 457 | WLR_EDGE_BOTTOM : WLR_EDGE_TOP; |
458 | seatop_begin_resize_floating(seat, floater, edge); | 458 | seatop_begin_resize_floating(seat, floater, edge); |
459 | return; | 459 | return; |
@@ -463,7 +463,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
463 | // Handle moving a tiling container | 463 | // Handle moving a tiling container |
464 | if (config->tiling_drag && (mod_pressed || on_titlebar) && | 464 | if (config->tiling_drag && (mod_pressed || on_titlebar) && |
465 | state == WLR_BUTTON_PRESSED && !is_floating_or_child && | 465 | state == WLR_BUTTON_PRESSED && !is_floating_or_child && |
466 | cont && cont->fullscreen_mode == FULLSCREEN_NONE) { | 466 | cont && cont->pending.fullscreen_mode == FULLSCREEN_NONE) { |
467 | struct sway_container *focus = seat_get_focused_container(seat); | 467 | struct sway_container *focus = seat_get_focused_container(seat); |
468 | bool focused = focus == cont || container_has_ancestor(focus, cont); | 468 | bool focused = focus == cont || container_has_ancestor(focus, cont); |
469 | if (on_titlebar && !focused) { | 469 | if (on_titlebar && !focused) { |
@@ -674,7 +674,7 @@ static void handle_pointer_axis(struct sway_seat *seat, | |||
674 | bool on_border = edge != WLR_EDGE_NONE; | 674 | bool on_border = edge != WLR_EDGE_NONE; |
675 | bool on_titlebar = cont && !on_border && !surface; | 675 | bool on_titlebar = cont && !on_border && !surface; |
676 | bool on_titlebar_border = cont && on_border && | 676 | bool on_titlebar_border = cont && on_border && |
677 | cursor->cursor->y < cont->content_y; | 677 | cursor->cursor->y < cont->pending.content_y; |
678 | bool on_contents = cont && !on_border && surface; | 678 | bool on_contents = cont && !on_border && surface; |
679 | bool on_workspace = node && node->type == N_WORKSPACE; | 679 | bool on_workspace = node && node->type == N_WORKSPACE; |
680 | float scroll_factor = | 680 | float scroll_factor = |
diff --git a/sway/input/seatop_move_floating.c b/sway/input/seatop_move_floating.c index 6683be21..ddcd4c53 100644 --- a/sway/input/seatop_move_floating.c +++ b/sway/input/seatop_move_floating.c | |||
@@ -15,7 +15,7 @@ static void finalize_move(struct sway_seat *seat) { | |||
15 | 15 | ||
16 | // We "move" the container to its own location | 16 | // We "move" the container to its own location |
17 | // so it discovers its output again. | 17 | // so it discovers its output again. |
18 | container_floating_move_to(e->con, e->con->x, e->con->y); | 18 | container_floating_move_to(e->con, e->con->pending.x, e->con->pending.y); |
19 | transaction_commit_dirty(); | 19 | transaction_commit_dirty(); |
20 | 20 | ||
21 | seatop_begin_default(seat); | 21 | seatop_begin_default(seat); |
@@ -70,8 +70,8 @@ void seatop_begin_move_floating(struct sway_seat *seat, | |||
70 | return; | 70 | return; |
71 | } | 71 | } |
72 | e->con = con; | 72 | e->con = con; |
73 | e->dx = cursor->cursor->x - con->x; | 73 | e->dx = cursor->cursor->x - con->pending.x; |
74 | e->dy = cursor->cursor->y - con->y; | 74 | e->dy = cursor->cursor->y - con->pending.y; |
75 | 75 | ||
76 | seat->seatop_impl = &seatop_impl; | 76 | seat->seatop_impl = &seatop_impl; |
77 | seat->seatop_data = e; | 77 | seat->seatop_data = e; |
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index 7d9ecd8f..446612c6 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c | |||
@@ -120,8 +120,8 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { | |||
120 | 120 | ||
121 | // Deny moving within own workspace if this is the only child | 121 | // Deny moving within own workspace if this is the only child |
122 | struct sway_container *con = node->sway_container; | 122 | struct sway_container *con = node->sway_container; |
123 | if (workspace_num_tiling_views(e->con->workspace) == 1 && | 123 | if (workspace_num_tiling_views(e->con->pending.workspace) == 1 && |
124 | con->workspace == e->con->workspace) { | 124 | con->pending.workspace == e->con->pending.workspace) { |
125 | e->target_node = NULL; | 125 | e->target_node = NULL; |
126 | e->target_edge = WLR_EDGE_NONE; | 126 | e->target_edge = WLR_EDGE_NONE; |
127 | return; | 127 | return; |
@@ -133,8 +133,8 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { | |||
133 | enum wlr_edges edge = WLR_EDGE_NONE; | 133 | enum wlr_edges edge = WLR_EDGE_NONE; |
134 | enum sway_container_layout layout = container_parent_layout(con); | 134 | enum sway_container_layout layout = container_parent_layout(con); |
135 | struct wlr_box parent; | 135 | struct wlr_box parent; |
136 | con->parent ? container_get_box(con->parent, &parent) : | 136 | con->pending.parent ? container_get_box(con->pending.parent, &parent) : |
137 | workspace_get_box(con->workspace, &parent); | 137 | workspace_get_box(con->pending.workspace, &parent); |
138 | if (layout == L_HORIZ || layout == L_TABBED) { | 138 | if (layout == L_HORIZ || layout == L_TABBED) { |
139 | if (cursor->cursor->y < parent.y + DROP_LAYOUT_BORDER) { | 139 | if (cursor->cursor->y < parent.y + DROP_LAYOUT_BORDER) { |
140 | edge = WLR_EDGE_TOP; | 140 | edge = WLR_EDGE_TOP; |
@@ -161,7 +161,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { | |||
161 | desktop_damage_box(&e->drop_box); | 161 | desktop_damage_box(&e->drop_box); |
162 | return; | 162 | return; |
163 | } | 163 | } |
164 | con = con->parent; | 164 | con = con->pending.parent; |
165 | } | 165 | } |
166 | 166 | ||
167 | // Use the hovered view - but we must be over the actual surface | 167 | // Use the hovered view - but we must be over the actual surface |
@@ -174,23 +174,23 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { | |||
174 | } | 174 | } |
175 | 175 | ||
176 | // Find the closest edge | 176 | // Find the closest edge |
177 | size_t thickness = fmin(con->content_width, con->content_height) * 0.3; | 177 | size_t thickness = fmin(con->pending.content_width, con->pending.content_height) * 0.3; |
178 | size_t closest_dist = INT_MAX; | 178 | size_t closest_dist = INT_MAX; |
179 | size_t dist; | 179 | size_t dist; |
180 | e->target_edge = WLR_EDGE_NONE; | 180 | e->target_edge = WLR_EDGE_NONE; |
181 | if ((dist = cursor->cursor->y - con->y) < closest_dist) { | 181 | if ((dist = cursor->cursor->y - con->pending.y) < closest_dist) { |
182 | closest_dist = dist; | 182 | closest_dist = dist; |
183 | e->target_edge = WLR_EDGE_TOP; | 183 | e->target_edge = WLR_EDGE_TOP; |
184 | } | 184 | } |
185 | if ((dist = cursor->cursor->x - con->x) < closest_dist) { | 185 | if ((dist = cursor->cursor->x - con->pending.x) < closest_dist) { |
186 | closest_dist = dist; | 186 | closest_dist = dist; |
187 | e->target_edge = WLR_EDGE_LEFT; | 187 | e->target_edge = WLR_EDGE_LEFT; |
188 | } | 188 | } |
189 | if ((dist = con->x + con->width - cursor->cursor->x) < closest_dist) { | 189 | if ((dist = con->pending.x + con->pending.width - cursor->cursor->x) < closest_dist) { |
190 | closest_dist = dist; | 190 | closest_dist = dist; |
191 | e->target_edge = WLR_EDGE_RIGHT; | 191 | e->target_edge = WLR_EDGE_RIGHT; |
192 | } | 192 | } |
193 | if ((dist = con->y + con->height - cursor->cursor->y) < closest_dist) { | 193 | if ((dist = con->pending.y + con->pending.height - cursor->cursor->y) < closest_dist) { |
194 | closest_dist = dist; | 194 | closest_dist = dist; |
195 | e->target_edge = WLR_EDGE_BOTTOM; | 195 | e->target_edge = WLR_EDGE_BOTTOM; |
196 | } | 196 | } |
@@ -200,10 +200,10 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { | |||
200 | } | 200 | } |
201 | 201 | ||
202 | e->target_node = node; | 202 | e->target_node = node; |
203 | e->drop_box.x = con->content_x; | 203 | e->drop_box.x = con->pending.content_x; |
204 | e->drop_box.y = con->content_y; | 204 | e->drop_box.y = con->pending.content_y; |
205 | e->drop_box.width = con->content_width; | 205 | e->drop_box.width = con->pending.content_width; |
206 | e->drop_box.height = con->content_height; | 206 | e->drop_box.height = con->pending.content_height; |
207 | resize_box(&e->drop_box, e->target_edge, thickness); | 207 | resize_box(&e->drop_box, e->target_edge, thickness); |
208 | desktop_damage_box(&e->drop_box); | 208 | desktop_damage_box(&e->drop_box); |
209 | } | 209 | } |
@@ -234,11 +234,11 @@ static void finalize_move(struct sway_seat *seat) { | |||
234 | } | 234 | } |
235 | 235 | ||
236 | struct sway_container *con = e->con; | 236 | struct sway_container *con = e->con; |
237 | struct sway_container *old_parent = con->parent; | 237 | struct sway_container *old_parent = con->pending.parent; |
238 | struct sway_workspace *old_ws = con->workspace; | 238 | struct sway_workspace *old_ws = con->pending.workspace; |
239 | struct sway_node *target_node = e->target_node; | 239 | struct sway_node *target_node = e->target_node; |
240 | struct sway_workspace *new_ws = target_node->type == N_WORKSPACE ? | 240 | struct sway_workspace *new_ws = target_node->type == N_WORKSPACE ? |
241 | target_node->sway_workspace : target_node->sway_container->workspace; | 241 | target_node->sway_workspace : target_node->sway_container->pending.workspace; |
242 | enum wlr_edges edge = e->target_edge; | 242 | enum wlr_edges edge = e->target_edge; |
243 | int after = edge != WLR_EDGE_TOP && edge != WLR_EDGE_LEFT; | 243 | int after = edge != WLR_EDGE_TOP && edge != WLR_EDGE_LEFT; |
244 | bool swap = edge == WLR_EDGE_NONE && target_node->type == N_CONTAINER; | 244 | bool swap = edge == WLR_EDGE_NONE && target_node->type == N_CONTAINER; |
@@ -285,8 +285,8 @@ static void finalize_move(struct sway_seat *seat) { | |||
285 | int index = list_find(siblings, con); | 285 | int index = list_find(siblings, con); |
286 | struct sway_container *sibling = index == 0 ? | 286 | struct sway_container *sibling = index == 0 ? |
287 | siblings->items[1] : siblings->items[index - 1]; | 287 | siblings->items[1] : siblings->items[index - 1]; |
288 | con->width = sibling->width; | 288 | con->pending.width = sibling->pending.width; |
289 | con->height = sibling->height; | 289 | con->pending.height = sibling->pending.height; |
290 | con->width_fraction = sibling->width_fraction; | 290 | con->width_fraction = sibling->width_fraction; |
291 | con->height_fraction = sibling->height_fraction; | 291 | con->height_fraction = sibling->height_fraction; |
292 | } | 292 | } |
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; |
diff --git a/sway/input/seatop_resize_tiling.c b/sway/input/seatop_resize_tiling.c index c5fe269e..869d11b5 100644 --- a/sway/input/seatop_resize_tiling.c +++ b/sway/input/seatop_resize_tiling.c | |||
@@ -53,19 +53,19 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
53 | if (e->h_con) { | 53 | if (e->h_con) { |
54 | container_set_resizing(e->h_con, false); | 54 | container_set_resizing(e->h_con, false); |
55 | container_set_resizing(e->h_sib, false); | 55 | container_set_resizing(e->h_sib, false); |
56 | if (e->h_con->parent) { | 56 | if (e->h_con->pending.parent) { |
57 | arrange_container(e->h_con->parent); | 57 | arrange_container(e->h_con->pending.parent); |
58 | } else { | 58 | } else { |
59 | arrange_workspace(e->h_con->workspace); | 59 | arrange_workspace(e->h_con->pending.workspace); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | if (e->v_con) { | 62 | if (e->v_con) { |
63 | container_set_resizing(e->v_con, false); | 63 | container_set_resizing(e->v_con, false); |
64 | container_set_resizing(e->v_sib, false); | 64 | container_set_resizing(e->v_sib, false); |
65 | if (e->v_con->parent) { | 65 | if (e->v_con->pending.parent) { |
66 | arrange_container(e->v_con->parent); | 66 | arrange_container(e->v_con->pending.parent); |
67 | } else { | 67 | } else { |
68 | arrange_workspace(e->v_con->workspace); | 68 | arrange_workspace(e->v_con->pending.workspace); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | transaction_commit_dirty(); | 71 | transaction_commit_dirty(); |
@@ -82,16 +82,16 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { | |||
82 | 82 | ||
83 | if (e->h_con) { | 83 | if (e->h_con) { |
84 | if (e->edge & WLR_EDGE_LEFT) { | 84 | if (e->edge & WLR_EDGE_LEFT) { |
85 | amount_x = (e->h_con_orig_width - moved_x) - e->h_con->width; | 85 | amount_x = (e->h_con_orig_width - moved_x) - e->h_con->pending.width; |
86 | } else if (e->edge & WLR_EDGE_RIGHT) { | 86 | } else if (e->edge & WLR_EDGE_RIGHT) { |
87 | amount_x = (e->h_con_orig_width + moved_x) - e->h_con->width; | 87 | amount_x = (e->h_con_orig_width + moved_x) - e->h_con->pending.width; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | if (e->v_con) { | 90 | if (e->v_con) { |
91 | if (e->edge & WLR_EDGE_TOP) { | 91 | if (e->edge & WLR_EDGE_TOP) { |
92 | amount_y = (e->v_con_orig_height - moved_y) - e->v_con->height; | 92 | amount_y = (e->v_con_orig_height - moved_y) - e->v_con->pending.height; |
93 | } else if (e->edge & WLR_EDGE_BOTTOM) { | 93 | } else if (e->edge & WLR_EDGE_BOTTOM) { |
94 | amount_y = (e->v_con_orig_height + moved_y) - e->v_con->height; | 94 | amount_y = (e->v_con_orig_height + moved_y) - e->v_con->pending.height; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
@@ -143,7 +143,7 @@ void seatop_begin_resize_tiling(struct sway_seat *seat, | |||
143 | if (e->h_con) { | 143 | if (e->h_con) { |
144 | container_set_resizing(e->h_con, true); | 144 | container_set_resizing(e->h_con, true); |
145 | container_set_resizing(e->h_sib, true); | 145 | container_set_resizing(e->h_sib, true); |
146 | e->h_con_orig_width = e->h_con->width; | 146 | e->h_con_orig_width = e->h_con->pending.width; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | if (edge & (WLR_EDGE_TOP | WLR_EDGE_BOTTOM)) { | 149 | if (edge & (WLR_EDGE_TOP | WLR_EDGE_BOTTOM)) { |
@@ -154,7 +154,7 @@ void seatop_begin_resize_tiling(struct sway_seat *seat, | |||
154 | if (e->v_con) { | 154 | if (e->v_con) { |
155 | container_set_resizing(e->v_con, true); | 155 | container_set_resizing(e->v_con, true); |
156 | container_set_resizing(e->v_sib, true); | 156 | container_set_resizing(e->v_sib, true); |
157 | e->v_con_orig_height = e->v_con->height; | 157 | e->v_con_orig_height = e->v_con->pending.height; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||