gi-gdk-4.0.1: Gdk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gdk.Objects.Device

Description

The Device object represents a single input device, such as a keyboard, a mouse, a touchpad, etc.

See the Seat documentation for more information about the various kinds of master and slave devices, and their relationships.

Synopsis

Exported types

newtype Device Source #

Memory-managed wrapper type.

Constructors

Device (ManagedPtr Device) 

Instances

Instances details
Eq Device Source # 
Instance details

Defined in GI.Gdk.Objects.Device

Methods

(==) :: Device -> Device -> Bool #

(/=) :: Device -> Device -> Bool #

GObject Device Source # 
Instance details

Defined in GI.Gdk.Objects.Device

Methods

gobjectType :: IO GType #

IsGValue Device Source #

Convert Device to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Gdk.Objects.Device

HasParentTypes Device Source # 
Instance details

Defined in GI.Gdk.Objects.Device

type ParentTypes Device Source # 
Instance details

Defined in GI.Gdk.Objects.Device

class (GObject o, IsDescendantOf Device o) => IsDevice o Source #

Type class for types which can be safely cast to Device, for instance with toDevice.

Instances

Instances details
(GObject o, IsDescendantOf Device o) => IsDevice o Source # 
Instance details

Defined in GI.Gdk.Objects.Device

toDevice :: (MonadIO m, IsDevice o) => o -> m Device Source #

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

noDevice :: Maybe Device Source #

A convenience alias for Nothing :: Maybe Device.

Methods

Overloaded methods

getAssociatedDevice

deviceGetAssociatedDevice Source #

Arguments

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

device: a Device

-> m (Maybe Device)

Returns: The associated device, or Nothing

Returns the associated device to device, if device is of type DeviceTypeMaster, it will return the paired pointer or keyboard.

If device is of type DeviceTypeSlave, it will return the master device to which device is attached to.

If device is of type DeviceTypeFloating, Nothing will be returned, as there is no associated device.

getAxes

deviceGetAxes Source #

Arguments

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

device: a Device

-> m [AxisFlags] 

Returns the axes currently available on the device.

getAxisUse

deviceGetAxisUse Source #

Arguments

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

device: a pointer Device.

-> Word32

index_: the index of the axis.

-> m AxisUse

Returns: a AxisUse specifying how the axis is used.

Returns the axis use for index_.

getDeviceType

deviceGetDeviceType Source #

Arguments

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

device: a Device

-> m DeviceType

Returns: the DeviceType for device.

Returns the device type for device.

getDisplay

deviceGetDisplay Source #

Arguments

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

device: a Device

-> m Display

Returns: a Display. This memory is owned by GTK+, and must not be freed or unreffed.

Returns the Display to which device pertains.

getHasCursor

deviceGetHasCursor Source #

Arguments

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

device: a Device

-> m Bool

Returns: True if the pointer follows device motion

Determines whether the pointer follows device motion. This is not meaningful for keyboard devices, which don't have a pointer.

getKey

deviceGetKey Source #

Arguments

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

device: a Device.

-> Word32

index_: the index of the macro button to get.

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

Returns: True if keyval is set for index.

If index_ has a valid keyval, this function will return True and fill in keyval and modifiers with the keyval settings.

getLastEventSurface

deviceGetLastEventSurface Source #

Arguments

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

device: a Device, with a source other than InputSourceKeyboard

-> m (Maybe Surface)

Returns: the last surface the device

Gets information about which surface the given pointer device is in, based on events that have been received so far from the display server. If another application has a pointer grab, or this application has a grab with owner_events = False, Nothing may be returned even if the pointer is physically over one of this application's surfaces.

getMode

deviceGetMode Source #

Arguments

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

device: a Device

-> m InputMode

Returns: a InputSource

Determines the mode of the device.

getNAxes

deviceGetNAxes Source #

Arguments

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

device: a pointer Device

-> m Int32

Returns: the number of axes.

Returns the number of axes the device currently has.

getNKeys

deviceGetNKeys Source #

Arguments

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

device: a Device

-> m Int32

Returns: the number of keys.

Returns the number of keys the device currently has.

getName

deviceGetName Source #

Arguments

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

device: a Device

-> m Text

Returns: a name

Determines the name of the device.

getPosition

deviceGetPosition Source #

Arguments

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

device: pointer device to query status about.

-> m (Double, Double) 

Gets the current location of device in double precision. As a slave device's coordinates are those of its master pointer, this function may not be called on devices of type DeviceTypeSlave, unless there is an ongoing grab on them. See gdk_device_grab().

getProductId

deviceGetProductId Source #

Arguments

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

device: a slave Device

-> m (Maybe Text)

Returns: the product ID, or Nothing

Returns the product ID of this device, or Nothing if this information couldn't be obtained. This ID is retrieved from the device, and is thus constant for it. See deviceGetVendorId for more information.

getSeat

deviceGetSeat Source #

Arguments

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

device: A Device

-> m Seat

Returns: A Seat. This memory is owned by GTK+ and must not be freed.

Returns the Seat the device belongs to.

getSource

deviceGetSource Source #

Arguments

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

device: a Device

-> m InputSource

Returns: a InputSource

Determines the type of the device.

getSurfaceAtPosition

deviceGetSurfaceAtPosition Source #

Arguments

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

device: pointer Device to query info to.

-> m (Maybe Surface, Double, Double)

Returns: the Surface under the device position, or Nothing.

Obtains the surface underneath device, returning the location of the device in winX and winY in double precision. Returns Nothing if the surface tree under device is not known to GDK (for example, belongs to another application).

As a slave device coordinates are those of its master pointer, This function may not be called on devices of type DeviceTypeSlave, unless there is an ongoing grab on them, see gdk_device_grab().

getVendorId

deviceGetVendorId Source #

Arguments

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

device: a slave Device

-> m (Maybe Text)

Returns: the vendor ID, or Nothing

Returns the vendor ID of this device, or Nothing if this information couldn't be obtained. This ID is retrieved from the device, and is thus constant for it.

This function, together with deviceGetProductId, can be used to eg. compose Settings paths to store settings for this device.

C code

static GSettings *
get_device_settings (GdkDevice *device)
{
  const gchar *vendor, *product;
  GSettings *settings;
  GdkDevice *device;
  gchar *path;

  vendor = gdk_device_get_vendor_id (device);
  product = gdk_device_get_product_id (device);

  path = g_strdup_printf ("/org/example/app/devices/%s:%s/", vendor, product);
  settings = g_settings_new_with_path (DEVICE_SCHEMA, path);
  g_free (path);

  return settings;
}

listAxes

deviceListAxes Source #

Arguments

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

device: a pointer Device

-> m [Text]

Returns: A List of strings, free with g_list_free().

Returns a List of GdkAtoms, containing the labels for the axes that device currently has.

listSlaveDevices

deviceListSlaveDevices Source #

Arguments

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

device: a Device

-> m [Device]

Returns: the list of slave devices, or Nothing. The list must be freed with g_list_free(), the contents of the list are owned by GTK+ and should not be freed.

If the device if of type DeviceTypeMaster, it will return the list of slave devices attached to it, otherwise it will return Nothing

setAxisUse

deviceSetAxisUse Source #

Arguments

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

device: a pointer Device

-> Word32

index_: the index of the axis

-> AxisUse

use: specifies how the axis is used

-> m () 

Specifies how an axis of a device is used.

setKey

deviceSetKey Source #

Arguments

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

device: a Device

-> Word32

index_: the index of the macro button to set

-> Word32

keyval: the keyval to generate

-> [ModifierType]

modifiers: the modifiers to set

-> m () 

Specifies the X key event to generate when a macro button of a device is pressed.

setMode

deviceSetMode Source #

Arguments

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

device: a Device.

-> InputMode

mode: the input mode.

-> m Bool

Returns: True if the mode was successfully changed.

Sets a the mode of an input device. The mode controls if the device is active and whether the device’s range is mapped to the entire screen or to a single surface.

Note: This is only meaningful for floating devices, master devices (and slaves connected to these) drive the pointer cursor, which is not limited by the input mode.

Properties

associatedDevice

Associated pointer or keyboard with this device, if any. Devices of type GDK_DEVICE_TYPE_MASTER always come in keyboard/pointer pairs. Other device types will have a Nothing associated device.

getDeviceAssociatedDevice :: (MonadIO m, IsDevice o) => o -> m (Maybe Device) Source #

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

get device #associatedDevice

axes

The axes currently available for this device.

getDeviceAxes :: (MonadIO m, IsDevice o) => o -> m [AxisFlags] Source #

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

get device #axes

display

The Display the Device pertains to.

constructDeviceDisplay :: (IsDevice o, IsDisplay a) => a -> IO (GValueConstruct o) Source #

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

getDeviceDisplay :: (MonadIO m, IsDevice o) => o -> m Display Source #

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

get device #display

hasCursor

Whether the device is represented by a cursor on the screen. Devices of type DeviceTypeMaster will have True here.

constructDeviceHasCursor :: IsDevice o => Bool -> IO (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.

getDeviceHasCursor :: (MonadIO m, IsDevice o) => o -> m Bool Source #

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

get device #hasCursor

inputMode

No description available in the introspection data.

constructDeviceInputMode :: IsDevice o => InputMode -> IO (GValueConstruct o) Source #

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

getDeviceInputMode :: (MonadIO m, IsDevice o) => o -> m InputMode Source #

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

get device #inputMode

setDeviceInputMode :: (MonadIO m, IsDevice o) => o -> InputMode -> m () Source #

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

set device [ #inputMode := value ]

inputSource

Source type for the device.

constructDeviceInputSource :: IsDevice o => InputSource -> IO (GValueConstruct o) Source #

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

getDeviceInputSource :: (MonadIO m, IsDevice o) => o -> m InputSource Source #

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

get device #inputSource

nAxes

Number of axes in the device.

getDeviceNAxes :: (MonadIO m, IsDevice o) => o -> m Word32 Source #

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

get device #nAxes

name

The device name.

constructDeviceName :: IsDevice o => Text -> IO (GValueConstruct o) Source #

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

getDeviceName :: (MonadIO m, IsDevice o) => o -> m Text Source #

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

get device #name

numTouches

The maximal number of concurrent touches on a touch device. Will be 0 if the device is not a touch device or if the number of touches is unknown.

constructDeviceNumTouches :: IsDevice o => Word32 -> IO (GValueConstruct o) Source #

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

getDeviceNumTouches :: (MonadIO m, IsDevice o) => o -> m Word32 Source #

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

get device #numTouches

productId

Product ID of this device, see deviceGetProductId.

constructDeviceProductId :: IsDevice o => Text -> IO (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.

getDeviceProductId :: (MonadIO m, IsDevice o) => o -> m (Maybe Text) Source #

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

get device #productId

seat

Seat of this device.

clearDeviceSeat :: (MonadIO m, IsDevice o) => o -> m () Source #

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

clear #seat

constructDeviceSeat :: (IsDevice o, IsSeat a) => a -> IO (GValueConstruct o) Source #

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

getDeviceSeat :: (MonadIO m, IsDevice o) => o -> m Seat Source #

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

get device #seat

setDeviceSeat :: (MonadIO m, IsDevice o, IsSeat a) => o -> a -> m () Source #

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

set device [ #seat := value ]

tool

No description available in the introspection data.

getDeviceTool :: (MonadIO m, IsDevice o) => o -> m (Maybe DeviceTool) Source #

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

get device #tool

type

Device role in the device manager.

constructDeviceType :: IsDevice o => DeviceType -> IO (GValueConstruct o) Source #

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

getDeviceType :: (MonadIO m, IsDevice o) => o -> m DeviceType Source #

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

get device #type

vendorId

Vendor ID of this device, see deviceGetVendorId.

constructDeviceVendorId :: IsDevice o => Text -> IO (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.

getDeviceVendorId :: (MonadIO m, IsDevice o) => o -> m (Maybe Text) Source #

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

get device #vendorId

Signals

changed

type C_DeviceChangedCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type DeviceChangedCallback = IO () Source #

The changed signal is emitted either when the Device has changed the number of either axes or keys. For example In X this will normally happen when the slave device routing events through the master device changes (for example, user switches from the USB mouse to a tablet), in that case the master device will change to reflect the new slave device axes and keys.

afterDeviceChanged :: (IsDevice a, MonadIO m) => a -> DeviceChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after device #changed callback

mk_DeviceChangedCallback :: C_DeviceChangedCallback -> IO (FunPtr C_DeviceChangedCallback) Source #

Generate a function pointer callable from C code, from a C_DeviceChangedCallback.

onDeviceChanged :: (IsDevice a, MonadIO m) => a -> DeviceChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on device #changed callback

toolChanged

type C_DeviceToolChangedCallback = Ptr () -> Ptr DeviceTool -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type DeviceToolChangedCallback Source #

Arguments

 = DeviceTool

tool: The new current tool

-> IO () 

The toolChanged signal is emitted on pen/eraser GdkDevices whenever tools enter or leave proximity.

afterDeviceToolChanged :: (IsDevice a, MonadIO m) => a -> DeviceToolChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the toolChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after device #toolChanged callback

onDeviceToolChanged :: (IsDevice a, MonadIO m) => a -> DeviceToolChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the toolChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on device #toolChanged callback