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();
351 // Ensure any messages queued during pause callbacks are processed by doing another update.
356 // Dali::Internal::Adaptor::Adaptor::Resume
357 void Adaptor::Resume()
359 // Only resume the adaptor if we are in the suspended state.
360 if( PAUSED == mState )
364 // Reset the event handler when adaptor resumed
367 mEventHandler->Resume();
370 // Inform observers that we have resumed.
371 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
376 // trigger processing of events queued up while paused
377 mCore->ProcessEvents();
379 // Do at end to ensure our first update/render after resumption includes the processed messages as well
380 mThreadController->Resume();
386 if( RUNNING == mState ||
388 PAUSED_WHILE_HIDDEN == mState )
390 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
395 mThreadController->Stop();
397 // Delete the TTS player
398 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
402 mTtsPlayers[i].Reset();
406 delete mEventHandler;
407 mEventHandler = NULL;
409 delete mNotificationTrigger;
410 mNotificationTrigger = NULL;
412 mCallbackManager->Stop();
418 void Adaptor::ContextLost()
420 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
423 void Adaptor::ContextRegained()
425 // Inform core, so that texture resources can be reloaded
426 mCore->RecoverFromContextLoss();
428 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
431 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
433 mEventHandler->FeedTouchPoint( point, timeStamp );
436 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
438 mEventHandler->FeedWheelEvent( wheelEvent );
441 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
443 mEventHandler->FeedKeyEvent( keyEvent );
446 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
448 PositionSize positionSize = surface.GetPositionSize();
450 // let the core know the surface size has changed
451 mCore->SurfaceResized( positionSize.width, positionSize.height );
453 mResizedSignal.Emit( mAdaptor );
455 mNativeWindow = nativeWindow;
458 // flush the event queue to give the update-render thread chance
459 // to start processing messages for new camera setup etc as soon as possible
462 // this method blocks until the render thread has completed the replace.
463 mThreadController->ReplaceSurface(mSurface);
466 RenderSurface& Adaptor::GetSurface() const
471 void Adaptor::ReleaseSurfaceLock()
473 mSurface->ReleaseLock();
476 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
478 if(!mTtsPlayers[mode])
480 // Create the TTS player when it needed, because it can reduce launching time.
481 mTtsPlayers[mode] = TtsPlayer::New(mode);
484 return mTtsPlayers[mode];
487 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
489 bool idleAdded(false);
491 // Only add an idle if the Adaptor is actually running
492 if( RUNNING == mState || READY == mState || forceAdd )
494 idleAdded = mCallbackManager->AddIdleCallback( callback );
500 void Adaptor::RemoveIdle( CallbackBase* callback )
502 mCallbackManager->RemoveIdleCallback( callback );
505 Dali::Adaptor& Adaptor::Get()
507 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
508 return gThreadLocalAdaptor->mAdaptor;
511 bool Adaptor::IsAvailable()
513 return gThreadLocalAdaptor != NULL;
516 void Adaptor::SceneCreated()
518 mCore->SceneCreated();
521 Dali::Integration::Core& Adaptor::GetCore()
526 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
528 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
531 void Adaptor::SetUseHardwareVSync( bool useHardware )
533 mVSyncMonitor->SetUseHardwareVSync( useHardware );
536 EglFactory& Adaptor::GetEGLFactory() const
538 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
542 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
547 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
549 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
553 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
555 return *mPlatformAbstraction;
558 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
563 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
565 return *mNotificationTrigger;
568 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
570 return mTriggerEventFactory;
573 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
575 return mSocketFactory;
578 RenderSurface* Adaptor::GetRenderSurfaceInterface()
583 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
585 return mVSyncMonitor;
588 TraceInterface& Adaptor::GetKernelTraceInterface()
590 return mKernelTracer;
593 TraceInterface& Adaptor::GetSystemTraceInterface()
595 return mSystemTracer;
598 PerformanceInterface* Adaptor::GetPerformanceInterface()
600 return mPerformanceInterface;
603 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
605 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
606 return *mPlatformAbstraction;
609 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
611 mDragAndDropDetector = detector;
615 mEventHandler->SetDragAndDropDetector( detector );
619 void Adaptor::SetRotationObserver( RotationObserver* observer )
623 mEventHandler->SetRotationObserver( observer );
625 else if( mState == READY )
627 // Set once event handler exists
628 mDeferredRotationObserver = observer;
632 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
634 if(mTtsPlayers[mode])
636 mTtsPlayers[mode].Reset();
640 void Adaptor::SetMinimumPinchDistance(float distance)
642 if( mGestureManager )
644 mGestureManager->SetMinimumPinchDistance(distance);
648 Any Adaptor::GetNativeWindowHandle()
650 return mNativeWindow;
653 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
655 mUseRemoteSurface = useRemoteSurface;
658 void Adaptor::AddObserver( LifeCycleObserver& observer )
660 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
662 if ( match == mObservers.end() )
664 mObservers.push_back( &observer );
668 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
670 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
672 if ( match != mObservers.end() )
674 mObservers.erase( match );
678 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
682 mCore->QueueEvent(event);
686 void Adaptor::ProcessCoreEvents()
690 if( mPerformanceInterface )
692 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
695 mCore->ProcessEvents();
697 if( mPerformanceInterface )
699 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
704 void Adaptor::RequestUpdate( bool forceUpdate )
710 mThreadController->RequestUpdate();
714 case PAUSED_WHILE_HIDDEN:
716 // When Dali applications are partially visible behind the lock-screen,
717 // the indicator must be updated (therefore allow updates in the PAUSED state)
720 mThreadController->RequestUpdateOnce();
732 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
734 // Only request a notification if the Adaptor is actually running
735 // and we haven't installed the idle notification
736 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
738 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
742 void Adaptor::OnWindowShown()
744 if ( PAUSED_WHILE_HIDDEN == mState )
746 // Adaptor can now be resumed
751 // Force a render task
756 void Adaptor::OnWindowHidden()
758 if ( RUNNING == mState )
762 // Adaptor cannot be resumed until the window is shown
763 mState = PAUSED_WHILE_HIDDEN;
767 // Dali::Internal::Adaptor::Adaptor::OnDamaged
768 void Adaptor::OnDamaged( const DamageArea& area )
770 // This is needed for the case where Dali window is partially obscured
771 RequestUpdate( false );
774 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
776 // let the core know the surface size has changed
777 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
779 mResizedSignal.Emit( mAdaptor );
782 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
784 // flush the event queue to give the update-render thread chance
785 // to start processing messages for new camera setup etc as soon as possible
788 // this method blocks until the render thread has completed the resizing.
789 mThreadController->ResizeSurface();
792 void Adaptor::NotifySceneCreated()
794 GetCore().SceneCreated();
796 // Start thread controller after the scene has been created
797 mThreadController->Start();
799 // process after surface is created (registering to remote surface provider if required)
800 SurfaceInitialized();
805 void Adaptor::NotifyLanguageChanged()
807 mLanguageChangedSignal.Emit( mAdaptor );
810 void Adaptor::RenderOnce()
815 void Adaptor::RequestUpdateOnce()
817 if( mThreadController )
819 mThreadController->RequestUpdateOnce();
823 void Adaptor::IndicatorSizeChanged(int height)
825 // let the core know the indicator height is changed
826 mCore->SetTopMargin(height);
829 void Adaptor::ProcessCoreEventsFromIdle()
833 // the idle handle automatically un-installs itself
834 mNotificationOnIdleInstalled = false;
837 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
839 mLanguageChangedSignal(),
843 mThreadController( NULL ),
844 mVSyncMonitor( NULL ),
848 mNativeWindow( nativeWindow ),
850 mPlatformAbstraction( NULL ),
851 mEventHandler( NULL ),
852 mCallbackManager( NULL ),
853 mNotificationOnIdleInstalled( false ),
854 mNotificationTrigger( NULL ),
855 mGestureManager( NULL ),
856 mDaliFeedbackPlugin(),
857 mFeedbackController( NULL ),
860 mDragAndDropDetector(),
861 mDeferredRotationObserver( NULL ),
862 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
863 mPerformanceInterface( NULL ),
866 mTriggerEventFactory(),
867 mObjectProfiler( NULL ),
870 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
871 mUseRemoteSurface( false )
873 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
874 gThreadLocalAdaptor = this;
879 void Adaptor::SetViewMode( ViewMode viewMode )
881 mSurface->SetViewMode( viewMode );
882 mCore->SetViewMode( viewMode );
885 ViewMode Adaptor::GetViewMode() const
887 return mCore->GetViewMode();
890 void Adaptor::SetStereoBase( float stereoBase )
892 mCore->SetStereoBase( stereoBase );
895 float Adaptor::GetStereoBase() const
897 return mCore->GetStereoBase();
900 void Adaptor::SetRootLayoutDirection( std::string locale )
902 Dali::Stage stage = Dali::Stage::GetCurrent();
904 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
905 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
908 void Adaptor::SetWindow( Dali::Window window )
913 Dali::Window Adaptor::GetWindow()
918 } // namespace Adaptor
920 } // namespace Internal