From dd6110fbf88c36e42ed01846228393e7f4158786 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 13 Apr 2018 01:18:54 +0900 Subject: [PATCH] input: Add KeyNumLock (#580) --- genkeys.go | 1 + internal/input/keys.go | 1 + internal/input/keys_glfw.go | 1 + internal/input/keys_js.go | 3 +++ keys.go | 3 +++ 5 files changed, 9 insertions(+) diff --git a/genkeys.go b/genkeys.go index 3e6aceb73bc6..7ef53f674fc2 100644 --- a/genkeys.go +++ b/genkeys.go @@ -69,6 +69,7 @@ func init() { "Backslash": {"Backslash"}, "RightBracket": {"BracketRight"}, "GraveAccent": {"Backquote"}, + "NumLock": {"NumLock"}, } // ASCII: 0 - 9 for c := '0'; c <= '9'; c++ { diff --git a/internal/input/keys.go b/internal/input/keys.go index 3f89be1add8b..a9b15d4ca9e7 100644 --- a/internal/input/keys.go +++ b/internal/input/keys.go @@ -103,6 +103,7 @@ const ( KeyLeft KeyLeftBracket KeyMinus + KeyNumLock KeyPageDown KeyPageUp KeyPeriod diff --git a/internal/input/keys_glfw.go b/internal/input/keys_glfw.go index 3fd125bb4276..e41ae418265e 100644 --- a/internal/input/keys_glfw.go +++ b/internal/input/keys_glfw.go @@ -108,6 +108,7 @@ var glfwKeyCodeToKey = map[glfw.Key]Key{ glfw.KeyLeft: KeyLeft, glfw.KeyLeftBracket: KeyLeftBracket, glfw.KeyMinus: KeyMinus, + glfw.KeyNumLock: KeyNumLock, glfw.KeyPageDown: KeyPageDown, glfw.KeyPageUp: KeyPageUp, glfw.KeyPeriod: KeyPeriod, diff --git a/internal/input/keys_js.go b/internal/input/keys_js.go index 95f6f8ce4943..9a2ad12e7db6 100644 --- a/internal/input/keys_js.go +++ b/internal/input/keys_js.go @@ -235,6 +235,9 @@ var keyToCodes = map[Key][]string{ KeyN: { "KeyN", }, + KeyNumLock: { + "NumLock", + }, KeyO: { "KeyO", }, diff --git a/keys.go b/keys.go index b0b19bb259ed..8e9578c5d1b3 100644 --- a/keys.go +++ b/keys.go @@ -113,6 +113,7 @@ const ( KeyLeft Key = Key(input.KeyLeft) KeyLeftBracket Key = Key(input.KeyLeftBracket) KeyMinus Key = Key(input.KeyMinus) + KeyNumLock Key = Key(input.KeyNumLock) KeyPageDown Key = Key(input.KeyPageDown) KeyPageUp Key = Key(input.KeyPageUp) KeyPeriod Key = Key(input.KeyPeriod) @@ -297,6 +298,8 @@ func keyNameToKey(name string) (Key, bool) { return KeyLeftBracket, true case "minus": return KeyMinus, true + case "numlock": + return KeyNumLock, true case "pagedown": return KeyPageDown, true case "pageup":