Copyright | (c) David Janssen 2019 |
---|---|
License | MIT |
Maintainer | janssen.dhj@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
KMonad.Keyboard.IO.Windows.Types
Description
Windows in general. There is some translation happening in the c-code.
Synopsis
- data WinError
- = NoWinKeycodeTo Keycode
- | NoWinKeycodeFrom WinKeycode
- data WinKeyEvent
- mkWinKeyEvent :: WinSwitch -> WinKeycode -> WinKeyEvent
- toWinKeyEvent :: KeyEvent -> Either WinError WinKeyEvent
- fromWinKeyEvent :: WinKeyEvent -> Either WinError KeyEvent
- winCodeKeyCodeMapping :: [(WinKeycode, Keycode)]
Documentation
Everything that can go wrong with Windows Key-IO
Constructors
NoWinKeycodeTo Keycode | Error translating to |
NoWinKeycodeFrom WinKeycode | Error translating from |
Instances
Exception WinError Source # | |
Defined in KMonad.Keyboard.IO.Windows.Types Methods toException :: WinError -> SomeException # fromException :: SomeException -> Maybe WinError # displayException :: WinError -> String # | |
Show WinError Source # | |
data WinKeyEvent Source #
WinKeyEvent
is the C-representation of a a KeyEvent
for our Windows API.
It contains a Word8
signifying whether the event was a Press (0) or Release
(1), and a Word32
(Windows DWORD
) signifying the *Windows keycode*.
NOTE: Windows and Linux keycodes do not line up. Internally we use Linux Keycodes for everything, we translate at the KeyIO stage (here).
Instances
mkWinKeyEvent :: WinSwitch -> WinKeycode -> WinKeyEvent Source #
toWinKeyEvent :: KeyEvent -> Either WinError WinKeyEvent Source #
Convert a KeyEvent
to a WinKeyEvent
NOTE: Windows 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.
fromWinKeyEvent :: WinKeyEvent -> Either WinError KeyEvent Source #
Convert a WinKeyEvent
to a KeyEvent
NOTE: Same limitations as toWinKeyEvent
apply
winCodeKeyCodeMapping :: [(WinKeycode, Keycode)] Source #
A table of which virtual-key code from Windows correspond to which KMonad KeyCode. This table may have the same virtual-key code from Windows multiple times and also may have the same KMonad KeyCode multiple times.
It is essentially a merge of winCodeToKeyCode
and keyCodeToWinCode
.