device: Add keys and axes accessors

Allow retrieving the number of keys and axes, since we provide the API
to iterate over them both.
This commit is contained in:
Emmanuele Bassi
2011-01-18 16:13:26 +00:00
parent b662a070f2
commit 431200f40d
6 changed files with 38 additions and 14 deletions

View File

@ -907,9 +907,20 @@ _clutter_input_device_translate_axis (ClutterInputDevice *device,
return TRUE;
}
/**
* clutter_input_device_get_axis:
* @device: a #ClutterInputDevice
* @index_: the index of the axis
*
* Retrieves the type of axis on @device at the given index.
*
* Return value: the axis type
*
* Since: 1.6
*/
ClutterInputAxis
_clutter_input_device_get_axis (ClutterInputDevice *device,
guint index_)
clutter_input_device_get_axis (ClutterInputDevice *device,
guint index_)
{
ClutterAxisInfo *info;
@ -963,15 +974,22 @@ _clutter_input_device_set_keys (ClutterInputDevice *device,
device->max_keycode = max_keycode;
}
/**
* clutter_input_device_get_n_keys:
* @device: a #ClutterInputDevice
*
* Retrieves the number of keys registered for @device.
*
* Return value: the number of registered keys
*
* Since: 1.6
*/
guint
clutter_input_device_get_n_keys (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
if (device->keys != NULL)
return device->keys->len;
return 0;
return device->n_keys;
}
/**