summaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-07-28 09:30:12 -0400
committerLibravatar GitHub <noreply@github.com>2018-07-28 09:30:12 -0400
commit53069f1403587d230e8f2c6adb61daa7c5e022b7 (patch)
tree67b966d2736ba19540b0102381710f9fb5316e61 /sway/input/cursor.c
parentMerge pull request #2368 from RyanDwyer/handle-out-of-fds (diff)
parentFocus child when showing a scratchpad container (diff)
downloadsway-53069f1403587d230e8f2c6adb61daa7c5e022b7.tar.gz
sway-53069f1403587d230e8f2c6adb61daa7c5e022b7.tar.zst
sway-53069f1403587d230e8f2c6adb61daa7c5e022b7.zip
Merge pull request #2360 from RyanDwyer/floating-containers
Allow containers to float
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index cc0dbe99..96ac7b33 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -437,18 +437,22 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor,
437 seat_pointer_notify_button(seat, time_msec, button, state); 437 seat_pointer_notify_button(seat, time_msec, button, state);
438 return; 438 return;
439 } 439 }
440 struct sway_container *floater = cont;
441 while (floater->parent->layout != L_FLOATING) {
442 floater = floater->parent;
443 }
440 444
441 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat); 445 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
442 bool mod_pressed = keyboard && 446 bool mod_pressed = keyboard &&
443 (wlr_keyboard_get_modifiers(keyboard) & config->floating_mod); 447 (wlr_keyboard_get_modifiers(keyboard) & config->floating_mod);
444 enum wlr_edges edge = find_resize_edge(cont, cursor); 448 enum wlr_edges edge = find_resize_edge(floater, cursor);
445 bool over_title = edge == WLR_EDGE_NONE && !surface; 449 bool over_title = edge == WLR_EDGE_NONE && !surface;
446 450
447 // Check for beginning move 451 // Check for beginning move
448 uint32_t btn_move = config->floating_mod_inverse ? BTN_RIGHT : BTN_LEFT; 452 uint32_t btn_move = config->floating_mod_inverse ? BTN_RIGHT : BTN_LEFT;
449 if (button == btn_move && state == WLR_BUTTON_PRESSED && 453 if (button == btn_move && state == WLR_BUTTON_PRESSED &&
450 (mod_pressed || over_title)) { 454 (mod_pressed || over_title)) {
451 seat_begin_move(seat, cont, button); 455 seat_begin_move(seat, floater, button);
452 return; 456 return;
453 } 457 }
454 458
@@ -459,12 +463,12 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor,
459 if ((resizing_via_border || resizing_via_mod) && 463 if ((resizing_via_border || resizing_via_mod) &&
460 state == WLR_BUTTON_PRESSED) { 464 state == WLR_BUTTON_PRESSED) {
461 if (edge == WLR_EDGE_NONE) { 465 if (edge == WLR_EDGE_NONE) {
462 edge |= cursor->cursor->x > cont->x + cont->width / 2 ? 466 edge |= cursor->cursor->x > floater->x + floater->width / 2 ?
463 WLR_EDGE_RIGHT : WLR_EDGE_LEFT; 467 WLR_EDGE_RIGHT : WLR_EDGE_LEFT;
464 edge |= cursor->cursor->y > cont->y + cont->height / 2 ? 468 edge |= cursor->cursor->y > floater->y + floater->height / 2 ?
465 WLR_EDGE_BOTTOM : WLR_EDGE_TOP; 469 WLR_EDGE_BOTTOM : WLR_EDGE_TOP;
466 } 470 }
467 seat_begin_resize(seat, cont, button, edge); 471 seat_begin_resize(seat, floater, button, edge);
468 return; 472 return;
469 } 473 }
470 474
@@ -598,7 +602,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
598 seat_set_focus_layer(cursor->seat, layer); 602 seat_set_focus_layer(cursor->seat, layer);
599 } 603 }
600 seat_pointer_notify_button(cursor->seat, time_msec, button, state); 604 seat_pointer_notify_button(cursor->seat, time_msec, button, state);
601 } else if (cont && container_is_floating(cont)) { 605 } else if (cont && container_is_floating_or_child(cont)) {
602 dispatch_cursor_button_floating(cursor, time_msec, button, state, 606 dispatch_cursor_button_floating(cursor, time_msec, button, state,
603 surface, sx, sy, cont); 607 surface, sx, sy, cont);
604 } else if (surface && cont && cont->type != C_VIEW) { 608 } else if (surface && cont && cont->type != C_VIEW) {