Bug 1345355 - Don't register a window as touch-enabled if there's no touch device supported. r=jimm
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 09 Mar 2017 18:59:32 -0500
changeset 346862 f2262b093262a137e43f5fb3f9e1b3892deaf3c4
parent 346861 f12a9623b44546b79cf2ada33cdf5c927ef22cd8
child 346863 32c79b4aeaaa51260e3b979c7e77f9b193170963
push id31480
push usercbook@mozilla.com
push dateFri, 10 Mar 2017 10:37:06 +0000
treeherdermozilla-central@e18d3dd20e8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1345355
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1345355 - Don't register a window as touch-enabled if there's no touch device supported. r=jimm MozReview-Commit-ID: IycX3e0I5TQ
testing/profiles/prefs_general.js
widget/windows/nsWindow.cpp
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -51,16 +51,17 @@ user_pref("security.warn_viewing_mixed",
 user_pref("app.update.enabled", false);
 user_pref("app.update.staging.enabled", false);
 user_pref("app.update.url.android", "");
 // Make sure GMPInstallManager won't hit the network.
 user_pref("media.gmp-manager.url.override", "http://%(server)s/dummy-gmp-manager.xml");
 user_pref("media.gmp-manager.updateEnabled", false);
 user_pref("dom.w3c_touch_events.enabled", 1);
 user_pref("layout.accessiblecaret.enabled_on_touch", false);
+user_pref("test.force_register_touch_windows", true);
 user_pref("dom.webcomponents.enabled", true);
 user_pref("dom.webcomponents.customelements.enabled", true);
 user_pref("dom.htmlimports.enabled", true);
 // Existing tests assume there is no font size inflation.
 user_pref("font.size.inflation.emPerLine", 0);
 user_pref("font.size.inflation.minTwips", 0);
 // Disable the caret blinking so we get stable snapshot
 user_pref("ui.caretBlinkTime", -1);
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1699,16 +1699,25 @@ void nsWindow::SetThemeRegion()
 
 /**************************************************************
  *
  * SECTION: Touch and APZ-related functions
  *
  **************************************************************/
 
 void nsWindow::RegisterTouchWindow() {
+  if (!WinUtils::IsTouchDeviceSupportPresent() &&
+      !Preferences::GetBool("test.force_register_touch_windows", false)) {
+    // If we don't have any touch support on the device, don't
+    // register any touch windows because it'll consume WM_GESTURE
+    // events from other devices.
+    // For testing purposes we have a pref to override this behaviour
+    // and force the registration of touch windows.
+    return;
+  }
   mTouchWindow = true;
   mGesture.RegisterTouchWindow(mWnd);
   ::EnumChildWindows(mWnd, nsWindow::RegisterTouchForDescendants, 0);
 }
 
 BOOL CALLBACK nsWindow::RegisterTouchForDescendants(HWND aWnd, LPARAM aMsg) {
   nsWindow* win = WinUtils::GetNSWindowPtr(aWnd);
   if (win)