aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2020-06-04 14:28:43 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2020-06-07 10:46:14 +0200
commit53dc83fb68d2da079f2595994af41cc6b9acbeea (patch)
tree7532ea7ae132fcb592779b69606a54c6205dbbd9 /sway/input
parentcommon/util: fix `get_current_time_msec` returning microseconds (diff)
downloadsway-53dc83fb68d2da079f2595994af41cc6b9acbeea.tar.gz
sway-53dc83fb68d2da079f2595994af41cc6b9acbeea.tar.zst
sway-53dc83fb68d2da079f2595994af41cc6b9acbeea.zip
tree/container: introduce `container_toplevel_ancestor` helper
This allows us to not have to explicitly write the same while loop everywhere.
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seatop_default.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index 2bce2f77..b8265441 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -338,10 +338,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
338 if (button == btn_move && (mod_pressed || on_titlebar)) { 338 if (button == btn_move && (mod_pressed || on_titlebar)) {
339 seat_set_focus_container(seat, 339 seat_set_focus_container(seat,
340 seat_get_focus_inactive_view(seat, &cont->node)); 340 seat_get_focus_inactive_view(seat, &cont->node));
341 while (cont->parent) { 341 seatop_begin_move_floating(seat, container_toplevel_ancestor(cont));
342 cont = cont->parent;
343 }
344 seatop_begin_move_floating(seat, cont);
345 return; 342 return;
346 } 343 }
347 } 344 }
@@ -359,10 +356,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
359 uint32_t btn_resize = config->floating_mod_inverse ? 356 uint32_t btn_resize = config->floating_mod_inverse ?
360 BTN_LEFT : BTN_RIGHT; 357 BTN_LEFT : BTN_RIGHT;
361 if (mod_pressed && button == btn_resize) { 358 if (mod_pressed && button == btn_resize) {
362 struct sway_container *floater = cont; 359 struct sway_container *floater = container_toplevel_ancestor(cont);
363 while (floater->parent) {
364 floater = floater->parent;
365 }
366 edge = 0; 360 edge = 0;
367 edge |= cursor->cursor->x > floater->x + floater->width / 2 ? 361 edge |= cursor->cursor->x > floater->x + floater->width / 2 ?
368 WLR_EDGE_RIGHT : WLR_EDGE_LEFT; 362 WLR_EDGE_RIGHT : WLR_EDGE_LEFT;