windowing/windowserver/nga/SERVER/wsdisplaychangeao.cpp
changeset 187 9f66f99ee56f
parent 0 5d03bc08d59c
equal deleted inserted replaced
103:2717213c588a 187:9f66f99ee56f
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   241 void CWsConfigChangeNotifier::CancelNotificationRequest()
   241 void CWsConfigChangeNotifier::CancelNotificationRequest()
   242 	{
   242 	{
   243 	Cancel();
   243 	Cancel();
   244 	}
   244 	}
   245 
   245 
       
   246 void CWsConfigChangeNotifier::UpdateLastSetConfiguration(TDisplayConfiguration& aNewConfig)
       
   247     {
       
   248     TSize resolution(0,0);
       
   249     if (aNewConfig.GetResolution(resolution))
       
   250         {
       
   251         iLastSetConfig.SetResolution(resolution);
       
   252         }
       
   253     
       
   254     TSize resolutionTwips(0,0);
       
   255     if (aNewConfig.GetResolutionTwips(resolutionTwips))
       
   256         {
       
   257         iLastSetConfig.SetResolutionTwips(resolutionTwips);   
       
   258         }
       
   259     
       
   260     TDisplayConfiguration1::TRotation rotation;
       
   261     if (aNewConfig.GetRotation(rotation))
       
   262         {
       
   263         iLastSetConfig.SetRotation(rotation);
       
   264         }
       
   265     }
       
   266 
   246 void CWsConfigChangeNotifier::RunL()
   267 void CWsConfigChangeNotifier::RunL()
   247 	{
   268 	{
   248 	if(iStatus == KErrNone)
   269 	if(iStatus == KErrNone)
   249 		{
   270 		{
   250 		//IssueNotificationRequest() will overwrite iLastConfig, save a copy first
   271 		//IssueNotificationRequest() will overwrite iLastConfig, save a copy first
   257 			{
   278 			{
   258 			//first thing is to cancel the retry AO if it's running for the last event
   279 			//first thing is to cancel the retry AO if it's running for the last event
   259 			iRetry->CancelRetry();
   280 			iRetry->CancelRetry();
   260 			
   281 			
   261 			iOwner->IncreaseConfigSpinner();
   282 			iOwner->IncreaseConfigSpinner();
       
   283 			
       
   284 			//if the config change comes from a render stage then ensure screen device size 
       
   285 			//is also updated
       
   286 			TSize currentRes;
       
   287 			currentConfig.GetResolution(currentRes);
       
   288 			TBool disconnected = (currentRes.iHeight == 0 || currentRes.iWidth == 0) ? ETrue : EFalse;
       
   289             
       
   290 			//if the config change is due to CScreen::SetConfiguration() being called then we
       
   291 			//don't want to update it again. Only update if the configs are different and the
       
   292 			//display is connected...
       
   293 			TDisplayConfiguration lastSetConfig(iLastSetConfig);
       
   294 			if (!((currentConfig == lastSetConfig) || (disconnected)))
       
   295 			    {
       
   296                 TDisplayConfiguration1::TRotation rotation;
       
   297                 if (lastSetConfig.GetRotation(rotation))
       
   298                     {
       
   299                     //use the latest rotation value to ensure we don't get any
       
   300                     //inconsistencies with the layer extents
       
   301                     currentConfig.SetRotation(rotation);
       
   302                     }
       
   303                 iOwner->UpdateConfiguration(currentConfig);
       
   304 			    }		
       
   305 			
   262 			//put config change event on queue
   306 			//put config change event on queue
   263 			RPointerArray<CWsClient> clientArray;
   307 			RPointerArray<CWsClient> clientArray;
   264 			CleanupClosePushL(clientArray);
   308 			CleanupClosePushL(clientArray);
   265 			User::LeaveIfError(iOwner->GetNotificationClients(clientArray));
   309 			User::LeaveIfError(iOwner->GetNotificationClients(clientArray));
   266 			TBool eventOnAllQueues = ETrue;
   310 			TBool eventOnAllQueues = ETrue;
   280 				{
   324 				{
   281 				iRetry->Init(iOwner);
   325 				iRetry->Init(iOwner);
   282 				iRetry->Retry(KRetryInitialDelay);
   326 				iRetry->Retry(KRetryInitialDelay);
   283 				}
   327 				}
   284 			}
   328 			}
       
   329 		iNextLevelInterface->GetConfiguration(iLastSetConfig);
   285 		}
   330 		}
   286 	else if(iStatus != KErrCancel && iStatus != KErrNotSupported)
   331 	else if(iStatus != KErrCancel && iStatus != KErrNotSupported)
   287 		{
   332 		{
   288 		IssueNotificationRequest();
   333 		IssueNotificationRequest();
   289 		}
   334 		}