File BMC13246_0007-Changed-MOrientationTrackerPrivate-remove-assumption.patch of Package libmeegotouch

From 3749f269eef9ce3fc9893a223953b7a435c5893e Mon Sep 17 00:00:00 2001
From: Shane Bryan <shane.bryan@linux.intel.com>
Date: Tue, 8 Mar 2011 13:44:37 -0800
Subject: [PATCH 7/9] Changed: MOrientationTrackerPrivate - remove assumption that native orientation is landscape

RevBy: Daniel d'Andrada
ModifiedBy: Daniel d'Andrada
 - Made it use MDeviceProfile::orientationFromAngle() instead of own implementation.
Details: Use device native orientation when calculating correct angles
and orientations in rotateToAngleIfAllowed() and doUpdateOrientationAngle().
Part of fix for BMC#13264.
---
 src/corelib/events/morientationtracker.cpp |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/corelib/events/morientationtracker.cpp b/src/corelib/events/morientationtracker.cpp
index d1dc2a1..2727ac6 100644
--- a/src/corelib/events/morientationtracker.cpp
+++ b/src/corelib/events/morientationtracker.cpp
@@ -62,11 +62,8 @@ MOrientationTrackerPrivate::MOrientationTrackerPrivate(MOrientationTracker *cont
 #endif //Q_WS_X11
 {
     if (MComponentData::isOrientationForced()) {
-        M::Orientation orientation = M::Landscape;
-
         currentAngle = MComponentData::forcedOrientationAngle();
-        if (currentAngle == M::Angle90 || currentAngle == M::Angle270)
-            orientation = M::Portrait;
+        M::Orientation orientation = MDeviceProfile::instance()->orientationFromAngle(currentAngle);
 
         foreach(MWindow * window, MApplication::windows()) {
             if (window->orientation() == orientation)
@@ -205,9 +202,13 @@ void MOrientationTrackerPrivate::doUpdateOrientationAngle(M::OrientationAngle an
     }
     currentIsKeyboardOpen = isKeyboardOpen;
 
-    if (tvIsConnected) // TV forces landscape for now, no transformations
-        angle = M::Angle0;
-    else if (!MDeviceProfile::instance()->orientationAngleIsSupported(angle, isKeyboardOpen)) {
+    if (tvIsConnected) { // TV forces landscape for now, no transformations
+        if (MDeviceProfile::instance()->orientationFromAngle(M::Angle0) == M::Landscape) {
+            angle = M::Angle0;
+        } else {
+            angle = M::Angle270;
+        }
+    } else if (!MDeviceProfile::instance()->orientationAngleIsSupported(angle, isKeyboardOpen)) {
         //it seems that orientation does not match allowed for current kybrd state.
         //check if the previous one was ok:
         if (MDeviceProfile::instance()->orientationAngleIsSupported(currentAngle, isKeyboardOpen)) {
@@ -250,9 +251,7 @@ void MOrientationTrackerPrivate::doUpdateOrientationAngle(M::OrientationAngle an
 
 void MOrientationTrackerPrivate::rotateToAngleIfAllowed(M::OrientationAngle angle, MWindow* window)
 {
-    M::Orientation orientation = M::Landscape;
-    if (angle == M::Angle90 || angle == M::Angle270)
-        orientation = M::Portrait;
+    M::Orientation orientation = MDeviceProfile::instance()->orientationFromAngle(angle);
     if (!window->isOrientationAngleLocked() &&
         (!window->isOrientationLocked() || window->orientation() == orientation)) {
         window->setOrientationAngle(angle);
-- 
1.7.2.2

openSUSE Build Service is sponsored by