OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TOUCH_FACTORY_X11_H_ | 5 #ifndef UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
6 #define UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ | 6 #define UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
7 | 7 |
8 #include <bitset> | 8 #include <bitset> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "ui/events/devices/events_devices_export.h" | 14 #include "ui/events/devices/events_devices_export.h" |
15 #include "ui/gfx/sequential_id_generator.h" | 15 #include "ui/gfx/sequential_id_generator.h" |
16 | 16 |
| 17 namespace base { |
17 template <typename T> struct DefaultSingletonTraits; | 18 template <typename T> struct DefaultSingletonTraits; |
| 19 } // namespace base |
18 | 20 |
19 typedef unsigned long Cursor; | 21 typedef unsigned long Cursor; |
20 typedef unsigned long Window; | 22 typedef unsigned long Window; |
21 typedef struct _XDisplay Display; | 23 typedef struct _XDisplay Display; |
22 typedef union _XEvent XEvent; | 24 typedef union _XEvent XEvent; |
23 | 25 |
24 namespace ui { | 26 namespace ui { |
25 | 27 |
26 // Functions related to determining touch devices. | 28 // Functions related to determining touch devices. |
27 class EVENTS_DEVICES_EXPORT TouchFactory { | 29 class EVENTS_DEVICES_EXPORT TouchFactory { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // devices and enables touch events processing. This function is only | 90 // devices and enables touch events processing. This function is only |
89 // for test purpose, and it does not query from X server. | 91 // for test purpose, and it does not query from X server. |
90 void SetTouchDeviceForTest(const std::vector<int>& devices); | 92 void SetTouchDeviceForTest(const std::vector<int>& devices); |
91 | 93 |
92 // Sets up the device id in the list |devices| as pointer devices. | 94 // Sets up the device id in the list |devices| as pointer devices. |
93 // This function is only for test purpose, and it does not query from | 95 // This function is only for test purpose, and it does not query from |
94 // X server. | 96 // X server. |
95 void SetPointerDeviceForTest(const std::vector<int>& devices); | 97 void SetPointerDeviceForTest(const std::vector<int>& devices); |
96 | 98 |
97 private: | 99 private: |
98 // Requirement for Singleton | 100 // Requirement for base::Singleton |
99 friend struct DefaultSingletonTraits<TouchFactory>; | 101 friend struct base::DefaultSingletonTraits<TouchFactory>; |
100 | 102 |
101 void CacheTouchscreenIds(int id); | 103 void CacheTouchscreenIds(int id); |
102 | 104 |
103 // NOTE: To keep track of touch devices, we currently maintain a lookup table | 105 // NOTE: To keep track of touch devices, we currently maintain a lookup table |
104 // to quickly decide if a device is a touch device or not. We also maintain a | 106 // to quickly decide if a device is a touch device or not. We also maintain a |
105 // list of the touch devices. Ideally, there will be only one touch device, | 107 // list of the touch devices. Ideally, there will be only one touch device, |
106 // and instead of having the lookup table and the list, there will be a single | 108 // and instead of having the lookup table and the list, there will be a single |
107 // identifier for the touch device. This can be completed after enough testing | 109 // identifier for the touch device. This can be completed after enough testing |
108 // on real touch devices. | 110 // on real touch devices. |
109 | 111 |
(...skipping 26 matching lines...) Expand all Loading... |
136 | 138 |
137 // Associate each device ID with its master device ID. | 139 // Associate each device ID with its master device ID. |
138 std::map<int, int> device_master_id_list_; | 140 std::map<int, int> device_master_id_list_; |
139 | 141 |
140 DISALLOW_COPY_AND_ASSIGN(TouchFactory); | 142 DISALLOW_COPY_AND_ASSIGN(TouchFactory); |
141 }; | 143 }; |
142 | 144 |
143 } // namespace ui | 145 } // namespace ui |
144 | 146 |
145 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ | 147 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
OLD | NEW |