OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ | 5 #ifndef UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ |
6 #define UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ | 6 #define UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ |
7 | 7 |
8 // Generically-named #defines from Xlib is conflicting with symbols in GTest. | 8 // Generically-named #defines from Xlib is conflicting with symbols in GTest. |
9 // So many tests .cc file #undef Bool before including device_data_manager.h, | 9 // So many tests .cc file #undef Bool before including device_data_manager.h, |
10 // which makes Bool unrecognized in XInput2.h. | 10 // which makes Bool unrecognized in XInput2.h. |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 double increment; | 294 double increment; |
295 // Current scroll position; used to find the difference between events. | 295 // Current scroll position; used to find the difference between events. |
296 double position; | 296 double position; |
297 // If true then scroll has been seen in this direction. | 297 // If true then scroll has been seen in this direction. |
298 bool seen; | 298 bool seen; |
299 }; | 299 }; |
300 | 300 |
301 AxisInfo vertical, horizontal; | 301 AxisInfo vertical, horizontal; |
302 }; | 302 }; |
303 | 303 |
| 304 // Information from XIValuatorClassInfo. |
| 305 struct ValuatorInfo { |
| 306 // The valuator number. |
| 307 int number = -1; |
| 308 // The valuator min value. |
| 309 double min = 0.0; |
| 310 // The valuator max value. |
| 311 double max = 0.0; |
| 312 }; |
| 313 |
304 DeviceDataManagerX11(); | 314 DeviceDataManagerX11(); |
305 ~DeviceDataManagerX11() override; | 315 ~DeviceDataManagerX11() override; |
306 | 316 |
307 // Initialize the XInput related system information. | 317 // Initialize the XInput related system information. |
308 bool InitializeXInputInternal(); | 318 bool InitializeXInputInternal(); |
309 | 319 |
310 void InitializeValuatorsForTest(int deviceid, | 320 void InitializeValuatorsForTest(int deviceid, |
311 int start_valuator, | 321 int start_valuator, |
312 int end_valuator, | 322 int end_valuator, |
313 double min_value, | 323 double min_value, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // A quick lookup table for determining if events from the XI device | 362 // A quick lookup table for determining if events from the XI device |
353 // should be blocked. | 363 // should be blocked. |
354 std::bitset<kMaxDeviceNum> blocked_devices_; | 364 std::bitset<kMaxDeviceNum> blocked_devices_; |
355 | 365 |
356 // The set of keys allowed while the keyboard is blocked. | 366 // The set of keys allowed while the keyboard is blocked. |
357 std::unique_ptr<std::set<KeyboardCode>> blocked_keyboard_allowed_keys_; | 367 std::unique_ptr<std::set<KeyboardCode>> blocked_keyboard_allowed_keys_; |
358 | 368 |
359 // Number of valuators on the specific device. | 369 // Number of valuators on the specific device. |
360 int valuator_count_[kMaxDeviceNum]; | 370 int valuator_count_[kMaxDeviceNum]; |
361 | 371 |
362 // Index table to find the valuator for DataType on the specific device | 372 // Index table to find valuator number, min and max for DataType on the |
363 // by valuator_lookup_[device_id][data_type]. | 373 // specific device by valuator_lookup_[device_id][data_type]. |
364 std::vector<int> valuator_lookup_[kMaxDeviceNum]; | 374 std::vector<ValuatorInfo> valuator_lookup_[kMaxDeviceNum]; |
365 | 375 |
366 // Indicates if the user has disabled high precision scrolling support. | 376 // Indicates if the user has disabled high precision scrolling support. |
367 bool high_precision_scrolling_disabled_; | 377 bool high_precision_scrolling_disabled_; |
368 | 378 |
369 // Index table to find the horizontal and vertical scroll valuator | 379 // Index table to find the horizontal and vertical scroll valuator |
370 // numbers, scroll increments and scroll position. | 380 // numbers, scroll increments and scroll position. |
371 ScrollInfo scroll_data_[kMaxDeviceNum]; | 381 ScrollInfo scroll_data_[kMaxDeviceNum]; |
372 | 382 |
373 // Index table to find the DataType for valuator on the specific device | 383 // Index table to find the DataType for valuator on the specific device |
374 // by data_type_lookup_[device_id][valuator]. | 384 // by data_type_lookup_[device_id][valuator]. |
375 std::vector<int> data_type_lookup_[kMaxDeviceNum]; | 385 std::vector<int> data_type_lookup_[kMaxDeviceNum]; |
376 | 386 |
377 // Index table to find the min & max value of the Valuator on a specific | |
378 // device. | |
379 std::vector<double> valuator_min_[kMaxDeviceNum]; | |
380 std::vector<double> valuator_max_[kMaxDeviceNum]; | |
381 | |
382 // Table to keep track of the last seen value for the specified valuator for | 387 // Table to keep track of the last seen value for the specified valuator for |
383 // a specified slot of a device. Defaults to 0 if the valuator for that slot | 388 // a specified slot of a device. Defaults to 0 if the valuator for that slot |
384 // was not specified in an earlier event. With MT-B/XI2.2, valuators in an | 389 // was not specified in an earlier event. With MT-B/XI2.2, valuators in an |
385 // XEvent are not reported if the values haven't changed from the previous | 390 // XEvent are not reported if the values haven't changed from the previous |
386 // event. So it is necessary to remember these valuators so that chrome | 391 // event. So it is necessary to remember these valuators so that chrome |
387 // doesn't think X/device doesn't know about the valuators. We currently | 392 // doesn't think X/device doesn't know about the valuators. We currently |
388 // use this only on touchscreen devices. | 393 // use this only on touchscreen devices. |
389 std::vector<double> last_seen_valuator_[kMaxDeviceNum][kMaxSlotNum]; | 394 std::vector<double> last_seen_valuator_[kMaxDeviceNum][kMaxSlotNum]; |
390 | 395 |
391 // Map that stores meta-data for blocked keyboards. This is needed to restore | 396 // Map that stores meta-data for blocked keyboards. This is needed to restore |
392 // devices when they are re-enabled. | 397 // devices when they are re-enabled. |
393 std::map<int, ui::InputDevice> blocked_keyboard_devices_; | 398 std::map<int, ui::InputDevice> blocked_keyboard_devices_; |
394 | 399 |
395 // X11 atoms cache. | 400 // X11 atoms cache. |
396 X11AtomCache atom_cache_; | 401 X11AtomCache atom_cache_; |
397 | 402 |
398 unsigned char button_map_[256]; | 403 unsigned char button_map_[256]; |
399 int button_map_count_; | 404 int button_map_count_; |
400 | 405 |
401 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11); | 406 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11); |
402 }; | 407 }; |
403 | 408 |
404 } // namespace ui | 409 } // namespace ui |
405 | 410 |
406 #endif // UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ | 411 #endif // UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ |
OLD | NEW |