Fixed advance keycode translation

This commit is contained in:
Sasha Koshka 2022-11-14 22:58:44 -05:00
parent 84cd21b16d
commit c6c7383ef2

View File

@ -5,7 +5,8 @@ import "github.com/jezek/xgb/xproto"
import "github.com/jezek/xgbutil/keybind"
import "git.tebibyte.media/sashakoshka/stone"
// when making changes to this file, look at keysymdef.h
// when making changes to this file, look at keysymdef.h and
// https://tronche.com/gui/x/xlib/input/keyboard-encoding.html
var buttonCodeTable = map[xproto.Keysym] stone.Button {
0xFFFFFF: stone.ButtonUnknown,
@ -19,7 +20,7 @@ var buttonCodeTable = map[xproto.Keysym] stone.Button {
0xFF7F: stone.KeyNumLock,
0xFF08: stone.KeyBackspace,
0xFF09: stone.KeyTab,
0xFF0A: stone.KeyEnter,
0xFF0D: stone.KeyEnter,
0xFF1B: stone.KeyEscape,
0xFF52: stone.KeyUp,
@ -147,25 +148,18 @@ func (backend *Backend) keycodeToButton (
}
case shift:
selectedKeysym = symbol3
selectedRune = symbol3Rune
selectedKeysym = symbol2
selectedRune = symbol2Rune
}
// look up in table
var isControl bool
button, isControl = buttonCodeTable[selectedKeysym]
if isControl { return }
// if it wasn't found,
if !isControl {
button = stone.Button(selectedRune)
// TODO: shift isnt working. follow
// https://tronche.com/gui/x/xlib/input/keyboard-encoding.html
println("--")
println(keycode)
println(selectedKeysym)
println(selectedRune)
println(button)
}
return
}