mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
input: Percolate swipe gestures through seat handlers
Let swipe pointer gestures percolate through seat and default seatop handlers so sway-internal handling can be added if desired. As a side-effect this makes swipes count as user activity. There should be no other functional changes. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
This commit is contained in:
parent
4e302fb402
commit
b518870bc1
4 changed files with 68 additions and 9 deletions
|
|
@ -19,6 +19,12 @@ struct sway_seatop_impl {
|
|||
void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec);
|
||||
void (*pointer_axis)(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_axis *event);
|
||||
void (*swipe_begin)(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_begin *event);
|
||||
void (*swipe_update)(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_update *event);
|
||||
void (*swipe_end)(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_end *event);
|
||||
void (*rebase)(struct sway_seat *seat, uint32_t time_msec);
|
||||
void (*tablet_tool_motion)(struct sway_seat *seat,
|
||||
struct sway_tablet_tool *tool, uint32_t time_msec);
|
||||
|
|
@ -280,6 +286,13 @@ void seatop_tablet_tool_tip(struct sway_seat *seat,
|
|||
void seatop_tablet_tool_motion(struct sway_seat *seat,
|
||||
struct sway_tablet_tool *tool, uint32_t time_msec);
|
||||
|
||||
void seatop_swipe_begin(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_begin *event);
|
||||
void seatop_swipe_update(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_update *event);
|
||||
void seatop_swipe_end(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_end *event);
|
||||
|
||||
void seatop_rebase(struct sway_seat *seat, uint32_t time_msec);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -952,27 +952,24 @@ static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data)
|
|||
struct sway_cursor *cursor = wl_container_of(
|
||||
listener, cursor, swipe_begin);
|
||||
struct wlr_event_pointer_swipe_begin *event = data;
|
||||
wlr_pointer_gestures_v1_send_swipe_begin(
|
||||
cursor->pointer_gestures, cursor->seat->wlr_seat,
|
||||
event->time_msec, event->fingers);
|
||||
cursor_handle_activity_from_device(cursor, event->device);
|
||||
seatop_swipe_begin(cursor->seat, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_swipe_update(struct wl_listener *listener, void *data) {
|
||||
struct sway_cursor *cursor = wl_container_of(
|
||||
listener, cursor, swipe_update);
|
||||
struct wlr_event_pointer_swipe_update *event = data;
|
||||
wlr_pointer_gestures_v1_send_swipe_update(
|
||||
cursor->pointer_gestures, cursor->seat->wlr_seat,
|
||||
event->time_msec, event->dx, event->dy);
|
||||
cursor_handle_activity_from_device(cursor, event->device);
|
||||
seatop_swipe_update(cursor->seat, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_swipe_end(struct wl_listener *listener, void *data) {
|
||||
struct sway_cursor *cursor = wl_container_of(
|
||||
listener, cursor, swipe_end);
|
||||
struct wlr_event_pointer_swipe_end *event = data;
|
||||
wlr_pointer_gestures_v1_send_swipe_end(
|
||||
cursor->pointer_gestures, cursor->seat->wlr_seat,
|
||||
event->time_msec, event->cancelled);
|
||||
cursor_handle_activity_from_device(cursor, event->device);
|
||||
seatop_swipe_end(cursor->seat, event);
|
||||
}
|
||||
|
||||
static void handle_image_surface_destroy(struct wl_listener *listener,
|
||||
|
|
|
|||
|
|
@ -1576,6 +1576,27 @@ void seatop_tablet_tool_motion(struct sway_seat *seat,
|
|||
}
|
||||
}
|
||||
|
||||
void seatop_swipe_begin(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_begin *event) {
|
||||
if (seat->seatop_impl->swipe_begin) {
|
||||
seat->seatop_impl->swipe_begin(seat, event);
|
||||
}
|
||||
}
|
||||
|
||||
void seatop_swipe_update(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_update *event) {
|
||||
if (seat->seatop_impl->swipe_update) {
|
||||
seat->seatop_impl->swipe_update(seat, event);
|
||||
}
|
||||
}
|
||||
|
||||
void seatop_swipe_end(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_end *event) {
|
||||
if (seat->seatop_impl->swipe_end) {
|
||||
seat->seatop_impl->swipe_end(seat, event);
|
||||
}
|
||||
}
|
||||
|
||||
void seatop_rebase(struct sway_seat *seat, uint32_t time_msec) {
|
||||
if (seat->seatop_impl->rebase) {
|
||||
seat->seatop_impl->rebase(seat, time_msec);
|
||||
|
|
|
|||
|
|
@ -747,6 +747,31 @@ static void handle_pointer_axis(struct sway_seat *seat,
|
|||
}
|
||||
}
|
||||
|
||||
static void handle_swipe_begin(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_begin *event) {
|
||||
struct sway_cursor *cursor = seat->cursor;
|
||||
wlr_pointer_gestures_v1_send_swipe_begin(
|
||||
cursor->pointer_gestures, cursor->seat->wlr_seat,
|
||||
event->time_msec, event->fingers);
|
||||
}
|
||||
|
||||
static void handle_swipe_update(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_update *event) {
|
||||
struct sway_cursor *cursor = seat->cursor;
|
||||
wlr_pointer_gestures_v1_send_swipe_update(
|
||||
cursor->pointer_gestures,
|
||||
cursor->seat->wlr_seat,
|
||||
event->time_msec, event->dx, event->dy);
|
||||
}
|
||||
|
||||
static void handle_swipe_end(struct sway_seat *seat,
|
||||
struct wlr_event_pointer_swipe_end *event) {
|
||||
struct sway_cursor *cursor = seat->cursor;
|
||||
wlr_pointer_gestures_v1_send_swipe_end(
|
||||
cursor->pointer_gestures, cursor->seat->wlr_seat,
|
||||
event->time_msec, event->cancelled);
|
||||
}
|
||||
|
||||
/*----------------------------------\
|
||||
* Functions used by handle_rebase /
|
||||
*--------------------------------*/
|
||||
|
|
@ -776,6 +801,9 @@ static const struct sway_seatop_impl seatop_impl = {
|
|||
.pointer_axis = handle_pointer_axis,
|
||||
.tablet_tool_tip = handle_tablet_tool_tip,
|
||||
.tablet_tool_motion = handle_tablet_tool_motion,
|
||||
.swipe_begin = handle_swipe_begin,
|
||||
.swipe_update = handle_swipe_update,
|
||||
.swipe_end = handle_swipe_end,
|
||||
.rebase = handle_rebase,
|
||||
.allow_set_cursor = true,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue