mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-06 19:24:51 +00:00
55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
From 3e765d49976685a8772bd3e12a8c5546868a97f7 Mon Sep 17 00:00:00 2001
|
|
From: SD Asif Hossein <s.dah.ingularity47@gmail.com>
|
|
Date: Fri, 12 Jul 2024 14:28:06 +0600
|
|
Subject: [PATCH] Added scroll-factor patch
|
|
|
|
---
|
|
config.def.h | 3 +++
|
|
dwl.c | 11 +++++++++--
|
|
2 files changed, 12 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
index 22d2171..83c4b87 100644
|
|
--- a/config.def.h
|
|
+++ b/config.def.h
|
|
@@ -71,6 +71,9 @@ static const int natural_scrolling = 0;
|
|
static const int disable_while_typing = 1;
|
|
static const int left_handed = 0;
|
|
static const int middle_button_emulation = 0;
|
|
+/* Scroll sensitivity */
|
|
+static const double scroll_factor = 1.0f;
|
|
+
|
|
/* You can choose between:
|
|
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
|
|
LIBINPUT_CONFIG_SCROLL_2FG
|
|
diff --git a/dwl.c b/dwl.c
|
|
index dc0437e..7e8d50d 100644
|
|
--- a/dwl.c
|
|
+++ b/dwl.c
|
|
@@ -581,13 +581,20 @@ axisnotify(struct wl_listener *listener, void *data)
|
|
/* This event is forwarded by the cursor when a pointer emits an axis event,
|
|
* for example when you move the scroll wheel. */
|
|
struct wlr_pointer_axis_event *event = data;
|
|
+ double delta = event->delta;
|
|
+ int32_t delta_disc = event->delta_discrete;
|
|
+ if(event->source == WLR_AXIS_SOURCE_FINGER) {
|
|
+ delta *= scroll_factor;
|
|
+ delta_disc = (int32_t)round(scroll_factor * delta_disc);
|
|
+ }
|
|
+
|
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
|
/* TODO: allow usage of scroll whell for mousebindings, it can be implemented
|
|
* checking the event's orientation and the delta of the event */
|
|
/* Notify the client with pointer focus of the axis event. */
|
|
wlr_seat_pointer_notify_axis(seat,
|
|
- event->time_msec, event->orientation, event->delta,
|
|
- event->delta_discrete, event->source);
|
|
+ event->time_msec, event->orientation, delta,
|
|
+ delta_disc, event->source);
|
|
}
|
|
|
|
void
|
|
--
|
|
2.45.2
|
|
|