Fix for RelayoutController. 28/40128/2
authorVictor Cebollada <v.cebollada@samsung.com>
Thu, 28 May 2015 14:46:10 +0000 (15:46 +0100)
committerVíctor Cebollada <v.cebollada@samsung.com>
Fri, 29 May 2015 10:07:19 +0000 (03:07 -0700)
Request to process events on idle if core is not processing events.

Change-Id: Ib7d3fed2fb68add0602694c6d5aa59b4fd3346d6
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali/internal/common/core-impl.cpp
dali/internal/event/size-negotiation/relayout-controller-impl.cpp
dali/internal/event/size-negotiation/relayout-controller-impl.h

index ddc8537..f0a10ac 100644 (file)
@@ -151,7 +151,7 @@ Core::Core( RenderController& renderController, PlatformAbstraction& platform,
   mStage = IntrusivePtr<Stage>( Stage::New( *mAnimationPlaylist, *mPropertyNotificationManager, *mUpdateManager, *mNotificationManager ) );
 
   // This must be called after stage is created but before stage initialization
-  mRelayoutController = IntrusivePtr< RelayoutController >( new RelayoutController() );
+  mRelayoutController = IntrusivePtr< RelayoutController >( new RelayoutController( mRenderController ) );
 
   mStage->Initialize();
 
@@ -317,6 +317,7 @@ void Core::ProcessEvents()
   }
 
   mProcessingEvent = true;
+  mRelayoutController->SetProcessingCoreEvents( true );
 
   // Signal that any messages received will be flushed soon
   mUpdateManager->EventProcessingStarted();
@@ -351,6 +352,8 @@ void Core::ProcessEvents()
     }
   }
 
+  mRelayoutController->SetProcessingCoreEvents( false );
+
   // ProcessEvents() may now be called again
   mProcessingEvent = false;
 }
index 91f0ad9..66a707a 100644 (file)
@@ -29,6 +29,7 @@
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/render-controller.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/object-registry.h>
 #include <dali/internal/event/actors/actor-impl.h>
@@ -111,14 +112,16 @@ RelayoutController* RelayoutController::Get()
   return &ThreadLocalStorage::Get().GetRelayoutController();
 }
 
-RelayoutController::RelayoutController()
-: mRelayoutInfoAllocator(),
+RelayoutController::RelayoutController( Integration::RenderController& controller )
+: mRenderController( controller ),
+  mRelayoutInfoAllocator(),
   mSlotDelegate( this ),
   mRelayoutStack( new MemoryPoolRelayoutContainer( mRelayoutInfoAllocator ) ),
   mRelayoutConnection( false ),
   mRelayoutFlag( false ),
   mEnabled( false ),
-  mPerformingRelayout( false )
+  mPerformingRelayout( false ),
+  mProcessingCoreEvents( false )
 {
   // Make space for 32 controls to avoid having to copy construct a lot in the beginning
   mRelayoutStack->Reserve( 32 );
@@ -182,6 +185,11 @@ void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension::Type di
 
     RemoveRequest( subRoot );
   }
+
+  if ( !mProcessingCoreEvents )
+  {
+    mRenderController.RequestProcessEventsOnIdle();
+  }
 }
 
 void RelayoutController::OnApplicationSceneCreated()
@@ -489,6 +497,11 @@ bool RelayoutController::IsPerformingRelayout() const
   return mPerformingRelayout;
 }
 
+void RelayoutController::SetProcessingCoreEvents( bool processingEvents )
+{
+  mProcessingCoreEvents = processingEvents;
+}
+
 void RelayoutController::FindAndZero( const RawActorList& list, const Dali::RefObject* object )
 {
   // Object has been destroyed so clear it from this list
index aa277c5..5b6e635 100644 (file)
 namespace Dali
 {
 
+namespace Integration
+{
+class RenderController;
+}
+
 namespace Internal
 {
 
@@ -43,8 +48,9 @@ public:
   /**
    * @brief Constructor.
    * We should only create a unique instance.
+   * @param[in] controller to request a render from the RenderController if core is not processing events.
    */
-  RelayoutController();
+  RelayoutController( Integration::RenderController& controller );
 
   /**
    * Destructor
@@ -111,6 +117,13 @@ public:
    */
   bool IsPerformingRelayout() const;
 
+  /**
+   * @brief Sets whether core is processing events.
+   *
+   * @param[in] processingEvents whether core is processing events.
+   */
+  void SetProcessingCoreEvents( bool processingEvents );
+
 public: // CALLBACKS
 
   /**
@@ -187,6 +200,7 @@ private:
 
 private:
 
+  Integration::RenderController& mRenderController;
   MemoryPoolObjectAllocator< MemoryPoolRelayoutContainer::RelayoutInfo > mRelayoutInfoAllocator;
 
   SlotDelegate< RelayoutController > mSlotDelegate;
@@ -197,6 +211,7 @@ private:
   bool mRelayoutFlag : 1;               ///< Relayout flag to avoid unnecessary calls
   bool mEnabled : 1;                    ///< Initially disabled. Must be enabled at some point.
   bool mPerformingRelayout : 1;         ///< The relayout controller is currently performing a relayout
+  bool mProcessingCoreEvents : 1;       ///< Whether core is processing events.
 
 };