[mutter/gnome-3-26] backends/native: Fix handling of trackball settings
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-26] backends/native: Fix handling of trackball settings
- Date: Thu, 26 Oct 2017 11:13:55 +0000 (UTC)
commit 6ef08c5018c8311653b49f85d3545facf0517279
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Oct 4 18:58:13 2017 +0200
backends/native: Fix handling of trackball settings
The org.gnome.desktop.peripherals.trackball.scroll-wheel-emulation-button
setting contains buttons X11-style. Work out the BTN evcode that applies
to it when applying the setting on the libinput device.
https://bugzilla.gnome.org/show_bug.cgi?id=787804
src/backends/native/meta-input-settings-native.c | 23 +++++++++++++++++++--
1 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/native/meta-input-settings-native.c
b/src/backends/native/meta-input-settings-native.c
index 8a62bb3..beb7217 100644
--- a/src/backends/native/meta-input-settings-native.c
+++ b/src/backends/native/meta-input-settings-native.c
@@ -245,16 +245,33 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
guint button)
{
struct libinput_device *libinput_device;
+ enum libinput_config_scroll_method method;
+ guint evcode;
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
if (!libinput_device)
return;
- if (!device_set_scroll_method (libinput_device,
- LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN))
+ if (button == 0)
+ {
+ method = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
+ evcode = 0;
+ }
+ else
+ {
+ /* Compensate for X11 scroll buttons */
+ if (button > 7)
+ button -= 4;
+
+ /* Button is 1-indexed */
+ evcode = (BTN_LEFT - 1) + button;
+ method = LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
+ }
+
+ if (!device_set_scroll_method (libinput_device, method))
return;
- libinput_device_config_scroll_set_button (libinput_device, button);
+ libinput_device_config_scroll_set_button (libinput_device, evcode);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]