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

Unified 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: Update the patch set according to comment #2. 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 side-by-side diff with in-line comments
Download patch
Index: views/touchui/touch_factory.h
diff --git a/views/touchui/touch_factory.h b/views/touchui/touch_factory.h
index ca281e420e64d42dc2fbd48e890fe8107358f6ff..cba33c19a38b47b74c29c7a91fbcc75dd0f38f18 100644
--- a/views/touchui/touch_factory.h
+++ b/views/touchui/touch_factory.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/memory/singleton.h"
+#include "base/hash_tables.h"
#include "base/timer.h"
#include "views/views_export.h"
@@ -77,13 +78,20 @@ class VIEWS_EXPORT TouchFactory {
// Is the device a touch-device?
bool IsTouchDevice(unsigned int deviceid) const;
-#if !defined(USE_XI2_MT)
+#if defined(USE_XI2_MT)
+ // Tries to find an existing slot ID mapping to tracking ID. If there
+ // isn't one already, allocates a new slot ID and sets up the mapping.
+ int GetSlotForTrackingID(uint32 tracking_id);
+
+ // Releases the slot ID mapping to tracking ID.
+ void ReleaseSlotForTrackingID(uint32 tracking_id);
+#endif
+
// Is the slot ID currently used?
bool IsSlotUsed(int slot) const;
// Marks a slot as being used/unused.
void SetSlotUsed(int slot, bool used);
-#endif
// Grabs the touch devices for the specified window on the specified display.
// Returns if grab was successful for all touch devices.
@@ -190,14 +198,17 @@ class VIEWS_EXPORT TouchFactory {
int touch_param_min_[kMaxDeviceNum][TP_LAST_ENTRY];
int touch_param_max_[kMaxDeviceNum][TP_LAST_ENTRY];
-#if !defined(USE_XI2_MT)
// Maximum simultaneous touch points.
static const int kMaxTouchPoints = 32;
// A lookup table for slots in use for a touch event.
std::bitset<kMaxTouchPoints> slots_used_;
-#endif
+#if defined(USE_XI2_MT)
+ // A hash table to map tracking ID to slot.
+ typedef base::hash_map<uint32, int> TrackingIdMap;
+ TrackingIdMap tracking_id_map_;
+#endif
DISALLOW_COPY_AND_ASSIGN(TouchFactory);
};

Powered by Google App Engine
This is Rietveld 408576698