| 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. The value may have system-specific acceleration applied to it, |
| 230 * depending on the device. The positive and negative meanings are the same |
| 231 * as for |delta|. |
| 232 * |
| 233 * If you are scrolling, you probably want to use the delta values above. |
| 234 * These tick events can be useful if you aren't doing actual scrolling and |
| 235 * don't want or pixel values. An example may be cycling between different |
| 236 * items in a game. |
| 237 * |
| 238 * You may receive fractional values for the wheel ticks if the mouse wheel |
| 239 * is high resolution or doesn't have "clicks". If your program wants |
| 240 * discrete events (as in the "picking items" example) you should accumulate |
| 241 * fractional click values from multiple messages until the total value |
| 242 * reaches positive or negative one. This should represent a similar amount |
| 243 * of scrolling as for a mouse that has a discrete mouse wheel. |
| 244 */ |
| 205 float wheel_ticks_x; | 245 float wheel_ticks_x; |
| 206 float wheel_ticks_y; | 246 float wheel_ticks_y; |
| 207 | 247 |
| 248 /** |
| 249 * Indicates if the scroll delta_x/delta_y indicates pages or lines to |
| 250 * scroll by. When true, the user is requesting to scroll by pages. |
| 251 */ |
| 208 PP_Bool scroll_by_page; | 252 PP_Bool scroll_by_page; |
| 209 }; | 253 }; |
| 210 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); | 254 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); |
| 211 /** | 255 /** |
| 212 * @} | 256 * @} |
| 213 */ | 257 */ |
| 214 | 258 |
| 215 /** | 259 /** |
| 216 * | 260 * |
| 217 * @addtogroup Structs | 261 * @addtogroup Structs |
| (...skipping 27 matching lines...) Expand all Loading... |
| 245 */ | 289 */ |
| 246 char padding[64]; | 290 char padding[64]; |
| 247 } u; | 291 } u; |
| 248 }; | 292 }; |
| 249 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); | 293 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); |
| 250 /** | 294 /** |
| 251 * @} | 295 * @} |
| 252 */ | 296 */ |
| 253 | 297 |
| 254 #endif /* PPAPI_C_PP_INPUT_EVENT_H_ */ | 298 #endif /* PPAPI_C_PP_INPUT_EVENT_H_ */ |
| OLD | NEW |