Bug 1189208 - Use mouse events in simulator chrome. r=ochameau
authorJ. Ryan Stinnett <jryans@gmail.com>
Tue, 04 Aug 2015 21:25:00 +0200
changeset 288214 d13b95d2aa59a29878cdf21dde99738d041f34ad
parent 288213 216e31f8f1d280dcbb43b22d63bcff7bbbcda2df
child 288215 4e25322e9e062d20eb343051a8015686c21123b3
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1189208
milestone42.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 1189208 - Use mouse events in simulator chrome. r=ochameau
b2g/chrome/content/desktop.js
--- a/b2g/chrome/content/desktop.js
+++ b/b2g/chrome/content/desktop.js
@@ -17,38 +17,35 @@ function enableTouch() {
 
 function setupButtons() {
   let homeButton = document.getElementById('home-button');
   if (!homeButton) {
     // The toolbar only exists in b2g desktop build with
     // FXOS_SIMULATOR turned on.
     return;
   }
-  // The touch event helper is enabled on shell.html document,
-  // so that click events are delayed and it is better to
-  // listen for touch events.
-  homeButton.addEventListener('touchstart', function() {
+  homeButton.addEventListener('mousedown', function() {
     let window = shell.contentBrowser.contentWindow;
     let e = new window.KeyboardEvent('keydown', {key: 'Home'});
     window.dispatchEvent(e);
     homeButton.classList.add('active');
   });
-  homeButton.addEventListener('touchend', function() {
+  homeButton.addEventListener('mouseup', function() {
     let window = shell.contentBrowser.contentWindow;
     let e = new window.KeyboardEvent('keyup', {key: 'Home'});
     window.dispatchEvent(e);
     homeButton.classList.remove('active');
   });
 
   Cu.import("resource://gre/modules/GlobalSimulatorScreen.jsm");
   let rotateButton = document.getElementById('rotate-button');
-  rotateButton.addEventListener('touchstart', function () {
+  rotateButton.addEventListener('mousedown', function() {
     rotateButton.classList.add('active');
   });
-  rotateButton.addEventListener('touchend', function() {
+  rotateButton.addEventListener('mouseup', function() {
     GlobalSimulatorScreen.flipScreen();
     rotateButton.classList.remove('active');
   });
 }
 
 function setupStorage() {
   let directory = null;