diff options
-rw-r--r-- | include/sway/input/seat.h | 10 | ||||
-rw-r--r-- | sway/input/cursor.c | 4 | ||||
-rw-r--r-- | sway/input/seat.c | 12 | ||||
-rw-r--r-- | sway/input/seatop_down.c | 8 |
4 files changed, 23 insertions, 11 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index eb674b70..ff4476d1 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -9,13 +9,15 @@ | |||
9 | struct sway_seat; | 9 | struct sway_seat; |
10 | 10 | ||
11 | struct sway_seatop_impl { | 11 | struct sway_seatop_impl { |
12 | void (*button)(struct sway_seat *seat, uint32_t time_msec, | ||
13 | struct wlr_input_device *device, uint32_t button, | ||
14 | enum wlr_button_state state); | ||
12 | void (*motion)(struct sway_seat *seat, uint32_t time_msec); | 15 | void (*motion)(struct sway_seat *seat, uint32_t time_msec); |
13 | void (*finish)(struct sway_seat *seat, uint32_t time_msec); | 16 | void (*finish)(struct sway_seat *seat, uint32_t time_msec); |
14 | void (*abort)(struct sway_seat *seat); | 17 | void (*abort)(struct sway_seat *seat); |
15 | void (*unref)(struct sway_seat *seat, struct sway_container *con); | 18 | void (*unref)(struct sway_seat *seat, struct sway_container *con); |
16 | void (*render)(struct sway_seat *seat, struct sway_output *output, | 19 | void (*render)(struct sway_seat *seat, struct sway_output *output, |
17 | pixman_region32_t *damage); | 20 | pixman_region32_t *damage); |
18 | bool allows_events; | ||
19 | }; | 21 | }; |
20 | 22 | ||
21 | struct sway_seat_device { | 23 | struct sway_seat_device { |
@@ -214,6 +216,10 @@ void seat_consider_warp_to_focus(struct sway_seat *seat); | |||
214 | 216 | ||
215 | bool seat_doing_seatop(struct sway_seat *seat); | 217 | bool seat_doing_seatop(struct sway_seat *seat); |
216 | 218 | ||
219 | void seatop_button(struct sway_seat *seat, uint32_t time_msec, | ||
220 | struct wlr_input_device *device, uint32_t button, | ||
221 | enum wlr_button_state state); | ||
222 | |||
217 | void seatop_motion(struct sway_seat *seat, uint32_t time_msec); | 223 | void seatop_motion(struct sway_seat *seat, uint32_t time_msec); |
218 | 224 | ||
219 | /** | 225 | /** |
@@ -240,6 +246,4 @@ void seatop_unref(struct sway_seat *seat, struct sway_container *con); | |||
240 | void seatop_render(struct sway_seat *seat, struct sway_output *output, | 246 | void seatop_render(struct sway_seat *seat, struct sway_output *output, |
241 | pixman_region32_t *damage); | 247 | pixman_region32_t *damage); |
242 | 248 | ||
243 | bool seatop_allows_events(struct sway_seat *seat); | ||
244 | |||
245 | #endif | 249 | #endif |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index d531a20e..011b4929 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -610,9 +610,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
610 | } else { | 610 | } else { |
611 | state_erase_button(cursor, button); | 611 | state_erase_button(cursor, button); |
612 | } | 612 | } |
613 | if (seatop_allows_events(seat)) { | 613 | seatop_button(seat, time_msec, device, button, state); |
614 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
615 | } | ||
616 | if (button == seat->seatop_button && state == WLR_BUTTON_RELEASED) { | 614 | if (button == seat->seatop_button && state == WLR_BUTTON_RELEASED) { |
617 | seatop_finish(seat, time_msec); | 615 | seatop_finish(seat, time_msec); |
618 | } | 616 | } |
diff --git a/sway/input/seat.c b/sway/input/seat.c index e56a6510..2c9a85c4 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -1216,6 +1216,14 @@ void seatop_unref(struct sway_seat *seat, struct sway_container *con) { | |||
1216 | } | 1216 | } |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | void seatop_button(struct sway_seat *seat, uint32_t time_msec, | ||
1220 | struct wlr_input_device *device, uint32_t button, | ||
1221 | enum wlr_button_state state) { | ||
1222 | if (seat->seatop_impl && seat->seatop_impl->button) { | ||
1223 | seat->seatop_impl->button(seat, time_msec, device, button, state); | ||
1224 | } | ||
1225 | } | ||
1226 | |||
1219 | void seatop_motion(struct sway_seat *seat, uint32_t time_msec) { | 1227 | void seatop_motion(struct sway_seat *seat, uint32_t time_msec) { |
1220 | if (seat->seatop_impl && seat->seatop_impl->motion) { | 1228 | if (seat->seatop_impl && seat->seatop_impl->motion) { |
1221 | seat->seatop_impl->motion(seat, time_msec); | 1229 | seat->seatop_impl->motion(seat, time_msec); |
@@ -1246,7 +1254,3 @@ void seatop_render(struct sway_seat *seat, struct sway_output *output, | |||
1246 | seat->seatop_impl->render(seat, output, damage); | 1254 | seat->seatop_impl->render(seat, output, damage); |
1247 | } | 1255 | } |
1248 | } | 1256 | } |
1249 | |||
1250 | bool seatop_allows_events(struct sway_seat *seat) { | ||
1251 | return seat->seatop_impl && seat->seatop_impl->allows_events; | ||
1252 | } | ||
diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c index 895571b1..fb2cf1d0 100644 --- a/sway/input/seatop_down.c +++ b/sway/input/seatop_down.c | |||
@@ -11,6 +11,12 @@ struct seatop_down_event { | |||
11 | bool moved; | 11 | bool moved; |
12 | }; | 12 | }; |
13 | 13 | ||
14 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, | ||
15 | struct wlr_input_device *device, uint32_t button, | ||
16 | enum wlr_button_state state) { | ||
17 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
18 | } | ||
19 | |||
14 | static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { | 20 | static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { |
15 | struct seatop_down_event *e = seat->seatop_data; | 21 | struct seatop_down_event *e = seat->seatop_data; |
16 | struct sway_container *con = e->con; | 22 | struct sway_container *con = e->con; |
@@ -54,11 +60,11 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) { | |||
54 | } | 60 | } |
55 | 61 | ||
56 | static const struct sway_seatop_impl seatop_impl = { | 62 | static const struct sway_seatop_impl seatop_impl = { |
63 | .button = handle_button, | ||
57 | .motion = handle_motion, | 64 | .motion = handle_motion, |
58 | .finish = handle_finish, | 65 | .finish = handle_finish, |
59 | .abort = handle_abort, | 66 | .abort = handle_abort, |
60 | .unref = handle_unref, | 67 | .unref = handle_unref, |
61 | .allows_events = true, | ||
62 | }; | 68 | }; |
63 | 69 | ||
64 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, | 70 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, |