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.

(cherry picked from commit 8490384c68)
This commit is contained in:
Jakub Schmidtke 2019-09-30 23:34:45 +00:00 committed by Peter Hutterer
parent a7d2b749f3
commit 62382f7d79
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

@ -357,6 +357,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;
@ -1841,6 +1846,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

@ -239,6 +239,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,