Fixed horizontal scrolling on Logitech MX Master 2S/3

Logitech MX Master 2S and 3 by default use natural scrolling
for the horizontal scroll wheel, while the main wheel
uses traditional mode. This change inverts the default
direction of horizontal scrolling.
This commit is contained in:
Jakub Schmidtke 2019-09-30 23:34:45 +00:00 committed by Peter Hutterer
parent df7b82588d
commit 8490384c68
5 changed files with 25 additions and 0 deletions

View file

@ -45,3 +45,13 @@ MatchBus=usb
MatchVendor=0x046D
MatchProduct=0x4011
AttrPalmPressureThreshold=400
[Logitech MX Master 2S]
MatchVendor=0x46D
MatchProduct=0x4069
ModelInvertHorizontalScrolling=1
[Logitech MX Master 3]
MatchVendor=0x46D
MatchProduct=0x4082
ModelInvertHorizontalScrolling=1

View file

@ -356,6 +356,11 @@ evdev_notify_axis(struct evdev_device *device,
struct normalized_coords delta = *delta_in;
struct discrete_coords discrete = *discrete_in;
if (device->scroll.invert_horizontal_scrolling) {
delta.x *= -1;
discrete.x *= -1;
}
if (device->scroll.natural_scrolling_enabled) {
delta.x *= -1;
delta.y *= -1;
@ -1840,6 +1845,10 @@ evdev_configure_device(struct evdev_device *device)
return NULL;
}
if (evdev_device_has_model_quirk(device, QUIRK_MODEL_INVERT_HORIZONTAL_SCROLLING)) {
device->scroll.invert_horizontal_scrolling = true;
}
return fallback_dispatch_create(&device->base);
}

View file

@ -216,6 +216,10 @@ struct evdev_device {
* used at runtime to enable/disable the feature */
bool natural_scrolling_enabled;
/* set during device init to invert direction of
* horizontal scrolling */
bool invert_horizontal_scrolling;
/* angle per REL_WHEEL click in degrees */
struct wheel_angle wheel_click_angle;

View file

@ -238,6 +238,7 @@ quirk_get_name(enum quirk q)
case QUIRK_MODEL_HP_PAVILION_DM4_TOUCHPAD: return "ModelHPPavilionDM4Touchpad";
case QUIRK_MODEL_HP_STREAM11_TOUCHPAD: return "ModelHPStream11Touchpad";
case QUIRK_MODEL_HP_ZBOOK_STUDIO_G3: return "ModelHPZBookStudioG3";
case QUIRK_MODEL_INVERT_HORIZONTAL_SCROLLING: return "ModelInvertHorizontalScrolling";
case QUIRK_MODEL_LENOVO_L380_TOUCHPAD: return "ModelLenovoL380Touchpad";
case QUIRK_MODEL_LENOVO_SCROLLPOINT: return "ModelLenovoScrollPoint";
case QUIRK_MODEL_LENOVO_T450_TOUCHPAD: return "ModelLenovoT450Touchpad";

View file

@ -71,6 +71,7 @@ enum quirk {
QUIRK_MODEL_HP_PAVILION_DM4_TOUCHPAD,
QUIRK_MODEL_HP_STREAM11_TOUCHPAD,
QUIRK_MODEL_HP_ZBOOK_STUDIO_G3,
QUIRK_MODEL_INVERT_HORIZONTAL_SCROLLING,
QUIRK_MODEL_LENOVO_L380_TOUCHPAD,
QUIRK_MODEL_LENOVO_SCROLLPOINT,
QUIRK_MODEL_LENOVO_T450_TOUCHPAD,