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:
parent
b662a070f2
commit
431200f40d
@ -148,8 +148,6 @@ guint _clutter_input_device_add_axis (ClutterInputDev
|
|||||||
gdouble min_value,
|
gdouble min_value,
|
||||||
gdouble max_value,
|
gdouble max_value,
|
||||||
gdouble resolution);
|
gdouble resolution);
|
||||||
ClutterInputAxis _clutter_input_device_get_axis (ClutterInputDevice *device,
|
|
||||||
guint index_);
|
|
||||||
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
|
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
|
||||||
|
|
||||||
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
|
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
|
||||||
|
@ -907,9 +907,20 @@ _clutter_input_device_translate_axis (ClutterInputDevice *device,
|
|||||||
return TRUE;
|
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
|
ClutterInputAxis
|
||||||
_clutter_input_device_get_axis (ClutterInputDevice *device,
|
clutter_input_device_get_axis (ClutterInputDevice *device,
|
||||||
guint index_)
|
guint index_)
|
||||||
{
|
{
|
||||||
ClutterAxisInfo *info;
|
ClutterAxisInfo *info;
|
||||||
|
|
||||||
@ -963,15 +974,22 @@ _clutter_input_device_set_keys (ClutterInputDevice *device,
|
|||||||
device->max_keycode = max_keycode;
|
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
|
guint
|
||||||
clutter_input_device_get_n_keys (ClutterInputDevice *device)
|
clutter_input_device_get_n_keys (ClutterInputDevice *device)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
||||||
|
|
||||||
if (device->keys != NULL)
|
return device->n_keys;
|
||||||
return device->keys->len;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +138,10 @@ ClutterStage * clutter_input_device_get_pointer_stage (ClutterInputDev
|
|||||||
G_CONST_RETURN gchar * clutter_input_device_get_device_name (ClutterInputDevice *device);
|
G_CONST_RETURN gchar * clutter_input_device_get_device_name (ClutterInputDevice *device);
|
||||||
|
|
||||||
guint clutter_input_device_get_n_axes (ClutterInputDevice *device);
|
guint clutter_input_device_get_n_axes (ClutterInputDevice *device);
|
||||||
|
ClutterInputAxis clutter_input_device_get_axis (ClutterInputDevice *device,
|
||||||
|
guint index_);
|
||||||
|
|
||||||
|
guint clutter_input_device_get_n_keys (ClutterInputDevice *device);
|
||||||
void clutter_input_device_set_key (ClutterInputDevice *device,
|
void clutter_input_device_set_key (ClutterInputDevice *device,
|
||||||
guint index_,
|
guint index_,
|
||||||
guint keyval,
|
guint keyval,
|
||||||
|
@ -500,7 +500,7 @@ translate_axes (ClutterInputDevice *device,
|
|||||||
if (!XIMaskIsSet (valuators->mask, i))
|
if (!XIMaskIsSet (valuators->mask, i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
axis = _clutter_input_device_get_axis (device, i);
|
axis = clutter_input_device_get_axis (device, i);
|
||||||
val = *values++;
|
val = *values++;
|
||||||
|
|
||||||
switch (axis)
|
switch (axis)
|
||||||
|
@ -258,8 +258,7 @@ translate_axes (ClutterInputDeviceX11 *device_x11,
|
|||||||
{
|
{
|
||||||
ClutterInputAxis axis;
|
ClutterInputAxis axis;
|
||||||
|
|
||||||
axis = _clutter_input_device_get_axis (device, i);
|
axis = clutter_input_device_get_axis (device, i);
|
||||||
|
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case CLUTTER_INPUT_AXIS_X:
|
case CLUTTER_INPUT_AXIS_X:
|
||||||
|
@ -1082,12 +1082,18 @@ clutter_input_device_get_device_name
|
|||||||
clutter_input_device_get_device_coords
|
clutter_input_device_get_device_coords
|
||||||
clutter_input_device_get_pointer_actor
|
clutter_input_device_get_pointer_actor
|
||||||
clutter_input_device_get_pointer_stage
|
clutter_input_device_get_pointer_stage
|
||||||
clutter_input_device_set_key
|
|
||||||
clutter_input_device_get_key
|
|
||||||
clutter_input_device_get_n_axes
|
|
||||||
clutter_input_device_get_associated_device
|
clutter_input_device_get_associated_device
|
||||||
clutter_input_device_get_slave_devices
|
clutter_input_device_get_slave_devices
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
clutter_input_device_get_n_keys
|
||||||
|
clutter_input_device_set_key
|
||||||
|
clutter_input_device_get_key
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
clutter_input_device_get_n_axes
|
||||||
|
clutter_input_device_get_axis
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
clutter_input_device_update_from_event
|
clutter_input_device_update_from_event
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user