[clutter/wip/evdev-tablet-support: 6/6] evdev: Implement ClutterInputDevice::update_from_tool
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/evdev-tablet-support: 6/6] evdev: Implement ClutterInputDevice::update_from_tool
- Date: Tue, 10 Feb 2015 22:33:53 +0000 (UTC)
commit 01738c2a4c4c8602dfdf4fac69aa284b0ea46341
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 4 17:20:58 2015 +0100
evdev: Implement ClutterInputDevice::update_from_tool
This vfunc pokes the libinput_tool in order to find out the currently
available axes, and updates the device as such.
clutter/evdev/clutter-input-device-evdev.c | 42 ++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/clutter/evdev/clutter-input-device-evdev.c b/clutter/evdev/clutter-input-device-evdev.c
index 9865388..57bef05 100644
--- a/clutter/evdev/clutter-input-device-evdev.c
+++ b/clutter/evdev/clutter-input-device-evdev.c
@@ -78,12 +78,54 @@ clutter_input_device_evdev_keycode_to_evdev (ClutterInputDevice *device,
}
static void
+clutter_input_device_evdev_update_from_tool (ClutterInputDevice *device,
+ ClutterInputDeviceTool *tool)
+{
+ guint axis;
+
+ g_object_freeze_notify (G_OBJECT (device));
+
+ _clutter_input_device_reset_axes (device);
+
+ for (axis = LIBINPUT_TABLET_AXIS_X; axis <= LIBINPUT_TABLET_AXIS_TILT_Y; axis++)
+ {
+ if (!tool || !libinput_tool_has_axis ((struct libinput_tool *) tool->data, axis))
+ continue;
+
+ switch (axis)
+ {
+ case LIBINPUT_TABLET_AXIS_X:
+ _clutter_input_device_add_axis (device, CLUTTER_INPUT_AXIS_X, 0, 0, 0);
+ break;
+ case LIBINPUT_TABLET_AXIS_Y:
+ _clutter_input_device_add_axis (device, CLUTTER_INPUT_AXIS_Y, 0, 0, 0);
+ break;
+ case LIBINPUT_TABLET_AXIS_DISTANCE:
+ _clutter_input_device_add_axis (device, CLUTTER_INPUT_AXIS_DISTANCE, 0, 1, 0);
+ break;
+ case LIBINPUT_TABLET_AXIS_PRESSURE:
+ _clutter_input_device_add_axis (device, CLUTTER_INPUT_AXIS_PRESSURE, 0, 1, 0);
+ break;
+ case LIBINPUT_TABLET_AXIS_TILT_X:
+ _clutter_input_device_add_axis (device, CLUTTER_INPUT_AXIS_XTILT, -1, 1, 0);
+ break;
+ case LIBINPUT_TABLET_AXIS_TILT_Y:
+ _clutter_input_device_add_axis (device, CLUTTER_INPUT_AXIS_YTILT, -1, 1, 0);
+ break;
+ }
+ }
+
+ g_object_thaw_notify (G_OBJECT (device));
+}
+
+static void
clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = clutter_input_device_evdev_finalize;
klass->keycode_to_evdev = clutter_input_device_evdev_keycode_to_evdev;
+ klass->update_from_tool = clutter_input_device_evdev_update_from_tool;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]