Made separate function for converting keycode to keysym
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package x
|
||||
|
||||
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
|
||||
@@ -54,6 +55,24 @@ var buttonCodeTable = map[xproto.Keysym] stone.Button {
|
||||
0xFFC9: stone.KeyF12,
|
||||
}
|
||||
|
||||
func (backend *Backend) keycodeToKeysym (
|
||||
keycode xproto.Keycode,
|
||||
) (
|
||||
keysym xproto.Keysym,
|
||||
) {
|
||||
keysym = keybind.KeysymGet(backend.connection, keycode, 0)
|
||||
|
||||
// TODO: shift isnt working. follow
|
||||
// https://tronche.com/gui/x/xlib/input/keyboard-encoding.html
|
||||
|
||||
println("--")
|
||||
println(keycode)
|
||||
println(keysym)
|
||||
println(stone.EventPress(keysymToButtonCode(keysym)))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func keysymToButtonCode (keysym xproto.Keysym) (button stone.Button) {
|
||||
var isControl bool
|
||||
button, isControl = buttonCodeTable[keysym]
|
||||
|
||||
Reference in New Issue
Block a user