mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
device: Add the :name property to InputDevice
The InputDevice should have a name, possibly user readable, coming from the backend.
This commit is contained in:
parent
79ad2b6a72
commit
cf4e05930a
@ -45,7 +45,8 @@ enum
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_ID,
|
PROP_ID,
|
||||||
PROP_DEVICE_TYPE
|
PROP_DEVICE_TYPE,
|
||||||
|
PROP_NAME
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterInputDevice, clutter_input_device, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (ClutterInputDevice, clutter_input_device, G_TYPE_OBJECT);
|
||||||
@ -68,6 +69,10 @@ clutter_input_device_set_property (GObject *gobject,
|
|||||||
self->device_type = g_value_get_enum (value);
|
self->device_type = g_value_get_enum (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_NAME:
|
||||||
|
self->device_name = g_strdup (g_value_get_string (value));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -92,6 +97,10 @@ clutter_input_device_get_property (GObject *gobject,
|
|||||||
g_value_set_enum (value, self->device_type);
|
g_value_set_enum (value, self->device_type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_NAME:
|
||||||
|
g_value_set_string (value, self->device_name);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -123,6 +132,21 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
|
|||||||
G_PARAM_CONSTRUCT_ONLY);
|
G_PARAM_CONSTRUCT_ONLY);
|
||||||
g_object_class_install_property (gobject_class, PROP_ID, pspec);
|
g_object_class_install_property (gobject_class, PROP_ID, pspec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterInputDevice:name:
|
||||||
|
*
|
||||||
|
* The name of the device
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
|
*/
|
||||||
|
pspec = g_param_spec_string ("name",
|
||||||
|
"Name",
|
||||||
|
"The name of the device",
|
||||||
|
NULL,
|
||||||
|
CLUTTER_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_NAME, pspec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterInputDevice:device-type:
|
* ClutterInputDevice:device-type:
|
||||||
*
|
*
|
||||||
@ -478,3 +502,23 @@ clutter_input_device_get_pointer_actor (ClutterInputDevice *device)
|
|||||||
|
|
||||||
return device->cursor_actor;
|
return device->cursor_actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_input_device_get_device_name:
|
||||||
|
* @device: a #ClutterInputDevice
|
||||||
|
*
|
||||||
|
* Retrieves the name of the @device
|
||||||
|
*
|
||||||
|
* Return value: the name of the device, or %NULL. The returned string
|
||||||
|
* is owned by the #ClutterInputDevice and should never be modified
|
||||||
|
* or freed
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
|
*/
|
||||||
|
G_CONST_RETURN gchar *
|
||||||
|
clutter_input_device_get_device_name (ClutterInputDevice *device)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||||
|
|
||||||
|
return device->device_name;
|
||||||
|
}
|
||||||
|
@ -42,9 +42,8 @@ G_BEGIN_DECLS
|
|||||||
/**
|
/**
|
||||||
* ClutterInputDevice:
|
* ClutterInputDevice:
|
||||||
*
|
*
|
||||||
* Generic representation of an input device. The
|
* Generic representation of an input device. The actual contents of this
|
||||||
* actual contents of this structure depend on the
|
* structure depend on the backend used.
|
||||||
* backend used.
|
|
||||||
*/
|
*/
|
||||||
typedef struct _ClutterInputDevice ClutterInputDevice;
|
typedef struct _ClutterInputDevice ClutterInputDevice;
|
||||||
typedef struct _ClutterInputDeviceClass ClutterInputDeviceClass;
|
typedef struct _ClutterInputDeviceClass ClutterInputDeviceClass;
|
||||||
@ -93,6 +92,7 @@ void clutter_input_device_get_device_coords (ClutterInputDevic
|
|||||||
gint *x,
|
gint *x,
|
||||||
gint *y);
|
gint *y);
|
||||||
ClutterActor * clutter_input_device_get_pointer_actor (ClutterInputDevice *device);
|
ClutterActor * clutter_input_device_get_pointer_actor (ClutterInputDevice *device);
|
||||||
|
G_CONST_RETURN gchar * clutter_input_device_get_device_name (ClutterInputDevice *device);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -91,19 +91,28 @@ struct _ClutterInputDevice
|
|||||||
|
|
||||||
ClutterInputDeviceType device_type;
|
ClutterInputDeviceType device_type;
|
||||||
|
|
||||||
|
gchar *device_name;
|
||||||
|
|
||||||
|
/* the actor underneath the pointer */
|
||||||
ClutterActor *cursor_actor;
|
ClutterActor *cursor_actor;
|
||||||
|
|
||||||
|
/* the actor that has a grab in place for the device */
|
||||||
ClutterActor *pointer_grab_actor;
|
ClutterActor *pointer_grab_actor;
|
||||||
|
|
||||||
|
/* the current click count */
|
||||||
gint click_count;
|
gint click_count;
|
||||||
|
|
||||||
|
/* the stage the device is on */
|
||||||
ClutterStage *stage;
|
ClutterStage *stage;
|
||||||
|
|
||||||
|
/* the current state */
|
||||||
gint current_x;
|
gint current_x;
|
||||||
gint current_y;
|
gint current_y;
|
||||||
guint32 current_time;
|
guint32 current_time;
|
||||||
gint current_button_number;
|
gint current_button_number;
|
||||||
ClutterModifierType current_state;
|
ClutterModifierType current_state;
|
||||||
|
|
||||||
|
/* the previous state, used for click count generation */
|
||||||
gint previous_x;
|
gint previous_x;
|
||||||
gint previous_y;
|
gint previous_y;
|
||||||
guint32 previous_time;
|
guint32 previous_time;
|
||||||
|
Loading…
Reference in New Issue
Block a user