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