aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/input/seatop_down.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c
index 95ea7cbb..04de894d 100644
--- a/sway/input/seatop_down.c
+++ b/sway/input/seatop_down.c
@@ -1,4 +1,5 @@
1#define _POSIX_C_SOURCE 200809L 1#define _POSIX_C_SOURCE 200809L
2#include <float.h>
2#include <wlr/types/wlr_cursor.h> 3#include <wlr/types/wlr_cursor.h>
3#include "sway/input/cursor.h" 4#include "sway/input/cursor.h"
4#include "sway/input/seat.h" 5#include "sway/input/seat.h"
@@ -11,6 +12,20 @@ struct seatop_down_event {
11 double ref_con_lx, ref_con_ly; // container's x/y at start of op 12 double ref_con_lx, ref_con_ly; // container's x/y at start of op
12}; 13};
13 14
15static void handle_axis(struct sway_seat *seat,
16 struct wlr_event_pointer_axis *event) {
17 struct sway_input_device *input_device =
18 event->device ? event->device->data : NULL;
19 struct input_config *ic =
20 input_device ? input_device_get_config(input_device) : NULL;
21 float scroll_factor =
22 (ic == NULL || ic->scroll_factor == FLT_MIN) ? 1.0f : ic->scroll_factor;
23
24 wlr_seat_pointer_notify_axis(seat->wlr_seat, event->time_msec,
25 event->orientation, scroll_factor * event->delta,
26 round(scroll_factor * event->delta_discrete), event->source);
27}
28
14static void handle_button(struct sway_seat *seat, uint32_t time_msec, 29static void handle_button(struct sway_seat *seat, uint32_t time_msec,
15 struct wlr_input_device *device, uint32_t button, 30 struct wlr_input_device *device, uint32_t button,
16 enum wlr_button_state state) { 31 enum wlr_button_state state) {
@@ -42,6 +57,7 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
42} 57}
43 58
44static const struct sway_seatop_impl seatop_impl = { 59static const struct sway_seatop_impl seatop_impl = {
60 .axis = handle_axis,
45 .button = handle_button, 61 .button = handle_button,
46 .motion = handle_motion, 62 .motion = handle_motion,
47 .unref = handle_unref, 63 .unref = handle_unref,