[mutter/wip/garnacho/virtual-input-device: 99/107] ClutterVirtualInputDeviceEvdev: Create associated ClutterInputDevice



commit 0942d68f1a77aba43ef8aca433942c67c5f73631
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Jun 22 17:51:38 2016 +0800

    ClutterVirtualInputDeviceEvdev: Create associated ClutterInputDevice
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765009

 .../evdev/clutter-virtual-input-device-evdev.c     |   43 ++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c 
b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c
index 4a82db7..648d077 100644
--- a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c
+++ b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c
@@ -29,6 +29,7 @@
 
 #include "clutter-private.h"
 #include "clutter-virtual-input-device.h"
+#include "evdev/clutter-input-device-evdev.h"
 #include "evdev/clutter-seat-evdev.h"
 #include "evdev/clutter-virtual-input-device-evdev.h"
 
@@ -47,6 +48,7 @@ struct _ClutterVirtualInputDeviceEvdev
 {
   ClutterVirtualInputDevice parent;
 
+  ClutterInputDevice *device;
   ClutterSeatEvdev *seat;
 };
 
@@ -127,6 +129,45 @@ clutter_virtual_input_device_evdev_set_property (GObject      *object,
 }
 
 static void
+clutter_virtual_input_device_evdev_constructed (GObject *object)
+{
+  ClutterVirtualInputDevice *virtual_device =
+    CLUTTER_VIRTUAL_INPUT_DEVICE (object);
+  ClutterVirtualInputDeviceEvdev *virtual_evdev =
+    CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (object);
+  ClutterDeviceManager *manager;
+  ClutterInputDeviceType device_type;
+  ClutterStage *stage;
+
+  manager = clutter_virtual_input_device_get_manager (virtual_device);
+  device_type = clutter_virtual_input_device_get_device_type (virtual_device);
+
+  virtual_evdev->device =
+    _clutter_input_device_evdev_new_virtual (manager,
+                                             virtual_evdev->seat,
+                                             device_type);
+
+  stage = _clutter_device_manager_evdev_get_stage (CLUTTER_DEVICE_MANAGER_EVDEV (manager));
+  _clutter_input_device_set_stage (virtual_evdev->device, stage);
+}
+
+static void
+clutter_virtual_input_device_evdev_finalize (GObject *object)
+{
+  ClutterVirtualInputDevice *virtual_device =
+    CLUTTER_VIRTUAL_INPUT_DEVICE (object);
+  ClutterVirtualInputDeviceEvdev *virtual_evdev =
+    CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (object);
+  GObjectClass *object_class;
+
+  g_clear_object (&virtual_evdev->device);
+
+  object_class =
+    G_OBJECT_CLASS (clutter_virtual_input_device_evdev_parent_class);
+  object_class->finalize (object);
+}
+
+static void
 clutter_virtual_input_device_evdev_init (ClutterVirtualInputDeviceEvdev *virtual_device_evdev)
 {
 }
@@ -140,6 +181,8 @@ clutter_virtual_input_device_evdev_class_init (ClutterVirtualInputDeviceEvdevCla
 
   object_class->get_property = clutter_virtual_input_device_evdev_get_property;
   object_class->set_property = clutter_virtual_input_device_evdev_set_property;
+  object_class->constructed = clutter_virtual_input_device_evdev_constructed;
+  object_class->finalize = clutter_virtual_input_device_evdev_finalize;
 
   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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]