[Tizen] Support Client Rotation and Screen Rotation
[platform/core/uifw/dali-core.git] / dali / internal / common / core-impl.cpp
index 1a09947..7412b9a 100644 (file)
@@ -191,13 +191,25 @@ void Core::ContextDestroyed()
   mRenderManager->ContextDestroyed();
 }
 
-void Core::SurfaceResized( Integration::RenderSurface* surface )
+void Core::SurfaceResized( Integration::RenderSurface* surface, bool forceUpdate )
 {
   for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
   {
     if( (*iter)->GetSurface() == surface )
     {
-      (*iter)->SetSurface( *surface );
+      (*iter)->SurfaceResized( forceUpdate );
+    }
+  }
+}
+
+void Core::SurfaceDeleted( Integration::RenderSurface* surface )
+{
+  for( auto scene : mScenes )
+  {
+    if( scene->GetSurface() == surface )
+    {
+      scene->SurfaceDeleted();
+      break;
     }
   }
 }
@@ -268,18 +280,22 @@ void Core::ProcessEvents()
   // Signal that any messages received will be flushed soon
   mUpdateManager->EventProcessingStarted();
 
+  // Scene could be added or removed while processing the events
+  // Copy the Scene container locally to avoid possibly invalid iterator
+  SceneContainer scenes = mScenes;
+
   // process events in all scenes
-  for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+  for( auto scene : scenes )
   {
-    (*iter)->ProcessEvents();
+    scene->ProcessEvents();
   }
 
   mNotificationManager->ProcessMessages();
 
   // Emit signal here to inform listeners that event processing has finished.
-  for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+  for( auto scene : scenes )
   {
-    (*iter)->EmitEventProcessingFinishedSignal();
+    scene->EmitEventProcessingFinishedSignal();
   }
 
   // Run any registered processors
@@ -289,9 +305,9 @@ void Core::ProcessEvents()
   mRelayoutController->Relayout();
 
   // Rebuild depth tree after event processing has finished
-  for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+  for( auto scene : scenes )
   {
-    (*iter)->RebuildDepthTree();
+    scene->RebuildDepthTree();
   }
 
   // Flush any queued messages for the update-thread