diff options
-rw-r--r-- | sway/input/cursor.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index d1347198..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 | ||
@@ -599,9 +603,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
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_or_child(cont)) { | 605 | } else if (cont && container_is_floating_or_child(cont)) { |
602 | while (cont->parent->layout != L_FLOATING) { | ||
603 | cont = cont->parent; | ||
604 | } | ||
605 | dispatch_cursor_button_floating(cursor, time_msec, button, state, | 606 | dispatch_cursor_button_floating(cursor, time_msec, button, state, |
606 | surface, sx, sy, cont); | 607 | surface, sx, sy, cont); |
607 | } else if (surface && cont && cont->type != C_VIEW) { | 608 | } else if (surface && cont && cont->type != C_VIEW) { |