|
|
6cef2e |
From 42a526581d1216d835dbbbeab5a7bdb75b349179 Mon Sep 17 00:00:00 2001
|
|
|
6cef2e |
From: Jason Gerecke <killertofu@gmail.com>
|
|
|
6cef2e |
Date: Tue, 10 Oct 2017 09:18:25 -0700
|
|
|
6cef2e |
Subject: [PATCH 1/2] clutter/evdev: Add support for BTN_STYLUS3
|
|
|
6cef2e |
|
|
|
6cef2e |
BTN_STYLUS3 is defined by the Linux 4.15 kernel and is sent when the
|
|
|
6cef2e |
third button on a stylus is pressed. At the moment, only Wacom's "Pro
|
|
|
6cef2e |
Pen 3D" has three stylus buttons. Pressing this button triggers a button
|
|
|
6cef2e |
8 event to be sent under X11, so we use the same mapping here.
|
|
|
6cef2e |
|
|
|
6cef2e |
https://bugzilla.gnome.org/show_bug.cgi?id=790033
|
|
|
6cef2e |
---
|
|
|
6cef2e |
clutter/clutter/evdev/clutter-seat-evdev.c | 8 ++++++++
|
|
|
6cef2e |
1 file changed, 8 insertions(+)
|
|
|
6cef2e |
|
|
|
6cef2e |
diff --git a/clutter/clutter/evdev/clutter-seat-evdev.c b/clutter/clutter/evdev/clutter-seat-evdev.c
|
|
|
6cef2e |
index e8524da..f98f85a 100644
|
|
|
6cef2e |
--- a/clutter/clutter/evdev/clutter-seat-evdev.c
|
|
|
6cef2e |
+++ b/clutter/clutter/evdev/clutter-seat-evdev.c
|
|
|
6cef2e |
@@ -45,6 +45,10 @@
|
|
|
6cef2e |
|
|
|
6cef2e |
#define DISCRETE_SCROLL_STEP 10.0
|
|
|
6cef2e |
|
|
|
6cef2e |
+#ifndef BTN_STYLUS3
|
|
|
6cef2e |
+#define BTN_STYLUS3 0x149 /* Linux 4.15 */
|
|
|
6cef2e |
+#endif
|
|
|
6cef2e |
+
|
|
|
6cef2e |
void
|
|
|
6cef2e |
clutter_seat_evdev_set_libinput_seat (ClutterSeatEvdev *seat,
|
|
|
6cef2e |
struct libinput_seat *libinput_seat)
|
|
|
6cef2e |
@@ -492,6 +496,10 @@ clutter_seat_evdev_notify_button (ClutterSeatEvdev *seat,
|
|
|
6cef2e |
button_nr = CLUTTER_BUTTON_MIDDLE;
|
|
|
6cef2e |
break;
|
|
|
6cef2e |
|
|
|
6cef2e |
+ case 0x149: /* BTN_STYLUS3 */
|
|
|
6cef2e |
+ button_nr = 8;
|
|
|
6cef2e |
+ break;
|
|
|
6cef2e |
+
|
|
|
6cef2e |
default:
|
|
|
6cef2e |
/* For compatibility reasons, all additional buttons go after the old 4-7 scroll ones */
|
|
|
6cef2e |
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
|
|
|
6cef2e |
--
|
|
|
6cef2e |
2.17.0
|
|
|
6cef2e |
|
|
|
6cef2e |
|
|
|
6cef2e |
From c42c5294d0ca3d27001f217974cad72a40ffae60 Mon Sep 17 00:00:00 2001
|
|
|
6cef2e |
From: Jason Gerecke <killertofu@gmail.com>
|
|
|
6cef2e |
Date: Tue, 10 Oct 2017 08:55:41 -0700
|
|
|
6cef2e |
Subject: [PATCH 2/2] backends: Add support for Wacom stylus
|
|
|
6cef2e |
tertiary-button-action
|
|
|
6cef2e |
|
|
|
6cef2e |
The tertiary-button-action (see bug 790028) is a place for g-c-c to store
|
|
|
6cef2e |
the action which should be performed when a stylus' third button is pressed.
|
|
|
6cef2e |
Pressing this button is signaled as a BTN_STYLUS3 event from the kernel or
|
|
|
6cef2e |
X11 button 8.
|
|
|
6cef2e |
|
|
|
6cef2e |
https://bugzilla.gnome.org/show_bug.cgi?id=790033
|
|
|
6cef2e |
---
|
|
|
6cef2e |
src/backends/meta-input-settings-private.h | 3 ++-
|
|
|
6cef2e |
src/backends/meta-input-settings.c | 5 +++--
|
|
|
6cef2e |
src/backends/native/meta-input-settings-native.c | 5 ++++-
|
|
|
6cef2e |
src/backends/x11/meta-input-settings-x11.c | 10 ++++++++--
|
|
|
6cef2e |
4 files changed, 17 insertions(+), 6 deletions(-)
|
|
|
6cef2e |
|
|
|
6cef2e |
diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h
|
|
|
6cef2e |
index 605690e..893d4ec 100644
|
|
|
6cef2e |
--- a/src/backends/meta-input-settings-private.h
|
|
|
6cef2e |
+++ b/src/backends/meta-input-settings-private.h
|
|
|
6cef2e |
@@ -111,7 +111,8 @@ struct _MetaInputSettingsClass
|
|
|
6cef2e |
ClutterInputDevice *device,
|
|
|
6cef2e |
ClutterInputDeviceTool *tool,
|
|
|
6cef2e |
GDesktopStylusButtonAction primary,
|
|
|
6cef2e |
- GDesktopStylusButtonAction secondary);
|
|
|
6cef2e |
+ GDesktopStylusButtonAction secondary,
|
|
|
6cef2e |
+ GDesktopStylusButtonAction tertiary);
|
|
|
6cef2e |
gboolean (* has_two_finger_scroll) (MetaInputSettings *settings,
|
|
|
6cef2e |
ClutterInputDevice *device);
|
|
|
6cef2e |
};
|
|
|
6cef2e |
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
|
|
|
6cef2e |
index ec0fc9f..989f9e3 100644
|
|
|
6cef2e |
--- a/src/backends/meta-input-settings.c
|
|
|
6cef2e |
+++ b/src/backends/meta-input-settings.c
|
|
|
6cef2e |
@@ -1453,7 +1453,7 @@ update_stylus_buttonmap (MetaInputSettings *input_settings,
|
|
|
6cef2e |
ClutterInputDeviceTool *tool)
|
|
|
6cef2e |
{
|
|
|
6cef2e |
MetaInputSettingsClass *input_settings_class;
|
|
|
6cef2e |
- GDesktopStylusButtonAction primary, secondary;
|
|
|
6cef2e |
+ GDesktopStylusButtonAction primary, secondary, tertiary;
|
|
|
6cef2e |
GSettings *tool_settings;
|
|
|
6cef2e |
|
|
|
6cef2e |
if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE &&
|
|
|
6cef2e |
@@ -1468,10 +1468,11 @@ update_stylus_buttonmap (MetaInputSettings *input_settings,
|
|
|
6cef2e |
|
|
|
6cef2e |
primary = g_settings_get_enum (tool_settings, "button-action");
|
|
|
6cef2e |
secondary = g_settings_get_enum (tool_settings, "secondary-button-action");
|
|
|
6cef2e |
+ tertiary = g_settings_get_enum (tool_settings, "tertiary-button-action");
|
|
|
6cef2e |
|
|
|
6cef2e |
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
|
|
6cef2e |
input_settings_class->set_stylus_button_map (input_settings, device, tool,
|
|
|
6cef2e |
- primary, secondary);
|
|
|
6cef2e |
+ primary, secondary, tertiary);
|
|
|
6cef2e |
}
|
|
|
6cef2e |
|
|
|
6cef2e |
static void
|
|
|
6cef2e |
diff --git a/src/backends/native/meta-input-settings-native.c b/src/backends/native/meta-input-settings-native.c
|
|
|
6cef2e |
index beb7217..7450725 100644
|
|
|
6cef2e |
--- a/src/backends/native/meta-input-settings-native.c
|
|
|
6cef2e |
+++ b/src/backends/native/meta-input-settings-native.c
|
|
|
6cef2e |
@@ -547,12 +547,15 @@ meta_input_settings_native_set_stylus_button_map (MetaInputSettings *se
|
|
|
6cef2e |
ClutterInputDevice *device,
|
|
|
6cef2e |
ClutterInputDeviceTool *tool,
|
|
|
6cef2e |
GDesktopStylusButtonAction primary,
|
|
|
6cef2e |
- GDesktopStylusButtonAction secondary)
|
|
|
6cef2e |
+ GDesktopStylusButtonAction secondary,
|
|
|
6cef2e |
+ GDesktopStylusButtonAction tertiary)
|
|
|
6cef2e |
{
|
|
|
6cef2e |
clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_MIDDLE,
|
|
|
6cef2e |
action_to_evcode (primary));
|
|
|
6cef2e |
clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_SECONDARY,
|
|
|
6cef2e |
action_to_evcode (secondary));
|
|
|
6cef2e |
+ clutter_evdev_input_device_tool_set_button_code (tool, 8, /* Back */
|
|
|
6cef2e |
+ action_to_evcode (tertiary));
|
|
|
6cef2e |
}
|
|
|
6cef2e |
|
|
|
6cef2e |
static void
|
|
|
6cef2e |
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
|
|
|
6cef2e |
index 4867b6b..7d5239f 100644
|
|
|
6cef2e |
--- a/src/backends/x11/meta-input-settings-x11.c
|
|
|
6cef2e |
+++ b/src/backends/x11/meta-input-settings-x11.c
|
|
|
6cef2e |
@@ -1031,7 +1031,8 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
|
|
|
6cef2e |
ClutterInputDevice *device,
|
|
|
6cef2e |
ClutterInputDeviceTool *tool,
|
|
|
6cef2e |
GDesktopStylusButtonAction primary,
|
|
|
6cef2e |
- GDesktopStylusButtonAction secondary)
|
|
|
6cef2e |
+ GDesktopStylusButtonAction secondary,
|
|
|
6cef2e |
+ GDesktopStylusButtonAction tertiary)
|
|
|
6cef2e |
{
|
|
|
6cef2e |
MetaDisplay *display = meta_get_display ();
|
|
|
6cef2e |
MetaBackend *backend = meta_get_backend ();
|
|
|
6cef2e |
@@ -1046,10 +1047,15 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
|
|
|
6cef2e |
xdev = device_ensure_xdevice (device);
|
|
|
6cef2e |
if (xdev)
|
|
|
6cef2e |
{
|
|
|
6cef2e |
- guchar map[3] = {
|
|
|
6cef2e |
+ guchar map[8] = {
|
|
|
6cef2e |
CLUTTER_BUTTON_PRIMARY,
|
|
|
6cef2e |
action_to_button (primary, CLUTTER_BUTTON_MIDDLE),
|
|
|
6cef2e |
action_to_button (secondary, CLUTTER_BUTTON_SECONDARY),
|
|
|
6cef2e |
+ 4,
|
|
|
6cef2e |
+ 5,
|
|
|
6cef2e |
+ 6,
|
|
|
6cef2e |
+ 7,
|
|
|
6cef2e |
+ action_to_button (tertiary, 8), /* "Back" */
|
|
|
6cef2e |
};
|
|
|
6cef2e |
|
|
|
6cef2e |
XSetDeviceButtonMapping (xdisplay, xdev, map, G_N_ELEMENTS (map));
|
|
|
6cef2e |
--
|
|
|
6cef2e |
2.17.0
|
|
|
6cef2e |
|