Mofidy codes for Dali Windows backend
[platform/core/uifw/dali-core.git] / dali / internal / common / core-impl.cpp
index 79e3e42..5d4ef67 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -227,6 +227,9 @@ void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds,
   // Check the Notification Manager message queue to set needsNotification
   status.needsNotification = mNotificationManager->MessagesToProcess();
 
+  // Check if the default surface is changed
+  status.surfaceRectChanged = mUpdateManager->IsDefaultSurfaceRectChanged();
+
   // No need to keep update running if there are notifications to process.
   // Any message to update will wake it up anyways
 }
@@ -271,9 +274,13 @@ void Core::ProcessEvents()
   // Emit signal here to inform listeners that event processing has finished.
   mStage->EmitEventProcessingFinishedSignal();
 
+  // Run any registered processors
+  RunProcessors();
+
   // Run the size negotiation after event processing finished signal
   mRelayoutController->Relayout();
 
+
   // Rebuild depth tree after event processing has finished
   mStage->RebuildDepthTree();
 
@@ -322,6 +329,34 @@ void Core::SetStereoBase( float stereoBase )
   mStage->SetStereoBase( stereoBase );
 }
 
+void Core::RegisterProcessor( Integration::Processor& processor )
+{
+  mProcessors.PushBack(&processor);
+}
+
+void Core::UnregisterProcessor( Integration::Processor& processor )
+{
+  auto iter = std::find( mProcessors.Begin(), mProcessors.End(), &processor );
+  if( iter != mProcessors.End() )
+  {
+    mProcessors.Erase( iter );
+  }
+}
+
+void Core::RunProcessors()
+{
+  // Copy processor pointers to prevent changes to vector affecting loop iterator.
+  Dali::Vector<Integration::Processor*> processors( mProcessors );
+
+  for( auto processor : processors )
+  {
+    if( processor )
+    {
+      processor->Process();
+    }
+  }
+}
+
 float Core::GetStereoBase() const
 {
   return mStage->GetStereoBase();