return false;
}
+static enum libinput_config_accel_profile
+get_accel_profile(const char *s)
+{
+ if (!s) {
+ return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
+ }
+ if (!strcasecmp(s, "flat")) {
+ return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
+ }
+ if (!strcasecmp(s, "adaptive")) {
+ return LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
+ }
+ return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
+}
+
static void
fill_font(char *nodename, char *content, enum font_place place)
{
}
} else if (!strcasecmp(nodename, "name.context.mouse")) {
current_mouse_context = content;
+ } else if (!strcasecmp(nodename, "PointerSpeed.libinput")) {
+ rc.pointer_speed = atof(content);
+ } else if (!strcasecmp(nodename, "NaturalScroll.libinput")) {
+ rc.natural_scroll = get_bool(content) ? 1 : 0;
+ } else if (!strcasecmp(nodename, "LeftHanded.libinput")) {
+ rc.left_handed = get_bool(content) ? 1 : 0;
+ } else if (!strcasecmp(nodename, "Tap.libinput")) {
+ rc.tap = get_bool(content) ? LIBINPUT_CONFIG_TAP_ENABLED :
+ LIBINPUT_CONFIG_TAP_DISABLED;
+ } else if (!strcasecmp(nodename, "MiddleEmulation.libinput")) {
+ rc.middle_emu = get_bool(content) ?
+ LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED :
+ LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED;
+ } else if (!strcasecmp(nodename, "DisableWhileTyping.libinput")) {
+ rc.dwt = get_bool(content) ? LIBINPUT_CONFIG_DWT_ENABLED :
+ LIBINPUT_CONFIG_DWT_DISABLED;
+ } else if (!strcasecmp(nodename, "AccelerationProfile.libinput")) {
+ rc.accel_profile = get_accel_profile(content);
}
}
rc.font_size_activewindow = 10;
rc.font_size_menuitem = 10;
rc.doubleclick_time = 500;
+ rc.pointer_speed = -2;
+ rc.natural_scroll = -1;
+ rc.left_handed = -1;
+ rc.tap = LIBINPUT_CONFIG_TAP_ENABLED;
+ rc.accel_profile = -1;
+ rc.middle_emu = -1;
+ rc.dwt = -1;
}
static struct {
wlr_log(WLR_ERROR, "no libinput_dev");
return;
}
+
if (libinput_device_config_tap_get_finger_count(libinput_dev) <= 0) {
- return;
+ wlr_log(WLR_INFO, "tap unavailable");
+ } else {
+ wlr_log(WLR_INFO, "tap configured");
+ libinput_device_config_tap_set_enabled(libinput_dev, rc.tap);
+ }
+
+ if (libinput_device_config_scroll_has_natural_scroll(libinput_dev) <= 0
+ || rc.natural_scroll < 0) {
+ wlr_log(WLR_INFO, "natural scroll not configured");
+ } else {
+ wlr_log(WLR_INFO, "natural scroll configured");
+ libinput_device_config_scroll_set_natural_scroll_enabled(
+ libinput_dev, rc.natural_scroll);
+ }
+
+ if (libinput_device_config_left_handed_is_available(libinput_dev) <= 0
+ || rc.left_handed < 0) {
+ wlr_log(WLR_INFO, "left-handed mode not configured");
+ } else {
+ wlr_log(WLR_INFO, "left-handed mode configured");
+ libinput_device_config_left_handed_set(libinput_dev,
+ rc.left_handed);
+ }
+
+ if (libinput_device_config_accel_is_available(libinput_dev) == 0) {
+ wlr_log(WLR_INFO, "pointer acceleration unavailable");
+ } else {
+ wlr_log(WLR_INFO, "pointer acceleration configured");
+ if (rc.pointer_speed > -1) {
+ libinput_device_config_accel_set_speed(libinput_dev,
+ rc.pointer_speed);
+ }
+ if (rc.accel_profile > 0) {
+ libinput_device_config_accel_set_profile(libinput_dev,
+ rc.accel_profile);
+ }
+ }
+
+ if (libinput_device_config_middle_emulation_is_available(libinput_dev)
+ == 0 || rc.dwt < 0) {
+ wlr_log(WLR_INFO, "middle emulation not configured");
+ } else {
+ wlr_log(WLR_INFO, "middle emulation configured");
+ libinput_device_config_middle_emulation_set_enabled(
+ libinput_dev, rc.middle_emu);
+ }
+
+ if (libinput_device_config_dwt_is_available(libinput_dev) == 0
+ || rc.dwt < 0) {
+ wlr_log(WLR_INFO, "dwt not configured");
+ } else {
+ wlr_log(WLR_INFO, "dwt configured");
+ libinput_device_config_dwt_set_enabled(libinput_dev, rc.dwt);
}
- wlr_log(WLR_INFO, "tap enabled");
- libinput_device_config_tap_set_enabled(libinput_dev,
- LIBINPUT_CONFIG_TAP_ENABLED);
}
void