Modify to use remote-surface for WatchApplication 16/99316/6
authorsuhyung Eom <suhyung.eom@samsung.com>
Tue, 22 Nov 2016 10:34:02 +0000 (19:34 +0900)
committersuhyung Eom <suhyung.eom@samsung.com>
Fri, 25 Nov 2016 06:52:06 +0000 (15:52 +0900)
Signed-off-by: suhyung Eom <suhyung.eom@samsung.com>
Change-Id: Icc0c42938f3bf94312550e1ffafff06b7d8a4b55

adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/common/application-impl.cpp [changed mode: 0755->0644]
adaptors/common/application-impl.h [changed mode: 0755->0644]
adaptors/tizen/adaptor-impl-tizen.cpp
adaptors/ubuntu/adaptor-impl-ubuntu.cpp

index 6c08db4..ee73fd5 100644 (file)
@@ -620,6 +620,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) );
@@ -733,6 +738,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()
@@ -797,7 +805,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 faf19b3..3688d89 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:
 
   /**
@@ -500,6 +506,11 @@ private:
   void SetSurface(RenderSurface *surface);
 
   /**
+   * called after surface is created
+   */
+  void SurfaceInitialized();
+
+  /**
    * Sends an notification message from main loop idle handler
    */
   void ProcessCoreEventsFromIdle();
@@ -573,6 +584,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;}
 };
old mode 100755 (executable)
new mode 100644 (file)
index 1be56dd..e8d8429
@@ -95,6 +95,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()
@@ -136,6 +137,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)
old mode 100755 (executable)
new mode 100644 (file)
index b76ead8..aeadb17
@@ -341,6 +341,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