From cf96d36e8fc9f569f9ff6b91168d8305fca0b4f7 Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Tue, 12 Jul 2016 13:13:21 +0200 Subject: [PATCH] event/key: add Compose key Fixes #16332 Change-Id: I4fcd9c4c60fb5c32abaab5b68d3036d536ab2b69 Reviewed-on: https://go-review.googlesource.com/24880 Reviewed-by: Nigel Tao --- event/key/code_string.go | 6 +++++- event/key/key.go | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/event/key/code_string.go b/event/key/code_string.go index e8af6ba..6af78b3 100644 --- a/event/key/code_string.go +++ b/event/key/code_string.go @@ -1,4 +1,4 @@ -// generated by stringer -type=Code; DO NOT EDIT +// Code generated by "stringer -type=Code"; DO NOT EDIT package key @@ -13,6 +13,7 @@ const ( _Code_name_5 = "CodeHelp" _Code_name_6 = "CodeMuteCodeVolumeUpCodeVolumeDown" _Code_name_7 = "CodeLeftControlCodeLeftShiftCodeLeftAltCodeLeftGUICodeRightControlCodeRightShiftCodeRightAltCodeRightGUI" + _Code_name_8 = "CodeCompose" ) var ( @@ -24,6 +25,7 @@ var ( _Code_index_5 = [...]uint8{0, 8} _Code_index_6 = [...]uint8{0, 8, 20, 34} _Code_index_7 = [...]uint8{0, 15, 28, 39, 50, 66, 80, 92, 104} + _Code_index_8 = [...]uint8{0, 11} ) func (i Code) String() string { @@ -50,6 +52,8 @@ func (i Code) String() string { case 224 <= i && i <= 231: i -= 224 return _Code_name_7[_Code_index_7[i]:_Code_index_7[i+1]] + case i == 65536: + return _Code_name_8 default: return fmt.Sprintf("Code(%d)", i) } diff --git a/event/key/key.go b/event/key/key.go index 4a9e694..d70f1c3 100644 --- a/event/key/key.go +++ b/event/key/key.go @@ -218,6 +218,17 @@ const ( CodeRightShift Code = 229 CodeRightAlt Code = 230 CodeRightGUI Code = 231 + + // The following codes are not part of the standard USB HID Usage IDs for + // keyboards. See http://www.usb.org/developers/hidpage/Hut1_12v2.pdf + // + // Usage IDs are uint16s, so these non-standard values start at 0x10000. + + // CodeCompose is the Code for a compose key, sometimes called a multi key, + // used to input non-ASCII characters such as ñ being composed of n and ~. + // + // See https://en.wikipedia.org/wiki/Compose_key + CodeCompose Code = 0x10000 ) // TODO: Given we use runes outside the unicode space, should we provide a