windowing/windowserver/nga/SERVER/openwfc/screen.cpp
branchRCL_3
changeset 20 25ffed67c7ef
parent 19 bbf46f59e123
equal deleted inserted replaced
19:bbf46f59e123 20:25ffed67c7ef
    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 LOCAL_D TBool FindNextValue(TLex& aLex, TInt& aValue) // assumes the list cannot contain *negative* integers
    71 /** Convert a TGraphicsOrientation value into a TDigitiserOrientation.
       
    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
    72 	{
    91 	{
    73 	while (!aLex.Eos())
    92 	while (!aLex.Eos())
    74 		{
    93 		{
    75 		const TUint character=aLex.Peek();
    94 		const TUint character=aLex.Peek();
    76 		if (Rng(TUint('0'), character, TUint('9')) || (character=='-'))
    95 		if (Rng(TUint('0'), character, TUint('9')) || (character=='-'))
  1120 			WS_ASSERT_DEBUG(KErrNone == errUnregister, EWsPanicDirectScreenAccess);
  1139 			WS_ASSERT_DEBUG(KErrNone == errUnregister, EWsPanicDirectScreenAccess);
  1121 			iDsaSurface = newSurface;
  1140 			iDsaSurface = newSurface;
  1122 			}
  1141 			}
  1123 		
  1142 		
  1124 		//updaterotation should not fail after this point (no cleanup)
  1143 		//updaterotation should not fail after this point (no cleanup)
  1125 			
  1144 		
  1126         //update the last set config with the new rotation change so we don't incorrectly
  1145         //update the last set config with the new rotation change so we don't incorrectly
  1127         //change the layer extents
  1146         //change the layer extents
  1128         if (iDisplayControl)
  1147         if (iDisplayControl)
  1129             {
  1148             {
  1130             TDisplayConfiguration config;
  1149             TDisplayConfiguration config;
  1131             config.SetRotation(static_cast<TDisplayConfiguration::TRotation>(newRotation));           
  1150             config.SetRotation(static_cast<TDisplayConfiguration::TRotation>(newRotation));           
  1132             iConfigChangeNotifier->UpdateLastSetConfiguration(config);
  1151             iConfigChangeNotifier->UpdateLastSetConfiguration(config);
  1133             }		
  1152             }   		
  1134 		
  1153 			
  1135 		TWservCrEvent crEvent(TWservCrEvent::EDeviceOrientationChanged,iScreenNumber,&gcOrientation);
  1154 		TWservCrEvent crEvent(TWservCrEvent::EDeviceOrientationChanged,iScreenNumber,&gcOrientation);
  1136 		TWindowServerEvent::NotifyDrawer(crEvent);
  1155 		TWindowServerEvent::NotifyDrawer(crEvent);
  1137 		
  1156 		
  1138 		if(iDsaDevice && iDsaDevice->GraphicsAccelerator())
  1157 		if(iDsaDevice && iDsaDevice->GraphicsAccelerator())
  1139 			{
  1158 			{
  1141 			}
  1160 			}
  1142 		
  1161 		
  1143 		}
  1162 		}
  1144 	
  1163 	
  1145 	iRootWindow->AdjustCoordsDueToRotation();
  1164 	iRootWindow->AdjustCoordsDueToRotation();
  1146 	if (rotating)
  1165     if (rotating || (iFlags & ERepeatSettingHalOrientation))
  1147 		{
  1166         {
  1148 		if(BlankScreenOnRotation())
  1167         if (HAL::Set(iScreenNumber, HALData::EDigitiserOrientation, GcToDigitiser(gcOrientation)) != KErrNone)
  1149 			{
  1168             {
  1150 			iRootWindow->ClearDisplay();
  1169             iFlags |= ERepeatSettingHalOrientation;
  1151 			}
  1170             }
  1152 		
  1171         else
  1153 		CWsTop::ClearAllRedrawStores();	
  1172             {
  1154 		DiscardAllSchedules();
  1173             iFlags &= ~ERepeatSettingHalOrientation;
  1155 		iRootWindow->InvalidateWholeScreen();
  1174             }
  1156 		}
  1175         }
       
  1176     
       
  1177     if (rotating)
       
  1178         {
       
  1179         if (BlankScreenOnRotation())
       
  1180             {
       
  1181             iRootWindow->ClearDisplay();
       
  1182             }
       
  1183         CWsTop::ClearAllRedrawStores();
       
  1184         DiscardAllSchedules();
       
  1185         iRootWindow->InvalidateWholeScreen();
       
  1186         }
       
  1187     
  1157 	return ETrue;
  1188 	return ETrue;
  1158 	}
  1189 	}
  1159 
  1190 
  1160 TPoint CScreen::PhysicalToLogical(TPoint aPhysicalPt)
  1191 TPoint CScreen::PhysicalToLogical(TPoint aPhysicalPt)
  1161 	{
  1192 	{
  2049 		reply = KErrNotSupported;
  2080 		reply = KErrNotSupported;
  2050 		}
  2081 		}
  2051 	return reply;
  2082 	return reply;
  2052 	}
  2083 	}
  2053 
  2084 
  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  **/
       
  2060 TInt CScreen::UpdateConfiguration(const TDisplayConfiguration& aConfigInput)
  2085 TInt CScreen::UpdateConfiguration(const TDisplayConfiguration& aConfigInput)
  2061     {
  2086     {
  2062     TInt reply = KErrNone;
  2087     TInt reply = KErrNone;
  2063     if(iDisplayControl)
  2088     if(iDisplayControl)
  2064         {
  2089         {
  2096             {
  2121             {
  2097             reply = iFallbackMap->Resize(newUiSize);
  2122             reply = iFallbackMap->Resize(newUiSize);
  2098             }
  2123             }
  2099 
  2124 
  2100         RecalculateModeTwips(&config);   //needs res and twips information
  2125         RecalculateModeTwips(&config);   //needs res and twips information
  2101         UpdateDynamicScreenModes();        
  2126         UpdateDynamicScreenModes();               
  2102         
  2127         
  2103         TWindowServerEvent::NotifyDrawer(TWservCrEvent(TWservCrEvent::EScreenSizeModeAboutToChange, iScreenSizeMode));
  2128         TWindowServerEvent::NotifyDrawer(TWservCrEvent(TWservCrEvent::EScreenSizeModeAboutToChange, iScreenSizeMode));
  2104         // This will remove all the DSA elements from the scene
  2129         // This will remove all the DSA elements from the scene
  2105         AbortAllDirectDrawing(RDirectScreenAccess::ETerminateRotation);
  2130         AbortAllDirectDrawing(RDirectScreenAccess::ETerminateRotation);
  2106         
  2131         
  2134         }
  2159         }
  2135     else
  2160     else
  2136         {
  2161         {
  2137         reply = KErrNotSupported;
  2162         reply = KErrNotSupported;
  2138         }
  2163         }
  2139     return reply;  
  2164     return reply;   
  2140     }
  2165     }
  2141 
  2166 
  2142 void CScreen::UpdateDynamicScreenModes()
  2167 void CScreen::UpdateDynamicScreenModes()
  2143 	{
  2168 	{
  2144 	WS_ASSERT_DEBUG(iDisplayControl,EWsPanicNoDisplayControl);
  2169 	WS_ASSERT_DEBUG(iDisplayControl,EWsPanicNoDisplayControl);