Class: Clutter::InputDevice

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#associated_deviceClutter::InputDevice

Retrieves a pointer to the Clutter::InputDevice that has been
associated to device.

If the Clutter::InputDevice:device-mode property of device is
set to %CLUTTER_INPUT_MODE_MASTER, this function will return
nil.

Returns:

#backendClutter::Backend

The Clutter::Backend that created the device.

Returns:

#backend=(backend) ⇒ Clutter::Backend

The Clutter::Backend that created the device.

Parameters:

Returns:

#device_idInteger

Retrieves the unique identifier of device

Returns:

  • (Integer)

    the identifier of the device

#device_managerClutter::DeviceManager

The Clutter::DeviceManager instance which owns the device

Returns:

#device_manager=(device_manager) ⇒ Clutter::DeviceManager

The Clutter::DeviceManager instance which owns the device

Parameters:

Returns:

#device_modeClutter::InputMode

Returns device-mode.

Returns:

#device_mode=(device_mode) ⇒ Clutter::InputMode

Parameters:

Returns:

#device_nameString

Retrieves the name of the device

Returns:

  • (String)

    the name of the device, or nil. The returned string
    is owned by the Clutter::InputDevice and should never be modified
    or freed

#device_typeClutter::InputDeviceType

The type of the device

Returns:

#device_type=(device_type) ⇒ Clutter::InputDeviceType

The type of the device

Parameters:

Returns:

#enabledBoolean

Retrieves whether device is enabled.

Returns:

  • (Boolean)

    true if the device is enabled

#enabled=(enabled) ⇒ Boolean

Whether the device is enabled.

A device with the Clutter::InputDevice:device-mode property set
to %CLUTTER_INPUT_MODE_MASTER cannot be disabled.

A device must be enabled in order to receive events from it.

Parameters:

  • enabled (Boolean)

Returns:

  • (Boolean)

    enabled

  • (Boolean)

    enabled

#enabled?Boolean

Whether the device is enabled.

A device with the Clutter::InputDevice:device-mode property set
to %CLUTTER_INPUT_MODE_MASTER cannot be disabled.

A device must be enabled in order to receive events from it.

Returns:

  • (Boolean)

    enabled

#get_axis(index_) ⇒ Clutter::InputAxis

Retrieves the type of axis on device at the given index.

Parameters:

  • index_ (Integer)

    the index of the axis

Returns:

#get_axis_value(axes, axis, value) ⇒ Boolean

Extracts the value of the given axis of a Clutter::InputDevice from
an array of axis values.

An example of typical usage for this function is:

|[
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);
]|

Parameters:

  • axes (Array<Float>)

    an array of axes values, typically
    coming from clutter_event_get_axes()

  • axis (Clutter::InputAxis)

    the axis to extract

  • value (Float)

    return location for the axis value

Returns:

  • (Boolean)

    true if the value was set, and false otherwise

#get_coords(sequence, point) ⇒ Boolean

Retrieves the latest coordinates of a pointer or touch point of
device.

Parameters:

  • sequence (Clutter::EventSequence)

    a Clutter::EventSequence, or nil if
    the device is not touch-based

  • point (Clutter::Point)

    return location for the pointer
    or touch point

Returns:

  • (Boolean)

    false if the device's sequence hasn't been found,
    and true otherwise.

#get_device_coords(x, y) ⇒ nil

Retrieves the latest coordinates of the pointer of device

Parameters:

  • x (Integer)

    return location for the X coordinate

  • y (Integer)

    return location for the Y coordinate

Returns:

  • (nil)

#get_key(index_, keyval, modifiers) ⇒ Boolean

Retrieves the key set using clutter_input_device_set_key()

Parameters:

  • index_ (Integer)

    the index of the key

  • keyval (Integer)

    return location for the keyval at index_

  • modifiers (Clutter::ModifierType)

    return location for the modifiers at index_

Returns:

  • (Boolean)

    true if a key was set at the given index

#grab(actor) ⇒ nil

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 Clutter::InputDevice of types %CLUTTER_POINTER_DEVICE and
%CLUTTER_KEYBOARD_DEVICE can hold a grab.

Parameters:

Returns:

  • (nil)

#grabbed_actorClutter::Actor

Retrieves a pointer to the Clutter::Actor currently grabbing all
the events coming from device.

Returns:

#has_cursorBoolean

Retrieves whether device has a pointer that follows the
device motion.

Returns:

  • (Boolean)

    true if the device has a cursor

#has_cursor=(has_cursor) ⇒ Boolean

Whether the device has an on screen cursor following its movement.

Parameters:

  • has_cursor (Boolean)

Returns:

  • (Boolean)

    has-cursor

  • (Boolean)

    has-cursor

#has_cursor?Boolean

Whether the device has an on screen cursor following its movement.

Returns:

  • (Boolean)

    has-cursor

#idInteger

The unique identifier of the device

Returns:

  • (Integer)

    id

#id=(id) ⇒ Integer

The unique identifier of the device

Parameters:

  • id (Integer)

Returns:

  • (Integer)

    id

  • (Integer)

    id

#keycode_to_evdev(hardware_keycode, evdev_keycode) ⇒ Boolean

Translates a hardware keycode from a Clutter::KeyEvent 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 Clutter::KeyEvent.hardware_keycode member of #ClutterKeyEvent.

Parameters:

  • hardware_keycode (Integer)

    The hardware keycode from a Clutter::KeyEvent

  • evdev_keycode (Integer)

    The return location for the evdev keycode

Returns:

  • (Boolean)

    true if the conversion succeeded, false otherwise.

#modifier_stateClutter::ModifierType

Retrieves the current modifiers state of the device, as seen
by the last event Clutter processed.

Returns:

#n_axesInteger

The number of axes of the device.

Returns:

  • (Integer)

    n-axes

#n_axes=(n_axes) ⇒ Integer

The number of axes of the device.

Parameters:

  • n_axes (Integer)

Returns:

  • (Integer)

    n-axes

  • (Integer)

    n-axes

#n_keysInteger

Retrieves the number of keys registered for device.

Returns:

  • (Integer)

    the number of registered keys

#nameString

The name of the device

Returns:

  • (String)

    name

#name=(name) ⇒ String

The name of the device

Parameters:

  • name (String)

Returns:

  • (String)

    name

  • (String)

    name

#pointer_actorClutter::Actor

Retrieves the Clutter::Actor underneath the pointer of device

Returns:

#pointer_stageClutter::Stage

Retrieves the Clutter::Stage underneath the pointer of device

Returns:

#product_idString

Product ID of this device.

Returns:

  • (String)

    product-id

#product_id=(product_id) ⇒ String

Product ID of this device.

Parameters:

  • product_id (String)

Returns:

  • (String)

    product-id

  • (String)

    product-id

#sequence_get_grabbed_actor(sequence) ⇒ Clutter::Actor

Retrieves a pointer to the Clutter::Actor currently grabbing the
touch events coming from device given the sequence.

Parameters:

  • sequence (Clutter::EventSequence)

    a Clutter::EventSequence

Returns:

#sequence_grab(sequence, actor) ⇒ nil

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.

Parameters:

  • sequence (Clutter::EventSequence)

    a Clutter::EventSequence

  • actor (Clutter::Actor)

    a Clutter::Actor

Returns:

  • (nil)

#sequence_ungrab(sequence) ⇒ nil

Releases the grab on the device for the given sequence, if one is
in place.

Parameters:

  • sequence (Clutter::EventSequence)

    a Clutter::EventSequence

Returns:

  • (nil)

#set_key(index_, keyval, modifiers) ⇒ nil

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.

Parameters:

  • index_ (Integer)

    the index of the key

  • keyval (Integer)

    the keyval

  • modifiers (Clutter::ModifierType)

    a bitmask of modifiers

Returns:

  • (nil)

#slave_devicesGLib::List<Clutter::InputDevice>

Retrieves the slave devices attached to device.

Returns:

  • (GLib::List<Clutter::InputDevice>)

    a
    list of Clutter::InputDevice, or nil. The contents of the list are
    owned by the device. Use g_list_free() when done

#ungrabnil

Releases the grab on the device, if one is in place.

Returns:

  • (nil)

#update_from_event(event, update_stage) ⇒ nil

Forcibly updates the state of the device using a Clutter::Event

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 Clutter::Event 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 Clutter::ButtonEvent
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 Clutter::MotionEvent and ask
Clutter to process it:

|[
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():

|[
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 Clutter::Stage; it will use the #ClutterStage field
of the passed event to update the stage associated to the input device.

Parameters:

  • event (Clutter::Event)

    a Clutter::Event

  • update_stage (Boolean)

    whether to update the Clutter::Stage of the device
    using the stage of the event

Returns:

  • (nil)

#vendor_idString

Vendor ID of this device.

Returns:

  • (String)

    vendor-id

#vendor_id=(vendor_id) ⇒ String

Vendor ID of this device.

Parameters:

  • vendor_id (String)

Returns:

  • (String)

    vendor-id

  • (String)

    vendor-id