Index: ui/base/touch/touch_factory.h |
diff --git a/ui/base/touch/touch_factory.h b/ui/base/touch/touch_factory.h |
index a4617384b798811325742e43cc46718860a8f47c..84db34e92a0ee2eac9fc7323ce7cd68ecc538c37 100644 |
--- a/ui/base/touch/touch_factory.h |
+++ b/ui/base/touch/touch_factory.h |
@@ -10,6 +10,7 @@ |
#include <vector> |
#include "base/memory/singleton.h" |
+#include "base/hash_tables.h" |
#include "base/timer.h" |
#include "ui/base/ui_export.h" |
@@ -77,13 +78,20 @@ class UI_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,24 @@ class UI_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; |
+#if defined(USE_XI2_MT) |
+ // Stores the minimum available slot ID which helps get slot ID from |
+ // tracking ID. When it equals to kMaxTouchPoints, there is no available |
+ // slot. |
+ int min_available_slot_; |
+#endif |
+ |
// 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); |
}; |