Top | ![]() |
![]() |
![]() |
![]() |
ClutterBackend * | backend | Read / Write / Construct Only |
ClutterDeviceManager * | device-manager | Read / Write / Construct Only |
ClutterInputMode | device-mode | Read / Write / Construct Only |
ClutterInputDeviceType | device-type | Read / Write / Construct Only |
gboolean | enabled | Read / Write |
gboolean | has-cursor | Read / Write / Construct Only |
int | id | Read / Write / Construct Only |
guint | n-axes | Read |
char * | name | Read / Write / Construct Only |
char * | product-id | Read / Write / Construct Only |
char * | vendor-id | Read / Write / Construct Only |
enum | ClutterInputDeviceType |
enum | ClutterInputAxis |
enum | ClutterInputMode |
ClutterInputDevice |
ClutterInputDevice represents an input device known to Clutter.
The ClutterInputDevice class holds the state of the device, but its contents are usually defined by the Clutter backend in use.
gint
clutter_input_device_get_device_id (ClutterInputDevice *device
);
Retrieves the unique identifier of device
Since: 1.0
ClutterInputDeviceType
clutter_input_device_get_device_type (ClutterInputDevice *device
);
Retrieves the type of device
Since: 1.0
const gchar *
clutter_input_device_get_device_name (ClutterInputDevice *device
);
Retrieves the name of the device
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
ClutterInputMode
clutter_input_device_get_device_mode (ClutterInputDevice *device
);
Retrieves the ClutterInputMode of device
.
Since: 1.6
gboolean
clutter_input_device_get_has_cursor (ClutterInputDevice *device
);
Retrieves whether device
has a pointer that follows the
device motion.
Since: 1.6
void clutter_input_device_set_enabled (ClutterInputDevice *device
,gboolean enabled
);
Enables or disables a ClutterInputDevice.
Only devices with a “device-mode” property set
to CLUTTER_INPUT_MODE_SLAVE
or CLUTTER_INPUT_MODE_FLOATING
can
be disabled.
Since: 1.6
gboolean
clutter_input_device_get_enabled (ClutterInputDevice *device
);
Retrieves whether device
is enabled.
Since: 1.6
ClutterInputDevice *
clutter_input_device_get_associated_device
(ClutterInputDevice *device
);
Retrieves a pointer to the ClutterInputDevice that has been
associated to device
.
If the “device-mode” property of device
is
set to CLUTTER_INPUT_MODE_MASTER
, this function will return
NULL
.
Since: 1.6
GList *
clutter_input_device_get_slave_devices
(ClutterInputDevice *device
);
Retrieves the slave devices attached to device
.
a
list of ClutterInputDevice, or NULL
. The contents of the list are
owned by the device. Use g_list_free()
when done.
[transfer container][element-type Clutter.InputDevice]
Since: 1.6
ClutterModifierType
clutter_input_device_get_modifier_state
(ClutterInputDevice *device
);
Retrieves the current modifiers state of the device, as seen by the last event Clutter processed.
Since: 1.16
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device
,guint hardware_keycode
,guint *evdev_keycode
);
Translates a hardware keycode from a ClutterKeyEvent to the equivalent evdev keycode. Note that depending on the input backend used by Clutter this function can fail if there is no obvious mapping between the key codes. The hardware keycode can be taken from the ClutterKeyEvent.hardware_keycode member of ClutterKeyEvent.
device |
||
hardware_keycode |
The hardware keycode from a ClutterKeyEvent |
|
evdev_keycode |
The return location for the evdev keycode |
Since: 1.10
const gchar *
clutter_input_device_get_vendor_id (ClutterInputDevice *device
);
Gets the vendor ID of this device.
Since: 1.22
const gchar *
clutter_input_device_get_product_id (ClutterInputDevice *device
);
Gets the product ID of this device.
Since: 1.22
guint
clutter_input_device_get_n_keys (ClutterInputDevice *device
);
Retrieves the number of keys registered for device
.
Since: 1.6
void clutter_input_device_set_key (ClutterInputDevice *device
,guint index_
,guint keyval
,ClutterModifierType modifiers
);
Sets the keyval and modifiers at the given index_
for device
.
Clutter will use the keyval and modifiers set when filling out an event coming from the same input device.
Since: 1.6
gboolean clutter_input_device_get_key (ClutterInputDevice *device
,guint index_
,guint *keyval
,ClutterModifierType *modifiers
);
Retrieves the key set using clutter_input_device_set_key()
device |
||
index_ |
the index of the key |
|
keyval |
return location for the keyval at |
[out] |
modifiers |
return location for the modifiers at |
[out] |
Since: 1.6
guint
clutter_input_device_get_n_axes (ClutterInputDevice *device
);
Retrieves the number of axes available on device
.
Since: 1.6
ClutterInputAxis clutter_input_device_get_axis (ClutterInputDevice *device
,guint index_
);
Retrieves the type of axis on device
at the given index.
Since: 1.6
gboolean clutter_input_device_get_axis_value (ClutterInputDevice *device
,gdouble *axes
,ClutterInputAxis axis
,gdouble *value
);
Extracts the value of the given axis
of a ClutterInputDevice from
an array of axis values.
An example of typical usage for this function is:
1 2 3 4 5 6 7 |
ClutterInputDevice *device = clutter_event_get_device (event); gdouble *axes = clutter_event_get_axes (event, NULL); gdouble pressure_value = 0; clutter_input_device_get_axis_value (device, axes, CLUTTER_INPUT_AXIS_PRESSURE, &pressure_value); |
device |
||
axes |
an array of axes values, typically
coming from |
[array] |
axis |
the axis to extract |
|
value |
return location for the axis value. |
[out] |
Since: 1.6
gboolean clutter_input_device_get_coords (ClutterInputDevice *device
,ClutterEventSequence *sequence
,ClutterPoint *point
);
Retrieves the latest coordinates of a pointer or touch point of
device
.
device |
||
sequence |
a ClutterEventSequence, or |
[allow-none] |
point |
return location for the pointer or touch point. |
[out caller-allocates] |
Since: 1.12
void clutter_input_device_get_device_coords (ClutterInputDevice *device
,gint *x
,gint *y
);
clutter_input_device_get_device_coords
has been deprecated since version 1.12 and should not be used in newly-written code.
Use clutter_input_device_get_coords()
instead.
Retrieves the latest coordinates of the pointer of device
device |
a ClutterInputDevice of type |
|
x |
return location for the X coordinate. |
[out] |
y |
return location for the Y coordinate. |
[out] |
Since: 1.2
ClutterActor *
clutter_input_device_get_pointer_actor
(ClutterInputDevice *device
);
Retrieves the ClutterActor underneath the pointer of device
Since: 1.2
ClutterStage *
clutter_input_device_get_pointer_stage
(ClutterInputDevice *device
);
Retrieves the ClutterStage underneath the pointer of device
Since: 1.2
void clutter_input_device_grab (ClutterInputDevice *device
,ClutterActor *actor
);
Acquires a grab on actor
for the given device
.
Any event coming from device
will be delivered to actor
, bypassing
the usual event delivery mechanism, until the grab is released by
calling clutter_input_device_ungrab()
.
The grab is client-side: even if the windowing system used by the Clutter backend has the concept of "device grabs", Clutter will not use them.
Only ClutterInputDevice of types CLUTTER_POINTER_DEVICE
and
CLUTTER_KEYBOARD_DEVICE
can hold a grab.
Since: 1.10
void
clutter_input_device_ungrab (ClutterInputDevice *device
);
Releases the grab on the device
, if one is in place.
Since: 1.10
ClutterActor *
clutter_input_device_get_grabbed_actor
(ClutterInputDevice *device
);
Retrieves a pointer to the ClutterActor currently grabbing all
the events coming from device
.
Since: 1.10
void clutter_input_device_sequence_grab (ClutterInputDevice *device
,ClutterEventSequence *sequence
,ClutterActor *actor
);
Acquires a grab on actor
for the given device
and the given touch
sequence
.
Any touch event coming from device
and from sequence
will be
delivered to actor
, bypassing the usual event delivery mechanism,
until the grab is released by calling
clutter_input_device_sequence_ungrab()
.
The grab is client-side: even if the windowing system used by the Clutter backend has the concept of "device grabs", Clutter will not use them.
Since: 1.12
void clutter_input_device_sequence_ungrab (ClutterInputDevice *device
,ClutterEventSequence *sequence
);
Releases the grab on the device
for the given sequence
, if one is
in place.
Since: 1.12
ClutterActor * clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device
,ClutterEventSequence *sequence
);
Retrieves a pointer to the ClutterActor currently grabbing the
touch events coming from device
given the sequence
.
Since: 1.12
void clutter_input_device_update_from_event (ClutterInputDevice *device
,ClutterEvent *event
,gboolean update_stage
);
Forcibly updates the state of the device
using a ClutterEvent
This function should never be used by applications: it is meant for integration with embedding toolkits, like clutter-gtk
Embedding toolkits that disable the event collection inside Clutter
need to use this function to update the state of input devices depending
on a ClutterEvent that they are going to submit to the event handling code
in Clutter though clutter_do_event()
. Since the input devices hold the state
that is going to be used to fill in fields like the ClutterButtonEvent
click count, or to emit synthesized events like CLUTTER_ENTER
and
CLUTTER_LEAVE
, it is necessary for embedding toolkits to also be
responsible of updating the input device state.
For instance, this might be the code to translate an embedding toolkit native motion notification into a Clutter ClutterMotionEvent and ask Clutter to process it:
1 2 3 4 5 |
ClutterEvent c_event; translate_native_event_to_clutter (native_event, &c_event); clutter_do_event (&c_event); |
Before letting clutter_do_event()
process the event, it is necessary to call
clutter_input_device_update_from_event()
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
ClutterEvent c_event; ClutterDeviceManager *manager; ClutterInputDevice *device; translate_native_event_to_clutter (native_event, &c_event); // get the device manager manager = clutter_device_manager_get_default (); // use the default Core Pointer that Clutter backends register by default device = clutter_device_manager_get_core_device (manager, %CLUTTER_POINTER_DEVICE); // update the state of the input device clutter_input_device_update_from_event (device, &c_event, FALSE); clutter_do_event (&c_event); |
The update_stage
boolean argument should be used when the input device
enters and leaves a ClutterStage; it will use the ClutterStage field
of the passed event
to update the stage associated to the input device.
device |
||
event |
||
update_stage |
whether to update the ClutterStage of the |
Since: 1.2
The types of input devices available.
The ClutterInputDeviceType enumeration can be extended at later date; not every platform supports every input device type.
A pointer device |
||
A keyboard device |
||
A generic extension device |
||
A joystick device |
||
A tablet device |
||
A touchpad device |
||
A touch screen device |
||
A pen device |
||
An eraser device |
||
A cursor device |
||
The number of device types |
Since: 1.0
The type of axes Clutter recognizes on a ClutterInputDevice
Unused axis |
||
The position on the X axis |
||
The position of the Y axis |
||
The pressure information |
||
The tilt on the X axis |
||
The tile on the Y axis |
||
A wheel |
||
Distance (Since 1.12) |
||
Last value of the enumeration; this value is useful when iterating over the enumeration values (Since 1.12) |
Since: 1.6
“backend”
property“backend” ClutterBackend *
The ClutterBackend that created the device.
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Since: 1.6
“device-manager”
property“device-manager” ClutterDeviceManager *
The ClutterDeviceManager instance which owns the device
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Since: 1.6
“device-mode”
property“device-mode” ClutterInputMode
The mode of the device.
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Default value: CLUTTER_INPUT_MODE_FLOATING
“device-type”
property“device-type” ClutterInputDeviceType
The type of the device
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Default value: CLUTTER_POINTER_DEVICE
Since: 1.2
“enabled”
property“enabled” gboolean
Whether the device is enabled.
A device with the “device-mode” property set
to CLUTTER_INPUT_MODE_MASTER
cannot be disabled.
A device must be enabled in order to receive events from it.
Owner: ClutterInputDevice
Flags: Read / Write
Default value: FALSE
Since: 1.6
“has-cursor”
property“has-cursor” gboolean
Whether the device has an on screen cursor following its movement.
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Default value: FALSE
Since: 1.6
“id”
property “id” int
The unique identifier of the device
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Allowed values: >= -1
Default value: 0
Since: 1.2
“n-axes”
property“n-axes” guint
The number of axes of the device.
Owner: ClutterInputDevice
Flags: Read
Default value: 0
Since: 1.6
“name”
property “name” char *
The name of the device
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Default value: NULL
Since: 1.2
“product-id”
property “product-id” char *
Product ID of this device.
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Default value: NULL
Since: 1.22
“vendor-id”
property “vendor-id” char *
Vendor ID of this device.
Owner: ClutterInputDevice
Flags: Read / Write / Construct Only
Default value: NULL
Since: 1.22