2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "adaptor-impl.h"
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/common/stage.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/devel-api/actors/actor-devel.h>
26 #include <dali/integration-api/debug.h>
27 #include <dali/integration-api/core.h>
28 #include <dali/integration-api/context-notifier.h>
29 #include <dali/integration-api/profiling.h>
30 #include <dali/integration-api/input-options.h>
31 #include <dali/integration-api/events/touch-event-integ.h>
34 #include <base/thread-controller.h>
35 #include <base/performance-logging/performance-interface-factory.h>
36 #include <base/lifecycle-observer.h>
38 #include <dali/devel-api/text-abstraction/font-client.h>
40 #include <callback-manager.h>
41 #include <render-surface.h>
42 #include <tts-player-impl.h>
43 #include <accessibility-adaptor-impl.h>
44 #include <events/gesture-manager.h>
45 #include <events/event-handler.h>
46 #include <gl/gl-proxy-implementation.h>
47 #include <gl/gl-implementation.h>
48 #include <gl/egl-sync-implementation.h>
49 #include <gl/egl-image-extensions.h>
50 #include <gl/egl-factory.h>
51 #include <imf-manager-impl.h>
52 #include <clipboard-impl.h>
53 #include <vsync-monitor.h>
54 #include <object-profiler.h>
55 #include <base/display-connection.h>
56 #include <window-impl.h>
58 #include <tizen-logging.h>
59 #include <image-loading.h>
61 #include <locale-utils.h>
63 using Dali::TextAbstraction::FontClient;
76 thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
77 } // unnamed namespace
79 Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
81 Dali::Adaptor* adaptor = new Dali::Adaptor;
82 Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
83 adaptor->mImpl = impl;
85 impl->Initialize(configuration);
90 Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
92 Any winId = window.GetNativeHandle();
94 Window& windowImpl = Dali::GetImplementation(window);
95 Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
97 Internal::Adaptor::Adaptor::GetImplementation( *adaptor ).SetWindow( window );
98 windowImpl.SetAdaptor(*adaptor);
102 void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
104 // all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
105 Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
106 mEnvironmentOptions->SetLogFunction( logFunction );
107 mEnvironmentOptions->InstallLogFunction(); // install logging for main thread
109 mPlatformAbstraction = new TizenPlatform::TizenPlatformAbstraction;
112 GetDataStoragePath( path );
113 mPlatformAbstraction->SetDataStoragePath( path );
115 ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
116 if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
118 dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
120 // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
121 // files automatically.
123 if( mEnvironmentOptions->PerformanceServerRequired() )
125 mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
128 mCallbackManager = CallbackManager::New();
130 PositionSize size = mSurface->GetPositionSize();
132 mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
134 if( mEnvironmentOptions->GetGlesCallTime() > 0 )
136 mGLES = new GlProxyImplementation( *mEnvironmentOptions );
140 mGLES = new GlImplementation();
143 const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() );
144 const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() );
146 mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable );
148 EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
150 mCore = Integration::Core::New( *this,
151 *mPlatformAbstraction,
155 dataRetentionPolicy ,
156 ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
157 depthBufferAvailable,
158 stencilBufferAvailable );
160 const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
161 if( 0u < timeInterval )
163 mObjectProfiler = new ObjectProfiler( timeInterval );
166 mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
168 mVSyncMonitor = new VSyncMonitor;
170 mThreadController = new ThreadController( *this, *mEnvironmentOptions );
172 // Should be called after Core creation
173 if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
175 Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
177 if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
179 Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
181 if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
183 Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
185 if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
187 Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
189 if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
191 Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
193 if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
195 Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
197 if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
199 Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
201 if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
203 Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
205 if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 )
207 Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false );
209 if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 )
211 Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() );
213 if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 )
215 Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false );
217 if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 )
219 Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false );
221 if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 )
223 Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() );
225 if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f )
227 Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() );
229 if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f )
231 Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() );
233 if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 )
235 Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() );
238 // Set max texture size
239 if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
241 Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
244 SetupSystemInformation();
249 // Ensure stop status
252 // set to NULL first as we do not want any access to Adaptor as it is being destroyed.
253 gThreadLocalAdaptor = NULL;
255 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
257 (*iter)->OnDestroy();
260 delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
261 delete mVSyncMonitor;
262 delete mEventHandler;
263 delete mObjectProfiler;
268 delete mGestureManager;
269 delete mPlatformAbstraction;
270 delete mCallbackManager;
271 delete mPerformanceInterface;
273 // uninstall it on this thread (main actor thread)
274 Dali::Integration::Log::UninstallLogFunction();
276 // Delete environment options if we own it
277 if( mEnvironmentOptionsOwned )
279 delete mEnvironmentOptions;
283 void Adaptor::Start()
285 // it doesn't support restart after stop at this moment
286 // to support restarting, need more testing
287 if( READY != mState )
292 // Start the callback manager
293 mCallbackManager->Start();
295 // create event handler
296 mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
298 if( mDeferredRotationObserver != NULL )
300 mEventHandler->SetRotationObserver(mDeferredRotationObserver);
301 mDeferredRotationObserver = NULL;
304 unsigned int dpiHor, dpiVer;
306 Dali::DisplayConnection::GetDpi(dpiHor, dpiVer);
308 // tell core about the DPI value
309 mCore->SetDpi(dpiHor, dpiVer);
311 // set the DPI value for font rendering
312 FontClient fontClient = FontClient::Get();
313 fontClient.SetDpi( dpiHor, dpiVer );
315 // Tell the core the size of the surface just before we start the render-thread
316 PositionSize size = mSurface->GetPositionSize();
317 mCore->SurfaceResized( size.width, size.height );
319 // Initialize the thread controller
320 mThreadController->Initialize();
322 ProcessCoreEvents(); // Ensure any startup messages are processed.
324 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
330 // Dali::Internal::Adaptor::Adaptor::Pause
331 void Adaptor::Pause()
333 // Only pause the adaptor if we're actually running.
334 if( RUNNING == mState )
336 // Inform observers that we are about to be paused.
337 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
342 // Reset the event handler when adaptor paused
345 mEventHandler->Pause();
348 mThreadController->Pause();
353 // Dali::Internal::Adaptor::Adaptor::Resume
354 void Adaptor::Resume()
356 // Only resume the adaptor if we are in the suspended state.
357 if( PAUSED == mState )
361 // Reset the event handler when adaptor resumed
364 mEventHandler->Resume();
367 // Inform observers that we have resumed.
368 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
373 // trigger processing of events queued up while paused
374 mCore->ProcessEvents();
376 // Do at end to ensure our first update/render after resumption includes the processed messages as well
377 mThreadController->Resume();
383 if( RUNNING == mState ||
385 PAUSED_WHILE_HIDDEN == mState )
387 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
392 mThreadController->Stop();
394 // Delete the TTS player
395 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
399 mTtsPlayers[i].Reset();
403 delete mEventHandler;
404 mEventHandler = NULL;
406 delete mNotificationTrigger;
407 mNotificationTrigger = NULL;
409 mCallbackManager->Stop();
415 void Adaptor::ContextLost()
417 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
420 void Adaptor::ContextRegained()
422 // Inform core, so that texture resources can be reloaded
423 mCore->RecoverFromContextLoss();
425 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
428 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
430 mEventHandler->FeedTouchPoint( point, timeStamp );
433 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
435 mEventHandler->FeedWheelEvent( wheelEvent );
438 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
440 mEventHandler->FeedKeyEvent( keyEvent );
443 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
445 PositionSize positionSize = surface.GetPositionSize();
447 // let the core know the surface size has changed
448 mCore->SurfaceResized( positionSize.width, positionSize.height );
450 mResizedSignal.Emit( mAdaptor );
452 mNativeWindow = nativeWindow;
455 // flush the event queue to give the update-render thread chance
456 // to start processing messages for new camera setup etc as soon as possible
459 // this method blocks until the render thread has completed the replace.
460 mThreadController->ReplaceSurface(mSurface);
463 RenderSurface& Adaptor::GetSurface() const
468 void Adaptor::ReleaseSurfaceLock()
470 mSurface->ReleaseLock();
473 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
475 if(!mTtsPlayers[mode])
477 // Create the TTS player when it needed, because it can reduce launching time.
478 mTtsPlayers[mode] = TtsPlayer::New(mode);
481 return mTtsPlayers[mode];
484 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
486 bool idleAdded(false);
488 // Only add an idle if the Adaptor is actually running
489 if( RUNNING == mState || READY == mState || forceAdd )
491 idleAdded = mCallbackManager->AddIdleCallback( callback );
497 void Adaptor::RemoveIdle( CallbackBase* callback )
499 mCallbackManager->RemoveIdleCallback( callback );
502 Dali::Adaptor& Adaptor::Get()
504 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
505 return gThreadLocalAdaptor->mAdaptor;
508 bool Adaptor::IsAvailable()
510 return gThreadLocalAdaptor != NULL;
513 void Adaptor::SceneCreated()
515 mCore->SceneCreated();
518 Dali::Integration::Core& Adaptor::GetCore()
523 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
525 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
528 void Adaptor::SetUseHardwareVSync( bool useHardware )
530 mVSyncMonitor->SetUseHardwareVSync( useHardware );
533 EglFactory& Adaptor::GetEGLFactory() const
535 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
539 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
544 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
546 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
550 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
552 return *mPlatformAbstraction;
555 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
560 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
562 return *mNotificationTrigger;
565 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
567 return mTriggerEventFactory;
570 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
572 return mSocketFactory;
575 RenderSurface* Adaptor::GetRenderSurfaceInterface()
580 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
582 return mVSyncMonitor;
585 TraceInterface& Adaptor::GetKernelTraceInterface()
587 return mKernelTracer;
590 TraceInterface& Adaptor::GetSystemTraceInterface()
592 return mSystemTracer;
595 PerformanceInterface* Adaptor::GetPerformanceInterface()
597 return mPerformanceInterface;
600 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
602 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
603 return *mPlatformAbstraction;
606 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
608 mDragAndDropDetector = detector;
612 mEventHandler->SetDragAndDropDetector( detector );
616 void Adaptor::SetRotationObserver( RotationObserver* observer )
620 mEventHandler->SetRotationObserver( observer );
622 else if( mState == READY )
624 // Set once event handler exists
625 mDeferredRotationObserver = observer;
629 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
631 if(mTtsPlayers[mode])
633 mTtsPlayers[mode].Reset();
637 void Adaptor::SetMinimumPinchDistance(float distance)
639 if( mGestureManager )
641 mGestureManager->SetMinimumPinchDistance(distance);
645 Any Adaptor::GetNativeWindowHandle()
647 return mNativeWindow;
650 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
652 mUseRemoteSurface = useRemoteSurface;
655 void Adaptor::AddObserver( LifeCycleObserver& observer )
657 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
659 if ( match == mObservers.end() )
661 mObservers.push_back( &observer );
665 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
667 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
669 if ( match != mObservers.end() )
671 mObservers.erase( match );
675 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
679 mCore->QueueEvent(event);
683 void Adaptor::ProcessCoreEvents()
687 if( mPerformanceInterface )
689 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
692 mCore->ProcessEvents();
694 if( mPerformanceInterface )
696 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
701 void Adaptor::RequestUpdate( bool forceUpdate )
707 mThreadController->RequestUpdate();
711 case PAUSED_WHILE_HIDDEN:
713 // When Dali applications are partially visible behind the lock-screen,
714 // the indicator must be updated (therefore allow updates in the PAUSED state)
717 mThreadController->RequestUpdateOnce();
729 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
731 // Only request a notification if the Adaptor is actually running
732 // and we haven't installed the idle notification
733 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
735 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
739 void Adaptor::OnWindowShown()
741 if ( PAUSED_WHILE_HIDDEN == mState )
743 // Adaptor can now be resumed
748 // Force a render task
753 void Adaptor::OnWindowHidden()
755 if ( RUNNING == mState )
759 // Adaptor cannot be resumed until the window is shown
760 mState = PAUSED_WHILE_HIDDEN;
764 // Dali::Internal::Adaptor::Adaptor::OnDamaged
765 void Adaptor::OnDamaged( const DamageArea& area )
767 // This is needed for the case where Dali window is partially obscured
768 RequestUpdate( false );
771 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
773 // let the core know the surface size has changed
774 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
776 mResizedSignal.Emit( mAdaptor );
779 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
781 // flush the event queue to give the update-render thread chance
782 // to start processing messages for new camera setup etc as soon as possible
785 // this method blocks until the render thread has completed the resizing.
786 mThreadController->ResizeSurface();
789 void Adaptor::NotifySceneCreated()
791 GetCore().SceneCreated();
793 // Start thread controller after the scene has been created
794 mThreadController->Start();
796 // process after surface is created (registering to remote surface provider if required)
797 SurfaceInitialized();
802 void Adaptor::NotifyLanguageChanged()
804 mLanguageChangedSignal.Emit( mAdaptor );
807 void Adaptor::RenderOnce()
812 void Adaptor::RequestUpdateOnce()
814 if( mThreadController )
816 mThreadController->RequestUpdateOnce();
820 void Adaptor::IndicatorSizeChanged(int height)
822 // let the core know the indicator height is changed
823 mCore->SetTopMargin(height);
826 void Adaptor::ProcessCoreEventsFromIdle()
830 // the idle handle automatically un-installs itself
831 mNotificationOnIdleInstalled = false;
834 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
836 mLanguageChangedSignal(),
840 mThreadController( NULL ),
841 mVSyncMonitor( NULL ),
845 mNativeWindow( nativeWindow ),
847 mPlatformAbstraction( NULL ),
848 mEventHandler( NULL ),
849 mCallbackManager( NULL ),
850 mNotificationOnIdleInstalled( false ),
851 mNotificationTrigger( NULL ),
852 mGestureManager( NULL ),
853 mDaliFeedbackPlugin(),
854 mFeedbackController( NULL ),
857 mDragAndDropDetector(),
858 mDeferredRotationObserver( NULL ),
859 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
860 mPerformanceInterface( NULL ),
863 mTriggerEventFactory(),
864 mObjectProfiler( NULL ),
867 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
868 mUseRemoteSurface( false )
870 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
871 gThreadLocalAdaptor = this;
876 void Adaptor::SetViewMode( ViewMode viewMode )
878 mSurface->SetViewMode( viewMode );
879 mCore->SetViewMode( viewMode );
882 ViewMode Adaptor::GetViewMode() const
884 return mCore->GetViewMode();
887 void Adaptor::SetStereoBase( float stereoBase )
889 mCore->SetStereoBase( stereoBase );
892 float Adaptor::GetStereoBase() const
894 return mCore->GetStereoBase();
897 void Adaptor::SetRootLayoutDirection( std::string locale )
899 Dali::Stage stage = Dali::Stage::GetCurrent();
901 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
902 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
905 void Adaptor::SetWindow( Dali::Window window )
910 Dali::Window Adaptor::GetWindow()
915 } // namespace Adaptor
917 } // namespace Internal