From c7c9e396975f37ef865bf4cea63ac64d93295a3d Mon Sep 17 00:00:00 2001 From: bokan Date: Thu, 11 Sep 2014 14:07:40 -0700 Subject: [PATCH] Speculative fix for MaxTouchPoints returning incorrect value on Windows. Windows 7 appears to sometimes return an incorrect value for max touch points, returning 1 when there's in fact no touch devices present. This breaks some web pages that use a non-zero number of touch points as a signal that the devices has a touch screen. As this is specific to certain Win7 configurations, I don't have a repro; however, reports in the bug show that the SM_DIGITIZER setting does indeed return the correct status of "no touchscreen". In light of this, we speculatively return 0 touches if there's no touchscreen device present. BUG=352942 Review URL: https://codereview.chromium.org/563853002 Cr-Commit-Position: refs/heads/master@{#294467} --- ui/base/touch/touch_device_win.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/base/touch/touch_device_win.cc b/ui/base/touch/touch_device_win.cc index ba5c2600b164..18f2f120d67e 100644 --- a/ui/base/touch/touch_device_win.cc +++ b/ui/base/touch/touch_device_win.cc @@ -15,6 +15,9 @@ bool IsTouchDevicePresent() { } int MaxTouchPoints() { + if (!IsTouchDevicePresent()) + return 0; + return GetSystemMetrics(SM_MAXIMUMTOUCHES); } -- 2.11.4.GIT