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. |
11 #ifndef Bool | 11 #ifndef Bool |
12 #define Bool int | 12 #define Bool int |
13 #endif | 13 #endif |
14 | 14 |
15 #include <X11/extensions/XInput2.h> | 15 #include <X11/extensions/XInput2.h> |
16 | 16 |
17 #include <bitset> | 17 #include <bitset> |
18 #include <functional> | 18 #include <functional> |
19 #include <map> | 19 #include <map> |
| 20 #include <memory> |
20 #include <set> | 21 #include <set> |
21 #include <vector> | 22 #include <vector> |
22 | 23 |
23 #include "base/event_types.h" | 24 #include "base/event_types.h" |
24 #include "base/macros.h" | 25 #include "base/macros.h" |
25 #include "base/memory/scoped_ptr.h" | |
26 #include "ui/events/devices/device_data_manager.h" | 26 #include "ui/events/devices/device_data_manager.h" |
27 #include "ui/events/devices/events_devices_export.h" | 27 #include "ui/events/devices/events_devices_export.h" |
28 #include "ui/events/event_constants.h" | 28 #include "ui/events/event_constants.h" |
29 #include "ui/events/keycodes/keyboard_codes.h" | 29 #include "ui/events/keycodes/keyboard_codes.h" |
30 #include "ui/gfx/geometry/rect.h" | 30 #include "ui/gfx/geometry/rect.h" |
31 #include "ui/gfx/x/x11_atom_cache.h" | 31 #include "ui/gfx/x/x11_atom_cache.h" |
32 | 32 |
33 typedef union _XEvent XEvent; | 33 typedef union _XEvent XEvent; |
34 | 34 |
35 namespace ui { | 35 namespace ui { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 void SetDeviceListForTest(const std::vector<int>& touchscreen, | 251 void SetDeviceListForTest(const std::vector<int>& touchscreen, |
252 const std::vector<int>& cmt_devices, | 252 const std::vector<int>& cmt_devices, |
253 const std::vector<int>& other_devices); | 253 const std::vector<int>& other_devices); |
254 | 254 |
255 void SetValuatorDataForTest(XIDeviceEvent* xievent, | 255 void SetValuatorDataForTest(XIDeviceEvent* xievent, |
256 DataType type, | 256 DataType type, |
257 double value); | 257 double value); |
258 | 258 |
259 // Sets the keys which are still allowed on a disabled keyboard device. | 259 // Sets the keys which are still allowed on a disabled keyboard device. |
260 void SetDisabledKeyboardAllowedKeys( | 260 void SetDisabledKeyboardAllowedKeys( |
261 scoped_ptr<std::set<KeyboardCode> > excepted_keys); | 261 std::unique_ptr<std::set<KeyboardCode>> excepted_keys); |
262 | 262 |
263 // Disables and enables events from devices by device id. | 263 // Disables and enables events from devices by device id. |
264 void DisableDevice(int deviceid); | 264 void DisableDevice(int deviceid); |
265 void EnableDevice(int deviceid); | 265 void EnableDevice(int deviceid); |
266 | 266 |
267 bool IsDeviceEnabled(int device_id) const; | 267 bool IsDeviceEnabled(int device_id) const; |
268 | 268 |
269 // Returns true if |native_event| should be blocked. | 269 // Returns true if |native_event| should be blocked. |
270 bool IsEventBlocked(const XEvent& xev); | 270 bool IsEventBlocked(const XEvent& xev); |
271 | 271 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 std::bitset<kMaxDeviceNum> scrollclass_devices_; | 343 std::bitset<kMaxDeviceNum> scrollclass_devices_; |
344 | 344 |
345 // List of the master pointer devices. | 345 // List of the master pointer devices. |
346 std::vector<int> master_pointers_; | 346 std::vector<int> master_pointers_; |
347 | 347 |
348 // A quick lookup table for determining if events from the XI device | 348 // A quick lookup table for determining if events from the XI device |
349 // should be blocked. | 349 // should be blocked. |
350 std::bitset<kMaxDeviceNum> blocked_devices_; | 350 std::bitset<kMaxDeviceNum> blocked_devices_; |
351 | 351 |
352 // The set of keys allowed while the keyboard is blocked. | 352 // The set of keys allowed while the keyboard is blocked. |
353 scoped_ptr<std::set<KeyboardCode> > blocked_keyboard_allowed_keys_; | 353 std::unique_ptr<std::set<KeyboardCode>> blocked_keyboard_allowed_keys_; |
354 | 354 |
355 // Number of valuators on the specific device. | 355 // Number of valuators on the specific device. |
356 int valuator_count_[kMaxDeviceNum]; | 356 int valuator_count_[kMaxDeviceNum]; |
357 | 357 |
358 // Index table to find the valuator for DataType on the specific device | 358 // Index table to find the valuator for DataType on the specific device |
359 // by valuator_lookup_[device_id][data_type]. | 359 // by valuator_lookup_[device_id][data_type]. |
360 std::vector<int> valuator_lookup_[kMaxDeviceNum]; | 360 std::vector<int> valuator_lookup_[kMaxDeviceNum]; |
361 | 361 |
362 // Index table to find the horizontal and vertical scroll valuator | 362 // Index table to find the horizontal and vertical scroll valuator |
363 // numbers, scroll increments and scroll position. | 363 // numbers, scroll increments and scroll position. |
(...skipping 26 matching lines...) Expand all Loading... |
390 | 390 |
391 unsigned char button_map_[256]; | 391 unsigned char button_map_[256]; |
392 int button_map_count_; | 392 int button_map_count_; |
393 | 393 |
394 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11); | 394 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11); |
395 }; | 395 }; |
396 | 396 |
397 } // namespace ui | 397 } // namespace ui |
398 | 398 |
399 #endif // UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ | 399 #endif // UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ |
OLD | NEW |