aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/libinput/pointer.c6
-rw-r--r--backend/wayland/wl_seat.c9
-rw-r--r--backend/x11/input_device.c6
3 files changed, 17 insertions, 4 deletions
diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c
index 9a39b66b..f628cf22 100644
--- a/backend/libinput/pointer.c
+++ b/backend/libinput/pointer.c
@@ -126,8 +126,10 @@ void handle_pointer_axis(struct libinput_event *event,
wlr_event.orientation = WLR_AXIS_ORIENTATION_HORIZONTAL;
break;
}
- wlr_event.delta = libinput_event_pointer_get_axis_value(
- pevent, axies[i]);
+ wlr_event.delta =
+ libinput_event_pointer_get_axis_value(pevent, axies[i]);
+ wlr_event.delta_discrete =
+ libinput_event_pointer_get_axis_value_discrete(pevent, axies[i]);
wlr_signal_emit_safe(&wlr_dev->pointer->events.axis, &wlr_event);
}
}
diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c
index 8191cb80..cf9b9372 100644
--- a/backend/wayland/wl_seat.c
+++ b/backend/wayland/wl_seat.c
@@ -111,11 +111,14 @@ static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer,
struct wlr_event_pointer_axis event = {
.device = &pointer->input_device->wlr_input_device,
.delta = wl_fixed_to_double(value),
+ .delta_discrete = pointer->axis_discrete,
.orientation = axis,
.time_msec = time,
.source = pointer->axis_source,
};
wlr_signal_emit_safe(&pointer->wlr_pointer.events.axis, &event);
+
+ pointer->axis_discrete = 0;
}
static void pointer_handle_frame(void *data, struct wl_pointer *wl_pointer) {
@@ -140,7 +143,13 @@ static void pointer_handle_axis_stop(void *data, struct wl_pointer *wl_pointer,
static void pointer_handle_axis_discrete(void *data, struct wl_pointer *wl_pointer,
uint32_t axis, int32_t discrete) {
+ struct wlr_wl_backend *backend = data;
+ struct wlr_wl_pointer *pointer = backend->current_pointer;
+ if (pointer == NULL) {
+ return;
+ }
+ pointer->axis_discrete = discrete;
}
static const struct wl_pointer_listener pointer_listener = {
diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c
index 75cfa76e..a16da1c9 100644
--- a/backend/x11/input_device.c
+++ b/backend/x11/input_device.c
@@ -73,13 +73,15 @@ void handle_x11_input_event(struct wlr_x11_backend *x11,
if (ev->detail == XCB_BUTTON_INDEX_4 ||
ev->detail == XCB_BUTTON_INDEX_5) {
- double delta = (ev->detail == XCB_BUTTON_INDEX_4 ? -15 : 15);
+ int32_t delta_discrete = ev->detail == XCB_BUTTON_INDEX_4 ? -1 : 1;
struct wlr_event_pointer_axis axis = {
.device = &output->pointer_dev,
.time_msec = ev->time,
.source = WLR_AXIS_SOURCE_WHEEL,
.orientation = WLR_AXIS_ORIENTATION_VERTICAL,
- .delta = delta,
+ // 15 is a typical value libinput sends for one scroll
+ .delta = delta_discrete * 15,
+ .delta_discrete = delta_discrete,
};
wlr_signal_emit_safe(&output->pointer.events.axis, &axis);
x11->time = ev->time;