gi-clutter-1.0.2: clutter GObject bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Clutter.Objects.InputDevice

Description

Generic representation of an input device. The actual contents of this structure depend on the backend used.

Synopsis

Exported types

class (GObject o, IsDescendantOf InputDevice o) => IsInputDevice o Source #

Type class for types which can be safely cast to InputDevice, for instance with toInputDevice.

Instances

Instances details
(GObject o, IsDescendantOf InputDevice o) => IsInputDevice o Source # 
Instance details

Defined in GI.Clutter.Objects.InputDevice

toInputDevice :: (MonadIO m, IsInputDevice o) => o -> m InputDevice Source #

Cast to InputDevice, for types for which this is known to be safe. For general casts, use castTo.

Methods

getAssociatedDevice

inputDeviceGetAssociatedDevice Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m InputDevice

Returns: a InputDevice, or Nothing

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

If the InputDevice:device-mode property of device is set to InputModeMaster, this function will return Nothing.

Since: 1.6

getAxis

inputDeviceGetAxis Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> Word32

index_: the index of the axis

-> m InputAxis

Returns: the axis type

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

Since: 1.6

getAxisValue

inputDeviceGetAxisValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> [Double]

axes: an array of axes values, typically coming from eventGetAxes

-> InputAxis

axis: the axis to extract

-> m (Bool, Double)

Returns: True if the value was set, and False otherwise

Extracts the value of the given axis of a 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);

Since: 1.6

getCoords

inputDeviceGetCoords Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> Maybe EventSequence

sequence: a EventSequence, or Nothing if the device is not touch-based

-> m (Bool, Point)

Returns: False if the device's sequence hasn't been found, and True otherwise.

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

Since: 1.12

getDeviceCoords

inputDeviceGetDeviceCoords Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice of type InputDeviceTypePointerDevice

-> m (Int32, Int32) 

Deprecated: (Since version 1.12)Use inputDeviceGetCoords instead.

Retrieves the latest coordinates of the pointer of device

Since: 1.2

getDeviceId

inputDeviceGetDeviceId Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m Int32

Returns: the identifier of the device

Retrieves the unique identifier of device

Since: 1.0

getDeviceMode

inputDeviceGetDeviceMode Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m InputMode

Returns: the device mode

Retrieves the InputMode of device.

Since: 1.6

getDeviceName

inputDeviceGetDeviceName Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m Text

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

Retrieves the name of the device

Since: 1.2

getDeviceType

inputDeviceGetDeviceType Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m InputDeviceType

Returns: the type of the device

Retrieves the type of device

Since: 1.0

getEnabled

inputDeviceGetEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m Bool

Returns: True if the device is enabled

Retrieves whether device is enabled.

Since: 1.6

getGrabbedActor

inputDeviceGetGrabbedActor Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m Actor

Returns: a Actor, or Nothing

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

Since: 1.10

getHasCursor

inputDeviceGetHasCursor Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m Bool

Returns: True if the device has a cursor

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

Since: 1.6

getKey

inputDeviceGetKey Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> Word32

index_: the index of the key

-> m (Bool, Word32, [ModifierType])

Returns: True if a key was set at the given index

Retrieves the key set using inputDeviceSetKey

Since: 1.6

getModifierState

inputDeviceGetModifierState Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m [ModifierType]

Returns: the last known modifier state

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

Since: 1.16

getNAxes

inputDeviceGetNAxes Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m Word32

Returns: the number of axes on the device

Retrieves the number of axes available on device.

Since: 1.6

getNKeys

inputDeviceGetNKeys Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m Word32

Returns: the number of registered keys

Retrieves the number of keys registered for device.

Since: 1.6

getPointerActor

inputDeviceGetPointerActor Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice of type InputDeviceTypePointerDevice

-> m Actor

Returns: a pointer to the Actor or Nothing

Retrieves the Actor underneath the pointer of device

Since: 1.2

getPointerStage

inputDeviceGetPointerStage Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice of type InputDeviceTypePointerDevice

-> m Stage

Returns: a pointer to the Stage or Nothing

Retrieves the Stage underneath the pointer of device

Since: 1.2

getProductId

inputDeviceGetProductId Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a slave InputDevice

-> m Text

Returns: the product ID

Gets the product ID of this device.

Since: 1.22

getSlaveDevices

inputDeviceGetSlaveDevices Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m [InputDevice]

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

Retrieves the slave devices attached to device.

Since: 1.6

getVendorId

inputDeviceGetVendorId Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a slave InputDevice

-> m Text

Returns: the vendor ID

Gets the vendor ID of this device.

Since: 1.22

grab

inputDeviceGrab Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a, IsActor b) 
=> a

device: a InputDevice

-> b

actor: a Actor

-> m () 

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 inputDeviceUngrab.

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 InputDevice of types InputDeviceTypePointerDevice and InputDeviceTypeKeyboardDevice can hold a grab.

Since: 1.10

keycodeToEvdev

inputDeviceKeycodeToEvdev Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: A InputDevice

-> Word32

hardwareKeycode: The hardware keycode from a KeyEvent

-> Word32

evdevKeycode: The return location for the evdev keycode

-> m Bool

Returns: True if the conversion succeeded, False otherwise.

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

Since: 1.10

sequenceGetGrabbedActor

inputDeviceSequenceGetGrabbedActor Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> EventSequence

sequence: a EventSequence

-> m Actor

Returns: a Actor, or Nothing

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

Since: 1.12

sequenceGrab

inputDeviceSequenceGrab Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a, IsActor b) 
=> a

device: a InputDevice

-> EventSequence

sequence: a EventSequence

-> b

actor: a Actor

-> m () 

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 inputDeviceSequenceUngrab.

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

sequenceUngrab

inputDeviceSequenceUngrab Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> EventSequence

sequence: a EventSequence

-> m () 

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

Since: 1.12

setEnabled

inputDeviceSetEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> Bool

enabled: True to enable the device

-> m () 

Enables or disables a InputDevice.

Only devices with a InputDevice:device-mode property set to InputModeSlave or InputModeFloating can be disabled.

Since: 1.6

setKey

inputDeviceSetKey Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> Word32

index_: the index of the key

-> Word32

keyval: the keyval

-> [ModifierType]

modifiers: a bitmask of modifiers

-> m () 

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

ungrab

inputDeviceUngrab Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> m () 

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

Since: 1.10

updateFromEvent

inputDeviceUpdateFromEvent Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputDevice a) 
=> a

device: a InputDevice

-> Event

event: a Event

-> Bool

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

-> m () 

Forcibly updates the state of the device using a 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 Event that they are going to submit to the event handling code in Clutter though doEvent. Since the input devices hold the state that is going to be used to fill in fields like the ButtonEvent click count, or to emit synthesized events like EventTypeEnter and EventTypeLeave, 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 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 doEvent process the event, it is necessary to call inputDeviceUpdateFromEvent:

 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 updateStage boolean argument should be used when the input device enters and leaves a Stage; it will use the Stage field of the passed event to update the stage associated to the input device.

Since: 1.2

Properties

backend

The Backend that created the device.

Since: 1.6

constructInputDeviceBackend :: (IsInputDevice o, MonadIO m, IsBackend a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “backend” property. This is rarely needed directly, but it is used by new.

getInputDeviceBackend :: (MonadIO m, IsInputDevice o) => o -> m (Maybe Backend) Source #

Get the value of the “backend” property. When overloading is enabled, this is equivalent to

get inputDevice #backend

deviceManager

The DeviceManager instance which owns the device

Since: 1.6

constructInputDeviceDeviceManager :: (IsInputDevice o, MonadIO m, IsDeviceManager a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “device-manager” property. This is rarely needed directly, but it is used by new.

getInputDeviceDeviceManager :: (MonadIO m, IsInputDevice o) => o -> m (Maybe DeviceManager) Source #

Get the value of the “device-manager” property. When overloading is enabled, this is equivalent to

get inputDevice #deviceManager

deviceMode

No description available in the introspection data.

constructInputDeviceDeviceMode :: (IsInputDevice o, MonadIO m) => InputMode -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “device-mode” property. This is rarely needed directly, but it is used by new.

getInputDeviceDeviceMode :: (MonadIO m, IsInputDevice o) => o -> m InputMode Source #

Get the value of the “device-mode” property. When overloading is enabled, this is equivalent to

get inputDevice #deviceMode

deviceType

The type of the device

Since: 1.2

constructInputDeviceDeviceType :: (IsInputDevice o, MonadIO m) => InputDeviceType -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “device-type” property. This is rarely needed directly, but it is used by new.

getInputDeviceDeviceType :: (MonadIO m, IsInputDevice o) => o -> m InputDeviceType Source #

Get the value of the “device-type” property. When overloading is enabled, this is equivalent to

get inputDevice #deviceType

enabled

Whether the device is enabled.

A device with the InputDevice:device-mode property set to InputModeMaster cannot be disabled.

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

Since: 1.6

constructInputDeviceEnabled :: (IsInputDevice o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “enabled” property. This is rarely needed directly, but it is used by new.

getInputDeviceEnabled :: (MonadIO m, IsInputDevice o) => o -> m Bool Source #

Get the value of the “enabled” property. When overloading is enabled, this is equivalent to

get inputDevice #enabled

setInputDeviceEnabled :: (MonadIO m, IsInputDevice o) => o -> Bool -> m () Source #

Set the value of the “enabled” property. When overloading is enabled, this is equivalent to

set inputDevice [ #enabled := value ]

hasCursor

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

Since: 1.6

constructInputDeviceHasCursor :: (IsInputDevice o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “has-cursor” property. This is rarely needed directly, but it is used by new.

getInputDeviceHasCursor :: (MonadIO m, IsInputDevice o) => o -> m Bool Source #

Get the value of the “has-cursor” property. When overloading is enabled, this is equivalent to

get inputDevice #hasCursor

id

The unique identifier of the device

Since: 1.2

constructInputDeviceId :: (IsInputDevice o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “id” property. This is rarely needed directly, but it is used by new.

getInputDeviceId :: (MonadIO m, IsInputDevice o) => o -> m Int32 Source #

Get the value of the “id” property. When overloading is enabled, this is equivalent to

get inputDevice #id

nAxes

The number of axes of the device.

Since: 1.6

getInputDeviceNAxes :: (MonadIO m, IsInputDevice o) => o -> m Word32 Source #

Get the value of the “n-axes” property. When overloading is enabled, this is equivalent to

get inputDevice #nAxes

name

The name of the device

Since: 1.2

constructInputDeviceName :: (IsInputDevice o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “name” property. This is rarely needed directly, but it is used by new.

getInputDeviceName :: (MonadIO m, IsInputDevice o) => o -> m (Maybe Text) Source #

Get the value of the “name” property. When overloading is enabled, this is equivalent to

get inputDevice #name

productId

Product ID of this device.

Since: 1.22

constructInputDeviceProductId :: (IsInputDevice o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “product-id” property. This is rarely needed directly, but it is used by new.

getInputDeviceProductId :: (MonadIO m, IsInputDevice o) => o -> m Text Source #

Get the value of the “product-id” property. When overloading is enabled, this is equivalent to

get inputDevice #productId

vendorId

Vendor ID of this device.

Since: 1.22

constructInputDeviceVendorId :: (IsInputDevice o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “vendor-id” property. This is rarely needed directly, but it is used by new.

getInputDeviceVendorId :: (MonadIO m, IsInputDevice o) => o -> m Text Source #

Get the value of the “vendor-id” property. When overloading is enabled, this is equivalent to

get inputDevice #vendorId