Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 #ifndef PPAPI_C_PP_INPUT_EVENT_H_ | 5 #ifndef PPAPI_C_PP_INPUT_EVENT_H_ |
| 6 #define PPAPI_C_PP_INPUT_EVENT_H_ | 6 #define PPAPI_C_PP_INPUT_EVENT_H_ |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * @file | 9 * @file |
| 10 * Defines the API ... | 10 * Defines the API ... |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 */ | 193 */ |
| 194 | 194 |
| 195 /** | 195 /** |
| 196 * @addtogroup Structs | 196 * @addtogroup Structs |
| 197 * @{ | 197 * @{ |
| 198 */ | 198 */ |
| 199 struct PP_InputEvent_Wheel { | 199 struct PP_InputEvent_Wheel { |
| 200 /** A combination of the EVENT_MODIFIER flags. */ | 200 /** A combination of the EVENT_MODIFIER flags. */ |
| 201 uint32_t modifier; | 201 uint32_t modifier; |
| 202 | 202 |
| 203 /** | |
| 204 * Indicates the amount vertically and horizontally the user has requested | |
| 205 * to scroll by with their mouse wheel. A scroll down or to the right (where | |
| 206 * the content moves up or left) is represented as positive values, and | |
| 207 * a scroll up or to the left (where the content moves down or right) is | |
| 208 * represented as negative values. | |
| 209 * | |
| 210 * The units are either in pixels (when scroll_by_page is false) or pages | |
| 211 * (when scroll_by_page is true). For example, delta_y = -3 means scroll up 3 | |
| 212 * pixels when scroll_by_page is false, and scroll up 3 pages when | |
| 213 * scroll_by_page is true. | |
| 214 * | |
| 215 * This amount is system dependent and will take into account the user's | |
| 216 * preferred scroll sensitivity and potentially also nonlinear acceleration | |
| 217 * based on the speed of the scrolling. | |
| 218 * | |
| 219 * Devices will be of varying resolution. Some mice with large detents will | |
| 220 * only generate integer scroll amounts. But fractional values are also | |
| 221 * possible, for example, on some trackpads and newer mice that don't have | |
| 222 * "clicks". | |
| 223 */ | |
| 203 float delta_x; | 224 float delta_x; |
| 204 float delta_y; | 225 float delta_y; |
| 226 | |
| 227 /** | |
| 228 * The number of "clicks" of the scroll wheel that have produced the | |
| 229 * event. This value will not take into account acceleration for faster | |
|
Peter Kasting
2011/02/15 20:03:59
This would be ideal, but it's inaccurate. On Mac
| |
| 230 * movement. The positive and negative meanings are the same as for |delta|. | |
| 231 * | |
| 232 * If you are scrolling, you probably want to use the delta values above. | |
| 233 * These tick events can be useful if you aren't doing actual scrolling and | |
| 234 * don't want acceleration or pixel values. An example may be cycling | |
| 235 * between different items in a game. | |
| 236 * | |
| 237 * You may receive fractional values for the wheel ticks if the mouse wheel | |
| 238 * is high resolution or doesn't have "clicks". If your program wants | |
| 239 * discrete events (as in the "picking items" example) you should accumulate | |
| 240 * fractional click values from multiple messages until the total value | |
| 241 * reaches positive or negative one. This should represent a similar amount | |
| 242 * of scrolling as for a mouse that has a discrete mouse wheel. | |
| 243 */ | |
| 205 float wheel_ticks_x; | 244 float wheel_ticks_x; |
| 206 float wheel_ticks_y; | 245 float wheel_ticks_y; |
| 207 | 246 |
| 247 /** | |
| 248 * Indicates if the scroll delta_x/delta_y indicates pages or lines to | |
| 249 * scroll by. When true, the user is requesting to scroll by pages. | |
| 250 */ | |
| 208 PP_Bool scroll_by_page; | 251 PP_Bool scroll_by_page; |
| 209 }; | 252 }; |
| 210 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); | 253 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); |
| 211 /** | 254 /** |
| 212 * @} | 255 * @} |
| 213 */ | 256 */ |
| 214 | 257 |
| 215 /** | 258 /** |
| 216 * | 259 * |
| 217 * @addtogroup Structs | 260 * @addtogroup Structs |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 245 */ | 288 */ |
| 246 char padding[64]; | 289 char padding[64]; |
| 247 } u; | 290 } u; |
| 248 }; | 291 }; |
| 249 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); | 292 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); |
| 250 /** | 293 /** |
| 251 * @} | 294 * @} |
| 252 */ | 295 */ |
| 253 | 296 |
| 254 #endif /* PPAPI_C_PP_INPUT_EVENT_H_ */ | 297 #endif /* PPAPI_C_PP_INPUT_EVENT_H_ */ |
| OLD | NEW |