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