From e0262c20e39d2ce26d1f705b04daecd2c4a36b7a Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 12 Mar 2021 08:19:01 +0100 Subject: [PATCH] io/key: add NameSpace, report it on Linux Fixes gio#204. Signed-off-by: pierre --- app/internal/wm/os_js.go | 2 +- app/internal/wm/os_macos.go | 2 +- app/internal/wm/os_windows.go | 2 +- app/internal/xkb/xkb_unix.go | 4 ++-- io/key/key.go | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/internal/wm/os_js.go b/app/internal/wm/os_js.go index ab7455e68..f43c026f2 100644 --- a/app/internal/wm/os_js.go +++ b/app/internal/wm/os_js.go @@ -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: diff --git a/app/internal/wm/os_macos.go b/app/internal/wm/os_macos.go index a62b5dbc1..09d9d297e 100644 --- a/app/internal/wm/os_macos.go +++ b/app/internal/wm/os_macos.go @@ -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) { diff --git a/app/internal/wm/os_windows.go b/app/internal/wm/os_windows.go index c58b308e2..a59fdd8ef 100644 --- a/app/internal/wm/os_windows.go +++ b/app/internal/wm/os_windows.go @@ -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: diff --git a/app/internal/xkb/xkb_unix.go b/app/internal/xkb/xkb_unix.go index 2f0fefacc..9e5a6264b 100644 --- a/app/internal/xkb/xkb_unix.go +++ b/app/internal/xkb/xkb_unix.go @@ -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 @@ -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 } diff --git a/io/key/key.go b/io/key/key.go index 8d951d9f9..c19338ab4 100644 --- a/io/key/key.go +++ b/io/key/key.go @@ -112,6 +112,7 @@ const ( NamePageUp = "⇞" NamePageDown = "⇟" NameTab = "⇥" + NameSpace = "Space" ) // Contain reports whether m contains all modifiers