*<mouse><doubleClickTime>*
Set double click time in milliseconds. Default is 500.
-*<mouse><scrollFactor>*
- Set scroll factor. Default is 1.0.
-
*<mouse><context name=""><mousebind button="" direction="" action=""><action>*
Multiple *<mousebind>* can exist within one *<context>*; and multiple
*<action>* can exist within one *<mousebind>*.
<clickMethod></clickMethod>
<sendEventsMode></sendEventsMode>
<calibrationMatrix></calibrationMatrix>
+ <scrollFactor>1.0</scrollFactor>
</device>
</libinput>
```
visit https://wayland.freedesktop.org/libinput/doc/latest/absolute-axes.html#calibration-of-absolute-devices
for more information.
+*<libinput><scrollFactor>*
+ Set scroll factor. Default is 1.0.
+
## WINDOW RULES
Two types of window rules are supported, actions and properties. They are
<!-- time is in ms -->
<doubleClickTime>500</doubleClickTime>
- <scrollFactor>1.0</scrollFactor>
<context name="Frame">
<mousebind button="A-Left" action="Press">
- clickMethod [none|buttonAreas|clickfinger]
- sendEventsMode [yes|no|disabledOnExternalMouse]
- calibrationMatrix [six float values split by space]
+ - scrollFactor [float]
-->
<libinput>
<device category="default">
<clickMethod></clickMethod>
<sendEventsMode></sendEventsMode>
<calibrationMatrix></calibrationMatrix>
+ <scrollFactor>1.0</scrollFactor>
</device>
</libinput>
int click_method; /* -1 or libinput_config_click_method */
int send_events_mode; /* -1 or libinput_config_send_events_mode */
bool have_calibration_matrix;
+ double scroll_factor;
float calibration_matrix[6];
};
/* mouse */
long doubleclick_time; /* in ms */
struct wl_list mousebinds; /* struct mousebind.link */
- double scroll_factor;
/* touch tablet */
struct wl_list touch_configs;
struct input {
struct wlr_input_device *wlr_input_device;
struct seat *seat;
+ /* Set for pointer/touch devices */
+ double scroll_factor;
struct wl_listener destroy;
struct wl_list link; /* seat.inputs */
};
l->click_method = -1;
l->send_events_mode = -1;
l->have_calibration_matrix = false;
+ l->scroll_factor = 1.0;
}
enum lab_libinput_device_type
static struct action *current_window_rule_action;
static struct view_query *current_view_query;
static struct action *current_child_action;
+/* for backword compatibility of <mouse><scrollFactor> */
+static double mouse_scroll_factor = -1;
enum font_place {
FONT_PLACE_NONE = 0,
current_libinput_category->have_calibration_matrix = false;
}
g_strfreev(elements);
+ } else if (!strcasecmp(nodename, "scrollFactor")) {
+ set_double(content, ¤t_libinput_category->scroll_factor);
}
}
wlr_log(WLR_ERROR, "invalid doubleClickTime");
}
} else if (!strcasecmp(nodename, "scrollFactor.mouse")) {
- set_double(content, &rc.scroll_factor);
+ /* This is deprecated. Show an error message in post_processing() */
+ set_double(content, &mouse_scroll_factor);
} else if (!strcasecmp(nodename, "name.context.mouse")) {
current_mouse_context = content;
current_mousebind = NULL;
rc.raise_on_focus = false;
rc.doubleclick_time = 500;
- rc.scroll_factor = 1.0;
rc.tablet.force_mouse_emulation = false;
rc.tablet.output_name = NULL;
rc.font_osd.name = xstrdup("sans");
}
if (!libinput_category_get_default()) {
- /* So we still allow tap to click by default */
+ /* So we set default values of <tap> and <scrollFactor> */
struct libinput_category *l = libinput_category_create();
/* Prevents unused variable warning when compiled without asserts */
(void)l;
assert(l && libinput_category_get_default() == l);
}
+ if (mouse_scroll_factor >= 0) {
+ wlr_log(WLR_ERROR, "<mouse><scrollFactor> is deprecated"
+ " and overwrites <libinput><scrollFactor>."
+ " Use only <libinput><scrollFactor>.");
+ struct libinput_category *l;
+ wl_list_for_each(l, &rc.libinput_categories, link) {
+ l->scroll_factor = mouse_scroll_factor;
+ }
+ }
int nr_workspaces = wl_list_length(&rc.workspace_config.workspaces);
if (nr_workspaces < rc.workspace_config.min_nr_workspaces) {
current_field = NULL;
current_window_rule = NULL;
current_window_rule_action = NULL;
+ mouse_scroll_factor = -1;
}
struct seat *seat = wl_container_of(listener, seat, cursor_axis);
struct wlr_pointer_axis_event *event = data;
struct server *server = seat->server;
+
+ /* input->scroll_factor is set for pointer/touch devices */
+ assert(event->pointer->base.type == WLR_INPUT_DEVICE_POINTER
+ || event->pointer->base.type == WLR_INPUT_DEVICE_TOUCH);
+ struct input *input = event->pointer->base.data;
+ double scroll_factor = input->scroll_factor;
+
struct cursor_context ctx = get_cursor_context(server);
idle_manager_notify_activity(seat->seat);
/* Notify the client with pointer focus of the axis event. */
wlr_seat_pointer_notify_axis(seat->seat, event->time_msec,
- event->orientation, rc.scroll_factor * event->delta,
- round(rc.scroll_factor * event->delta_discrete),
+ event->orientation, scroll_factor * event->delta,
+ round(scroll_factor * event->delta_discrete),
event->source, event->relative_direction);
}
}
wlr_log(WLR_ERROR, "no wlr_input_device");
return;
}
+ struct input *input = wlr_input_device->data;
+
+ /* Set scroll factor to 1.0 for Wayland/X11 backends or virtual pointers */
if (!wlr_input_device_is_libinput(wlr_input_device)) {
+ input->scroll_factor = 1.0;
return;
}
wlr_log(WLR_INFO, "calibration matrix configured");
libinput_device_config_calibration_set_matrix(libinput_dev, dc->calibration_matrix);
}
+
+ wlr_log(WLR_INFO, "scroll factor configured");
+ input->scroll_factor = dc->scroll_factor;
}
static struct wlr_output *
{
struct input *input = znew(*input);
input->wlr_input_device = dev;
+ dev->data = input;
configure_libinput(dev);
wlr_cursor_attach_input_device(seat->cursor, dev);
{
struct input *input = znew(*input);
input->wlr_input_device = dev;
+ dev->data = input;
configure_libinput(dev);
wlr_cursor_attach_input_device(seat->cursor, dev);
/* In support of running with WLR_WL_OUTPUTS set to >=2 */