diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-21 11:23:48 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-22 23:10:19 +1000 |
commit | 9df660ee3188386c907d8feb999636ce8d61d095 (patch) | |
tree | eb9343b66221d664ac995995d7bcceb45d25ee94 /sway/input/cursor.c | |
parent | Prevent re-uploading the same cursor image multiple times (diff) | |
download | sway-9df660ee3188386c907d8feb999636ce8d61d095.tar.gz sway-9df660ee3188386c907d8feb999636ce8d61d095.tar.zst sway-9df660ee3188386c907d8feb999636ce8d61d095.zip |
Store last button and use it when views request to move or resize
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 43721d28..ad0ceb94 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -429,7 +429,7 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor, | |||
429 | 429 | ||
430 | // Deny moving or resizing a fullscreen view | 430 | // Deny moving or resizing a fullscreen view |
431 | if (cont->type == C_VIEW && cont->sway_view->is_fullscreen) { | 431 | if (cont->type == C_VIEW && cont->sway_view->is_fullscreen) { |
432 | wlr_seat_pointer_notify_button(seat->wlr_seat, time_msec, button, state); | 432 | seat_pointer_notify_button(seat, time_msec, button, state); |
433 | return; | 433 | return; |
434 | } | 434 | } |
435 | 435 | ||
@@ -442,7 +442,7 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor, | |||
442 | // Check for beginning move | 442 | // Check for beginning move |
443 | if (button == BTN_LEFT && state == WLR_BUTTON_PRESSED && | 443 | if (button == BTN_LEFT && state == WLR_BUTTON_PRESSED && |
444 | (mod_pressed || over_title)) { | 444 | (mod_pressed || over_title)) { |
445 | seat_begin_move(seat, cont); | 445 | seat_begin_move(seat, cont, BTN_LEFT); |
446 | return; | 446 | return; |
447 | } | 447 | } |
448 | 448 | ||
@@ -456,7 +456,7 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor, | |||
456 | } | 456 | } |
457 | 457 | ||
458 | // Send event to surface | 458 | // Send event to surface |
459 | wlr_seat_pointer_notify_button(seat->wlr_seat, time_msec, button, state); | 459 | seat_pointer_notify_button(seat, time_msec, button, state); |
460 | } | 460 | } |
461 | 461 | ||
462 | void dispatch_cursor_button(struct sway_cursor *cursor, | 462 | void dispatch_cursor_button(struct sway_cursor *cursor, |
@@ -480,8 +480,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
480 | if (layer->current.keyboard_interactive) { | 480 | if (layer->current.keyboard_interactive) { |
481 | seat_set_focus_layer(cursor->seat, layer); | 481 | seat_set_focus_layer(cursor->seat, layer); |
482 | } | 482 | } |
483 | wlr_seat_pointer_notify_button(cursor->seat->wlr_seat, | 483 | seat_pointer_notify_button(cursor->seat, time_msec, button, state); |
484 | time_msec, button, state); | ||
485 | } else if (cont && container_is_floating(cont)) { | 484 | } else if (cont && container_is_floating(cont)) { |
486 | dispatch_cursor_button_floating(cursor, time_msec, button, state, | 485 | dispatch_cursor_button_floating(cursor, time_msec, button, state, |
487 | surface, sx, sy, cont); | 486 | surface, sx, sy, cont); |
@@ -501,15 +500,12 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
501 | if (new_ws != old_ws) { | 500 | if (new_ws != old_ws) { |
502 | seat_set_focus(cursor->seat, cont); | 501 | seat_set_focus(cursor->seat, cont); |
503 | } | 502 | } |
504 | wlr_seat_pointer_notify_button(cursor->seat->wlr_seat, | 503 | seat_pointer_notify_button(cursor->seat, time_msec, button, state); |
505 | time_msec, button, state); | ||
506 | } else if (cont) { | 504 | } else if (cont) { |
507 | seat_set_focus(cursor->seat, cont); | 505 | seat_set_focus(cursor->seat, cont); |
508 | wlr_seat_pointer_notify_button(cursor->seat->wlr_seat, | 506 | seat_pointer_notify_button(cursor->seat, time_msec, button, state); |
509 | time_msec, button, state); | ||
510 | } else { | 507 | } else { |
511 | wlr_seat_pointer_notify_button(cursor->seat->wlr_seat, | 508 | seat_pointer_notify_button(cursor->seat, time_msec, button, state); |
512 | time_msec, button, state); | ||
513 | } | 509 | } |
514 | 510 | ||
515 | transaction_commit_dirty(); | 511 | transaction_commit_dirty(); |