aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_down.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seatop_down.c')
-rw-r--r--sway/input/seatop_down.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c
index 358d5c59..dd8be6bf 100644
--- a/sway/input/seatop_down.c
+++ b/sway/input/seatop_down.c
@@ -1,6 +1,7 @@
1#define _POSIX_C_SOURCE 200809L 1#define _POSIX_C_SOURCE 200809L
2#include <float.h> 2#include <float.h>
3#include <wlr/types/wlr_cursor.h> 3#include <wlr/types/wlr_cursor.h>
4#include <wlr/types/wlr_tablet_v2.h>
4#include "sway/input/cursor.h" 5#include "sway/input/cursor.h"
5#include "sway/input/seat.h" 6#include "sway/input/seat.h"
6#include "sway/tree/view.h" 7#include "sway/tree/view.h"
@@ -49,6 +50,27 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec,
49 } 50 }
50} 51}
51 52
53static void handle_tablet_tool_tip(struct sway_seat *seat,
54 struct sway_tablet_tool *tool, uint32_t time_msec,
55 enum wlr_tablet_tool_tip_state state) {
56 if (state == WLR_TABLET_TOOL_TIP_UP) {
57 seatop_begin_default(seat);
58 }
59}
60
61static void handle_tablet_tool_motion(struct sway_seat *seat,
62 struct sway_tablet_tool *tool, uint32_t time_msec, double dx, double dy) {
63 struct seatop_down_event *e = seat->seatop_data;
64 struct sway_container *con = e->con;
65 if (seat_is_input_allowed(seat, con->view->surface)) {
66 double moved_x = seat->cursor->cursor->x - e->ref_lx;
67 double moved_y = seat->cursor->cursor->y - e->ref_ly;
68 double sx = e->ref_con_lx + moved_x;
69 double sy = e->ref_con_ly + moved_y;
70 wlr_tablet_v2_tablet_tool_notify_motion(tool->tablet_v2_tool, sx, sy);
71 }
72}
73
52static void handle_unref(struct sway_seat *seat, struct sway_container *con) { 74static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
53 struct seatop_down_event *e = seat->seatop_data; 75 struct seatop_down_event *e = seat->seatop_data;
54 if (e->con == con) { 76 if (e->con == con) {
@@ -60,6 +82,8 @@ static const struct sway_seatop_impl seatop_impl = {
60 .button = handle_button, 82 .button = handle_button,
61 .pointer_motion = handle_pointer_motion, 83 .pointer_motion = handle_pointer_motion,
62 .pointer_axis = handle_pointer_axis, 84 .pointer_axis = handle_pointer_axis,
85 .tablet_tool_tip = handle_tablet_tool_tip,
86 .tablet_tool_motion = handle_tablet_tool_motion,
63 .unref = handle_unref, 87 .unref = handle_unref,
64 .allow_set_cursor = true, 88 .allow_set_cursor = true,
65}; 89};