gi-gdk4-4.0.10: Gdk bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gdk.Objects.Device

Contents

- Exported types
- Methods
  - getActiveLayoutIndex
  - getCapsLockState
  - getDeviceTool
  - getDirection
  - getDisplay
  - getHasCursor
  - getLayoutNames
  - getModifierState
  - getName
  - getNumLockState
  - getNumTouches
  - getProductId
  - getScrollLockState
  - getSeat
  - getSource
  - getSurfaceAtPosition
  - getTimestamp
  - getVendorId
  - hasBidiLayouts
- Properties
  - activeLayoutIndex
  - capsLockState
  - direction
  - display
  - hasBidiLayouts
  - hasCursor
  - layoutNames
  - modifierState
  - nAxes
  - name
  - numLockState
  - numTouches
  - productId
  - scrollLockState
  - seat
  - source
  - tool
  - vendorId
- Signals
  - changed
  - toolChanged

Description

Represents an input device, such as a keyboard, mouse or touchpad.

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

Synopsis

- newtype Device = Device (ManagedPtr Device)
- class (GObject o, IsDescendantOf Device o) => IsDevice o
- toDevice :: (MonadIO m, IsDevice o) => o -> m Device
- deviceGetActiveLayoutIndex :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Int32
- deviceGetCapsLockState :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Bool
- deviceGetDeviceTool :: (HasCallStack, MonadIO m, IsDevice a) => a -> m (Maybe DeviceTool)
- deviceGetDirection :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Direction
- deviceGetDisplay :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Display
- deviceGetHasCursor :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Bool
- deviceGetLayoutNames :: (HasCallStack, MonadIO m, IsDevice a) => a -> m (Maybe [Text])
- deviceGetModifierState :: (HasCallStack, MonadIO m, IsDevice a) => a -> m [ModifierType]
- deviceGetName :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Text
- deviceGetNumLockState :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Bool
- deviceGetNumTouches :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Word32
- deviceGetProductId :: (HasCallStack, MonadIO m, IsDevice a) => a -> m (Maybe Text)
- deviceGetScrollLockState :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Bool
- deviceGetSeat :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Seat
- deviceGetSource :: (HasCallStack, MonadIO m, IsDevice a) => a -> m InputSource
- deviceGetSurfaceAtPosition :: (HasCallStack, MonadIO m, IsDevice a) => a -> m (Maybe Surface, Double, Double)
- deviceGetTimestamp :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Word32
- deviceGetVendorId :: (HasCallStack, MonadIO m, IsDevice a) => a -> m (Maybe Text)
- deviceHasBidiLayouts :: (HasCallStack, MonadIO m, IsDevice a) => a -> m Bool
- getDeviceActiveLayoutIndex :: (MonadIO m, IsDevice o) => o -> m Int32
- getDeviceCapsLockState :: (MonadIO m, IsDevice o) => o -> m Bool
- getDeviceDirection :: (MonadIO m, IsDevice o) => o -> m Direction
- constructDeviceDisplay :: (IsDevice o, MonadIO m, IsDisplay a) => a -> m (GValueConstruct o)
- getDeviceDisplay :: (MonadIO m, IsDevice o) => o -> m Display
- getDeviceHasBidiLayouts :: (MonadIO m, IsDevice o) => o -> m Bool
- constructDeviceHasCursor :: (IsDevice o, MonadIO m) => Bool -> m (GValueConstruct o)
- getDeviceHasCursor :: (MonadIO m, IsDevice o) => o -> m Bool
- getDeviceLayoutNames :: (MonadIO m, IsDevice o) => o -> m (Maybe [Text])
- getDeviceModifierState :: (MonadIO m, IsDevice o) => o -> m [ModifierType]
- getDeviceNAxes :: (MonadIO m, IsDevice o) => o -> m Word32
- constructDeviceName :: (IsDevice o, MonadIO m) => Text -> m (GValueConstruct o)
- getDeviceName :: (MonadIO m, IsDevice o) => o -> m Text
- getDeviceNumLockState :: (MonadIO m, IsDevice o) => o -> m Bool
- constructDeviceNumTouches :: (IsDevice o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getDeviceNumTouches :: (MonadIO m, IsDevice o) => o -> m Word32
- constructDeviceProductId :: (IsDevice o, MonadIO m) => Text -> m (GValueConstruct o)
- getDeviceProductId :: (MonadIO m, IsDevice o) => o -> m (Maybe Text)
- getDeviceScrollLockState :: (MonadIO m, IsDevice o) => o -> m Bool
- clearDeviceSeat :: (MonadIO m, IsDevice o) => o -> m ()
- constructDeviceSeat :: (IsDevice o, MonadIO m, IsSeat a) => a -> m (GValueConstruct o)
- getDeviceSeat :: (MonadIO m, IsDevice o) => o -> m Seat
- setDeviceSeat :: (MonadIO m, IsDevice o, IsSeat a) => o -> a -> m ()
- constructDeviceSource :: (IsDevice o, MonadIO m) => InputSource -> m (GValueConstruct o)
- getDeviceSource :: (MonadIO m, IsDevice o) => o -> m InputSource
- getDeviceTool :: (MonadIO m, IsDevice o) => o -> m (Maybe DeviceTool)
- constructDeviceVendorId :: (IsDevice o, MonadIO m) => Text -> m (GValueConstruct o)
- getDeviceVendorId :: (MonadIO m, IsDevice o) => o -> m (Maybe Text)
- type DeviceChangedCallback = IO ()
- afterDeviceChanged :: (IsDevice a, MonadIO m) => a -> ((?self :: a) => DeviceChangedCallback) -> m SignalHandlerId
- onDeviceChanged :: (IsDevice a, MonadIO m) => a -> ((?self :: a) => DeviceChangedCallback) -> m SignalHandlerId
- type DeviceToolChangedCallback = DeviceTool -> IO ()
- afterDeviceToolChanged :: (IsDevice a, MonadIO m) => a -> ((?self :: a) => DeviceToolChangedCallback) -> m SignalHandlerId
- onDeviceToolChanged :: (IsDevice a, MonadIO m) => a -> ((?self :: a) => DeviceToolChangedCallback) -> m SignalHandlerId

# 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 Source # (/=) :: Device -> Device -> Bool Source #
GObject Device Source # |
Instance details Defined in GI.Gdk.Objects.Device
ManagedPtrNewtype Device Source # |
Instance details Defined in GI.Gdk.Objects.Device Methods toManagedPtr :: Device -> ManagedPtr Device Source #
TypedObject Device Source # |
Instance details Defined in GI.Gdk.Objects.Device Methods glibType :: IO GType Source #
HasParentTypes Device Source # |
Instance details Defined in GI.Gdk.Objects.Device
IsGValue (Maybe Device) Source # | Convert `Device` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gdk.Objects.Device Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Device -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Device) Source #
type ParentTypes Device Source # |
Instance details Defined in GI.Gdk.Objects.Device type ParentTypes Device = '[Object]

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

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, hasBidiLayouts, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getActiveLayoutIndex, getCapsLockState, getData, getDeviceTool, getDirection, getDisplay, getHasCursor, getLayoutNames, getModifierState, getName, getNumLockState, getNumTouches, getProductId, getProperty, getQdata, getScrollLockState, getSeat, getSource, getSurfaceAtPosition, getTimestamp, getVendorId.

#### Setters

setData, setDataFull, setProperty.

## getActiveLayoutIndex

deviceGetActiveLayoutIndex Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m Int32 | Returns: The layout index of the active layout or -1.

Retrieves the index of the active layout of the keyboard.

If there is no valid active layout for the `GdkDevice`, this function will return -1;

This is only relevant for keyboard devices.

Since: 4.18

## getCapsLockState

deviceGetCapsLockState Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m Bool | Returns: `True` if Caps Lock is on for `device`

Retrieves whether the Caps Lock modifier of the keyboard is locked.

This is only relevant for keyboard devices.

## getDeviceTool

deviceGetDeviceTool Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m (Maybe DeviceTool) | Returns: the `GdkDeviceTool`

Retrieves the current tool for `device`.

## getDirection

deviceGetDirection Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m Direction | Returns: `DirectionLtr` or `DirectionRtl` if it can determine the direction. `DirectionNeutral` otherwise

Returns the direction of effective layout of the keyboard.

This is only relevant for keyboard devices.

The direction of a layout is the direction of the majority of its symbols. See `unicharDirection`.

## getDisplay

deviceGetDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m Display | Returns: a `GdkDisplay`

Returns the `GdkDisplay` to which `device` pertains.

## getHasCursor

deviceGetHasCursor Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> 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.

## getLayoutNames

deviceGetLayoutNames Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m (Maybe [Text]) | Returns: `Nothing`-terminated array of strings of layouts,

Retrieves the names of the layouts of the keyboard.

This is only relevant for keyboard devices.

Since: 4.18

## getModifierState

deviceGetModifierState Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m [ModifierType] | Returns: the current modifier state

Retrieves the current modifier state of the keyboard.

This is only relevant for keyboard devices.

## getName

deviceGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a GdkDevice`
-> m Text | Returns: a name

The name of the device, suitable for showing in a user interface.

## getNumLockState

deviceGetNumLockState Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a ``GdkDevice`
-> m Bool | Returns: `True` if Num Lock is on for `device`

Retrieves whether the Num Lock modifier of the keyboard is locked.

This is only relevant for keyboard devices.

## getNumTouches

deviceGetNumTouches Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m Word32 | Returns: the number of touch points

Retrieves the number of touch points associated to `device`.

## getProductId

deviceGetProductId Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a physical `GdkDevice`
-> m (Maybe Text) | Returns: the product ID

Returns the product ID of this device.

This ID is retrieved from the device, and does not change. See `deviceGetVendorId` for more information.

## getScrollLockState

deviceGetScrollLockState Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m Bool | Returns: `True` if Scroll Lock is on for `device`

Retrieves whether the Scroll Lock modifier of the keyboard is locked.

This is only relevant for keyboard devices.

## getSeat

deviceGetSeat Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: A `GdkDevice`
-> m Seat | Returns: a `GdkSeat`

Returns the `GdkSeat` the device belongs to.

## getSource

deviceGetSource Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m InputSource | Returns: a `GdkInputSource`

Determines the type of the device.

## getSurfaceAtPosition

deviceGetSurfaceAtPosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: pointer `GdkDevice` to query info to
-> m (Maybe Surface, Double, Double) | Returns: the `GdkSurface` under the device position

Obtains the surface underneath `device`, returning the location of the device in `winX` and `winY`.

Returns `Nothing` if the surface tree under `device` is not known to GDK (for example, belongs to another application).

## getTimestamp

deviceGetTimestamp Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m Word32 | Returns: the timestamp of the last activity for this device

Returns the timestamp of the last activity for this device.

In practice, this means the timestamp of the last event that was received from the OS for this device. (GTK may occasionally produce events for a device that are not received from the OS, and will not update the timestamp).

Since: 4.2

## getVendorId

deviceGetVendorId Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a physical `GdkDevice`
-> m (Maybe Text) | Returns: the vendor ID

Returns the vendor ID of this device.

This ID is retrieved from the device, and does not change.

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

### c code

    static GSettings *
    get_device_settings (GdkDevice *device)
    {
      const char *vendor, *product;
      GSettings *settings;
      GdkDevice *device;
      char *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;
    }

## hasBidiLayouts

deviceHasBidiLayouts Source #

Arguments

:: (HasCallStack, MonadIO m, IsDevice a) |
=> a | `device`: a `GdkDevice`
-> m Bool | Returns: `True` if there are layouts with both directions, `False` otherwise

Determines if layouts for both right-to-left and left-to-right languages are in use on the keyboard.

This is only relevant for keyboard devices.

# Properties

## activeLayoutIndex

The index of the keyboard active layout of a `GdkDevice`.

Will be -1 if there is no valid active layout.

This is only relevant for keyboard devices.

Since: 4.18

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

Get the value of the “`active-layout-index`” property. When overloading is enabled, this is equivalent to

    get device #activeLayoutIndex

## capsLockState

Whether Caps Lock is on.

This is only relevant for keyboard devices.

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

Get the value of the “`caps-lock-state`” property. When overloading is enabled, this is equivalent to

    get device #capsLockState

## direction

The direction of the current layout.

This is only relevant for keyboard devices.

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

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

    get device #direction

## display

The `GdkDisplay` the `GdkDevice` pertains to.

constructDeviceDisplay :: (IsDevice o, MonadIO m, IsDisplay a) => a -> m (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

## hasBidiLayouts

Whether the device has both right-to-left and left-to-right layouts.

This is only relevant for keyboard devices.

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

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

    get device #hasBidiLayouts

## hasCursor

Whether the device is represented by a cursor on the screen.

constructDeviceHasCursor :: (IsDevice 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`.

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

## layoutNames

The names of the keyboard layouts of a `GdkDevice`.

This is only relevant for keyboard devices.

Since: 4.18

getDeviceLayoutNames :: (MonadIO m, IsDevice o) => o -> m (Maybe [Text]) Source #

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

    get device #layoutNames

## modifierState

The current modifier state of the device.

This is only relevant for keyboard devices.

getDeviceModifierState :: (MonadIO m, IsDevice o) => o -> m [ModifierType] Source #

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

    get device #modifierState

## 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, 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`.

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

## numLockState

Whether Num Lock is on.

This is only relevant for keyboard devices.

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

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

    get device #numLockState

## 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, MonadIO m) => Word32 -> m (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, 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`.

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

## scrollLockState

Whether Scroll Lock is on.

This is only relevant for keyboard devices.

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

Get the value of the “`scroll-lock-state`” property. When overloading is enabled, this is equivalent to

    get device #scrollLockState

## seat

`GdkSeat` 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, MonadIO m, IsSeat a) => a -> m (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 ]

## source

Source type for the device.

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

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

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

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

    get device #source

## tool

The `GdkDeviceTool` that is currently used with this device.

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

## vendorId

Vendor ID of this device.

See `deviceGetVendorId`.

constructDeviceVendorId :: (IsDevice 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`.

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 DeviceChangedCallback = IO () Source #

Emitted either when the number of either axes or keys changes.

On X11 this will normally happen when the physical device routing events through the logical device changes (for example, user switches from the USB mouse to a tablet); in that case the logical device will change to reflect the axes and keys on the new physical device.

afterDeviceChanged :: (IsDevice a, MonadIO m) => a -> ((?self :: 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

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onDeviceChanged :: (IsDevice a, MonadIO m) => a -> ((?self :: 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 DeviceToolChangedCallback Source #

Arguments

= DeviceTool | `tool`: The new current tool
-> IO () |

Emitted on pen/eraser devices whenever tools enter or leave proximity.

afterDeviceToolChanged :: (IsDevice a, MonadIO m) => a -> ((?self :: 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

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onDeviceToolChanged :: (IsDevice a, MonadIO m) => a -> ((?self :: 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