aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_default.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_default.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_default.c')
-rw-r--r--sway/input/seatop_default.c32
1 files changed, 16 insertions, 16 deletions
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 =