wild-bind-x11-0.2.0.11: X11-specific implementation for WildBind

MaintainerToshio Ito <debug.ito@gmail.com>
Safe HaskellNone
LanguageHaskell2010

WildBind.X11.Internal.Key

Contents

Description

This is an internal module. Package users should not rely on this.

Synopsis

Key

class XKeyInput k where Source #

Class of data types that can be handled by X11. The data type can tell X11 to grab key with optional modifiers, and it can be extracted from a X11 Event object.

Since: 0.2.0.0

Minimal complete definition

toKeySym, fromKeyEvent

Methods

toKeySym :: k -> KeySym Source #

Get the X11 keysym for this input.

toModifierMasks :: KeyMaskMap -> k -> NonEmpty KeyMask Source #

Get modifer masks to grab the keysym. The grab action is repeated for all modifier masks. By default, it just returns 0.

fromKeyEvent :: KeyMaskMap -> KeyEventType -> KeySym -> KeyMask -> Maybe k Source #

Create the input object from a key event type, a keysym and a modifier (got from XEvent.)

Instances
XKeyInput NumPadLocked Source #

This input event captures the KeyRelease event only. That way, you can deliver events to the window that originally has the keyboard focus.

Instance details

Defined in WildBind.X11.Internal.Key

Methods

toKeySym :: NumPadLocked -> KeySym Source #

toModifierMasks :: KeyMaskMap -> NumPadLocked -> NonEmpty KeyMask Source #

fromKeyEvent :: KeyMaskMap -> KeyEventType -> KeySym -> KeyMask -> Maybe NumPadLocked Source #

XKeyInput NumPadUnlocked Source #

This input event captures the KeyRelease event only. That way, you can deliver events to the window that originally has the keyboard focus.

Instance details

Defined in WildBind.X11.Internal.Key

Methods

toKeySym :: NumPadUnlocked -> KeySym Source #

toModifierMasks :: KeyMaskMap -> NumPadUnlocked -> NonEmpty KeyMask Source #

fromKeyEvent :: KeyMaskMap -> KeyEventType -> KeySym -> KeyMask -> Maybe NumPadUnlocked Source #

XKeyInput XKeyEvent Source #

fromKeyEvent always returns Just.

Instance details

Defined in WildBind.X11.Internal.Key

(XKeyInput a, XKeyInput b) => XKeyInput (Either a b) Source #

fromKeyEvent first tries to create Left (type a). If it fails, then it tries to create Right (type b).

Instance details

Defined in WildBind.X11.Internal.Key

Methods

toKeySym :: Either a b -> KeySym Source #

toModifierMasks :: KeyMaskMap -> Either a b -> NonEmpty KeyMask Source #

fromKeyEvent :: KeyMaskMap -> KeyEventType -> KeySym -> KeyMask -> Maybe (Either a b) Source #

xKeyEventToXKeyInput :: XKeyInput k => KeyMaskMap -> KeyEventType -> XKeyEventPtr -> MaybeT IO k Source #

Extract the XKeyInput from the XKeyEvent.

Since: 0.2.0.0

data KeyEventType Source #

Whether the key is pressed or released.

Since: 0.2.0.0

Constructors

KeyPress 
KeyRelease 

Modifiers

data KeyMaskMap Source #

KeyMask values assigned to each modifier keys/states. If the modifier doesn't exist, the mask is 0.

Since: 0.2.0.0

Instances
Eq KeyMaskMap Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

(==) :: KeyMaskMap -> KeyMaskMap -> Bool

(/=) :: KeyMaskMap -> KeyMaskMap -> Bool

Ord KeyMaskMap Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Show KeyMaskMap Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

showsPrec :: Int -> KeyMaskMap -> ShowS

show :: KeyMaskMap -> String

showList :: [KeyMaskMap] -> ShowS

getKeyMaskMap :: Display -> IO KeyMaskMap Source #

Get current KeyMaskMap.

Since: 0.2.0.0

XKeyEvent

data XKeyEvent Source #

High-level X11 key event.

Since: 0.2.0.0

Constructors

XKeyEvent 

Fields

Instances
Eq XKeyEvent Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

(==) :: XKeyEvent -> XKeyEvent -> Bool

(/=) :: XKeyEvent -> XKeyEvent -> Bool

Ord XKeyEvent Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

compare :: XKeyEvent -> XKeyEvent -> Ordering

(<) :: XKeyEvent -> XKeyEvent -> Bool

(<=) :: XKeyEvent -> XKeyEvent -> Bool

(>) :: XKeyEvent -> XKeyEvent -> Bool

(>=) :: XKeyEvent -> XKeyEvent -> Bool

max :: XKeyEvent -> XKeyEvent -> XKeyEvent

min :: XKeyEvent -> XKeyEvent -> XKeyEvent

Show XKeyEvent Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

showsPrec :: Int -> XKeyEvent -> ShowS

show :: XKeyEvent -> String

showList :: [XKeyEvent] -> ShowS

Describable XKeyEvent Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

describe :: XKeyEvent -> ActionDescription

ToXKeyEvent XKeyEvent Source # 
Instance details

Defined in WildBind.X11.Internal.Key

XKeyInput XKeyEvent Source #

fromKeyEvent always returns Just.

Instance details

Defined in WildBind.X11.Internal.Key

data XMod Source #

X11 key modifiers.

Since: 0.2.0.0

Constructors

Shift 
Ctrl 
Alt 
Super 
Instances
Bounded XMod Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Enum XMod Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

succ :: XMod -> XMod

pred :: XMod -> XMod

toEnum :: Int -> XMod

fromEnum :: XMod -> Int

enumFrom :: XMod -> [XMod]

enumFromThen :: XMod -> XMod -> [XMod]

enumFromTo :: XMod -> XMod -> [XMod]

enumFromThenTo :: XMod -> XMod -> XMod -> [XMod]

Eq XMod Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

(==) :: XMod -> XMod -> Bool

(/=) :: XMod -> XMod -> Bool

Ord XMod Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

compare :: XMod -> XMod -> Ordering

(<) :: XMod -> XMod -> Bool

(<=) :: XMod -> XMod -> Bool

(>) :: XMod -> XMod -> Bool

(>=) :: XMod -> XMod -> Bool

max :: XMod -> XMod -> XMod

min :: XMod -> XMod -> XMod

Show XMod Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

showsPrec :: Int -> XMod -> ShowS

show :: XMod -> String

showList :: [XMod] -> ShowS

class ToXKeyEvent k where Source #

Something that can converted to XKeyEvent.

Since: 0.2.0.0

Methods

toXKeyEvent :: k -> XKeyEvent Source #

Instances
ToXKeyEvent KeySym Source #

KeyPress event of KeySym with empty XMod set.

Instance details

Defined in WildBind.X11.Internal.Key

ToXKeyEvent XKeyEvent Source # 
Instance details

Defined in WildBind.X11.Internal.Key

(ToXKeyEvent a, ToXKeyEvent b) => ToXKeyEvent (Either a b) Source # 
Instance details

Defined in WildBind.X11.Internal.Key

Methods

toXKeyEvent :: Either a b -> XKeyEvent Source #

addXMod :: ToXKeyEvent k => XMod -> k -> XKeyEvent Source #

Add a XMod to xKeyEventMods.

Since: 0.2.0.0

press :: ToXKeyEvent k => k -> XKeyEvent Source #

Set KeyPress to xKeyEventType.

Since: 0.2.0.0

release :: ToXKeyEvent k => k -> XKeyEvent Source #

Set KeyRelease to xKeyEventType.

Since: 0.2.0.0

shift :: ToXKeyEvent k => k -> XKeyEvent Source #

Add Shift modifier to xKeyEventMods.

Since: 0.2.0.0

ctrl :: ToXKeyEvent k => k -> XKeyEvent Source #

Add Ctrl modifier to xKeyEventMods.

Since: 0.2.0.0

alt :: ToXKeyEvent k => k -> XKeyEvent Source #

Add Alt modifier to xKeyEventMods.

Since: 0.2.0.0

super :: ToXKeyEvent k => k -> XKeyEvent Source #

Add Super modifier to xKeyEventMods.

Since: 0.2.0.0

Grabs

xGrabKey :: Display -> Window -> KeySym -> KeyMask -> IO () Source #

Grab the specified key on the specified window. The key is captured from now on, so the window won't get that.

Since: 0.2.0.0

xUngrabKey :: Display -> Window -> KeySym -> KeyMask -> IO () Source #

Release the grab on the specified key.

Since: 0.2.0.0

Event generation

xSendKeyEvent :: KeyMaskMap -> Display -> Window -> XKeyEvent -> IO () Source #

Send a XKeyEvent to the window.

Since: 0.2.0.0