| 1 | // Copyright 2015 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:generate stringer -type=Code |
| 6 | |
| 7 | // Package key defines an event for physical keyboard keys. |
| 8 | // |
| 9 | // On-screen software keyboards do not send key events. |
| 10 | // |
| 11 | // See the golang.org/x/mobile/app package for details on the event model. |
| 12 | package keyscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ |
| 13 | |
| 14 | import ( |
| 15 | "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/" |
| 16 | "stringsscip-go gomod github.com/golang/go/src go1.24.0 strings/" |
| 17 | ) |
| 18 | |
| 19 | // Event is a key event. |
| 20 | type Eventscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event# struct { |
| 21 | // Rune is the meaning of the key event as determined by the |
| 22 | // operating system. The mapping is determined by system-dependent |
| 23 | // current layout, modifiers, lock-states, etc. |
| 24 | // |
| 25 | // If non-negative, it is a Unicode codepoint: pressing the 'a' key |
| 26 | // generates different Runes 'a' or 'A' (but the same Code) depending on |
| 27 | // the state of the shift key. |
| 28 | // |
| 29 | // If -1, the key does not generate a Unicode codepoint. To distinguish |
| 30 | // them, look at Code. |
| 31 | Runescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Rune. rune |
| 32 | |
| 33 | // Code is the identity of the physical key relative to a notional |
| 34 | // "standard" keyboard, independent of current layout, modifiers, |
| 35 | // lock-states, etc |
| 36 | // |
| 37 | // For standard key codes, its value matches USB HID key codes. |
| 38 | // Compare its value to uint32-typed constants in this package, such |
| 39 | // as CodeLeftShift and CodeEscape. |
| 40 | // |
| 41 | // Pressing the regular '2' key and number-pad '2' key (with Num-Lock) |
| 42 | // generate different Codes (but the same Rune). |
| 43 | Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Code. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# |
| 44 | |
| 45 | // Modifiers is a bitmask representing a set of modifier keys: ModShift, |
| 46 | // ModAlt, etc. |
| 47 | Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Modifiers. Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers# |
| 48 | |
| 49 | // Direction is the direction of the key event: DirPress, DirRelease, |
| 50 | // or DirNone (for key repeats). |
| 51 | Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Direction. Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Direction# |
| 52 | |
| 53 | // TODO: add a Device ID, for multiple input devices? |
| 54 | // TODO: add a time.Time? |
| 55 | } |
| 56 | |
| 57 | func (e Eventscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#) Stringscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#String().() string { |
| 58 | if e.Runescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Rune. >= 0 { |
| 59 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("key.Event{%q (%v), %v, %v}", e.Runescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Rune., e.Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Code., e.Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Modifiers., e.Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Direction.) |
| 60 | } |
| 61 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("key.Event{(%v), %v, %v}", e.Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Code., e.Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Modifiers., e.Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Event#Direction.) |
| 62 | } |
| 63 | |
| 64 | // Direction is the direction of the key event. |
| 65 | type Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Direction# uint8 |
| 66 | |
| 67 | const ( |
| 68 | DirNonescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/DirNone. Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Direction# = 0 |
| 69 | DirPressscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/DirPress. Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Direction# = 1 |
| 70 | DirReleasescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/DirRelease. Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Direction# = 2 |
| 71 | ) |
| 72 | |
| 73 | // Modifiers is a bitmask representing a set of modifier keys. |
| 74 | type Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers# uint32 |
| 75 | |
| 76 | const ( |
| 77 | ModShiftscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ModShift. Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers# = 1 << 0 |
| 78 | ModControlscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ModControl. Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers# = 1 << 1 |
| 79 | ModAltscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ModAlt. Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers# = 1 << 2 |
| 80 | ModMetascip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ModMeta. Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers# = 1 << 3 // called "Command" on OS X |
| 81 | ) |
| 82 | |
| 83 | // Code is the identity of a key relative to a notional "standard" keyboard. |
| 84 | type Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# uint32 |
| 85 | |
| 86 | // Physical key codes. |
| 87 | // |
| 88 | // For standard key codes, its value matches USB HID key codes. |
| 89 | // TODO: add missing codes. |
| 90 | const ( |
| 91 | CodeUnknownscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeUnknown. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 0 |
| 92 | |
| 93 | CodeAscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeA. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 4 |
| 94 | CodeBscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeB. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 5 |
| 95 | CodeCscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeC. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 6 |
| 96 | CodeDscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeD. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 7 |
| 97 | CodeEscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeE. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 8 |
| 98 | CodeFscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 9 |
| 99 | CodeGscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeG. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 10 |
| 100 | CodeHscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeH. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 11 |
| 101 | CodeIscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeI. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 12 |
| 102 | CodeJscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeJ. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 13 |
| 103 | CodeKscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeK. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 14 |
| 104 | CodeLscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeL. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 15 |
| 105 | CodeMscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeM. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 16 |
| 106 | CodeNscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeN. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 17 |
| 107 | CodeOscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeO. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 18 |
| 108 | CodePscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeP. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 19 |
| 109 | CodeQscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeQ. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 20 |
| 110 | CodeRscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeR. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 21 |
| 111 | CodeSscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeS. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 22 |
| 112 | CodeTscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeT. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 23 |
| 113 | CodeUscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeU. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 24 |
| 114 | CodeVscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeV. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 25 |
| 115 | CodeWscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeW. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 26 |
| 116 | CodeXscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeX. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 27 |
| 117 | CodeYscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeY. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 28 |
| 118 | CodeZscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeZ. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 29 |
| 119 | |
| 120 | Code1scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code1. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 30 |
| 121 | Code2scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code2. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 31 |
| 122 | Code3scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code3. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 32 |
| 123 | Code4scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code4. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 33 |
| 124 | Code5scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code5. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 34 |
| 125 | Code6scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code6. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 35 |
| 126 | Code7scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code7. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 36 |
| 127 | Code8scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code8. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 37 |
| 128 | Code9scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code9. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 38 |
| 129 | Code0scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code0. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 39 |
| 130 | |
| 131 | CodeReturnEnterscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeReturnEnter. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 40 |
| 132 | CodeEscapescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeEscape. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 41 |
| 133 | CodeDeleteBackspacescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeDeleteBackspace. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 42 |
| 134 | CodeTabscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeTab. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 43 |
| 135 | CodeSpacebarscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeSpacebar. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 44 |
| 136 | CodeHyphenMinusscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeHyphenMinus. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 45 // - |
| 137 | CodeEqualSignscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeEqualSign. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 46 // = |
| 138 | CodeLeftSquareBracketscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeLeftSquareBracket. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 47 // [ |
| 139 | CodeRightSquareBracketscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeRightSquareBracket. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 48 // ] |
| 140 | CodeBackslashscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeBackslash. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 49 // \ |
| 141 | CodeSemicolonscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeSemicolon. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 51 // ; |
| 142 | CodeApostrophescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeApostrophe. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 52 // ' |
| 143 | CodeGraveAccentscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeGraveAccent. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 53 // ` |
| 144 | CodeCommascip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeComma. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 54 // , |
| 145 | CodeFullStopscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeFullStop. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 55 // . |
| 146 | CodeSlashscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeSlash. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 56 // / |
| 147 | CodeCapsLockscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeCapsLock. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 57 |
| 148 | |
| 149 | CodeF1scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF1. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 58 |
| 150 | CodeF2scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF2. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 59 |
| 151 | CodeF3scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF3. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 60 |
| 152 | CodeF4scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF4. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 61 |
| 153 | CodeF5scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF5. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 62 |
| 154 | CodeF6scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF6. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 63 |
| 155 | CodeF7scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF7. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 64 |
| 156 | CodeF8scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF8. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 65 |
| 157 | CodeF9scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF9. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 66 |
| 158 | CodeF10scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF10. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 67 |
| 159 | CodeF11scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF11. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 68 |
| 160 | CodeF12scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF12. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 69 |
| 161 | |
| 162 | CodePausescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodePause. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 72 |
| 163 | CodeInsertscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeInsert. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 73 |
| 164 | CodeHomescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeHome. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 74 |
| 165 | CodePageUpscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodePageUp. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 75 |
| 166 | CodeDeleteForwardscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeDeleteForward. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 76 |
| 167 | CodeEndscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeEnd. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 77 |
| 168 | CodePageDownscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodePageDown. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 78 |
| 169 | |
| 170 | CodeRightArrowscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeRightArrow. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 79 |
| 171 | CodeLeftArrowscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeLeftArrow. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 80 |
| 172 | CodeDownArrowscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeDownArrow. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 81 |
| 173 | CodeUpArrowscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeUpArrow. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 82 |
| 174 | |
| 175 | CodeKeypadNumLockscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypadNumLock. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 83 |
| 176 | CodeKeypadSlashscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypadSlash. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 84 // / |
| 177 | CodeKeypadAsteriskscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypadAsterisk. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 85 // * |
| 178 | CodeKeypadHyphenMinusscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypadHyphenMinus. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 86 // - |
| 179 | CodeKeypadPlusSignscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypadPlusSign. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 87 // + |
| 180 | CodeKeypadEnterscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypadEnter. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 88 |
| 181 | CodeKeypad1scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad1. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 89 |
| 182 | CodeKeypad2scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad2. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 90 |
| 183 | CodeKeypad3scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad3. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 91 |
| 184 | CodeKeypad4scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad4. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 92 |
| 185 | CodeKeypad5scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad5. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 93 |
| 186 | CodeKeypad6scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad6. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 94 |
| 187 | CodeKeypad7scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad7. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 95 |
| 188 | CodeKeypad8scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad8. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 96 |
| 189 | CodeKeypad9scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad9. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 97 |
| 190 | CodeKeypad0scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypad0. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 98 |
| 191 | CodeKeypadFullStopscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypadFullStop. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 99 // . |
| 192 | CodeKeypadEqualSignscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeKeypadEqualSign. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 103 // = |
| 193 | |
| 194 | CodeF13scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF13. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 104 |
| 195 | CodeF14scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF14. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 105 |
| 196 | CodeF15scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF15. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 106 |
| 197 | CodeF16scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF16. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 107 |
| 198 | CodeF17scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF17. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 108 |
| 199 | CodeF18scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF18. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 109 |
| 200 | CodeF19scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF19. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 110 |
| 201 | CodeF20scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF20. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 111 |
| 202 | CodeF21scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF21. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 112 |
| 203 | CodeF22scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF22. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 113 |
| 204 | CodeF23scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF23. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 114 |
| 205 | CodeF24scip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeF24. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 115 |
| 206 | |
| 207 | CodeHelpscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeHelp. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 117 |
| 208 | |
| 209 | CodeMutescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeMute. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 127 |
| 210 | CodeVolumeUpscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeVolumeUp. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 128 |
| 211 | CodeVolumeDownscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeVolumeDown. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 129 |
| 212 | |
| 213 | CodeLeftControlscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeLeftControl. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 224 |
| 214 | CodeLeftShiftscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeLeftShift. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 225 |
| 215 | CodeLeftAltscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeLeftAlt. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 226 |
| 216 | CodeLeftGUIscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeLeftGUI. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 227 |
| 217 | CodeRightControlscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeRightControl. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 228 |
| 218 | CodeRightShiftscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeRightShift. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 229 |
| 219 | CodeRightAltscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeRightAlt. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 230 |
| 220 | CodeRightGUIscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeRightGUI. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 231 |
| 221 | |
| 222 | // The following codes are not part of the standard USB HID Usage IDs for |
| 223 | // keyboards. See http://www.usb.org/developers/hidpage/Hut1_12v2.pdf |
| 224 | // |
| 225 | // Usage IDs are uint16s, so these non-standard values start at 0x10000. |
| 226 | |
| 227 | // CodeCompose is the Code for a compose key, sometimes called a multi key, |
| 228 | // used to input non-ASCII characters such as ñ being composed of n and ~. |
| 229 | // |
| 230 | // See https://en.wikipedia.org/wiki/Compose_key |
| 231 | CodeComposescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/CodeCompose. Codescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Code# = 0x10000 |
| 232 | ) |
| 233 | |
| 234 | // TODO: Given we use runes outside the unicode space, should we provide a |
| 235 | // printing function? Related: it's a little unfortunate that printing a |
| 236 | // key.Event with %v gives not very readable output like: |
| 237 | // {100 7 key.Modifiers() Press} |
| 238 | |
| 239 | var modsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/mods. = [...]struct { |
| 240 | mscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/mods:m. Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers# |
| 241 | sscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/mods:s. string |
| 242 | }{ |
| 243 | {ModShiftscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ModShift., "Shift"}, |
| 244 | {ModControlscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ModControl., "Control"}, |
| 245 | {ModAltscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ModAlt., "Alt"}, |
| 246 | {ModMetascip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/ModMeta., "Meta"}, |
| 247 | } |
| 248 | |
| 249 | func (m Modifiersscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers#) Stringscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Modifiers#String().() string { |
| 250 | var match []string |
| 251 | for _, mod := range modsscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/mods. { |
| 252 | if mod.mscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/mods:m.&m != 0 { |
| 253 | match = append(match, mod.sscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/mods:s.) |
| 254 | } |
| 255 | } |
| 256 | return "key.Modifiers(" + stringsscip-go gomod github.com/golang/go/src go1.24.0 strings/.Joinscip-go gomod github.com/golang/go/src go1.24.0 strings/Join().(match, "|") + ")" |
| 257 | } |
| 258 | |
| 259 | func (d Directionscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Direction#) Stringscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/Direction#String().() string { |
| 260 | switch d { |
| 261 | case DirNonescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/DirNone.: |
| 262 | return "None" |
| 263 | case DirPressscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/DirPress.: |
| 264 | return "Press" |
| 265 | case DirReleasescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/event/key`/DirRelease.: |
| 266 | return "Release" |
| 267 | default: |
| 268 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("key.Direction(%d)", d) |
| 269 | } |
| 270 | } |