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 { |
| 18 |
17 template <typename T> struct DefaultSingletonTraits; | 19 template <typename T> struct DefaultSingletonTraits; |
| 20 } |
18 | 21 |
19 typedef unsigned long Cursor; | 22 typedef unsigned long Cursor; |
20 typedef unsigned long Window; | 23 typedef unsigned long Window; |
21 typedef struct _XDisplay Display; | 24 typedef struct _XDisplay Display; |
22 typedef union _XEvent XEvent; | 25 typedef union _XEvent XEvent; |
23 | 26 |
24 namespace ui { | 27 namespace ui { |
25 | 28 |
26 // Functions related to determining touch devices. | 29 // Functions related to determining touch devices. |
27 class EVENTS_DEVICES_EXPORT TouchFactory { | 30 class EVENTS_DEVICES_EXPORT TouchFactory { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // for test purpose, and it does not query from X server. | 92 // for test purpose, and it does not query from X server. |
90 void SetTouchDeviceForTest(const std::vector<int>& devices); | 93 void SetTouchDeviceForTest(const std::vector<int>& devices); |
91 | 94 |
92 // Sets up the device id in the list |devices| as pointer devices. | 95 // 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 | 96 // This function is only for test purpose, and it does not query from |
94 // X server. | 97 // X server. |
95 void SetPointerDeviceForTest(const std::vector<int>& devices); | 98 void SetPointerDeviceForTest(const std::vector<int>& devices); |
96 | 99 |
97 private: | 100 private: |
98 // Requirement for Singleton | 101 // Requirement for Singleton |
99 friend struct DefaultSingletonTraits<TouchFactory>; | 102 friend struct base::DefaultSingletonTraits<TouchFactory>; |
100 | 103 |
101 void CacheTouchscreenIds(int id); | 104 void CacheTouchscreenIds(int id); |
102 | 105 |
103 // NOTE: To keep track of touch devices, we currently maintain a lookup table | 106 // 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 | 107 // 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, | 108 // 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 | 109 // 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 | 110 // identifier for the touch device. This can be completed after enough testing |
108 // on real touch devices. | 111 // on real touch devices. |
109 | 112 |
(...skipping 26 matching lines...) Expand all Loading... |
136 | 139 |
137 // Associate each device ID with its master device ID. | 140 // Associate each device ID with its master device ID. |
138 std::map<int, int> device_master_id_list_; | 141 std::map<int, int> device_master_id_list_; |
139 | 142 |
140 DISALLOW_COPY_AND_ASSIGN(TouchFactory); | 143 DISALLOW_COPY_AND_ASSIGN(TouchFactory); |
141 }; | 144 }; |
142 | 145 |
143 } // namespace ui | 146 } // namespace ui |
144 | 147 |
145 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ | 148 #endif // UI_EVENTS_DEVICES_X11_TOUCH_FACTORY_X11_H_ |
OLD | NEW |