From: suhyung Eom Date: Tue, 22 Nov 2016 10:34:02 +0000 (+0900) Subject: Modify to use remote-surface for WatchApplication X-Git-Tag: dali_1.2.17~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F99316%2F6;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Modify to use remote-surface for WatchApplication Signed-off-by: suhyung Eom Change-Id: Icc0c42938f3bf94312550e1ffafff06b7d8a4b55 --- diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index 6c08db4..ee73fd5 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -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; diff --git a/adaptors/common/adaptor-impl.h b/adaptors/common/adaptor-impl.h index faf19b3..3688d89 100644 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -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;} }; diff --git a/adaptors/common/application-impl.cpp b/adaptors/common/application-impl.cpp old mode 100755 new mode 100644 index 1be56dd..e8d8429 --- a/adaptors/common/application-impl.cpp +++ b/adaptors/common/application-impl.cpp @@ -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) diff --git a/adaptors/common/application-impl.h b/adaptors/common/application-impl.h old mode 100755 new mode 100644 index b76ead8..aeadb17 --- a/adaptors/common/application-impl.h +++ b/adaptors/common/application-impl.h @@ -341,6 +341,7 @@ private: std::string mName; std::string mStylesheet; EnvironmentOptions mEnvironmentOptions; + bool mUseRemoteSurface; SlotDelegate< Application > mSlotDelegate; }; diff --git a/adaptors/tizen/adaptor-impl-tizen.cpp b/adaptors/tizen/adaptor-impl-tizen.cpp index b4a56eb..cd002cd 100644 --- a/adaptors/tizen/adaptor-impl-tizen.cpp +++ b/adaptors/tizen/adaptor-impl-tizen.cpp @@ -19,8 +19,10 @@ #include // EXTERNAL INCLUDES -#ifdef USE_APPFW #include +#ifdef APPCORE_WATCH_AVAILABLE +#include +#include #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( mNativeWindow ); + aul_rsm_provider_remote_enable(appId, ecore_wl_window_surface_get(ecoreWlWindow)); +#endif +} + } // namespace Adaptor } // namespace Internal diff --git a/adaptors/ubuntu/adaptor-impl-ubuntu.cpp b/adaptors/ubuntu/adaptor-impl-ubuntu.cpp index 7574dc7..be25b7b 100644 --- a/adaptors/ubuntu/adaptor-impl-ubuntu.cpp +++ b/adaptors/ubuntu/adaptor-impl-ubuntu.cpp @@ -37,6 +37,10 @@ void Adaptor::GetAppId( std::string& appId ) appId = ""; } +void Adaptor::SurfaceInitialized() +{ +} + } // namespace Adaptor } // namespace Internal