mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
ClutterVirtualInputDevice: Keep track of the device manager
https://bugzilla.gnome.org/show_bug.cgi?id=765009
This commit is contained in:
parent
fb47374629
commit
85e8feca67
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include <clutter/clutter-input-device.h>
|
#include <clutter/clutter-input-device.h>
|
||||||
#include <clutter/clutter-stage.h>
|
#include <clutter/clutter-stage.h>
|
||||||
#include <clutter/clutter-virtual-input-device.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ typedef struct _ClutterState ClutterState;
|
|||||||
|
|
||||||
typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
|
typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
|
||||||
typedef struct _ClutterInputDevice ClutterInputDevice;
|
typedef struct _ClutterInputDevice ClutterInputDevice;
|
||||||
|
typedef struct _ClutterVirtualInputDevice ClutterVirtualInputDevice;
|
||||||
|
|
||||||
typedef CoglMatrix ClutterMatrix;
|
typedef CoglMatrix ClutterMatrix;
|
||||||
|
|
||||||
|
@ -29,19 +29,28 @@
|
|||||||
|
|
||||||
#include "clutter-virtual-input-device.h"
|
#include "clutter-virtual-input-device.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterVirtualInputDevice,
|
#include "clutter-device-manager.h"
|
||||||
clutter_virtual_input_device,
|
#include "clutter-private.h"
|
||||||
G_TYPE_OBJECT)
|
|
||||||
|
|
||||||
static void
|
enum
|
||||||
clutter_virtual_input_device_init (ClutterVirtualInputDevice *virtual_device)
|
|
||||||
{
|
{
|
||||||
}
|
PROP_0,
|
||||||
|
|
||||||
static void
|
PROP_DEVICE_MANAGER,
|
||||||
clutter_virtual_input_device_class_init (ClutterVirtualInputDeviceClass *klass)
|
|
||||||
|
PROP_LAST
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec *obj_props[PROP_LAST];
|
||||||
|
|
||||||
|
typedef struct _ClutterVirtualInputDevicePrivate
|
||||||
{
|
{
|
||||||
}
|
ClutterDeviceManager *manager;
|
||||||
|
} ClutterVirtualInputDevicePrivate;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE (ClutterVirtualInputDevice,
|
||||||
|
clutter_virtual_input_device,
|
||||||
|
G_TYPE_OBJECT)
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_virtual_input_device_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
|
clutter_virtual_input_device_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
|
||||||
@ -90,3 +99,79 @@ clutter_virtual_input_device_notify_key (ClutterVirtualInputDevice *virtual_devi
|
|||||||
|
|
||||||
klass->notify_key (virtual_device, time_us, key, key_state);
|
klass->notify_key (virtual_device, time_us, key, key_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClutterDeviceManager *
|
||||||
|
clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device)
|
||||||
|
{
|
||||||
|
ClutterVirtualInputDevicePrivate *priv =
|
||||||
|
clutter_virtual_input_device_get_instance_private (virtual_device);
|
||||||
|
|
||||||
|
return priv->manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_virtual_input_device_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
ClutterVirtualInputDevice *virtual_device =
|
||||||
|
CLUTTER_VIRTUAL_INPUT_DEVICE (object);
|
||||||
|
ClutterVirtualInputDevicePrivate *priv =
|
||||||
|
clutter_virtual_input_device_get_instance_private (virtual_device);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_DEVICE_MANAGER:
|
||||||
|
g_value_set_object (value, priv->manager);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_virtual_input_device_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
ClutterVirtualInputDevice *virtual_device =
|
||||||
|
CLUTTER_VIRTUAL_INPUT_DEVICE (object);
|
||||||
|
ClutterVirtualInputDevicePrivate *priv =
|
||||||
|
clutter_virtual_input_device_get_instance_private (virtual_device);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_DEVICE_MANAGER:
|
||||||
|
priv->manager = g_value_get_object (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_virtual_input_device_init (ClutterVirtualInputDevice *virtual_device)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_virtual_input_device_class_init (ClutterVirtualInputDeviceClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->get_property = clutter_virtual_input_device_get_property;
|
||||||
|
object_class->set_property = clutter_virtual_input_device_set_property;
|
||||||
|
|
||||||
|
obj_props[PROP_DEVICE_MANAGER] =
|
||||||
|
g_param_spec_object ("device-manager",
|
||||||
|
P_("Device Manager"),
|
||||||
|
P_("The device manager instance"),
|
||||||
|
CLUTTER_TYPE_DEVICE_MANAGER,
|
||||||
|
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
|
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
|
||||||
|
}
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "clutter-device-manager.h"
|
||||||
|
|
||||||
#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE (clutter_virtual_input_device_get_type ())
|
#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE (clutter_virtual_input_device_get_type ())
|
||||||
G_DECLARE_DERIVABLE_TYPE (ClutterVirtualInputDevice,
|
G_DECLARE_DERIVABLE_TYPE (ClutterVirtualInputDevice,
|
||||||
clutter_virtual_input_device,
|
clutter_virtual_input_device,
|
||||||
@ -90,4 +92,6 @@ void clutter_virtual_input_device_notify_key (ClutterVirtualInputDevice *virtual
|
|||||||
uint32_t key,
|
uint32_t key,
|
||||||
ClutterKeyState key_state);
|
ClutterKeyState key_state);
|
||||||
|
|
||||||
|
ClutterDeviceManager * clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device);
|
||||||
|
|
||||||
#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_H__ */
|
#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_H__ */
|
||||||
|
@ -2186,7 +2186,9 @@ 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)
|
||||||
{
|
{
|
||||||
return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_EVDEV, NULL);
|
return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_EVDEV,
|
||||||
|
"device-manager", manager,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user