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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 DT_TOUCH_TRACKING_ID, // ID of the touch point. | 102 DT_TOUCH_TRACKING_ID, // ID of the touch point. |
103 | 103 |
104 // Kernel timestamp from touch screen (if available). | 104 // Kernel timestamp from touch screen (if available). |
105 DT_TOUCH_RAW_TIMESTAMP, | 105 DT_TOUCH_RAW_TIMESTAMP, |
106 | 106 |
107 // End of touch data types. | 107 // End of touch data types. |
108 | 108 |
109 DT_LAST_ENTRY // This must come last. | 109 DT_LAST_ENTRY // This must come last. |
110 }; | 110 }; |
111 | 111 |
| 112 // A Device ID number that can be passed to InvalidateScrollClasses that |
| 113 // invalidates all devices. |
| 114 static const int kAllDevices = -1; |
| 115 |
112 // Data struct to store extracted data from an input event. | 116 // Data struct to store extracted data from an input event. |
113 typedef std::map<int, double> EventData; | 117 typedef std::map<int, double> EventData; |
114 | 118 |
115 static void CreateInstance(); | 119 static void CreateInstance(); |
116 | 120 |
117 // We use int because enums can be casted to ints but not vice versa. | 121 // We use int because enums can be casted to ints but not vice versa. |
118 static bool IsCMTDataType(const int type); | 122 static bool IsCMTDataType(const int type); |
119 static bool IsTouchDataType(const int type); | 123 static bool IsTouchDataType(const int type); |
120 | 124 |
121 // Returns the DeviceDataManagerX11 singleton. | 125 // Returns the DeviceDataManagerX11 singleton. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 int* finger_count); | 197 int* finger_count); |
194 | 198 |
195 // Extract data from a scroll class event (smooth scrolling). User must | 199 // Extract data from a scroll class event (smooth scrolling). User must |
196 // first verify the event type with GetScrollClassEventDetail. | 200 // first verify the event type with GetScrollClassEventDetail. |
197 // Pointers shouldn't be NULL. | 201 // Pointers shouldn't be NULL. |
198 void GetScrollClassOffsets(const XEvent& xev, | 202 void GetScrollClassOffsets(const XEvent& xev, |
199 double* x_offset, | 203 double* x_offset, |
200 double* y_offset); | 204 double* y_offset); |
201 | 205 |
202 // Invalidate stored scroll class counters, since they can change when | 206 // Invalidate stored scroll class counters, since they can change when |
203 // pointing at other windows. | 207 // pointing at other windows. If kAllDevices is specified, all devices are |
204 void InvalidateScrollClasses(); | 208 // invalidated. |
| 209 void InvalidateScrollClasses(int device_id); |
205 | 210 |
206 // Extract data from a fling event. User must first verify the event type | 211 // Extract data from a fling event. User must first verify the event type |
207 // with IsFlingEvent. Pointers shouldn't be NULL. | 212 // with IsFlingEvent. Pointers shouldn't be NULL. |
208 void GetFlingData(const XEvent& xev, | 213 void GetFlingData(const XEvent& xev, |
209 float* vx, | 214 float* vx, |
210 float* vy, | 215 float* vy, |
211 float* vx_ordinal, | 216 float* vx_ordinal, |
212 float* vy_ordinal, | 217 float* vy_ordinal, |
213 bool* is_cancel); | 218 bool* is_cancel); |
214 | 219 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 395 |
391 unsigned char button_map_[256]; | 396 unsigned char button_map_[256]; |
392 int button_map_count_; | 397 int button_map_count_; |
393 | 398 |
394 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11); | 399 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11); |
395 }; | 400 }; |
396 | 401 |
397 } // namespace ui | 402 } // namespace ui |
398 | 403 |
399 #endif // UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ | 404 #endif // UI_EVENTS_DEVICES_X11_DEVICE_DATA_MANAGER_X11_H_ |
OLD | NEW |