[3.0] Modify to use remote-surface for WatchApplication 71/100371/1
authorsuhyung Eom <suhyung.eom@samsung.com>
Tue, 22 Nov 2016 10:34:02 +0000 (19:34 +0900)
committersuhyung Eom <suhyung.eom@samsung.com>
Mon, 28 Nov 2016 04:02:41 +0000 (13:02 +0900)
Signed-off-by: suhyung Eom <suhyung.eom@samsung.com>
Change-Id: I1a427e54f82906cdf1eed75ce643875306d23e9e

adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/common/application-impl.cpp
adaptors/common/application-impl.h
adaptors/tizen/adaptor-impl-tizen.cpp
adaptors/ubuntu/adaptor-impl-ubuntu.cpp

index a24c54c..6e59fbb 100644 (file)
@@ -618,6 +618,11 @@ Any Adaptor::GetNativeWindowHandle()
   return mNativeWindow;
 }
 
+void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
+{
+  mUseRemoteSurface = useRemoteSurface;
+}
+
 void Adaptor::AddObserver( LifeCycleObserver& observer )
 {
   ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
@@ -731,6 +736,9 @@ void Adaptor::NotifySceneCreated()
 
   // Start thread controller after the scene has been created
   mThreadController->Start();
+
+  // process after surface is created (registering to remote surface provider if required)
+  SurfaceInitialized();
 }
 
 void Adaptor::NotifyLanguageChanged()
@@ -789,7 +797,8 @@ Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surfac
   mTriggerEventFactory(),
   mObjectProfiler( NULL ),
   mSocketFactory(),
-  mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ )
+  mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
+  mUseRemoteSurface( false )
 {
   DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
   gThreadLocalAdaptor = this;
index 62d21fa..b2bd30a 100644 (file)
@@ -293,6 +293,12 @@ public:
    */
   Any GetNativeWindowHandle();
 
+  /**
+   * Sets use remote surface for eglSurface output
+   * @param[in] useRemoteSurface True if the remote surface is used
+   */
+  void SetUseRemoteSurface(bool useRemoteSurface);
+
 public:
 
   /**
@@ -495,6 +501,11 @@ private:
   void SetSurface(RenderSurface *surface);
 
   /**
+   * called after surface is created
+   */
+  void SurfaceInitialized();
+
+  /**
    * Sends an notification message from main loop idle handler
    */
   void ProcessCoreEventsFromIdle();
@@ -568,6 +579,7 @@ private: // Data
   ObjectProfiler*                       mObjectProfiler;              ///< Tracks object lifetime for profiling
   SocketFactory                         mSocketFactory;               ///< Socket factory
   const bool                            mEnvironmentOptionsOwned:1;   ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
+  bool                                  mUseRemoteSurface;            ///< whether the remoteSurface is used or not
 public:
   inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) {return *adaptor.mImpl;}
 };
index e43871f..c3cdd1e 100644 (file)
@@ -94,6 +94,7 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee
 
   mCommandLineOptions = new CommandLineOptions(argc, argv);
   mFramework = new Framework( *this, argc, argv, applicationType );
+  mUseRemoteSurface = (applicationType == Framework::WATCH);
 }
 
 Application::~Application()
@@ -135,6 +136,8 @@ void Application::CreateAdaptor()
   mAdaptor = Dali::Internal::Adaptor::Adaptor::New( mWindow, mContextLossConfiguration, &mEnvironmentOptions );
 
   mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize );
+
+  Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetUseRemoteSurface( mUseRemoteSurface );
 }
 
 void Application::MainLoop(Dali::Configuration::ContextLoss configuration)
index 68de173..8c1de19 100644 (file)
@@ -309,6 +309,7 @@ private:
   std::string                           mName;
   std::string                           mStylesheet;
   EnvironmentOptions                    mEnvironmentOptions;
+  bool                                  mUseRemoteSurface;
 
   SlotDelegate< Application >           mSlotDelegate;
 };
index b4a56eb..cd002cd 100644 (file)
 #include <adaptor-impl.h>
 
 // EXTERNAL INCLUDES
-#ifdef  USE_APPFW
 #include <app.h>
+#ifdef APPCORE_WATCH_AVAILABLE
+#include <aul_rsm_provider.h>
+#include <ecore-wl-render-surface.h>
 #endif
 
 namespace Dali
@@ -65,6 +67,21 @@ void Adaptor::GetAppId( std::string& appId )
 #endif
 }
 
+void Adaptor::SurfaceInitialized()
+{
+#ifdef APPCORE_WATCH_AVAILABLE
+  if ( !mUseRemoteSurface )
+  {
+    return;
+  }
+  char *appId;
+  app_get_id(&appId);
+
+  Ecore_Wl_Window* ecoreWlWindow = AnyCast<Ecore_Wl_Window*>( mNativeWindow );
+  aul_rsm_provider_remote_enable(appId, ecore_wl_window_surface_get(ecoreWlWindow));
+#endif
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 7574dc7..be25b7b 100644 (file)
@@ -37,6 +37,10 @@ void Adaptor::GetAppId( std::string& appId )
   appId = "";
 }
 
+void Adaptor::SurfaceInitialized()
+{
+}
+
 } // namespace Adaptor
 
 } // namespace Internal