windowing/windowserver/nga/SERVER/openwfc/screen.cpp
branchRCL_3
changeset 19 bbf46f59e123
parent 10 0e9202c0340c
child 20 25ffed67c7ef
equal deleted inserted replaced
18:57c618273d5c 19:bbf46f59e123
    66 	// Each device orientation is defined to be the value where just the bit
    66 	// Each device orientation is defined to be the value where just the bit
    67 	// corresponding to the GDI orientation value is set.
    67 	// corresponding to the GDI orientation value is set.
    68 	return (TDeviceOrientation)(1 << aGcOrientation);
    68 	return (TDeviceOrientation)(1 << aGcOrientation);
    69 	}
    69 	}
    70 
    70 
    71 /** Convert a TGraphicsOrientation value into a TDigitiserOrientation.
    71 LOCAL_D TBool FindNextValue(TLex& aLex, TInt& aValue) // assumes the list cannot contain *negative* integers
    72 Note: The algorithm used makes use of the ordering of the values of the respective enums, 
       
    73 thus this is checked for (at compile time) at the start of the function.
       
    74 @param aGcOrientation A value from the TGraphicsOrientation enums.
       
    75 @return The equivalent value from the TDigitiserOrientation enums.
       
    76 */
       
    77 inline HALData::TDigitiserOrientation GcToDigitiser(CFbsBitGc::TGraphicsOrientation aGcOrientation)
       
    78 	{
       
    79 	__ASSERT_COMPILE(CFbsBitGc::EGraphicsOrientationNormal+1==CFbsBitGc::EGraphicsOrientationRotated90);
       
    80     __ASSERT_COMPILE(CFbsBitGc::EGraphicsOrientationNormal+2==CFbsBitGc::EGraphicsOrientationRotated180);
       
    81     __ASSERT_COMPILE(CFbsBitGc::EGraphicsOrientationNormal+3==CFbsBitGc::EGraphicsOrientationRotated270);
       
    82     __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+1==HALData::EDigitiserOrientation_090);
       
    83     __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+2==HALData::EDigitiserOrientation_180);
       
    84     __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+3==HALData::EDigitiserOrientation_270);
       
    85     HALData::TDigitiserOrientation ret = static_cast<HALData::TDigitiserOrientation> 
       
    86             (HALData::EDigitiserOrientation_000 + (aGcOrientation - CFbsBitGc::EGraphicsOrientationNormal));
       
    87     return ret;
       
    88 	}
       
    89 
       
    90 LOCAL_C TBool FindNextValue(TLex& aLex, TInt& aValue) // assumes the list cannot contain *negative* integers
       
    91 	{
    72 	{
    92 	while (!aLex.Eos())
    73 	while (!aLex.Eos())
    93 		{
    74 		{
    94 		const TUint character=aLex.Peek();
    75 		const TUint character=aLex.Peek();
    95 		if (Rng(TUint('0'), character, TUint('9')) || (character=='-'))
    76 		if (Rng(TUint('0'), character, TUint('9')) || (character=='-'))
  1139 			WS_ASSERT_DEBUG(KErrNone == errUnregister, EWsPanicDirectScreenAccess);
  1120 			WS_ASSERT_DEBUG(KErrNone == errUnregister, EWsPanicDirectScreenAccess);
  1140 			iDsaSurface = newSurface;
  1121 			iDsaSurface = newSurface;
  1141 			}
  1122 			}
  1142 		
  1123 		
  1143 		//updaterotation should not fail after this point (no cleanup)
  1124 		//updaterotation should not fail after this point (no cleanup)
  1144 		
  1125 			
  1145         //update the last set config with the new rotation change so we don't incorrectly
  1126         //update the last set config with the new rotation change so we don't incorrectly
  1146         //change the layer extents
  1127         //change the layer extents
  1147         if (iDisplayControl)
  1128         if (iDisplayControl)
  1148             {
  1129             {
  1149             TDisplayConfiguration config;
  1130             TDisplayConfiguration config;
  1150             config.SetRotation(static_cast<TDisplayConfiguration::TRotation>(newRotation));           
  1131             config.SetRotation(static_cast<TDisplayConfiguration::TRotation>(newRotation));           
  1151             iConfigChangeNotifier->UpdateLastSetConfiguration(config);
  1132             iConfigChangeNotifier->UpdateLastSetConfiguration(config);
  1152             }   		
  1133             }		
  1153 			
  1134 		
  1154 		TWservCrEvent crEvent(TWservCrEvent::EDeviceOrientationChanged,iScreenNumber,&gcOrientation);
  1135 		TWservCrEvent crEvent(TWservCrEvent::EDeviceOrientationChanged,iScreenNumber,&gcOrientation);
  1155 		TWindowServerEvent::NotifyDrawer(crEvent);
  1136 		TWindowServerEvent::NotifyDrawer(crEvent);
  1156 		
  1137 		
  1157 		if(iDsaDevice && iDsaDevice->GraphicsAccelerator())
  1138 		if(iDsaDevice && iDsaDevice->GraphicsAccelerator())
  1158 			{
  1139 			{
  1160 			}
  1141 			}
  1161 		
  1142 		
  1162 		}
  1143 		}
  1163 	
  1144 	
  1164 	iRootWindow->AdjustCoordsDueToRotation();
  1145 	iRootWindow->AdjustCoordsDueToRotation();
  1165     if (rotating || (iFlags & ERepeatSettingHalOrientation))
  1146 	if (rotating)
  1166         {
  1147 		{
  1167         if (HAL::Set(iScreenNumber, HALData::EDigitiserOrientation, GcToDigitiser(gcOrientation)) != KErrNone)
  1148 		if(BlankScreenOnRotation())
  1168             {
  1149 			{
  1169             iFlags |= ERepeatSettingHalOrientation;
  1150 			iRootWindow->ClearDisplay();
  1170             }
  1151 			}
  1171         else
  1152 		
  1172             {
  1153 		CWsTop::ClearAllRedrawStores();	
  1173             iFlags &= ~ERepeatSettingHalOrientation;
  1154 		DiscardAllSchedules();
  1174             }
  1155 		iRootWindow->InvalidateWholeScreen();
  1175         }
  1156 		}
  1176     
       
  1177     if (rotating)
       
  1178         {
       
  1179         if (BlankScreenOnRotation())
       
  1180             {
       
  1181             iRootWindow->ClearDisplay();
       
  1182             }
       
  1183         CWsTop::ClearAllRedrawStores();
       
  1184         DiscardAllSchedules();
       
  1185         iRootWindow->InvalidateWholeScreen();
       
  1186         }
       
  1187     
       
  1188 	return ETrue;
  1157 	return ETrue;
  1189 	}
  1158 	}
  1190 
  1159 
  1191 TPoint CScreen::PhysicalToLogical(TPoint aPhysicalPt)
  1160 TPoint CScreen::PhysicalToLogical(TPoint aPhysicalPt)
  1192 	{
  1161 	{
  2080 		reply = KErrNotSupported;
  2049 		reply = KErrNotSupported;
  2081 		}
  2050 		}
  2082 	return reply;
  2051 	return reply;
  2083 	}
  2052 	}
  2084 
  2053 
       
  2054 /**
       
  2055  * Updates the screen device display properties. This is to ensure the screen device is 
       
  2056  * consistent with any configuration changes not made using CScreen::SetConfiguration.
       
  2057  * 
       
  2058  * @param aConfigInput a fully populated display configuration
       
  2059  **/
  2085 TInt CScreen::UpdateConfiguration(const TDisplayConfiguration& aConfigInput)
  2060 TInt CScreen::UpdateConfiguration(const TDisplayConfiguration& aConfigInput)
  2086     {
  2061     {
  2087     TInt reply = KErrNone;
  2062     TInt reply = KErrNone;
  2088     if(iDisplayControl)
  2063     if(iDisplayControl)
  2089         {
  2064         {
  2121             {
  2096             {
  2122             reply = iFallbackMap->Resize(newUiSize);
  2097             reply = iFallbackMap->Resize(newUiSize);
  2123             }
  2098             }
  2124 
  2099 
  2125         RecalculateModeTwips(&config);   //needs res and twips information
  2100         RecalculateModeTwips(&config);   //needs res and twips information
  2126         UpdateDynamicScreenModes();               
  2101         UpdateDynamicScreenModes();        
  2127         
  2102         
  2128         TWindowServerEvent::NotifyDrawer(TWservCrEvent(TWservCrEvent::EScreenSizeModeAboutToChange, iScreenSizeMode));
  2103         TWindowServerEvent::NotifyDrawer(TWservCrEvent(TWservCrEvent::EScreenSizeModeAboutToChange, iScreenSizeMode));
  2129         // This will remove all the DSA elements from the scene
  2104         // This will remove all the DSA elements from the scene
  2130         AbortAllDirectDrawing(RDirectScreenAccess::ETerminateRotation);
  2105         AbortAllDirectDrawing(RDirectScreenAccess::ETerminateRotation);
  2131         
  2106         
  2159         }
  2134         }
  2160     else
  2135     else
  2161         {
  2136         {
  2162         reply = KErrNotSupported;
  2137         reply = KErrNotSupported;
  2163         }
  2138         }
  2164     return reply;   
  2139     return reply;  
  2165     }
  2140     }
  2166 
  2141 
  2167 void CScreen::UpdateDynamicScreenModes()
  2142 void CScreen::UpdateDynamicScreenModes()
  2168 	{
  2143 	{
  2169 	WS_ASSERT_DEBUG(iDisplayControl,EWsPanicNoDisplayControl);
  2144 	WS_ASSERT_DEBUG(iDisplayControl,EWsPanicNoDisplayControl);