| OLD | NEW |
| 1 UI Events | 1 UI Events |
| 2 ========= | 2 ========= |
| 3 | 3 |
| 4 Scope | 4 Scope |
| 5 ----- | 5 ----- |
| 6 | 6 |
| 7 The following input devices are supported by sky: | 7 The following input devices are supported by sky: |
| 8 - fingers on multitouch screens | 8 - fingers on multitouch screens |
| 9 - mice, including mouse wheels | 9 - mice, including mouse wheels |
| 10 - styluses on screens | 10 - styluses on screens |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 until the corresponding pointer-up event (even if the buttons change). | 85 until the corresponding pointer-up event (even if the buttons change). |
| 86 At the time of a pointer-up event, if there is another pointer that is | 86 At the time of a pointer-up event, if there is another pointer that is |
| 87 already down and is of the same kind, and that has either no buttons | 87 already down and is of the same kind, and that has either no buttons |
| 88 or only its primary button active, then that becomes the new primary | 88 or only its primary button active, then that becomes the new primary |
| 89 pointer. | 89 pointer. |
| 90 | 90 |
| 91 | 91 |
| 92 These events all bubble and their data is an object with the following | 92 These events all bubble and their data is an object with the following |
| 93 fields: | 93 fields: |
| 94 | 94 |
| 95 pointer: an integer assigned to this touch or pointer when it | 95 pointer: an integer assigned to this touch or pointer when it |
| 96 enters the system, never reused, increasing | 96 enters the system, never reused, increasing |
| 97 monotonically every time a new value is assigned, | 97 monotonically every time a new value is assigned, |
| 98 starting from 1 (if the system gets a new tap every | 98 starting from 1 (if the system gets a new tap every |
| 99 microsecond, this will cause a problem after 285 | 99 microsecond, this will cause a problem after 285 |
| 100 years) | 100 years) |
| 101 | 101 |
| 102 kind: one of 'touch', 'mouse', 'stylus', 'inverted-stylus' | 102 kind: one of 'touch', 'mouse', 'stylus', 'inverted-stylus' |
| 103 | 103 |
| 104 x: x-position relative to the top-left corner of the | 104 x: x-position relative to the top-left corner of the |
| 105 surface of the node on which the event was fired | 105 surface of the node on which the event was fired |
| 106 | 106 |
| 107 y: y-position relative to the top-left corner of the | 107 y: y-position relative to the top-left corner of the |
| 108 surface of the node on which the event was fired | 108 surface of the node on which the event was fired |
| 109 | 109 |
| 110 buttons: a bitfield of the buttons pressed, from the following | 110 buttons: a bitfield of the buttons pressed, from the following |
| 111 list: | 111 list: |
| 112 1: primary mouse button (not available on stylus) | |
| 113 2: secondary mouse button, primary stylus button | |
| 114 3: middle mouse button, secondary stylus button | |
| 115 4: back button | |
| 116 5: forward button | |
| 117 additional buttons can be represented by numbers | |
| 118 greater than six: | |
| 119 n: (n-2)th mouse button, ignoring any buttons that | |
| 120 are explicitly back or forward buttons | |
| 121 (n-4)th stylus button, again ignoring any | |
| 122 explictly back or forward buttons | |
| 123 | 112 |
| 124 down: true if the pointer is down (in pointer-down event or | 113 1: primary mouse button (not available on stylus) |
| 125 subsequent pointer-move events); false otherwise (in | |
| 126 pointer-added, pointer-up, and pointer-removed events, | |
| 127 and in pointer-move events that aren't between | |
| 128 pointer-down and pointer-up events) | |
| 129 | 114 |
| 130 primary: true if this is a primary pointer/touch (see above) | 115 2: secondary mouse button, primary stylus button |
| 131 | 116 |
| 132 obscured: true if the system was rendering another view on top | 117 3: middle mouse button, secondary stylus button |
| 133 of the sky application at the time of the event (this | 118 |
| 134 is intended to enable click-jacking protections) | 119 4: back button |
| 120 |
| 121 5: forward button |
| 122 |
| 123 additional buttons can be represented by numbers |
| 124 greater than six: |
| 125 |
| 126 n: (n-2)th mouse button, ignoring any buttons that |
| 127 are explicitly back or forward buttons |
| 128 |
| 129 (n-4)th stylus button, again ignoring any |
| 130 explictly back or forward buttons |
| 131 |
| 132 down: true if the pointer is down (in pointer-down event or |
| 133 subsequent pointer-move events); false otherwise (in |
| 134 pointer-added, pointer-up, and pointer-removed |
| 135 events, and in pointer-move events that aren't |
| 136 between pointer-down and pointer-up events) |
| 137 |
| 138 primary: true if this is a primary pointer/touch (see above) |
| 139 |
| 140 obscured: true if the system was rendering another view on top |
| 141 of the sky application at the time of the event (this |
| 142 is intended to enable click-jacking protections) |
| 135 | 143 |
| 136 | 144 |
| 137 When primary is true, the following fields are available: | 145 When primary is true, the following fields are available: |
| 138 | 146 |
| 139 dx: if primary, then this is the delta from the x-position | 147 dx: if primary, then this is the delta from the |
| 140 at the time that the pointer became primary. | 148 x-position at the time that the pointer became |
| 149 primary. |
| 141 | 150 |
| 142 dy: if primary, then this is the delta from the x-position | 151 dy: if primary, then this is the delta from the |
| 143 at the time that the pointer became primary. | 152 x-position at the time that the pointer became |
| 153 primary. |
| 144 | 154 |
| 145 | 155 |
| 146 When down is true: | 156 When down is true: |
| 147 | 157 |
| 148 pressure: the pressure of the touch as a number ranging from | 158 pressure: the pressure of the touch as a number ranging from |
| 149 0.0, indicating a touch with no discernible pressure, | 159 0.0, indicating a touch with no discernible pressure, |
| 150 to 1.0, indicating a touch with "normal" pressure, and | 160 to 1.0, indicating a touch with "normal" pressure, |
| 151 possibly beyond, indicating a stronger touch; for | 161 and possibly beyond, indicating a stronger touch; for |
| 152 devices that do not detect pressure (e.g. mice), | 162 devices that do not detect pressure (e.g. mice), |
| 153 returns 1.0 | 163 returns 1.0 |
| 154 | 164 |
| 155 pressure-min: the minimum value that pressure can return for this | 165 pressure-min: the minimum value that pressure can return for this |
| 156 pointer | 166 pointer |
| 157 | 167 |
| 158 pressure-max: the maximum value that pressure can return for this | 168 pressure-max: the maximum value that pressure can return for this |
| 159 pointer | 169 pointer |
| 160 | 170 |
| 161 | 171 |
| 162 When kind is 'touch', 'stylus', or 'stylus-inverted': | 172 When kind is 'touch', 'stylus', or 'stylus-inverted': |
| 163 | 173 |
| 164 distance: distance of detected object from surface (e.g. | 174 distance: distance of detected object from surface (e.g. |
| 165 distance of stylus or finger from screen), if | 175 distance of stylus or finger from screen), if |
| 166 supported and down is not true, otherwise 0.0. | 176 supported and down is not true, otherwise 0.0. |
| 167 | 177 |
| 168 distance-min: the minimum value that distance can return for this | 178 distance-min: the minimum value that distance can return for this |
| 169 pointer (always 0.0) | 179 pointer (always 0.0) |
| 170 | 180 |
| 171 distance-max: the maximum value that distance can return for this | 181 distance-max: the maximum value that distance can return for this |
| 172 pointer (0.0 if not supported) | 182 pointer (0.0 if not supported) |
| 173 | 183 |
| 174 | 184 |
| 175 When kind is 'touch', 'stylus', or 'stylus-inverted' and down is true: | 185 When kind is 'touch', 'stylus', or 'stylus-inverted' and down is true: |
| 176 | 186 |
| 177 radius-major: the radius of the contact ellipse along the major | 187 radius-major: the radius of the contact ellipse along the major |
| 178 axis, in pixels | 188 axis, in pixels |
| 179 | 189 |
| 180 radius-minor: the radius of the contact ellipse along the major | 190 radius-minor: the radius of the contact ellipse along the major |
| 181 axis, in pixels | 191 axis, in pixels |
| 182 | 192 |
| 183 radius-min: the minimum value that could be reported for | 193 radius-min: the minimum value that could be reported for |
| 184 radius-major or radius-minor for this pointer | 194 radius-major or radius-minor for this pointer |
| 185 | 195 |
| 186 radius-max: the maximum value that could be reported for | 196 radius-max: the maximum value that could be reported for |
| 187 radius-major or radius-minor for this pointer | 197 radius-major or radius-minor for this pointer |
| 188 | 198 |
| 189 | 199 |
| 190 When kind is 'touch' and down is true: | 200 When kind is 'touch' and down is true: |
| 191 | 201 |
| 192 orientation: the angle of the contact ellipse, in radians in the | 202 orientation: the angle of the contact ellipse, in radians in the |
| 193 range | 203 range |
| 194 -pi/2 < orientation <= pi/2 | 204 |
| 195 ...giving the angle of the major axis of the ellipse | 205 -pi/2 < orientation <= pi/2 |
| 196 with the y-axis (negative angles indicating an | 206 |
| 197 orientation along the top-left / bottom-right | 207 ...giving the angle of the major axis of the ellipse |
| 198 diagonal, positive angles indicating an orientation | 208 with the y-axis (negative angles indicating an |
| 199 along the top-right / bottom-left diagonal, and zero | 209 orientation along the top-left / bottom-right |
| 200 indicating an orientation parallel with the y-axis) | 210 diagonal, positive angles indicating an orientation |
| 211 along the top-right / bottom-left diagonal, and zero |
| 212 indicating an orientation parallel with the y-axis) |
| 201 | 213 |
| 202 | 214 |
| 203 When kind is 'stylus' or 'stylus-inverted': | 215 When kind is 'stylus' or 'stylus-inverted': |
| 204 | 216 |
| 205 orientation: the angle of the stylus, in radians in the range | 217 orientation: the angle of the stylus, in radians in the range |
| 206 -pi < orientation <= pi | |
| 207 ...giving the angle of the axis of the stylus | |
| 208 projected onto the screen, relative to the positive | |
| 209 y-axis of the screen (thus 0 indicates the stylus, if | |
| 210 projected onto the screen, would go from the contact | |
| 211 point vertically up in the positive y-axis direction, | |
| 212 pi would indicate that the stylus would go down in the | |
| 213 negative y-axis direction; pi/4 would indicate that | |
| 214 the stylus goes up and to the right, -pi/2 would | |
| 215 indicate that the stylus goes to the left, etc) | |
| 216 | 218 |
| 217 tilt: the angle of the stylus, in radians in the range | 219 -pi < orientation <= pi |
| 218 0 <= tilt <= pi/2 | 220 |
| 219 ...giving the angle of the axis of the stylus, | 221 ...giving the angle of the axis of the stylus |
| 220 relative to the axis perpendicular to the screen (thus | 222 projected onto the screen, relative to the positive |
| 221 0 indicates the stylus is orthogonal to the plane of | 223 y-axis of the screen (thus 0 indicates the stylus, if |
| 222 the screen, while pi/2 indicates that the stylus is | 224 projected onto the screen, would go from the contact |
| 223 flat on the screen) | 225 point vertically up in the positive y-axis direction, |
| 226 pi would indicate that the stylus would go down in |
| 227 the negative y-axis direction; pi/4 would indicate |
| 228 that the stylus goes up and to the right, -pi/2 would |
| 229 indicate that the stylus goes to the left, etc) |
| 230 |
| 231 tilt: the angle of the stylus, in radians in the range |
| 232 |
| 233 0 <= tilt <= pi/2 |
| 234 |
| 235 ...giving the angle of the axis of the stylus, |
| 236 relative to the axis perpendicular to the screen |
| 237 (thus 0 indicates the stylus is orthogonal to the |
| 238 plane of the screen, while pi/2 indicates that the |
| 239 stylus is flat on the screen) |
| 224 | 240 |
| 225 | 241 |
| 226 Wheel events | 242 Wheel events |
| 227 ------------ | 243 ------------ |
| 228 | 244 |
| 229 When a wheel input device is turned, a 'wheel' event that bubbles is | 245 When a wheel input device is turned, a 'wheel' event that bubbles is |
| 230 fired at the application's document, with the following fields: | 246 fired at the application's document, with the following fields: |
| 231 | 247 |
| 232 wheel: an integer assigned to this wheel by the system. The | 248 wheel: an integer assigned to this wheel by the system. The |
| 233 same wheel on the same system must always be given the | 249 same wheel on the same system must always be given |
| 234 same ID. The primary wheel (e.g. the vertical wheel on | 250 the same ID. The primary wheel (e.g. the vertical |
| 235 a mouse) must be given ID 1. | 251 wheel on a mouse) must be given ID 1. |
| 236 | 252 |
| 237 delta: an floating point number representing the fraction of | 253 delta: an floating point number representing the fraction of |
| 238 the wheel that was turned, with positive numbers | 254 the wheel that was turned, with positive numbers |
| 239 representing a downward movement on vertical wheels, | 255 representing a downward movement on vertical wheels, |
| 240 rightward movement on horizontal wheels, and a | 256 rightward movement on horizontal wheels, and a |
| 241 clockwise movement on wheels with a user-facing side. | 257 clockwise movement on wheels with a user-facing side. |
| 242 | 258 |
| 243 Additionally, if the wheel is associated with a pointer (e.g. a | 259 Additionally, if the wheel is associated with a pointer (e.g. a mouse |
| 244 mouse wheel), the following fields must be present also: | 260 wheel), the following fields must be present also: |
| 245 | 261 |
| 246 pointer: the integer assigned to the pointer in its | 262 pointer: the integer assigned to the pointer in its |
| 247 'pointer-add' event (see above). | 263 'pointer-add' event (see above). |
| 248 | 264 |
| 249 x: x-position relative to the top-left corner of the | 265 x: x-position relative to the top-left corner of the |
| 250 display, in global layout coordinates | 266 display, in global layout coordinates |
| 251 | 267 |
| 252 y: x-position relative to the top-left corner of the | 268 y: x-position relative to the top-left corner of the |
| 253 display, in global layout coordinates | 269 display, in global layout coordinates |
| 254 | 270 |
| 255 Note: The only wheels that are supported are mouse wheels and physical | 271 Note: The only wheels that are supported are mouse wheels and physical |
| 256 dials. Track balls are not reported as mouse wheels. | 272 dials. Track balls are not reported as mouse wheels. |
| 257 | 273 |
| 258 | 274 |
| 259 Text input events | 275 Text input events |
| 260 ----------------- | 276 ----------------- |
| 261 | 277 |
| 262 TODO(ianh): keyboard events | 278 TODO(ianh): keyboard events |
| OLD | NEW |