| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
KMonad.Keyboard.IO.Mac.Types
Synopsis
- data MacError
- = NoMacKeycodeTo Keycode
- | NoMacKeycodeFrom MacKeycode
- | BadMacSwitch MacSwitch
- data MacKeyEvent
- toMacKeyEvent :: KeyEvent -> Either MacError MacKeyEvent
- fromMacKeyEvent :: MacKeyEvent -> Maybe (Either [MacError] KeyEvent)
- kcMapRaw :: [(MacKeycode, Keycode)]
Documentation
Everything that can go wrong with Mac Key-IO
Constructors
| NoMacKeycodeTo Keycode | Error translating to |
| NoMacKeycodeFrom MacKeycode | Error translating from |
| BadMacSwitch MacSwitch | Error interpreting |
Instances
| Exception MacError Source # | |
Defined in KMonad.Keyboard.IO.Mac.Types Methods toException :: MacError -> SomeException # fromException :: SomeException -> Maybe MacError # displayException :: MacError -> String # | |
| Show MacError Source # | |
| Exception [MacError] Source # | |
Defined in KMonad.Keyboard.IO.Mac.Types Methods toException :: [MacError] -> SomeException # fromException :: SomeException -> Maybe [MacError] # displayException :: [MacError] -> String # | |
data MacKeyEvent Source #
MacKeyEvent is the C-representation of a a KeyEvent for our Mac API.
It contains a Word8 signifying whether the event was a Press (0)
or Release (1), and a Word32 (uint32_t) signifying the Mac
keycode (the upper 16 bits represent the IOKit usage page, and the
lower 16 bits represent the IOKit usage).
NOTE: Mac and Linux keycodes do not line up. Internally we use Linux Keycodes for everything, we translate at the KeyIO stage (here).
Instances
toMacKeyEvent :: KeyEvent -> Either MacError MacKeyEvent Source #
Convert a KeyEvent to a MacKeyEvent
NOTE: Mac keycodes are different, and I am not confident I have full coverage, therefore this conversion is not total. We are going to leave this error-handling in until we are sure this is covered well. Once it lines up perfectly, this is essentially an Iso.
fromMacKeyEvent :: MacKeyEvent -> Maybe (Either [MacError] KeyEvent) Source #
Convert a MacKeyEvent to a KeyEvent
NOTE: Same limitations as toMacKeyEvent apply