summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-11-12 14:17:27 +0100
committerCarlos Garnacho <carlosg@gnome.org>2016-04-05 18:56:35 +0200
commitfa1f5db5978c678194c656db2442b024151627ae (patch)
tree6c47a00e4208961b5699850cb2b8e7a23f9c77b3
parenta3fc1db550eb539ac796fccb0547ed7d84b71673 (diff)
downloadclutter-fa1f5db5978c678194c656db2442b024151627ae.tar.gz
evdev: Implement ClutterInputDeviceTool
This will be backed by a libinput_tool, the type and serial are fetched from there.
-rw-r--r--clutter/Makefile.am2
-rw-r--r--clutter/evdev/clutter-input-device-tool-evdev.c71
-rw-r--r--clutter/evdev/clutter-input-device-tool-evdev.h77
3 files changed, 150 insertions, 0 deletions
diff --git a/clutter/Makefile.am b/clutter/Makefile.am
index 652f42b98..bb3046074 100644
--- a/clutter/Makefile.am
+++ b/clutter/Makefile.am
@@ -601,10 +601,12 @@ evdev_c_priv = \
evdev/clutter-device-manager-evdev.c \
evdev/clutter-input-device-evdev.c \
evdev/clutter-event-evdev.c \
+ evdev/clutter-input-device-tool-evdev.c \
$(NULL)
evdev_h_priv = \
evdev/clutter-device-manager-evdev.h \
evdev/clutter-input-device-evdev.h \
+ evdev/clutter-input-device-tool-evdev.h \
$(NULL)
evdev_h = evdev/clutter-evdev.h
diff --git a/clutter/evdev/clutter-input-device-tool-evdev.c b/clutter/evdev/clutter-input-device-tool-evdev.c
new file mode 100644
index 000000000..8269ecf70
--- /dev/null
+++ b/clutter/evdev/clutter-input-device-tool-evdev.c
@@ -0,0 +1,71 @@
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Copyright © 2009, 2010, 2011 Intel Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Carlos Garnacho <carlosg@gnome.org>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "clutter-input-device-tool-evdev.h"
+
+G_DEFINE_TYPE (ClutterInputDeviceToolEvdev, clutter_input_device_tool_evdev,
+ CLUTTER_TYPE_INPUT_DEVICE_TOOL)
+
+static void
+clutter_input_device_tool_evdev_finalize (GObject *object)
+{
+ ClutterInputDeviceToolEvdev *tool = CLUTTER_INPUT_DEVICE_TOOL_EVDEV (object);
+
+ libinput_tablet_tool_unref (tool->tool);
+
+ G_OBJECT_CLASS (clutter_input_device_tool_evdev_parent_class)->finalize (object);
+}
+
+static void
+clutter_input_device_tool_evdev_class_init (ClutterInputDeviceToolEvdevClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = clutter_input_device_tool_evdev_finalize;
+}
+
+static void
+clutter_input_device_tool_evdev_init (ClutterInputDeviceToolEvdev *tool)
+{
+}
+
+ClutterInputDeviceTool *
+clutter_input_device_tool_evdev_new (struct libinput_tablet_tool *tool,
+ guint64 serial,
+ ClutterInputDeviceToolType type)
+{
+ ClutterInputDeviceToolEvdev *evdev_tool;
+
+ evdev_tool = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV,
+ "type", type,
+ "serial", serial,
+ NULL);
+
+ evdev_tool->tool = libinput_tablet_tool_ref (tool);
+
+ return CLUTTER_INPUT_DEVICE_TOOL (evdev_tool);
+}
diff --git a/clutter/evdev/clutter-input-device-tool-evdev.h b/clutter/evdev/clutter-input-device-tool-evdev.h
new file mode 100644
index 000000000..c92a2ca6b
--- /dev/null
+++ b/clutter/evdev/clutter-input-device-tool-evdev.h
@@ -0,0 +1,77 @@
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Copyright © 2009, 2010, 2011 Intel Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Carlos Garnacho <carlosg@gnome.org>
+ */
+
+#ifndef __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__
+#define __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__
+
+#include <libinput.h>
+
+#include <clutter/clutter-input-device-tool.h>
+
+G_BEGIN_DECLS
+
+#define CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV (clutter_input_device_tool_evdev_get_type ())
+
+#define CLUTTER_INPUT_DEVICE_TOOL_EVDEV(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+ CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdev))
+
+#define CLUTTER_IS_INPUT_DEVICE_TOOL_EVDEV(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+ CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV))
+
+#define CLUTTER_INPUT_DEVICE_TOOL_EVDEV_CLASS(c) \
+ (G_TYPE_CHECK_CLASS_CAST ((c), \
+ CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdevClass))
+
+#define CLUTTER_IS_INPUT_DEVICE_TOOL_EVDEV_CLASS(c) \
+ (G_TYPE_CHECK_CLASS_TYPE ((c), \
+ CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV))
+
+#define CLUTTER_INPUT_DEVICE_TOOL_EVDEV_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), \
+ CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdevClass))
+
+typedef struct _ClutterInputDeviceToolEvdev ClutterInputDeviceToolEvdev;
+typedef struct _ClutterInputDeviceToolEvdevClass ClutterInputDeviceToolEvdevClass;
+
+struct _ClutterInputDeviceToolEvdev
+{
+ ClutterInputDeviceTool parent_instance;
+ struct libinput_tablet_tool *tool;
+};
+
+struct _ClutterInputDeviceToolEvdevClass
+{
+ ClutterInputDeviceToolClass parent_class;
+};
+
+GType clutter_input_device_tool_evdev_get_type (void) G_GNUC_CONST;
+
+ClutterInputDeviceTool * clutter_input_device_tool_evdev_new (struct libinput_tablet_tool *tool,
+ guint64 serial,
+ ClutterInputDeviceToolType type);
+
+G_END_DECLS
+
+#endif /* __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__ */