From: Jakub Schmidtke Date: Mon, 30 Sep 2019 23:34:45 +0000 (+0000) Subject: Fixed horizontal scrolling on Logitech MX Master 2S/3 X-Git-Tag: 1.14.2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62382f7d7989ffef7cbe4fac57c0891027a3af58;p=platform%2Fupstream%2Flibinput.git 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 8490384c688f6e6045414991a17d2c4a69cec858) --- diff --git a/quirks/30-vendor-logitech.quirks b/quirks/30-vendor-logitech.quirks index 7292234e..d864c208 100644 --- a/quirks/30-vendor-logitech.quirks +++ b/quirks/30-vendor-logitech.quirks @@ -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 diff --git a/src/evdev.c b/src/evdev.c index 353aff5b..99713f2c 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -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); } diff --git a/src/evdev.h b/src/evdev.h index dd5b45d5..7de1fea9 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -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; diff --git a/src/quirks.c b/src/quirks.c index 444cdfaa..7c0b75a4 100644 --- a/src/quirks.c +++ b/src/quirks.c @@ -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"; diff --git a/src/quirks.h b/src/quirks.h index dd9265d2..88159b59 100644 --- a/src/quirks.h +++ b/src/quirks.h @@ -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,