diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/touch/touch_device.cc | 4 | ||||
-rw-r--r-- | ui/base/touch/touch_device.h | 14 | ||||
-rw-r--r-- | ui/base/touch/touch_device_android.cc | 13 | ||||
-rw-r--r-- | ui/base/touch/touch_device_aurax11.cc | 4 | ||||
-rw-r--r-- | ui/base/touch/touch_device_ozone.cc | 4 | ||||
-rw-r--r-- | ui/base/touch/touch_device_win.cc | 4 |
6 files changed, 43 insertions, 0 deletions
diff --git a/ui/base/touch/touch_device.cc b/ui/base/touch/touch_device.cc index de7785c..944ba17 100644 --- a/ui/base/touch/touch_device.cc +++ b/ui/base/touch/touch_device.cc @@ -12,4 +12,8 @@ bool IsTouchDevicePresent() { return false; } +int MaxTouchPoints() { + return 0; +} + } // namespace ui diff --git a/ui/base/touch/touch_device.h b/ui/base/touch/touch_device.h index 8cc4b7d..b06c564 100644 --- a/ui/base/touch/touch_device.h +++ b/ui/base/touch/touch_device.h @@ -9,9 +9,23 @@ namespace ui { +// TODO(sblom): This is non-standard, and should be removed before +// RuntimeEnabledFlags::PointerEventsMaxTouchPoints is marked stable. +// Tracked by: http://crbug.com/308649 +const int kMaxTouchPointsUnknown = -1; + // Returns true if a touch device is available. UI_EXPORT bool IsTouchDevicePresent(); +// Returns the maximum number of simultaneous touch contacts supported +// by the device. In the case of devices with multiple digitizers (e.g. +// multiple touchscreens), the value MUST be the maximum of the set of +// maximum supported contacts by each individual digitizer. +// For example, suppose a device has 3 touchscreens, which support 2, 5, +// and 10 simultaneous touch contacts, respectively. This returns 10. +// http://www.w3.org/TR/pointerevents/#widl-Navigator-maxTouchPoints +UI_EXPORT int MaxTouchPoints(); + } // namespace ui #endif // UI_BASE_TOUCH_TOUCH_DEVICE_H_ diff --git a/ui/base/touch/touch_device_android.cc b/ui/base/touch/touch_device_android.cc index 39e34c2..2b359c0 100644 --- a/ui/base/touch/touch_device_android.cc +++ b/ui/base/touch/touch_device_android.cc @@ -10,4 +10,17 @@ bool IsTouchDevicePresent() { return true; } +// Looks like the best we can do here is detect 1, 2+, or 5+ by +// feature detecting: +// FEATURE_TOUCHSCREEN (1), +// FEATURE_TOUCHSCREEN_MULTITOUCH (2), +// FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT (2+), or +// FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHANDS (5+) +// +// Probably start from the biggest and detect down the list until we +// find one that's supported and return its value. +int MaxTouchPoints() { + return kMaxTouchPointsUnknown; +} + } // namespace ui diff --git a/ui/base/touch/touch_device_aurax11.cc b/ui/base/touch/touch_device_aurax11.cc index 04d435e..d3b6df4 100644 --- a/ui/base/touch/touch_device_aurax11.cc +++ b/ui/base/touch/touch_device_aurax11.cc @@ -11,4 +11,8 @@ bool IsTouchDevicePresent() { return ui::TouchFactory::GetInstance()->IsTouchDevicePresent(); } +int MaxTouchPoints() { + return kMaxTouchPointsUnknown; +} + } // namespace ui diff --git a/ui/base/touch/touch_device_ozone.cc b/ui/base/touch/touch_device_ozone.cc index 7cb2ecb..d97a70b 100644 --- a/ui/base/touch/touch_device_ozone.cc +++ b/ui/base/touch/touch_device_ozone.cc @@ -11,4 +11,8 @@ bool IsTouchDevicePresent() { return true; } +int MaxTouchPoints() { + return kMaxTouchPointsUnknown; +} + } // namespace ui diff --git a/ui/base/touch/touch_device_win.cc b/ui/base/touch/touch_device_win.cc index c07fbe9..ba5c260 100644 --- a/ui/base/touch/touch_device_win.cc +++ b/ui/base/touch/touch_device_win.cc @@ -14,4 +14,8 @@ bool IsTouchDevicePresent() { ((value & NID_INTEGRATED_TOUCH) || (value & NID_EXTERNAL_TOUCH)); } +int MaxTouchPoints() { + return GetSystemMetrics(SM_MAXIMUMTOUCHES); +} + } // namespace ui |