x-backend #2

Merged
sashakoshka merged 34 commits from x-backend into main 2022-11-14 21:40:25 -07:00
Showing only changes of commit c6c7383ef2 - Show all commits

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 }
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
}