aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_default.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seatop_default.c')
-rw-r--r--sway/input/seatop_default.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index d9f9e371..b7e3ff3f 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -2,9 +2,11 @@
2#include <float.h> 2#include <float.h>
3#include <libevdev/libevdev.h> 3#include <libevdev/libevdev.h>
4#include <wlr/types/wlr_cursor.h> 4#include <wlr/types/wlr_cursor.h>
5#include <wlr/types/wlr_tablet_v2.h>
5#include <wlr/types/wlr_xcursor_manager.h> 6#include <wlr/types/wlr_xcursor_manager.h>
6#include "sway/input/cursor.h" 7#include "sway/input/cursor.h"
7#include "sway/input/seat.h" 8#include "sway/input/seat.h"
9#include "sway/input/tablet.h"
8#include "sway/tree/view.h" 10#include "sway/tree/view.h"
9#include "log.h" 11#include "log.h"
10#if HAVE_XWAYLAND 12#if HAVE_XWAYLAND
@@ -472,6 +474,42 @@ static void handle_motion(struct sway_seat *seat, uint32_t time_msec,
472 e->previous_node = node; 474 e->previous_node = node;
473} 475}
474 476
477static void handle_tablet_tool_motion(struct sway_seat *seat,
478 struct sway_tablet *tablet, struct sway_tablet_tool *tool,
479 uint32_t time_msec, double dx, double dy) {
480 struct seatop_default_event *e = seat->seatop_data;
481 struct sway_cursor *cursor = seat->cursor;
482
483 struct wlr_surface *surface = NULL;
484 double sx, sy;
485 struct sway_node *node = node_at_coords(seat,
486 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
487
488 if (node && config->focus_follows_mouse != FOLLOWS_NO) {
489 check_focus_follows_mouse(seat, e, node);
490 }
491
492 if (surface) {
493 if (seat_is_input_allowed(seat, surface)) {
494 wlr_tablet_v2_tablet_tool_notify_proximity_in(tool->tablet_v2_tool,
495 tablet->tablet_v2, surface);
496 wlr_tablet_v2_tablet_tool_notify_motion(tool->tablet_v2_tool, sx, sy);
497 }
498 } else {
499 cursor_update_image(cursor, node);
500 wlr_tablet_v2_tablet_tool_notify_proximity_out(tool->tablet_v2_tool);
501 }
502
503 struct sway_drag_icon *drag_icon;
504 wl_list_for_each(drag_icon, &root->drag_icons, link) {
505 if (drag_icon->seat == seat) {
506 drag_icon_update_position(drag_icon);
507 }
508 }
509
510 e->previous_node = node;
511}
512
475/*--------------------------------\ 513/*--------------------------------\
476 * Functions used by handle_axis / 514 * Functions used by handle_axis /
477 *------------------------------*/ 515 *------------------------------*/
@@ -612,6 +650,7 @@ static const struct sway_seatop_impl seatop_impl = {
612 .button = handle_button, 650 .button = handle_button,
613 .motion = handle_motion, 651 .motion = handle_motion,
614 .axis = handle_axis, 652 .axis = handle_axis,
653 .tablet_tool_motion = handle_tablet_tool_motion,
615 .rebase = handle_rebase, 654 .rebase = handle_rebase,
616 .allow_set_cursor = true, 655 .allow_set_cursor = true,
617}; 656};