Skip to content

Commit

Permalink
Fix for breaking Windows input. (#17)
Browse files Browse the repository at this point in the history
* Fix for breaking Windows input.

* Fixing the DWORD error in poke.

* Bumping patch version.
  • Loading branch information
chhackett committed Mar 2, 2024
1 parent f760f63 commit 4c39518
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Graphics/Vty/Platform/Windows/WindowsConsoleInput.hsc
Expand Up @@ -154,23 +154,23 @@ instance Storable WinConsoleInputEvent where
alignment _ = #alignment INPUT_RECORD

poke buf (KeyEventRecordU key) = do
(#poke INPUT_RECORD, EventType) buf (#{const KEY_EVENT} :: DWORD)
(#poke INPUT_RECORD, EventType) buf (#{const KEY_EVENT} :: WORD)
(#poke INPUT_RECORD, Event) buf key
poke buf (MouseEventRecordU mouse) = do
(#poke INPUT_RECORD, EventType) buf (#{const MOUSE_EVENT} :: DWORD)
(#poke INPUT_RECORD, EventType) buf (#{const MOUSE_EVENT} :: WORD)
(#poke INPUT_RECORD, Event) buf mouse
poke buf (WindowBufferSizeRecordU window) = do
(#poke INPUT_RECORD, EventType) buf (#{const WINDOW_BUFFER_SIZE_EVENT} :: DWORD)
(#poke INPUT_RECORD, EventType) buf (#{const WINDOW_BUFFER_SIZE_EVENT} :: WORD)
(#poke INPUT_RECORD, Event) buf window
poke buf (MenuEventRecordU menu) = do
(#poke INPUT_RECORD, EventType) buf (#{const MENU_EVENT} :: DWORD)
(#poke INPUT_RECORD, EventType) buf (#{const MENU_EVENT} :: WORD)
(#poke INPUT_RECORD, Event) buf menu
poke buf (FocusEventRecordU focus) = do
(#poke INPUT_RECORD, EventType) buf (#{const FOCUS_EVENT} :: DWORD)
(#poke INPUT_RECORD, EventType) buf (#{const FOCUS_EVENT} :: WORD)
(#poke INPUT_RECORD, Event) buf focus

peek buf = do
event <- (#peek INPUT_RECORD, EventType) buf :: IO DWORD
event <- (#peek INPUT_RECORD, EventType) buf :: IO WORD
case event of
#{const KEY_EVENT} ->
KeyEventRecordU `fmap` (#peek INPUT_RECORD, Event) buf
Expand Down
2 changes: 1 addition & 1 deletion vty-windows.cabal
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: vty-windows
version: 0.2.0.1
version: 0.2.0.2
license: BSD-3-Clause
license-file: LICENSE
author: Chris hackett
Expand Down

0 comments on commit 4c39518

Please sign in to comment.