mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-10-26 17:54:14 +00:00
implement scroll factor
This commit is contained in:
parent
1884a07646
commit
ae4ac6d3b7
@ -66,6 +66,7 @@ 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;
|
||||
static const double scroll_factor = 1;
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
|
||||
LIBINPUT_CONFIG_SCROLL_2FG
|
||||
|
||||
15
dwl.c
15
dwl.c
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* See LICENSE file for copyright and license details.
|
||||
*/
|
||||
#include <dlfcn.h>
|
||||
#include <getopt.h>
|
||||
#include <libinput.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
@ -226,6 +227,8 @@ typedef struct {
|
||||
struct wl_listener destroy;
|
||||
} SessionLock;
|
||||
|
||||
typedef double (*hooked_axis_t)(struct libinput_event_pointer*, enum libinput_pointer_axis);
|
||||
|
||||
/* function declarations */
|
||||
static void applybounds(Client *c, struct wlr_box *bbox);
|
||||
static void applyrules(Client *c);
|
||||
@ -978,6 +981,18 @@ createnotify(struct wl_listener *listener, void *data)
|
||||
LISTEN(&xdg_surface->toplevel->events.set_title, &c->set_title, updatetitle);
|
||||
}
|
||||
|
||||
double
|
||||
libinput_event_pointer_get_scroll_value(struct libinput_event_pointer* event, enum libinput_pointer_axis axis)
|
||||
{
|
||||
void* sym = dlsym(RTLD_NEXT, "libinput_event_pointer_get_scroll_value");
|
||||
hooked_axis_t hooked = *(hooked_axis_t*)(&sym);
|
||||
if (axis == LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL) {
|
||||
return hooked(event, axis) * scroll_factor;
|
||||
} else {
|
||||
return hooked(event, axis) * scroll_factor;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
createpointer(struct wlr_pointer *pointer)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user