Skip to content

Commit

Permalink
io/key: add NameSpace, report it on Linux
Browse files Browse the repository at this point in the history
Fixes gio#204.

Signed-off-by: pierre <[email protected]>
  • Loading branch information
pierrec authored and eliasnaur committed Mar 12, 2021
1 parent c5fb759 commit e0262c2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/internal/wm/os_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func translateKey(k string) (string, bool) {
case "Tab":
n = key.NameTab
case " ":
n = "Space"
n = key.NameSpace
case "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12":
n = k
default:
Expand Down
2 changes: 1 addition & 1 deletion app/internal/wm/os_macos.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func convertKey(k rune) (string, bool) {
case 0x09, 0x19:
n = key.NameTab
case 0x20:
n = "Space"
n = key.NameSpace
default:
k = unicode.ToUpper(k)
if !unicode.IsPrint(k) {
Expand Down
2 changes: 1 addition & 1 deletion app/internal/wm/os_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func convertKeyCode(code uintptr) (string, bool) {
case windows.VK_TAB:
r = key.NameTab
case windows.VK_SPACE:
r = "Space"
r = key.NameSpace
case windows.VK_OEM_1:
r = ";"
case windows.VK_OEM_PLUS:
Expand Down
4 changes: 2 additions & 2 deletions app/internal/xkb/xkb_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func convertKeysym(s C.xkb_keysym_t) (string, bool) {
if 'a' <= s && s <= 'z' {
return string(rune(s - 'a' + 'A')), true
}
if ' ' <= s && s <= '~' {
if ' ' < s && s <= '~' {
return string(rune(s)), true
}
var n string
Expand Down Expand Up @@ -292,7 +292,7 @@ func convertKeysym(s C.xkb_keysym_t) (string, bool) {
case C.XKB_KEY_Tab, C.XKB_KEY_KP_Tab, C.XKB_KEY_ISO_Left_Tab:
n = key.NameTab
case 0x20, C.XKB_KEY_KP_Space:
n = "Space"
n = key.NameSpace
default:
return "", false
}
Expand Down
1 change: 1 addition & 0 deletions io/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const (
NamePageUp = "⇞"
NamePageDown = "⇟"
NameTab = "⇥"
NameSpace = "Space"
)

// Contain reports whether m contains all modifiers
Expand Down

0 comments on commit e0262c2

Please sign in to comment.