backends: Add support for Wacom stylus tertiary-button-action
The tertiary-button-action (see bug 790028) is a place for g-c-c to store the action which should be performed when a stylus' third button is pressed. Pressing this button is signaled as a BTN_STYLUS3 event from the kernel or X11 button 8. https://bugzilla.gnome.org/show_bug.cgi?id=790033
This commit is contained in:
parent
91df801ffb
commit
f8f1bcfa9e
@ -111,7 +111,8 @@ struct _MetaInputSettingsClass
|
|||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
ClutterInputDeviceTool *tool,
|
ClutterInputDeviceTool *tool,
|
||||||
GDesktopStylusButtonAction primary,
|
GDesktopStylusButtonAction primary,
|
||||||
GDesktopStylusButtonAction secondary);
|
GDesktopStylusButtonAction secondary,
|
||||||
|
GDesktopStylusButtonAction tertiary);
|
||||||
gboolean (* has_two_finger_scroll) (MetaInputSettings *settings,
|
gboolean (* has_two_finger_scroll) (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device);
|
ClutterInputDevice *device);
|
||||||
};
|
};
|
||||||
|
@ -1525,7 +1525,7 @@ update_stylus_buttonmap (MetaInputSettings *input_settings,
|
|||||||
ClutterInputDeviceTool *tool)
|
ClutterInputDeviceTool *tool)
|
||||||
{
|
{
|
||||||
MetaInputSettingsClass *input_settings_class;
|
MetaInputSettingsClass *input_settings_class;
|
||||||
GDesktopStylusButtonAction primary, secondary;
|
GDesktopStylusButtonAction primary, secondary, tertiary;
|
||||||
GSettings *tool_settings;
|
GSettings *tool_settings;
|
||||||
|
|
||||||
if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE &&
|
if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE &&
|
||||||
@ -1540,10 +1540,11 @@ update_stylus_buttonmap (MetaInputSettings *input_settings,
|
|||||||
|
|
||||||
primary = g_settings_get_enum (tool_settings, "button-action");
|
primary = g_settings_get_enum (tool_settings, "button-action");
|
||||||
secondary = g_settings_get_enum (tool_settings, "secondary-button-action");
|
secondary = g_settings_get_enum (tool_settings, "secondary-button-action");
|
||||||
|
tertiary = g_settings_get_enum (tool_settings, "tertiary-button-action");
|
||||||
|
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
||||||
input_settings_class->set_stylus_button_map (input_settings, device, tool,
|
input_settings_class->set_stylus_button_map (input_settings, device, tool,
|
||||||
primary, secondary);
|
primary, secondary, tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -547,12 +547,15 @@ meta_input_settings_native_set_stylus_button_map (MetaInputSettings *se
|
|||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
ClutterInputDeviceTool *tool,
|
ClutterInputDeviceTool *tool,
|
||||||
GDesktopStylusButtonAction primary,
|
GDesktopStylusButtonAction primary,
|
||||||
GDesktopStylusButtonAction secondary)
|
GDesktopStylusButtonAction secondary,
|
||||||
|
GDesktopStylusButtonAction tertiary)
|
||||||
{
|
{
|
||||||
clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_MIDDLE,
|
clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_MIDDLE,
|
||||||
action_to_evcode (primary));
|
action_to_evcode (primary));
|
||||||
clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_SECONDARY,
|
clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_SECONDARY,
|
||||||
action_to_evcode (secondary));
|
action_to_evcode (secondary));
|
||||||
|
clutter_evdev_input_device_tool_set_button_code (tool, 8, /* Back */
|
||||||
|
action_to_evcode (tertiary));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -732,7 +732,8 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
|
|||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
ClutterInputDeviceTool *tool,
|
ClutterInputDeviceTool *tool,
|
||||||
GDesktopStylusButtonAction primary,
|
GDesktopStylusButtonAction primary,
|
||||||
GDesktopStylusButtonAction secondary)
|
GDesktopStylusButtonAction secondary,
|
||||||
|
GDesktopStylusButtonAction tertiary)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = meta_get_display ();
|
MetaDisplay *display = meta_get_display ();
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
@ -748,10 +749,15 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
|
|||||||
xdev = XOpenDevice (xdisplay, device_id);
|
xdev = XOpenDevice (xdisplay, device_id);
|
||||||
if (xdev)
|
if (xdev)
|
||||||
{
|
{
|
||||||
guchar map[3] = {
|
guchar map[8] = {
|
||||||
CLUTTER_BUTTON_PRIMARY,
|
CLUTTER_BUTTON_PRIMARY,
|
||||||
action_to_button (primary, CLUTTER_BUTTON_MIDDLE),
|
action_to_button (primary, CLUTTER_BUTTON_MIDDLE),
|
||||||
action_to_button (secondary, CLUTTER_BUTTON_SECONDARY),
|
action_to_button (secondary, CLUTTER_BUTTON_SECONDARY),
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
action_to_button (tertiary, 8), /* "Back" */
|
||||||
};
|
};
|
||||||
|
|
||||||
XSetDeviceButtonMapping (xdisplay, xdev, map, G_N_ELEMENTS (map));
|
XSetDeviceButtonMapping (xdisplay, xdev, map, G_N_ELEMENTS (map));
|
||||||
|
Loading…
Reference in New Issue
Block a user