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

Unified Diff: views/touchui/touch_factory.h

Issue 7792094: touchui: support XInput2 MT (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add gyp switch to support both XI2.0 and XI2.1. Correct the style issues also. 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 b18d8c38edede77969c88d8c703ddddf2381e6dd..15d56cbfe2a1f6de9b68a0831b13805d7ecdd98f 100644
--- a/views/touchui/touch_factory.h
+++ b/views/touchui/touch_factory.h
@@ -42,9 +42,15 @@ class VIEWS_EXPORT TouchFactory {
// 'Tracking ID' marks the removal of a touch point. During the lifetime of
// a touchpoint, we use the 'Slot ID' as its identifier. The XI_ButtonPress
// and XI_ButtonRelease events are ignored.
+#if !defined(USE_XI2_1)
TP_SLOT_ID, // ID of the finger that triggered a touch event
// (useful when tracking multiple simultaneous
// touches)
+#endif
+ // NOTE for XInput 2.1: 'Tracking ID' is provided in every touch event to
+ // track individual touch. 'Tracking ID' is a unsigned 32-bit value and
+ // is increased for each new touch. It will wrap back to 0 when reaching
+ // the numerical limit.
TP_TRACKING_ID, // ID of the touch point.
TP_LAST_ENTRY
@@ -71,11 +77,13 @@ class VIEWS_EXPORT TouchFactory {
// Is the device a touch-device?
bool IsTouchDevice(unsigned int deviceid) const;
+#if !defined(USE_XI2_1)
// 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.
@@ -151,6 +159,14 @@ class VIEWS_EXPORT TouchFactory {
// The invisible cursor.
Cursor invisible_cursor_;
+#if !defined(USE_XI2_1)
+ // 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
+
// NOTE: To keep track of touch devices, we currently maintain a lookup table
// to quickly decide if a device is a touch device or not. We also maintain a
// list of the touch devices. Ideally, there will be only one touch device,
@@ -182,12 +198,6 @@ class VIEWS_EXPORT TouchFactory {
int touch_param_min_[kMaxDeviceNum][TP_LAST_ENTRY];
int touch_param_max_[kMaxDeviceNum][TP_LAST_ENTRY];
- // 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_;
-
DISALLOW_COPY_AND_ASSIGN(TouchFactory);
};

Powered by Google App Engine
This is Rietveld 408576698