diff options
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index fa604426..cbb5c6e9 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include "util.h" | 20 | #include "util.h" |
21 | #include "sway/commands.h" | 21 | #include "sway/commands.h" |
22 | #include "sway/desktop.h" | 22 | #include "sway/desktop.h" |
23 | #include "sway/desktop/transaction.h" | ||
24 | #include "sway/input/cursor.h" | 23 | #include "sway/input/cursor.h" |
25 | #include "sway/input/keyboard.h" | 24 | #include "sway/input/keyboard.h" |
26 | #include "sway/input/tablet.h" | 25 | #include "sway/input/tablet.h" |
@@ -383,7 +382,6 @@ static void handle_pointer_motion_relative( | |||
383 | 382 | ||
384 | pointer_motion(cursor, e->time_msec, e->device, e->delta_x, e->delta_y, | 383 | pointer_motion(cursor, e->time_msec, e->device, e->delta_x, e->delta_y, |
385 | e->unaccel_dx, e->unaccel_dy); | 384 | e->unaccel_dx, e->unaccel_dy); |
386 | transaction_commit_dirty(); | ||
387 | } | 385 | } |
388 | 386 | ||
389 | static void handle_pointer_motion_absolute( | 387 | static void handle_pointer_motion_absolute( |
@@ -401,7 +399,6 @@ static void handle_pointer_motion_absolute( | |||
401 | double dy = ly - cursor->cursor->y; | 399 | double dy = ly - cursor->cursor->y; |
402 | 400 | ||
403 | pointer_motion(cursor, event->time_msec, event->device, dx, dy, dx, dy); | 401 | pointer_motion(cursor, event->time_msec, event->device, dx, dy, dx, dy); |
404 | transaction_commit_dirty(); | ||
405 | } | 402 | } |
406 | 403 | ||
407 | void dispatch_cursor_button(struct sway_cursor *cursor, | 404 | void dispatch_cursor_button(struct sway_cursor *cursor, |
@@ -431,7 +428,6 @@ static void handle_pointer_button(struct wl_listener *listener, void *data) { | |||
431 | cursor_handle_activity_from_device(cursor, event->device); | 428 | cursor_handle_activity_from_device(cursor, event->device); |
432 | dispatch_cursor_button(cursor, event->device, | 429 | dispatch_cursor_button(cursor, event->device, |
433 | event->time_msec, event->button, event->state); | 430 | event->time_msec, event->button, event->state); |
434 | transaction_commit_dirty(); | ||
435 | } | 431 | } |
436 | 432 | ||
437 | void dispatch_cursor_axis(struct sway_cursor *cursor, | 433 | void dispatch_cursor_axis(struct sway_cursor *cursor, |
@@ -444,7 +440,6 @@ static void handle_pointer_axis(struct wl_listener *listener, void *data) { | |||
444 | struct wlr_event_pointer_axis *event = data; | 440 | struct wlr_event_pointer_axis *event = data; |
445 | cursor_handle_activity_from_device(cursor, event->device); | 441 | cursor_handle_activity_from_device(cursor, event->device); |
446 | dispatch_cursor_axis(cursor, event); | 442 | dispatch_cursor_axis(cursor, event); |
447 | transaction_commit_dirty(); | ||
448 | } | 443 | } |
449 | 444 | ||
450 | static void handle_pointer_frame(struct wl_listener *listener, void *data) { | 445 | static void handle_pointer_frame(struct wl_listener *listener, void *data) { |
@@ -495,7 +490,6 @@ static void handle_touch_down(struct wl_listener *listener, void *data) { | |||
495 | dispatch_cursor_button(cursor, event->device, event->time_msec, | 490 | dispatch_cursor_button(cursor, event->device, event->time_msec, |
496 | BTN_LEFT, WLR_BUTTON_PRESSED); | 491 | BTN_LEFT, WLR_BUTTON_PRESSED); |
497 | wlr_seat_pointer_notify_frame(wlr_seat); | 492 | wlr_seat_pointer_notify_frame(wlr_seat); |
498 | transaction_commit_dirty(); | ||
499 | } | 493 | } |
500 | } | 494 | } |
501 | 495 | ||
@@ -512,7 +506,6 @@ static void handle_touch_up(struct wl_listener *listener, void *data) { | |||
512 | dispatch_cursor_button(cursor, event->device, event->time_msec, | 506 | dispatch_cursor_button(cursor, event->device, event->time_msec, |
513 | BTN_LEFT, WLR_BUTTON_RELEASED); | 507 | BTN_LEFT, WLR_BUTTON_RELEASED); |
514 | wlr_seat_pointer_notify_frame(wlr_seat); | 508 | wlr_seat_pointer_notify_frame(wlr_seat); |
515 | transaction_commit_dirty(); | ||
516 | } | 509 | } |
517 | } else { | 510 | } else { |
518 | wlr_seat_touch_notify_up(wlr_seat, event->time_msec, event->touch_id); | 511 | wlr_seat_touch_notify_up(wlr_seat, event->time_msec, event->touch_id); |
@@ -553,7 +546,6 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) { | |||
553 | dx = lx - cursor->cursor->x; | 546 | dx = lx - cursor->cursor->x; |
554 | dy = ly - cursor->cursor->y; | 547 | dy = ly - cursor->cursor->y; |
555 | pointer_motion(cursor, event->time_msec, event->device, dx, dy, dx, dy); | 548 | pointer_motion(cursor, event->time_msec, event->device, dx, dy, dx, dy); |
556 | transaction_commit_dirty(); | ||
557 | } | 549 | } |
558 | } else if (surface) { | 550 | } else if (surface) { |
559 | wlr_seat_touch_notify_motion(wlr_seat, event->time_msec, | 551 | wlr_seat_touch_notify_motion(wlr_seat, event->time_msec, |
@@ -639,8 +631,6 @@ static void handle_tablet_tool_position(struct sway_cursor *cursor, | |||
639 | wlr_tablet_v2_tablet_tool_notify_proximity_out(tool->tablet_v2_tool); | 631 | wlr_tablet_v2_tablet_tool_notify_proximity_out(tool->tablet_v2_tool); |
640 | pointer_motion(cursor, time_msec, input_device->wlr_device, dx, dy, dx, dy); | 632 | pointer_motion(cursor, time_msec, input_device->wlr_device, dx, dy, dx, dy); |
641 | } | 633 | } |
642 | |||
643 | transaction_commit_dirty(); | ||
644 | } | 634 | } |
645 | 635 | ||
646 | static void handle_tool_axis(struct wl_listener *listener, void *data) { | 636 | static void handle_tool_axis(struct wl_listener *listener, void *data) { |
@@ -720,7 +710,6 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) { | |||
720 | dispatch_cursor_button(cursor, event->device, event->time_msec, | 710 | dispatch_cursor_button(cursor, event->device, event->time_msec, |
721 | BTN_LEFT, WLR_BUTTON_RELEASED); | 711 | BTN_LEFT, WLR_BUTTON_RELEASED); |
722 | wlr_seat_pointer_notify_frame(cursor->seat->wlr_seat); | 712 | wlr_seat_pointer_notify_frame(cursor->seat->wlr_seat); |
723 | transaction_commit_dirty(); | ||
724 | } else if (!surface || !wlr_surface_accepts_tablet_v2(tablet_v2, surface)) { | 713 | } else if (!surface || !wlr_surface_accepts_tablet_v2(tablet_v2, surface)) { |
725 | // If we started holding the tool tip down on a surface that accepts | 714 | // If we started holding the tool tip down on a surface that accepts |
726 | // tablet v2, we should notify that surface if it gets released over a | 715 | // tablet v2, we should notify that surface if it gets released over a |
@@ -733,7 +722,6 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) { | |||
733 | dispatch_cursor_button(cursor, event->device, event->time_msec, | 722 | dispatch_cursor_button(cursor, event->device, event->time_msec, |
734 | BTN_LEFT, WLR_BUTTON_PRESSED); | 723 | BTN_LEFT, WLR_BUTTON_PRESSED); |
735 | wlr_seat_pointer_notify_frame(cursor->seat->wlr_seat); | 724 | wlr_seat_pointer_notify_frame(cursor->seat->wlr_seat); |
736 | transaction_commit_dirty(); | ||
737 | } | 725 | } |
738 | } else { | 726 | } else { |
739 | seatop_tablet_tool_tip(seat, sway_tool, event->time_msec, event->state); | 727 | seatop_tablet_tool_tip(seat, sway_tool, event->time_msec, event->state); |
@@ -820,7 +808,6 @@ static void handle_tool_button(struct wl_listener *listener, void *data) { | |||
820 | break; | 808 | break; |
821 | } | 809 | } |
822 | wlr_seat_pointer_notify_frame(cursor->seat->wlr_seat); | 810 | wlr_seat_pointer_notify_frame(cursor->seat->wlr_seat); |
823 | transaction_commit_dirty(); | ||
824 | return; | 811 | return; |
825 | } | 812 | } |
826 | 813 | ||
@@ -837,8 +824,8 @@ static void check_constraint_region(struct sway_cursor *cursor) { | |||
837 | 824 | ||
838 | struct sway_container *con = view->container; | 825 | struct sway_container *con = view->container; |
839 | 826 | ||
840 | double sx = cursor->cursor->x - con->content_x + view->geometry.x; | 827 | double sx = cursor->cursor->x - con->pending.content_x + view->geometry.x; |
841 | double sy = cursor->cursor->y - con->content_y + view->geometry.y; | 828 | double sy = cursor->cursor->y - con->pending.content_y + view->geometry.y; |
842 | 829 | ||
843 | if (!pixman_region32_contains_point(region, | 830 | if (!pixman_region32_contains_point(region, |
844 | floor(sx), floor(sy), NULL)) { | 831 | floor(sx), floor(sy), NULL)) { |
@@ -849,8 +836,8 @@ static void check_constraint_region(struct sway_cursor *cursor) { | |||
849 | double sy = (boxes[0].y1 + boxes[0].y2) / 2.; | 836 | double sy = (boxes[0].y1 + boxes[0].y2) / 2.; |
850 | 837 | ||
851 | wlr_cursor_warp_closest(cursor->cursor, NULL, | 838 | wlr_cursor_warp_closest(cursor->cursor, NULL, |
852 | sx + con->content_x - view->geometry.x, | 839 | sx + con->pending.content_x - view->geometry.x, |
853 | sy + con->content_y - view->geometry.y); | 840 | sy + con->pending.content_y - view->geometry.y); |
854 | 841 | ||
855 | cursor_rebase(cursor); | 842 | cursor_rebase(cursor); |
856 | } | 843 | } |
@@ -1170,8 +1157,8 @@ void cursor_warp_to_container(struct sway_cursor *cursor, | |||
1170 | return; | 1157 | return; |
1171 | } | 1158 | } |
1172 | 1159 | ||
1173 | double x = container->x + container->width / 2.0; | 1160 | double x = container->pending.x + container->pending.width / 2.0; |
1174 | double y = container->y + container->height / 2.0; | 1161 | double y = container->pending.y + container->pending.height / 2.0; |
1175 | 1162 | ||
1176 | wlr_cursor_warp(cursor->cursor, NULL, x, y); | 1163 | wlr_cursor_warp(cursor->cursor, NULL, x, y); |
1177 | cursor_unhide(cursor); | 1164 | cursor_unhide(cursor); |
@@ -1284,8 +1271,8 @@ static void warp_to_constraint_cursor_hint(struct sway_cursor *cursor) { | |||
1284 | struct sway_view *view = view_from_wlr_surface(constraint->surface); | 1271 | struct sway_view *view = view_from_wlr_surface(constraint->surface); |
1285 | struct sway_container *con = view->container; | 1272 | struct sway_container *con = view->container; |
1286 | 1273 | ||
1287 | double lx = sx + con->content_x - view->geometry.x; | 1274 | double lx = sx + con->pending.content_x - view->geometry.x; |
1288 | double ly = sy + con->content_y - view->geometry.y; | 1275 | double ly = sy + con->pending.content_y - view->geometry.y; |
1289 | 1276 | ||
1290 | wlr_cursor_warp(cursor->cursor, NULL, lx, ly); | 1277 | wlr_cursor_warp(cursor->cursor, NULL, lx, ly); |
1291 | 1278 | ||