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

Side by Side Diff: ui/base/touch/touch_factory.h

Issue 8070003: touchui: Convert XI2 MT tracking id to slot id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/base/touch/touch_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BASE_TOUCH_TOUCH_FACTORY_H_ 5 #ifndef UI_BASE_TOUCH_TOUCH_FACTORY_H_
6 #define UI_BASE_TOUCH_TOUCH_FACTORY_H_ 6 #define UI_BASE_TOUCH_TOUCH_FACTORY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <bitset> 9 #include <bitset>
10 #include <map> 10 #include <map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/hash_tables.h"
14 #include "base/timer.h" 15 #include "base/timer.h"
15 #include "ui/base/ui_export.h" 16 #include "ui/base/ui_export.h"
16 17
17 typedef unsigned long Cursor; 18 typedef unsigned long Cursor;
18 typedef unsigned long Window; 19 typedef unsigned long Window;
19 typedef struct _XDisplay Display; 20 typedef struct _XDisplay Display;
20 typedef union _XEvent XEvent; 21 typedef union _XEvent XEvent;
21 22
22 namespace ui { 23 namespace ui {
23 24
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // time this is called. 76 // time this is called.
76 void SetTouchDeviceList(const std::vector<unsigned int>& devices); 77 void SetTouchDeviceList(const std::vector<unsigned int>& devices);
77 78
78 // Is the device a touch-device? 79 // Is the device a touch-device?
79 bool IsTouchDevice(unsigned int deviceid) const; 80 bool IsTouchDevice(unsigned int deviceid) const;
80 81
81 // Is the device a real touch-device? (see doc. for |touch_device_list_| below 82 // Is the device a real touch-device? (see doc. for |touch_device_list_| below
82 // for more explanation.) 83 // for more explanation.)
83 bool IsRealTouchDevice(unsigned int deviceid) const; 84 bool IsRealTouchDevice(unsigned int deviceid) const;
84 85
85 #if !defined(USE_XI2_MT) 86 #if defined(USE_XI2_MT)
87 // Tries to find an existing slot ID mapping to tracking ID. If there
88 // isn't one already, allocates a new slot ID and sets up the mapping.
89 int GetSlotForTrackingID(uint32 tracking_id);
90
91 // Releases the slot ID mapping to tracking ID.
92 void ReleaseSlotForTrackingID(uint32 tracking_id);
93 #endif
94
86 // Is the slot ID currently used? 95 // Is the slot ID currently used?
87 bool IsSlotUsed(int slot) const; 96 bool IsSlotUsed(int slot) const;
88 97
89 // Marks a slot as being used/unused. 98 // Marks a slot as being used/unused.
90 void SetSlotUsed(int slot, bool used); 99 void SetSlotUsed(int slot, bool used);
91 #endif
92 100
93 // Grabs the touch devices for the specified window on the specified display. 101 // Grabs the touch devices for the specified window on the specified display.
94 // Returns if grab was successful for all touch devices. 102 // Returns if grab was successful for all touch devices.
95 bool GrabTouchDevices(Display* display, ::Window window); 103 bool GrabTouchDevices(Display* display, ::Window window);
96 104
97 // Ungrabs the touch devices. Returns if ungrab was successful for all touch 105 // Ungrabs the touch devices. Returns if ungrab was successful for all touch
98 // devices. 106 // devices.
99 bool UngrabTouchDevices(Display* display); 107 bool UngrabTouchDevices(Display* display);
100 108
101 // Updates the root window to show (or hide) the cursor. Also indicate whether 109 // Updates the root window to show (or hide) the cursor. Also indicate whether
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // index at the expense of space. If the kMaxDeviceNum grows larger that the 199 // index at the expense of space. If the kMaxDeviceNum grows larger that the
192 // space waste becomes a concern, the 2D lookup table can be replaced by a 200 // space waste becomes a concern, the 2D lookup table can be replaced by a
193 // hash map. 201 // hash map.
194 signed char valuator_lookup_[kMaxDeviceNum][TP_LAST_ENTRY]; 202 signed char valuator_lookup_[kMaxDeviceNum][TP_LAST_ENTRY];
195 203
196 // Index table to find the min & max value of the TouchParam on a specific 204 // Index table to find the min & max value of the TouchParam on a specific
197 // device. 205 // device.
198 int touch_param_min_[kMaxDeviceNum][TP_LAST_ENTRY]; 206 int touch_param_min_[kMaxDeviceNum][TP_LAST_ENTRY];
199 int touch_param_max_[kMaxDeviceNum][TP_LAST_ENTRY]; 207 int touch_param_max_[kMaxDeviceNum][TP_LAST_ENTRY];
200 208
201 #if !defined(USE_XI2_MT)
202 // Maximum simultaneous touch points. 209 // Maximum simultaneous touch points.
203 static const int kMaxTouchPoints = 32; 210 static const int kMaxTouchPoints = 32;
204 211
212 #if defined(USE_XI2_MT)
213 // Stores the minimum available slot ID which helps get slot ID from
214 // tracking ID. When it equals to kMaxTouchPoints, there is no available
215 // slot.
216 int min_available_slot_;
217
218 // A hash table to map tracking ID to slot.
219 typedef base::hash_map<uint32, int> TrackingIdMap;
220 TrackingIdMap tracking_id_map_;
221 #endif
222
205 // A lookup table for slots in use for a touch event. 223 // A lookup table for slots in use for a touch event.
206 std::bitset<kMaxTouchPoints> slots_used_; 224 std::bitset<kMaxTouchPoints> slots_used_;
207 #endif
208 225
209 DISALLOW_COPY_AND_ASSIGN(TouchFactory); 226 DISALLOW_COPY_AND_ASSIGN(TouchFactory);
210 }; 227 };
211 228
212 } // namespace ui 229 } // namespace ui
213 230
214 #endif // UI_BASE_TOUCH_TOUCH_FACTORY_H_ 231 #endif // UI_BASE_TOUCH_TOUCH_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | ui/base/touch/touch_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698