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

Contents

- Exported types
- Methods
  - getConsumedModifiers
  - getKeycode
  - getKeyval
  - getLayout
  - getLevel
  - getMatch
  - isModifier
  - matches

Description

An event related to a key-based device.

Synopsis

- newtype KeyEvent = KeyEvent (ManagedPtr KeyEvent)
- class (BoxedPtr o, TypedObject o, IsDescendantOf KeyEvent o) => IsKeyEvent o
- toKeyEvent :: (MonadIO m, IsKeyEvent o) => o -> m KeyEvent
- keyEventGetConsumedModifiers :: (HasCallStack, MonadIO m, IsKeyEvent a) => a -> m [ModifierType]
- keyEventGetKeycode :: (HasCallStack, MonadIO m, IsKeyEvent a) => a -> m Word32
- keyEventGetKeyval :: (HasCallStack, MonadIO m, IsKeyEvent a) => a -> m Word32
- keyEventGetLayout :: (HasCallStack, MonadIO m, IsKeyEvent a) => a -> m Word32
- keyEventGetLevel :: (HasCallStack, MonadIO m, IsKeyEvent a) => a -> m Word32
- keyEventGetMatch :: (HasCallStack, MonadIO m, IsKeyEvent a) => a -> m (Bool, Word32, [ModifierType])
- keyEventIsModifier :: (HasCallStack, MonadIO m, IsKeyEvent a) => a -> m Bool
- keyEventMatches :: (HasCallStack, MonadIO m, IsKeyEvent a) => a -> Word32 -> [ModifierType] -> m KeyMatch

# Exported types

newtype KeyEvent Source #

Memory-managed wrapper type.

Constructors

KeyEvent (ManagedPtr KeyEvent) |

#### Instances

Instances details

Eq KeyEvent Source # |
Instance details Defined in GI.Gdk.Objects.KeyEvent Methods (==) :: KeyEvent -> KeyEvent -> Bool Source # (/=) :: KeyEvent -> KeyEvent -> Bool Source #
BoxedPtr KeyEvent Source # |
Instance details Defined in GI.Gdk.Objects.KeyEvent Methods boxedPtrCopy :: KeyEvent -> IO KeyEvent Source # boxedPtrFree :: KeyEvent -> IO () Source #
ManagedPtrNewtype KeyEvent Source # |
Instance details Defined in GI.Gdk.Objects.KeyEvent Methods toManagedPtr :: KeyEvent -> ManagedPtr KeyEvent Source #
TypedObject KeyEvent Source # |
Instance details Defined in GI.Gdk.Objects.KeyEvent Methods glibType :: IO GType Source #
HasParentTypes KeyEvent Source # |
Instance details Defined in GI.Gdk.Objects.KeyEvent
type ParentTypes KeyEvent Source # |
Instance details Defined in GI.Gdk.Objects.KeyEvent type ParentTypes KeyEvent = '[Event]

class (BoxedPtr o, TypedObject o, IsDescendantOf KeyEvent o) => IsKeyEvent o Source #

Type class for types which can be safely cast to `KeyEvent`, for instance with `toKeyEvent`.

#### Instances

Instances details

(BoxedPtr o, TypedObject o, IsDescendantOf KeyEvent o) => IsKeyEvent o Source # |
Instance details Defined in GI.Gdk.Objects.KeyEvent

toKeyEvent :: (MonadIO m, IsKeyEvent o) => o -> m KeyEvent Source #

Cast to `KeyEvent`, 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

isModifier, matches, ref, triggersContextMenu, unref.

#### Getters

getAxes, getAxis, getConsumedModifiers, getDevice, getDeviceTool, getDisplay, getEventSequence, getEventType, getHistory, getKeycode, getKeyval, getLayout, getLevel, getMatch, getModifierState, getPointerEmulated, getPosition, getSeat, getSurface, getTime.

#### Setters

None.

## getConsumedModifiers

keyEventGetConsumedModifiers Source #

Arguments

:: (HasCallStack, MonadIO m, IsKeyEvent a) |
=> a | `event`: a key event
-> m [ModifierType] | Returns: the consumed modifiers or `event`

Extracts the consumed modifiers from a key event.

## getKeycode

keyEventGetKeycode Source #

Arguments

:: (HasCallStack, MonadIO m, IsKeyEvent a) |
=> a | `event`: a key event
-> m Word32 | Returns: the keycode of `event`

Extracts the keycode from a key event.

## getKeyval

keyEventGetKeyval Source #

Arguments

:: (HasCallStack, MonadIO m, IsKeyEvent a) |
=> a | `event`: a key event
-> m Word32 | Returns: the keyval of `event`

Extracts the keyval from a key event.

## getLayout

keyEventGetLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsKeyEvent a) |
=> a | `event`: a key event
-> m Word32 | Returns: the layout of `event`

Extracts the layout from a key event.

## getLevel

keyEventGetLevel Source #

Arguments

:: (HasCallStack, MonadIO m, IsKeyEvent a) |
=> a | `event`: a key event
-> m Word32 | Returns: the shift level of `event`

Extracts the shift level from a key event.

## getMatch

keyEventGetMatch Source #

Arguments

:: (HasCallStack, MonadIO m, IsKeyEvent a) |
=> a | `event`: a key `GdkEvent`
-> m (Bool, Word32, [ModifierType]) | Returns: `True` on success

Gets a keyval and modifier combination that will match the event.

See `keyEventMatches`.

## isModifier

keyEventIsModifier Source #

Arguments

:: (HasCallStack, MonadIO m, IsKeyEvent a) |
=> a | `event`: a key event
-> m Bool | Returns: `True` if the `event` is for a modifier key

Extracts whether the key event is for a modifier key.

## matches

keyEventMatches Source #

Arguments

:: (HasCallStack, MonadIO m, IsKeyEvent a) |
=> a | `event`: a key `GdkEvent`
-> Word32 | `keyval`: the keyval to match
-> [ModifierType] | `modifiers`: the modifiers to match
-> m KeyMatch | Returns: a `GdkKeyMatch` value describing whether `event` matches

Matches a key event against a keyval and modifiers.

This is typically used to trigger keyboard shortcuts such as Ctrl-C.

Partial matches are possible where the combination matches if the currently active group is ignored.

Note that we ignore Caps Lock for matching.