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

Unified 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, 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
« no previous file with comments | « no previous file | ui/base/touch/touch_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/touch/touch_factory.h
diff --git a/ui/base/touch/touch_factory.h b/ui/base/touch/touch_factory.h
index 9b161132a0275b4ac0331fcf30de24f9ace0fe19..3b1b5f164a17b89afdad109582813822fa6ea95b 100644
--- a/ui/base/touch/touch_factory.h
+++ b/ui/base/touch/touch_factory.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/memory/singleton.h"
+#include "base/hash_tables.h"
#include "base/timer.h"
#include "ui/base/ui_export.h"
@@ -82,13 +83,20 @@ class UI_EXPORT TouchFactory {
// for more explanation.)
bool IsRealTouchDevice(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.
@@ -198,13 +206,22 @@ 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_;
+
+ // A hash table to map tracking ID to slot.
+ typedef base::hash_map<uint32, int> TrackingIdMap;
+ TrackingIdMap tracking_id_map_;
+#endif
+
// A lookup table for slots in use for a touch event.
std::bitset<kMaxTouchPoints> slots_used_;
-#endif
DISALLOW_COPY_AND_ASSIGN(TouchFactory);
};
« 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