Remove the deferred RotationObserver from the Adaptor 39/203539/4
authorRichard Huang <r.huang@samsung.com>
Mon, 15 Apr 2019 16:05:33 +0000 (17:05 +0100)
committerRichard Huang <r.huang@samsung.com>
Tue, 16 Apr 2019 11:39:51 +0000 (12:39 +0100)
Change-Id: I9b9cc0af572e0c8bc5f90b45298e27dc82e9b325

dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/window-system/common/orientation-impl.cpp
dali/internal/window-system/common/orientation-impl.h
dali/internal/window-system/common/window-impl.cpp

index 0bdf2c7..d36c352 100755 (executable)
@@ -330,12 +330,6 @@ void Adaptor::Start()
 
   WindowPtr defaultWindow = mWindows.front();
 
-  if( mDeferredRotationObserver != NULL )
-  {
-    defaultWindow->SetRotationObserver( mDeferredRotationObserver );
-    mDeferredRotationObserver = NULL;
-  }
-
   unsigned int dpiHor, dpiVer;
   dpiHor = dpiVer = 0;
 
@@ -718,16 +712,6 @@ void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
   mDragAndDropDetector = detector;
 }
 
-void Adaptor::SetRotationObserver( RotationObserver* observer )
-{
-  WindowPtr defaultWindow = mWindows.front();
-  if( !defaultWindow->SetRotationObserver( observer ) && mState == READY )
-  {
-    // Set once event handler exists
-    mDeferredRotationObserver = observer;
-  }
-}
-
 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
 {
   if( mTtsPlayers[mode] )
@@ -993,7 +977,6 @@ Adaptor::Adaptor(Dali::Window window, Dali::Adaptor& adaptor, Dali::RenderSurfac
   mTtsPlayers(),
   mObservers(),
   mDragAndDropDetector(),
-  mDeferredRotationObserver( nullptr ),
   mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
   mPerformanceInterface( nullptr ),
   mKernelTracer(),
index b3d6181..9b61083 100755 (executable)
@@ -76,7 +76,6 @@ class TriggerEvent;
 class CallbackManager;
 class FeedbackPluginProxy;
 class FeedbackController;
-class RotationObserver;
 class VSyncMonitor;
 class PerformanceInterface;
 class LifeCycleObserver;
@@ -320,13 +319,6 @@ public:
   void SetDragAndDropDetector( DragAndDropDetectorPtr detector );
 
   /**
-   * Sets a rotation observer, or set to NULL to remove.
-   * @pre Adaptor::Start() has been called ( to create EventHandler )
-   * @param[in] observer The observer to listen for window rotation events
-   */
-  void SetRotationObserver( RotationObserver* observer );
-
-  /**
    * Destroy the TtsPlayer of specific mode.
    * @param[in] mode The mode of TtsPlayer to destroy
    */
@@ -669,7 +661,6 @@ private: // Data
   Dali::TtsPlayer                       mTtsPlayers[Dali::TtsPlayer::MODE_NUM];                   ///< Provides TTS support
   ObserverContainer                     mObservers;                   ///< A list of adaptor observer pointers
   DragAndDropDetectorPtr                mDragAndDropDetector;         ///< The Drag & Drop detector
-  RotationObserver*                     mDeferredRotationObserver;    ///< deferred Rotation observer needs event handler
   EnvironmentOptions*                   mEnvironmentOptions;          ///< environment options
   PerformanceInterface*                 mPerformanceInterface;        ///< Performance interface
   KernelTrace                           mKernelTracer;                ///< Kernel tracer
index 0adbe85..c2341eb 100644 (file)
@@ -53,16 +53,6 @@ Orientation::~Orientation()
   // so it will live longer than adaptor. (hence, no need to remove rotation observer)
 }
 
-void Orientation::SetAdaptor(Dali::Adaptor& adaptor)
-{
-  SetAdaptor( Adaptor::GetImplementation( adaptor ) );
-}
-
-void Orientation::SetAdaptor(Adaptor& adaptor)
-{
-  adaptor.SetRotationObserver(this);
-}
-
 int Orientation::GetDegrees() const
 {
   return mOrientation;
index 47c058d..65d02ea 100644 (file)
 
 namespace Dali
 {
-class Adaptor;
 
 namespace Internal
 {
 
 namespace Adaptor
 {
-class Adaptor;
 class Window;
 class Orientation;
 
@@ -62,17 +60,6 @@ protected:
   virtual ~Orientation();
 
 public:
-  /**
-   * Set the adaptor for basic setup
-   * @param[in] adaptor The adaptor
-   */
-  void SetAdaptor(Dali::Adaptor& adaptor);
-
-  /**
-   * Set the adaptor for basic setup
-   * @param[in] adaptor The adaptor
-   */
-  void SetAdaptor(Adaptor& adaptor);
 
   /**
    * Returns the actual orientation in degrees
index 7ff03e4..564ff14 100644 (file)
@@ -162,15 +162,16 @@ void Window::SetAdaptor(Adaptor& adaptor)
   // Can only create the detector when we know the Core has been instantiated.
   mDragAndDropDetector = DragAndDropDetector::New();
 
-  if( mOrientation )
-  {
-    mOrientation->SetAdaptor( adaptor );
-  }
-
   mSurface->SetAdaptor( *mAdaptor );
 
   mEventHandler = EventHandlerPtr(
       new EventHandler( mScene, *mAdaptor, *mAdaptor->GetGestureManager(), *mAdaptor ) );
+
+  // TODO: Orientation should be passed into the constructor of EventHandler
+  if( mOrientation )
+  {
+    SetRotationObserver( &(*mOrientation) );
+  }
 }
 
 WindowRenderSurface* Window::GetSurface() const