windowing/windowserver/nga/SERVER/openwfc/screen.cpp
branchRCL_3
changeset 164 25ffed67c7ef
parent 163 bbf46f59e123
--- a/windowing/windowserver/nga/SERVER/openwfc/screen.cpp	Tue Aug 31 16:31:06 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/screen.cpp	Wed Sep 01 12:39:21 2010 +0100
@@ -68,7 +68,26 @@
 	return (TDeviceOrientation)(1 << aGcOrientation);
 	}
 
-LOCAL_D TBool FindNextValue(TLex& aLex, TInt& aValue) // assumes the list cannot contain *negative* integers
+/** Convert a TGraphicsOrientation value into a TDigitiserOrientation.
+Note: The algorithm used makes use of the ordering of the values of the respective enums, 
+thus this is checked for (at compile time) at the start of the function.
+@param aGcOrientation A value from the TGraphicsOrientation enums.
+@return The equivalent value from the TDigitiserOrientation enums.
+*/
+inline HALData::TDigitiserOrientation GcToDigitiser(CFbsBitGc::TGraphicsOrientation aGcOrientation)
+	{
+	__ASSERT_COMPILE(CFbsBitGc::EGraphicsOrientationNormal+1==CFbsBitGc::EGraphicsOrientationRotated90);
+    __ASSERT_COMPILE(CFbsBitGc::EGraphicsOrientationNormal+2==CFbsBitGc::EGraphicsOrientationRotated180);
+    __ASSERT_COMPILE(CFbsBitGc::EGraphicsOrientationNormal+3==CFbsBitGc::EGraphicsOrientationRotated270);
+    __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+1==HALData::EDigitiserOrientation_090);
+    __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+2==HALData::EDigitiserOrientation_180);
+    __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+3==HALData::EDigitiserOrientation_270);
+    HALData::TDigitiserOrientation ret = static_cast<HALData::TDigitiserOrientation> 
+            (HALData::EDigitiserOrientation_000 + (aGcOrientation - CFbsBitGc::EGraphicsOrientationNormal));
+    return ret;
+	}
+
+LOCAL_C TBool FindNextValue(TLex& aLex, TInt& aValue) // assumes the list cannot contain *negative* integers
 	{
 	while (!aLex.Eos())
 		{
@@ -1122,7 +1141,7 @@
 			}
 		
 		//updaterotation should not fail after this point (no cleanup)
-			
+		
         //update the last set config with the new rotation change so we don't incorrectly
         //change the layer extents
         if (iDisplayControl)
@@ -1130,8 +1149,8 @@
             TDisplayConfiguration config;
             config.SetRotation(static_cast<TDisplayConfiguration::TRotation>(newRotation));           
             iConfigChangeNotifier->UpdateLastSetConfiguration(config);
-            }		
-		
+            }   		
+			
 		TWservCrEvent crEvent(TWservCrEvent::EDeviceOrientationChanged,iScreenNumber,&gcOrientation);
 		TWindowServerEvent::NotifyDrawer(crEvent);
 		
@@ -1143,17 +1162,29 @@
 		}
 	
 	iRootWindow->AdjustCoordsDueToRotation();
-	if (rotating)
-		{
-		if(BlankScreenOnRotation())
-			{
-			iRootWindow->ClearDisplay();
-			}
-		
-		CWsTop::ClearAllRedrawStores();	
-		DiscardAllSchedules();
-		iRootWindow->InvalidateWholeScreen();
-		}
+    if (rotating || (iFlags & ERepeatSettingHalOrientation))
+        {
+        if (HAL::Set(iScreenNumber, HALData::EDigitiserOrientation, GcToDigitiser(gcOrientation)) != KErrNone)
+            {
+            iFlags |= ERepeatSettingHalOrientation;
+            }
+        else
+            {
+            iFlags &= ~ERepeatSettingHalOrientation;
+            }
+        }
+    
+    if (rotating)
+        {
+        if (BlankScreenOnRotation())
+            {
+            iRootWindow->ClearDisplay();
+            }
+        CWsTop::ClearAllRedrawStores();
+        DiscardAllSchedules();
+        iRootWindow->InvalidateWholeScreen();
+        }
+    
 	return ETrue;
 	}
 
@@ -2051,12 +2082,6 @@
 	return reply;
 	}
 
-/**
- * Updates the screen device display properties. This is to ensure the screen device is 
- * consistent with any configuration changes not made using CScreen::SetConfiguration.
- * 
- * @param aConfigInput a fully populated display configuration
- **/
 TInt CScreen::UpdateConfiguration(const TDisplayConfiguration& aConfigInput)
     {
     TInt reply = KErrNone;
@@ -2098,7 +2123,7 @@
             }
 
         RecalculateModeTwips(&config);   //needs res and twips information
-        UpdateDynamicScreenModes();        
+        UpdateDynamicScreenModes();               
         
         TWindowServerEvent::NotifyDrawer(TWservCrEvent(TWservCrEvent::EScreenSizeModeAboutToChange, iScreenSizeMode));
         // This will remove all the DSA elements from the scene
@@ -2136,7 +2161,7 @@
         {
         reply = KErrNotSupported;
         }
-    return reply;  
+    return reply;   
     }
 
 void CScreen::UpdateDynamicScreenModes()