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

Side by Side Diff: views/touchui/touch_factory.h

Issue 7927001: touchui: Convert XI2 MT tracking id to slot id for gesture recognizer (Closed) Base URL: nhu@powerbuilder.sh.intel.com:/home/www-data/git-repos/chromium/chromium.git@trunk
Patch Set: Created 9 years, 3 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 (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 VIEWS_TOUCHUI_TOUCH_FACTORY_H_ 5 #ifndef VIEWS_TOUCHUI_TOUCH_FACTORY_H_
6 #define VIEWS_TOUCHUI_TOUCH_FACTORY_H_ 6 #define VIEWS_TOUCHUI_TOUCH_FACTORY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <bitset> 9 #include <bitset>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/hash_tables.h"
13 #include "base/timer.h" 14 #include "base/timer.h"
14 #include "views/views_export.h" 15 #include "views/views_export.h"
15 16
16 typedef unsigned long Cursor; 17 typedef unsigned long Cursor;
17 typedef unsigned long Window; 18 typedef unsigned long Window;
18 typedef struct _XDisplay Display; 19 typedef struct _XDisplay Display;
19 typedef union _XEvent XEvent; 20 typedef union _XEvent XEvent;
20 21
21 namespace views { 22 namespace views {
22 23
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void SetupXI2ForXWindow(::Window xid); 71 void SetupXI2ForXWindow(::Window xid);
71 72
72 // Keeps a list of touch devices so that it is possible to determine if a 73 // Keeps a list of touch devices so that it is possible to determine if a
73 // pointer event is a touch-event or a mouse-event. The list is reset each 74 // pointer event is a touch-event or a mouse-event. The list is reset each
74 // time this is called. 75 // time this is called.
75 void SetTouchDeviceList(const std::vector<unsigned int>& devices); 76 void SetTouchDeviceList(const std::vector<unsigned int>& devices);
76 77
77 // Is the device a touch-device? 78 // Is the device a touch-device?
78 bool IsTouchDevice(unsigned int deviceid) const; 79 bool IsTouchDevice(unsigned int deviceid) const;
79 80
80 #if !defined(USE_XI2_MT) 81 #if defined(USE_XI2_MT)
82 // Allocate a slot id according to tracking id.
83 int AllocateSlotIdForTrackingId(uint32 tracking_id);
sadrul 2011/09/19 16:13:36 Let's call this GetSlotIdForTracking, and update t
ningxin.hu 2011/09/20 16:08:49 Thanks for the comment. Will do that.
84
85 // Release the slot id according to tracking id.
sadrul 2011/09/19 16:13:36 Releases
ningxin.hu 2011/09/20 16:08:49 Will correct. Thanks.
86 void ReleaseSlotIdForTrackingId(uint32 tracking_id);
87 #endif
88
81 // Is the slot ID currently used? 89 // Is the slot ID currently used?
82 bool IsSlotUsed(int slot) const; 90 bool IsSlotUsed(int slot) const;
83 91
84 // Marks a slot as being used/unused. 92 // Marks a slot as being used/unused.
85 void SetSlotUsed(int slot, bool used); 93 void SetSlotUsed(int slot, bool used);
86 #endif
87 94
88 // Grabs the touch devices for the specified window on the specified display. 95 // Grabs the touch devices for the specified window on the specified display.
89 // Returns if grab was successful for all touch devices. 96 // Returns if grab was successful for all touch devices.
90 bool GrabTouchDevices(Display* display, ::Window window); 97 bool GrabTouchDevices(Display* display, ::Window window);
91 98
92 // Ungrabs the touch devices. Returns if ungrab was successful for all touch 99 // Ungrabs the touch devices. Returns if ungrab was successful for all touch
93 // devices. 100 // devices.
94 bool UngrabTouchDevices(Display* display); 101 bool UngrabTouchDevices(Display* display);
95 102
96 // Updates the root window to show (or hide) the cursor. Also indicate whether 103 // Updates the root window to show (or hide) the cursor. Also indicate whether
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // index at the expense of space. If the kMaxDeviceNum grows larger that the 190 // index at the expense of space. If the kMaxDeviceNum grows larger that the
184 // space waste becomes a concern, the 2D lookup table can be replaced by a 191 // space waste becomes a concern, the 2D lookup table can be replaced by a
185 // hash map. 192 // hash map.
186 signed char valuator_lookup_[kMaxDeviceNum][TP_LAST_ENTRY]; 193 signed char valuator_lookup_[kMaxDeviceNum][TP_LAST_ENTRY];
187 194
188 // Index table to find the min & max value of the TouchParam on a specific 195 // Index table to find the min & max value of the TouchParam on a specific
189 // device. 196 // device.
190 int touch_param_min_[kMaxDeviceNum][TP_LAST_ENTRY]; 197 int touch_param_min_[kMaxDeviceNum][TP_LAST_ENTRY];
191 int touch_param_max_[kMaxDeviceNum][TP_LAST_ENTRY]; 198 int touch_param_max_[kMaxDeviceNum][TP_LAST_ENTRY];
192 199
193 #if !defined(USE_XI2_MT)
194 // Maximum simultaneous touch points. 200 // Maximum simultaneous touch points.
195 static const int kMaxTouchPoints = 32; 201 static const int kMaxTouchPoints = 32;
196 202
197 // A lookup table for slots in use for a touch event. 203 // A lookup table for slots in use for a touch event.
198 std::bitset<kMaxTouchPoints> slots_used_; 204 std::bitset<kMaxTouchPoints> slots_used_;
205
206 #if defined(USE_XI2_MT)
207 // A hash table for tracking id to slot id mapping
208 typedef base::hash_map<uint32, int> TrackingIdMap;
209 TrackingIdMap tracking_id_map_;
199 #endif 210 #endif
200
201 DISALLOW_COPY_AND_ASSIGN(TouchFactory); 211 DISALLOW_COPY_AND_ASSIGN(TouchFactory);
202 }; 212 };
203 213
204 } // namespace views 214 } // namespace views
205 215
206 #endif // VIEWS_TOUCHUI_TOUCH_FACTORY_H_ 216 #endif // VIEWS_TOUCHUI_TOUCH_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698