Skip to content

Commit

Permalink
fix(input): windows api
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed May 15, 2024
1 parent fb066ab commit 2d25cbc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions input/driver_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ func parseConInputEvent(event coninput.InputRecord, ps *coninput.ButtonState) Ev
return event
}

layout, err := termwindows.GetKeyboardLayout(fgThread)
if layout == windows.InvalidHandle || err != nil {
layout := termwindows.GetKeyboardLayout(fgThread)
if layout == windows.InvalidHandle {
return event
}

// Translate key to rune
var keyState [256]byte
var utf16Buf [16]uint16
const dontChangeKernelKeyboardLayout = 0x4
ret, err := termwindows.ToUnicodeEx(
ret := termwindows.ToUnicodeEx(
uint32(e.VirtualKeyCode),
uint32(e.VirtualScanCode),
&keyState[0],
Expand All @@ -159,7 +159,7 @@ func parseConInputEvent(event coninput.InputRecord, ps *coninput.ButtonState) Ev

// -1 indicates a dead key
// 0 indicates no translation for this key
if ret < 1 || err != nil {
if ret < 1 {
return event
}

Expand Down

0 comments on commit 2d25cbc

Please sign in to comment.