diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-03-16 09:18:54 +1000 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-17 10:02:04 -0600 |
commit | fb3475e291ea6be94131c19fdc006e9ad873ea5f (patch) | |
tree | edf7a13eb1ee74f8efd14a8d7b5355f820a8b10a /sway | |
parent | 73605dac2ae18e2ca84a74da895c4098a1bee6f8 (diff) |
Replace seatup allows_events with button callback
Diffstat (limited to 'sway')
-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 |
3 files changed, 16 insertions, 8 deletions
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, } else { state_erase_button(cursor, button); } - if (seatop_allows_events(seat)) { - seat_pointer_notify_button(seat, time_msec, button, state); - } + seatop_button(seat, time_msec, device, button, state); if (button == seat->seatop_button && state == WLR_BUTTON_RELEASED) { seatop_finish(seat, time_msec); } 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) { } } +void seatop_button(struct sway_seat *seat, uint32_t time_msec, + struct wlr_input_device *device, uint32_t button, + enum wlr_button_state state) { + if (seat->seatop_impl && seat->seatop_impl->button) { + seat->seatop_impl->button(seat, time_msec, device, button, state); + } +} + void seatop_motion(struct sway_seat *seat, uint32_t time_msec) { if (seat->seatop_impl && seat->seatop_impl->motion) { seat->seatop_impl->motion(seat, time_msec); @@ -1246,7 +1254,3 @@ void seatop_render(struct sway_seat *seat, struct sway_output *output, seat->seatop_impl->render(seat, output, damage); } } - -bool seatop_allows_events(struct sway_seat *seat) { - return seat->seatop_impl && seat->seatop_impl->allows_events; -} 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 { bool moved; }; +static void handle_button(struct sway_seat *seat, uint32_t time_msec, + struct wlr_input_device *device, uint32_t button, + enum wlr_button_state state) { + seat_pointer_notify_button(seat, time_msec, button, state); +} + static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { struct seatop_down_event *e = seat->seatop_data; struct sway_container *con = e->con; @@ -54,11 +60,11 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) { } static const struct sway_seatop_impl seatop_impl = { + .button = handle_button, .motion = handle_motion, .finish = handle_finish, .abort = handle_abort, .unref = handle_unref, - .allows_events = true, }; void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, |