From 8e335ce183bd54e55b6f8aa9943c64062a7f1d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 22 Jun 2016 17:46:25 +0800 Subject: [PATCH] ClutterVirtualInputDeviceEvdev: Construct with a specific seat We are still single seated, so until we are properly multi seated its always the main seat. https://bugzilla.gnome.org/show_bug.cgi?id=765009 --- .../evdev/clutter-device-manager-evdev.c | 5 ++ .../clutter-virtual-input-device-evdev.c | 66 +++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c index d7d727178..4e52ecf80 100644 --- a/clutter/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c @@ -1959,8 +1959,13 @@ static ClutterVirtualInputDevice * clutter_device_manager_evdev_create_virtual_device (ClutterDeviceManager *manager, ClutterInputDeviceType device_type) { + ClutterDeviceManagerEvdev *manager_evdev = + CLUTTER_DEVICE_MANAGER_EVDEV (manager); + ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv; + return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_EVDEV, "device-manager", manager, + "seat", priv->main_seat, "device-type", device_type, NULL); } diff --git a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c index f8786bdd6..4a82db758 100644 --- a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c +++ b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c @@ -27,12 +27,27 @@ #include +#include "clutter-private.h" #include "clutter-virtual-input-device.h" +#include "evdev/clutter-seat-evdev.h" #include "evdev/clutter-virtual-input-device-evdev.h" +enum +{ + PROP_0, + + PROP_SEAT, + + PROP_LAST +}; + +static GParamSpec *obj_props[PROP_LAST]; + struct _ClutterVirtualInputDeviceEvdev { ClutterVirtualInputDevice parent; + + ClutterSeatEvdev *seat; }; G_DEFINE_TYPE (ClutterVirtualInputDeviceEvdev, @@ -71,6 +86,46 @@ clutter_virtual_input_device_evdev_notify_key (ClutterVirtualInputDevice *virtua { } +static void +clutter_virtual_input_device_evdev_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + ClutterVirtualInputDeviceEvdev *virtual_evdev = + CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (object); + + switch (prop_id) + { + case PROP_SEAT: + g_value_set_pointer (value, virtual_evdev->seat); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +clutter_virtual_input_device_evdev_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + ClutterVirtualInputDeviceEvdev *virtual_evdev = + CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (object); + + switch (prop_id) + { + case PROP_SEAT: + virtual_evdev->seat = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + static void clutter_virtual_input_device_evdev_init (ClutterVirtualInputDeviceEvdev *virtual_device_evdev) { @@ -79,11 +134,22 @@ clutter_virtual_input_device_evdev_init (ClutterVirtualInputDeviceEvdev *virtual static void clutter_virtual_input_device_evdev_class_init (ClutterVirtualInputDeviceEvdevClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); ClutterVirtualInputDeviceClass *virtual_input_device_class = CLUTTER_VIRTUAL_INPUT_DEVICE_CLASS (klass); + object_class->get_property = clutter_virtual_input_device_evdev_get_property; + object_class->set_property = clutter_virtual_input_device_evdev_set_property; + 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; + + obj_props[PROP_SEAT] = g_param_spec_pointer ("seat", + P_("ClutterSeatEvdev"), + P_("ClutterSeatEvdev"), + CLUTTER_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_properties (object_class, PROP_LAST, obj_props); }