Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: ui/events/x/device_data_manager.h

Issue 191223007: Move touch CTM from X into Chrome (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: move CTM update code into a separate file ash/touch/touch_ctm_controller.cc Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_X_DEVICE_DATA_MANAGER_H_ 5 #ifndef UI_EVENTS_X_DEVICE_DATA_MANAGER_H_
6 #define UI_EVENTS_X_DEVICE_DATA_MANAGER_H_ 6 #define UI_EVENTS_X_DEVICE_DATA_MANAGER_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 <map> 18 #include <map>
19 #include <vector> 19 #include <vector>
20 20
21 #include "base/basictypes.h" 21 #include "base/basictypes.h"
22 #include "base/event_types.h" 22 #include "base/event_types.h"
23 #include "ui/events/event_constants.h" 23 #include "ui/events/event_constants.h"
24 #include "ui/events/events_base_export.h" 24 #include "ui/events/events_base_export.h"
25 #include "ui/events/touch_ctm.h"
25 #include "ui/gfx/x/x11_atom_cache.h" 26 #include "ui/gfx/x/x11_atom_cache.h"
26 27
27 template <typename T> struct DefaultSingletonTraits; 28 template <typename T> struct DefaultSingletonTraits;
28 29
29 typedef union _XEvent XEvent; 30 typedef union _XEvent XEvent;
30 31
31 namespace ui { 32 namespace ui {
32 33
33 // CrOS touchpad metrics gesture types 34 // CrOS touchpad metrics gesture types
34 enum GestureMetricsType { 35 enum GestureMetricsType {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 const DataType type, 209 const DataType type,
209 double* value); 210 double* value);
210 211
211 // Extract the range of the data type. Return true if the range is available 212 // Extract the range of the data type. Return true if the range is available
212 // and written into min & max, false if the range is not available. 213 // and written into min & max, false if the range is not available.
213 bool GetDataRange(unsigned int deviceid, 214 bool GetDataRange(unsigned int deviceid,
214 const DataType type, 215 const DataType type,
215 double* min, 216 double* min,
216 double* max); 217 double* max);
217 218
219 void ClearTouchCTM();
sadrul 2014/03/15 19:32:51 Use something more descriptive than CTM
Yufeng Shen (Slow to review) 2014/04/29 20:34:18 renamed to TouchTransformer.
220 void SetTouchCTM(int touch_device_id,
221 const TouchCTM& touch_ctm);
222 void ApplyTouchCTM(int touch_device_id, float* x, float* y);
223
224 void ClearTouchDeviceToDisplayMap();
sadrul 2014/03/15 19:32:51 We should have one 'Clear<...>' instead of two sep
Yufeng Shen (Slow to review) 2014/04/29 20:34:18 Done.
225 void MapTouchDeviceToDisplay(int touch_device_id, int64 display_id);
226 int64 GetDisplayForTouchDevice(int touch_device_id);
227
228
218 // Sets up relevant valuator informations for device ids in the device lists. 229 // Sets up relevant valuator informations for device ids in the device lists.
219 // This function is only for test purpose. It does not query the X server for 230 // This function is only for test purpose. It does not query the X server for
220 // the actual device info, but rather inits the relevant valuator structures 231 // the actual device info, but rather inits the relevant valuator structures
221 // to have safe default values for testing. 232 // to have safe default values for testing.
222 void SetDeviceListForTest(const std::vector<unsigned int>& touchscreen, 233 void SetDeviceListForTest(const std::vector<unsigned int>& touchscreen,
223 const std::vector<unsigned int>& cmt_devices); 234 const std::vector<unsigned int>& cmt_devices);
224 235
225 void SetValuatorDataForTest(XIDeviceEvent* xievent, 236 void SetValuatorDataForTest(XIDeviceEvent* xievent,
226 DataType type, 237 DataType type,
227 double value); 238 double value);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // doesn't think X/device doesn't know about the valuators. We currently 296 // doesn't think X/device doesn't know about the valuators. We currently
286 // use this only on touchscreen devices. 297 // use this only on touchscreen devices.
287 std::vector<double> last_seen_valuator_[kMaxDeviceNum][kMaxSlotNum]; 298 std::vector<double> last_seen_valuator_[kMaxDeviceNum][kMaxSlotNum];
288 299
289 // X11 atoms cache. 300 // X11 atoms cache.
290 X11AtomCache atom_cache_; 301 X11AtomCache atom_cache_;
291 302
292 unsigned char button_map_[256]; 303 unsigned char button_map_[256];
293 int button_map_count_; 304 int button_map_count_;
294 305
306 // Table to keep track of which display id is mapped to which touch device.
307 int64 touch_device_to_display_map_[kMaxDeviceNum];
308 // Index table to find the TouchCTM for a touch device.
309 TouchCTM touch_device_ctm_map_[kMaxDeviceNum];
310
295 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); 311 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
296 }; 312 };
297 313
298 } // namespace ui 314 } // namespace ui
299 315
300 #endif // UI_EVENTS_X_DEVICE_DATA_MANAGER_H_ 316 #endif // UI_EVENTS_X_DEVICE_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698