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
This commit is contained in:
Jonas Ådahl 2016-06-22 17:46:25 +08:00 committed by Carlos Garnacho
parent ea5b691ac6
commit 73d5d837db
2 changed files with 71 additions and 0 deletions

View File

@ -1963,8 +1963,13 @@ static ClutterVirtualInputDevice *
clutter_device_manager_evdev_create_virtual_device (ClutterDeviceManager *manager, clutter_device_manager_evdev_create_virtual_device (ClutterDeviceManager *manager,
ClutterInputDeviceType device_type) 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, return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_EVDEV,
"device-manager", manager, "device-manager", manager,
"seat", priv->main_seat,
"device-type", device_type, "device-type", device_type,
NULL); NULL);
} }

View File

@ -27,12 +27,27 @@
#include <glib-object.h> #include <glib-object.h>
#include "clutter-private.h"
#include "clutter-virtual-input-device.h" #include "clutter-virtual-input-device.h"
#include "evdev/clutter-seat-evdev.h"
#include "evdev/clutter-virtual-input-device-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 struct _ClutterVirtualInputDeviceEvdev
{ {
ClutterVirtualInputDevice parent; ClutterVirtualInputDevice parent;
ClutterSeatEvdev *seat;
}; };
G_DEFINE_TYPE (ClutterVirtualInputDeviceEvdev, 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 static void
clutter_virtual_input_device_evdev_init (ClutterVirtualInputDeviceEvdev *virtual_device_evdev) clutter_virtual_input_device_evdev_init (ClutterVirtualInputDeviceEvdev *virtual_device_evdev)
{ {
@ -79,11 +134,22 @@ clutter_virtual_input_device_evdev_init (ClutterVirtualInputDeviceEvdev *virtual
static void static void
clutter_virtual_input_device_evdev_class_init (ClutterVirtualInputDeviceEvdevClass *klass) clutter_virtual_input_device_evdev_class_init (ClutterVirtualInputDeviceEvdevClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterVirtualInputDeviceClass *virtual_input_device_class = ClutterVirtualInputDeviceClass *virtual_input_device_class =
CLUTTER_VIRTUAL_INPUT_DEVICE_CLASS (klass); 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_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_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_button = clutter_virtual_input_device_evdev_notify_button;
virtual_input_device_class->notify_key = clutter_virtual_input_device_evdev_notify_key; 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);
} }