Bug 914776 - Fix touch event coordinates when rotated. r=m1, a=koi+
authorMichael Wu <mwu@mozilla.com>
Tue, 24 Sep 2013 14:58:58 -0700
changeset 160434 997e9a86b388e7325f83486d062adfa02e65ac50
parent 160433 fd7036a63e64d9a713154afe4c4783f851a494b7
child 160435 9569d4d10cec8947f532fcb4be6a219302390bf7
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm1, koi
bugs914776
milestone26.0a2
Bug 914776 - Fix touch event coordinates when rotated. r=m1, a=koi+
widget/gonk/nsAppShell.cpp
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -462,19 +462,28 @@ GeckoInputReaderPolicy::setDisplayInfo()
     static_assert(nsIScreen::ROTATION_180_DEG ==
                   DISPLAY_ORIENTATION_180,
                   "Orientation enums not matched!");
     static_assert(nsIScreen::ROTATION_270_DEG ==
                   DISPLAY_ORIENTATION_270,
                   "Orientation enums not matched!");
 
     DisplayViewport viewport;
-    viewport.setNonDisplayViewport(gScreenBounds.width, gScreenBounds.height);
     viewport.displayId = 0;
     viewport.orientation = nsScreenGonk::GetRotation();
+    viewport.physicalRight = viewport.deviceWidth = gScreenBounds.width;
+    viewport.physicalBottom = viewport.deviceHeight = gScreenBounds.height;
+    if (viewport.orientation == DISPLAY_ORIENTATION_90 ||
+        viewport.orientation == DISPLAY_ORIENTATION_270) {
+        viewport.logicalRight = gScreenBounds.height;
+        viewport.logicalBottom = gScreenBounds.width;
+    } else {
+        viewport.logicalRight = gScreenBounds.width;
+        viewport.logicalBottom = gScreenBounds.height;
+    }
     mConfig.setDisplayInfo(false, viewport);
 }
 
 void GeckoInputReaderPolicy::getReaderConfiguration(InputReaderConfiguration* outConfig)
 {
     *outConfig = mConfig;
 }