summaryrefslogtreecommitdiff
path: root/clutter/clutter/evdev
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-05-03 11:27:57 +0800
committerCarlos Garnacho <carlosg@gnome.org>2016-08-10 10:39:19 +0200
commit5db2be414b0620e738858f64fe8b1c4ab3ea4db6 (patch)
tree7eb60df972ca435dfce870c5d50fd34e81fb1cb3 /clutter/clutter/evdev
parent61bfe04b7bd9d4746ed7578b2f7f0eb4e814794a (diff)
downloadmutter-5db2be414b0620e738858f64fe8b1c4ab3ea4db6.tar.gz
clutter: Add virtual input device API
Virtual input devices aim to enable injecting input events as if they came from hardware events. This is useful for things such as remote controlling, for example via a remote desktop session. The API so far only consists of stumps. https://bugzilla.gnome.org/show_bug.cgi?id=765009
Diffstat (limited to 'clutter/clutter/evdev')
-rw-r--r--clutter/clutter/evdev/clutter-device-manager-evdev.c9
-rw-r--r--clutter/clutter/evdev/clutter-virtual-input-device-evdev.c89
-rw-r--r--clutter/clutter/evdev/clutter-virtual-input-device-evdev.h35
3 files changed, 133 insertions, 0 deletions
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c
index 1a86030a3..865f461eb 100644
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
@@ -46,6 +46,7 @@
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-input-device-evdev.h"
+#include "clutter-virtual-input-device-evdev.h"
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-stage-manager.h"
@@ -2413,6 +2414,13 @@ static const struct libinput_interface libinput_interface = {
close_restricted
};
+static ClutterVirtualInputDevice *
+clutter_device_manager_evdev_create_virtual_device (ClutterDeviceManager *manager,
+ ClutterInputDeviceType device_type)
+{
+ return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_EVDEV, NULL);
+}
+
/*
* GObject implementation
*/
@@ -2539,6 +2547,7 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass)
manager_class->get_devices = clutter_device_manager_evdev_get_devices;
manager_class->get_core_device = clutter_device_manager_evdev_get_core_device;
manager_class->get_device = clutter_device_manager_evdev_get_device;
+ manager_class->create_virtual_device = clutter_device_manager_evdev_create_virtual_device;
}
static void
diff --git a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c
new file mode 100644
index 000000000..f8786bdd6
--- /dev/null
+++ b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c
@@ -0,0 +1,89 @@
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Copyright (C) 2016 Red Hat Inc.
+ *
+ * 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: Jonas Ådahl <jadahl@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "clutter-build-config.h"
+#endif
+
+#include <glib-object.h>
+
+#include "clutter-virtual-input-device.h"
+#include "evdev/clutter-virtual-input-device-evdev.h"
+
+struct _ClutterVirtualInputDeviceEvdev
+{
+ ClutterVirtualInputDevice parent;
+};
+
+G_DEFINE_TYPE (ClutterVirtualInputDeviceEvdev,
+ clutter_virtual_input_device_evdev,
+ CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE)
+
+static void
+clutter_virtual_input_device_evdev_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ double dx,
+ double dy)
+{
+}
+
+static void
+clutter_virtual_input_device_evdev_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ double x,
+ double y)
+{
+}
+
+static void
+clutter_virtual_input_device_evdev_notify_button (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ uint32_t button,
+ ClutterButtonState button_state)
+{
+}
+
+static void
+clutter_virtual_input_device_evdev_notify_key (ClutterVirtualInputDevice *virtual_device,
+ uint64_t time_us,
+ uint32_t key,
+ ClutterKeyState key_state)
+{
+}
+
+static void
+clutter_virtual_input_device_evdev_init (ClutterVirtualInputDeviceEvdev *virtual_device_evdev)
+{
+}
+
+static void
+clutter_virtual_input_device_evdev_class_init (ClutterVirtualInputDeviceEvdevClass *klass)
+{
+ ClutterVirtualInputDeviceClass *virtual_input_device_class =
+ CLUTTER_VIRTUAL_INPUT_DEVICE_CLASS (klass);
+
+ virtual_input_device_class->notify_relative_motion = clutter_virtual_input_device_evdev_notify_relative_motion;
+ virtual_input_device_class->notify_absolute_motion = clutter_virtual_input_device_evdev_notify_absolute_motion;
+ virtual_input_device_class->notify_button = clutter_virtual_input_device_evdev_notify_button;
+ virtual_input_device_class->notify_key = clutter_virtual_input_device_evdev_notify_key;
+}
diff --git a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.h b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.h
new file mode 100644
index 000000000..9bb8db016
--- /dev/null
+++ b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.h
@@ -0,0 +1,35 @@
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Copyright (C) 2016 Red Hat Inc.
+ *
+ * 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: Jonas Ådahl <jadahl@gmail.com>
+ */
+
+#ifndef __CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV_H__
+#define __CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV_H__
+
+#include "clutter-virtual-input-device.h"
+
+#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_EVDEV (clutter_virtual_input_device_evdev_get_type ())
+G_DECLARE_FINAL_TYPE (ClutterVirtualInputDeviceEvdev,
+ clutter_virtual_input_device_evdev,
+ CLUTTER, VIRTUAL_INPUT_DEVICE_EVDEV,
+ ClutterVirtualInputDevice)
+
+#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV_H__ */