Add scrolldistance option, allowing scroll distance to be configured in
the config file
This commit is contained in:
parent
10ed06bac8
commit
c9292de59d
|
@ -269,7 +269,10 @@ spmenu = {
|
||||||
{ click = "None"; button = "Scroll Up"; function = "moveprev"; argument = "0"; }, // Scroll Up: Move to the previous page
|
{ click = "None"; button = "Scroll Up"; function = "moveprev"; argument = "0"; }, // Scroll Up: Move to the previous page
|
||||||
{ click = "None"; button = "Scroll Down"; function = "movenext"; argument = "0"; }, // Scroll Down: Move to the next page
|
{ click = "None"; button = "Scroll Down"; function = "movenext"; argument = "0"; }, // Scroll Down: Move to the next page
|
||||||
|
|
||||||
{ ignoreglobalmouse = 1; } ); // Ignore hardcoded mouse binds (0/1)
|
{
|
||||||
|
scrolldistance = 512; // Distance to scroll for a scroll action to count (num)
|
||||||
|
ignoreglobalmouse = 1; // Ignore hardcoded mouse binds (0/1)
|
||||||
|
} );
|
||||||
|
|
||||||
/* Keys
|
/* Keys
|
||||||
*
|
*
|
||||||
|
|
|
@ -968,6 +968,7 @@ void conf_init(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
config_setting_lookup_int(conf, "ignoreglobalmouse", &sp.ignoreglobalmouse);
|
config_setting_lookup_int(conf, "ignoreglobalmouse", &sp.ignoreglobalmouse);
|
||||||
|
config_setting_lookup_int(conf, "scrolldistance", &scrolldistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ static int loadtheme = 1; /* Load theme (~/.config/spmenu/them
|
||||||
static int loadbinds = 1; /* Load keybind file (~/.config/spmenu/binds.conf) on runtime */
|
static int loadbinds = 1; /* Load keybind file (~/.config/spmenu/binds.conf) on runtime */
|
||||||
static int mon = -1; /* Monitor to run spmenu on */
|
static int mon = -1; /* Monitor to run spmenu on */
|
||||||
|
|
||||||
|
/* Wayland options */
|
||||||
|
static int scrolldistance = 512; /* Distance to scroll for a scroll action to count */
|
||||||
|
|
||||||
/* Config file options */
|
/* Config file options */
|
||||||
#if USECONFIG
|
#if USECONFIG
|
||||||
static char *configfile = NULL; /* Config file path. Default is ~/.config/spmenu/spmenu.conf */
|
static char *configfile = NULL; /* Config file path. Default is ~/.config/spmenu/spmenu.conf */
|
||||||
|
|
|
@ -382,14 +382,19 @@ void pointer_motion_handler(void *data, struct wl_pointer *pointer, uint32_t tim
|
||||||
}
|
}
|
||||||
|
|
||||||
void pointer_axis_handler(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value) {
|
void pointer_axis_handler(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value) {
|
||||||
mouse_scroll = 1;
|
if (value > scrolldistance) {
|
||||||
|
|
||||||
if (value > 0) {
|
|
||||||
mouse_scroll_direction = 0;
|
mouse_scroll_direction = 0;
|
||||||
} else {
|
} else if (value < -scrolldistance) {
|
||||||
mouse_scroll_direction = 1;
|
mouse_scroll_direction = 1;
|
||||||
|
} else {
|
||||||
|
mouse_scroll = 0;
|
||||||
|
mouse_scroll_direction = -1;
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mouse_scroll = 1;
|
||||||
|
|
||||||
buttonpress_wl(mouse_scroll_direction, mouse_x, mouse_y);
|
buttonpress_wl(mouse_scroll_direction, mouse_x, mouse_y);
|
||||||
|
|
||||||
mouse_scroll = 0;
|
mouse_scroll = 0;
|
||||||
|
|
Loading…
Reference in a new issue