Support for meta and hyper keys added

Support for the compose key has also been added but it's just the
button code for now, no support for actually composing stuff.
There are plans for that in a fixme.
This commit is contained in:
Sasha Koshka
2022-11-21 23:43:22 -05:00
parent 9a37fbf04a
commit 8c28c57925
4 changed files with 71 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
package x
import "fmt"
import "unicode"
import "github.com/jezek/xgb/xproto"
import "github.com/jezek/xgbutil/keybind"
@@ -36,10 +37,15 @@ var buttonCodeTable = map[xproto.Keysym] stone.Button {
0xFFE2: stone.KeyRightShift,
0xFFE3: stone.KeyLeftControl,
0xFFE4: stone.KeyRightControl,
0xFFE7: stone.KeyLeftMeta,
0xFFE8: stone.KeyRightMeta,
0xFFE9: stone.KeyLeftAlt,
0xFFEA: stone.KeyRightAlt,
0xFFEB: stone.KeyLeftSuper,
0xFFEC: stone.KeyRightSuper,
0xFFED: stone.KeyLeftHyper,
0xFFEE: stone.KeyRightHyper,
0xFFFF: stone.KeyDelete,
@@ -55,6 +61,14 @@ var buttonCodeTable = map[xproto.Keysym] stone.Button {
0xFFC7: stone.KeyF10,
0xFFC8: stone.KeyF11,
0xFFC9: stone.KeyF12,
// TODO: send this whenever a compose key, dead key, etc is pressed,
// and then send the resulting character while witholding the key
// presses that were used to compose it. As far as the program is
// concerned, a magical key with the final character was pressed and the
// KeyDead key is just so that the program might provide some visual
// feedback to the user while input is being waited for.
0xFF20: stone.KeyDead,
}
func (backend *Backend) keycodeToButton (
@@ -84,7 +98,7 @@ func (backend *Backend) keycodeToButton (
symbol3 = symbol1
case symbol3 == 0 && symbol4 == 0:
symbol3 = symbol1
symbol2 = symbol2
symbol4 = symbol2
case symbol4 == 0:
symbol4 = 0
}
@@ -123,6 +137,8 @@ func (backend *Backend) keycodeToButton (
var selectedKeysym xproto.Keysym
var selectedRune rune
fmt.Printf("AAA\t%X\t%X\t%X\t%X\n", symbol1, symbol2, symbol3, symbol4)
// big ol list in the middle
switch {