event/key: add Compose key
Fixes #16332 Change-Id: I4fcd9c4c60fb5c32abaab5b68d3036d536ab2b69 Reviewed-on: https://go-review.googlesource.com/24880 Reviewed-by: Nigel Tao <nigeltao@golang.org>
This commit is contained in:
Родитель
efd7eed289
Коммит
cf96d36e8f
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче