-
Notifications
You must be signed in to change notification settings - Fork 1
/
multiplier.patch
77 lines (73 loc) · 2.24 KB
/
multiplier.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
diff --git a/src/evdev.c b/src/evdev.c
index f332bc1..0dbb4e0 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1369,6 +1369,7 @@ evdev_read_wheel_click_props(struct evdev_device *device)
} else {
angles.x = angles.y;
}
+ // angles.y = 361; // cause page down in sway
return angles;
}
diff --git a/src/libinput.c b/src/libinput.c
index a0c8504..112f96d 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -33,6 +33,9 @@
#include <sys/epoll.h>
#include <unistd.h>
#include <assert.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
#include "libinput.h"
#include "libinput-private.h"
@@ -747,6 +750,16 @@ libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event,
return value;
}
+static char *multiplier="1";
+static void libinput_discrete_deltay_multiplier(void) {
+ int fd;
+ char *file = "/tmp/libinput_discrete_deltay_multiplier";
+ if ((fd = open(file, O_RDWR | O_CREAT, 0666)) == -1) return;
+ fchmod(fd,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
+ if (write(fd, "1", sizeof(char)) == -1) return;
+ multiplier = mmap(NULL, 1024, PROT_READ, MAP_SHARED, fd, 0);
+}
+
LIBINPUT_EXPORT double
libinput_event_pointer_get_axis_value_discrete(struct libinput_event_pointer *event,
enum libinput_pointer_axis axis)
@@ -764,10 +777,10 @@ libinput_event_pointer_get_axis_value_discrete(struct libinput_event_pointer *ev
} else {
switch (axis) {
case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
- value = event->discrete.x;
+ value = event->discrete.x * atoi(multiplier);
break;
case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
- value = event->discrete.y;
+ value = event->discrete.y * atoi(multiplier);
break;
}
}
@@ -820,10 +833,10 @@ libinput_event_pointer_get_scroll_value_v120(struct libinput_event_pointer *even
} else {
switch (axis) {
case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
- value = event->v120.x;
+ value = event->v120.x * atoi(multiplier);
break;
case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
- value = event->v120.y;
+ value = event->v120.y * atoi(multiplier);
break;
}
}
@@ -1874,6 +1887,7 @@ libinput_init(struct libinput *libinput,
close(libinput->epoll_fd);
return -1;
}
+ libinput_discrete_deltay_multiplier();
return 0;
}