From c6c7383ef2ba6f9cf3cd864c863b259459f2dd47 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 14 Nov 2022 22:58:44 -0500 Subject: [PATCH] Fixed advance keycode translation --- backends/x/unicode.go | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/backends/x/unicode.go b/backends/x/unicode.go index 0cb45a5..ecfa329 100644 --- a/backends/x/unicode.go +++ b/backends/x/unicode.go @@ -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 } - 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) + // if it wasn't found, + if !isControl { + button = stone.Button(selectedRune) + } return }