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 <dali/internal/adaptor/common/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 <dali/internal/system/common/thread-controller.h>
35 #include <dali/internal/system/common/performance-interface-factory.h>
36 #include <dali/internal/adaptor/common/lifecycle-observer.h>
38 #include <dali/devel-api/text-abstraction/font-client.h>
40 #include <dali/internal/system/common/callback-manager.h>
41 #include <dali/devel-api/adaptor-framework/render-surface.h>
42 #include <dali/internal/accessibility/common/tts-player-impl.h>
43 #include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
44 #include <dali/internal/input/common/gesture-manager.h>
45 #include <dali/internal/window-system/common/event-handler.h>
46 #include <dali/internal/graphics/gles20/gl-proxy-implementation.h>
47 #include <dali/internal/graphics/gles20/gl-implementation.h>
48 #include <dali/internal/graphics/gles20/egl-sync-implementation.h>
49 #include <dali/internal/graphics/common/egl-image-extensions.h>
50 #include <dali/internal/graphics/gles20/egl-factory.h>
51 #include <dali/internal/input/common/imf-manager-impl.h>
52 #include <dali/internal/clipboard/common/clipboard-impl.h>
53 #include <dali/internal/graphics/common/vsync-monitor.h>
54 #include <dali/internal/system/common/object-profiler.h>
55 #include <dali/internal/window-system/common/display-connection.h>
56 #include <dali/internal/window-system/common/window-impl.h>
58 #include <dali/internal/system/common/logging.h>
59 #include <dali/devel-api/adaptor-framework/image-loading.h>
61 #include <dali/internal/system/common/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 );
96 windowImpl.SetAdaptor(*adaptor);
100 void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
102 // all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
103 Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
104 mEnvironmentOptions->SetLogFunction( logFunction );
105 mEnvironmentOptions->InstallLogFunction(); // install logging for main thread
107 mPlatformAbstraction = new TizenPlatform::TizenPlatformAbstraction;
110 GetDataStoragePath( path );
111 mPlatformAbstraction->SetDataStoragePath( path );
113 ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
114 if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
116 dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
118 // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
119 // files automatically.
121 if( mEnvironmentOptions->PerformanceServerRequired() )
123 mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
126 mCallbackManager = CallbackManager::New();
128 PositionSize size = mSurface->GetPositionSize();
130 mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
132 if( mEnvironmentOptions->GetGlesCallTime() > 0 )
134 mGLES = new GlProxyImplementation( *mEnvironmentOptions );
138 mGLES = new GlImplementation();
141 const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() );
142 const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() );
144 mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable );
146 EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
148 mCore = Integration::Core::New( *this,
149 *mPlatformAbstraction,
153 dataRetentionPolicy ,
154 ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
155 depthBufferAvailable,
156 stencilBufferAvailable );
158 const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
159 if( 0u < timeInterval )
161 mObjectProfiler = new ObjectProfiler( timeInterval );
164 mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
166 mVSyncMonitor = new VSyncMonitor;
168 mThreadController = new ThreadController( *this, *mEnvironmentOptions );
170 // Should be called after Core creation
171 if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
173 Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
175 if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
177 Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
179 if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
181 Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
183 if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
185 Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
187 if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
189 Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
191 if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
193 Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
195 if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
197 Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
199 if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
201 Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
203 if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 )
205 Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false );
207 if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 )
209 Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() );
211 if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 )
213 Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false );
215 if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 )
217 Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false );
219 if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 )
221 Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() );
223 if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f )
225 Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() );
227 if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f )
229 Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() );
231 if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 )
233 Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() );
236 // Set max texture size
237 if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
239 Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
242 SetupSystemInformation();
247 // Ensure stop status
250 // set to NULL first as we do not want any access to Adaptor as it is being destroyed.
251 gThreadLocalAdaptor = NULL;
253 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
255 (*iter)->OnDestroy();
258 delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
259 delete mVSyncMonitor;
260 delete mEventHandler;
261 delete mObjectProfiler;
266 delete mGestureManager;
267 delete mPlatformAbstraction;
268 delete mCallbackManager;
269 delete mPerformanceInterface;
271 // uninstall it on this thread (main actor thread)
272 Dali::Integration::Log::UninstallLogFunction();
274 // Delete environment options if we own it
275 if( mEnvironmentOptionsOwned )
277 delete mEnvironmentOptions;
281 void Adaptor::Start()
283 // it doesn't support restart after stop at this moment
284 // to support restarting, need more testing
285 if( READY != mState )
290 // Start the callback manager
291 mCallbackManager->Start();
293 // create event handler
294 mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
296 if( mDeferredRotationObserver != NULL )
298 mEventHandler->SetRotationObserver(mDeferredRotationObserver);
299 mDeferredRotationObserver = NULL;
302 unsigned int dpiHor, dpiVer;
304 Dali::DisplayConnection::GetDpi(dpiHor, dpiVer);
306 // tell core about the DPI value
307 mCore->SetDpi(dpiHor, dpiVer);
309 // set the DPI value for font rendering
310 FontClient fontClient = FontClient::Get();
311 fontClient.SetDpi( dpiHor, dpiVer );
313 // Tell the core the size of the surface just before we start the render-thread
314 PositionSize size = mSurface->GetPositionSize();
315 mCore->SurfaceResized( size.width, size.height );
317 // Initialize the thread controller
318 mThreadController->Initialize();
320 ProcessCoreEvents(); // Ensure any startup messages are processed.
322 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
328 // Dali::Internal::Adaptor::Adaptor::Pause
329 void Adaptor::Pause()
331 // Only pause the adaptor if we're actually running.
332 if( RUNNING == mState )
334 // Inform observers that we are about to be paused.
335 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
340 // Reset the event handler when adaptor paused
343 mEventHandler->Pause();
346 mThreadController->Pause();
349 // Ensure any messages queued during pause callbacks are processed by doing another update.
354 // Dali::Internal::Adaptor::Adaptor::Resume
355 void Adaptor::Resume()
357 // Only resume the adaptor if we are in the suspended state.
358 if( PAUSED == mState )
362 // Reset the event handler when adaptor resumed
365 mEventHandler->Resume();
368 // Inform observers that we have resumed.
369 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
374 // trigger processing of events queued up while paused
375 mCore->ProcessEvents();
377 // Do at end to ensure our first update/render after resumption includes the processed messages as well
378 mThreadController->Resume();
384 if( RUNNING == mState ||
386 PAUSED_WHILE_HIDDEN == mState )
388 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
393 mThreadController->Stop();
395 // Delete the TTS player
396 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
400 mTtsPlayers[i].Reset();
404 delete mEventHandler;
405 mEventHandler = NULL;
407 delete mNotificationTrigger;
408 mNotificationTrigger = NULL;
410 mCallbackManager->Stop();
416 void Adaptor::ContextLost()
418 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
421 void Adaptor::ContextRegained()
423 // Inform core, so that texture resources can be reloaded
424 mCore->RecoverFromContextLoss();
426 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
429 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
431 mEventHandler->FeedTouchPoint( point, timeStamp );
434 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
436 mEventHandler->FeedWheelEvent( wheelEvent );
439 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
441 mEventHandler->FeedKeyEvent( keyEvent );
444 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
446 PositionSize positionSize = surface.GetPositionSize();
448 // let the core know the surface size has changed
449 mCore->SurfaceResized( positionSize.width, positionSize.height );
451 mResizedSignal.Emit( mAdaptor );
453 mNativeWindow = nativeWindow;
456 // flush the event queue to give the update-render thread chance
457 // to start processing messages for new camera setup etc as soon as possible
460 // this method blocks until the render thread has completed the replace.
461 mThreadController->ReplaceSurface(mSurface);
464 RenderSurface& Adaptor::GetSurface() const
469 void Adaptor::ReleaseSurfaceLock()
471 mSurface->ReleaseLock();
474 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
476 if(!mTtsPlayers[mode])
478 // Create the TTS player when it needed, because it can reduce launching time.
479 mTtsPlayers[mode] = TtsPlayer::New(mode);
482 return mTtsPlayers[mode];
485 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
487 bool idleAdded(false);
489 // Only add an idle if the Adaptor is actually running
490 if( RUNNING == mState || READY == mState || forceAdd )
492 idleAdded = mCallbackManager->AddIdleCallback( callback );
498 void Adaptor::RemoveIdle( CallbackBase* callback )
500 mCallbackManager->RemoveIdleCallback( callback );
503 Dali::Adaptor& Adaptor::Get()
505 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
506 return gThreadLocalAdaptor->mAdaptor;
509 bool Adaptor::IsAvailable()
511 return gThreadLocalAdaptor != NULL;
514 void Adaptor::SceneCreated()
516 mCore->SceneCreated();
519 Dali::Integration::Core& Adaptor::GetCore()
524 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
526 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
529 void Adaptor::SetUseHardwareVSync( bool useHardware )
531 mVSyncMonitor->SetUseHardwareVSync( useHardware );
534 EglFactory& Adaptor::GetEGLFactory() const
536 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
540 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
545 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
547 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
551 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
553 return *mPlatformAbstraction;
556 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
561 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
563 return *mNotificationTrigger;
566 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
568 return mTriggerEventFactory;
571 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
573 return mSocketFactory;
576 RenderSurface* Adaptor::GetRenderSurfaceInterface()
581 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
583 return mVSyncMonitor;
586 TraceInterface& Adaptor::GetKernelTraceInterface()
588 return mKernelTracer;
591 TraceInterface& Adaptor::GetSystemTraceInterface()
593 return mSystemTracer;
596 PerformanceInterface* Adaptor::GetPerformanceInterface()
598 return mPerformanceInterface;
601 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
603 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
604 return *mPlatformAbstraction;
607 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
609 mDragAndDropDetector = detector;
613 mEventHandler->SetDragAndDropDetector( detector );
617 void Adaptor::SetRotationObserver( RotationObserver* observer )
621 mEventHandler->SetRotationObserver( observer );
623 else if( mState == READY )
625 // Set once event handler exists
626 mDeferredRotationObserver = observer;
630 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
632 if(mTtsPlayers[mode])
634 mTtsPlayers[mode].Reset();
638 void Adaptor::SetMinimumPinchDistance(float distance)
640 if( mGestureManager )
642 mGestureManager->SetMinimumPinchDistance(distance);
646 Any Adaptor::GetNativeWindowHandle()
648 return mNativeWindow;
651 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
653 mUseRemoteSurface = useRemoteSurface;
656 void Adaptor::AddObserver( LifeCycleObserver& observer )
658 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
660 if ( match == mObservers.end() )
662 mObservers.push_back( &observer );
666 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
668 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
670 if ( match != mObservers.end() )
672 mObservers.erase( match );
676 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
680 mCore->QueueEvent(event);
684 void Adaptor::ProcessCoreEvents()
688 if( mPerformanceInterface )
690 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
693 mCore->ProcessEvents();
695 if( mPerformanceInterface )
697 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
702 void Adaptor::RequestUpdate( bool forceUpdate )
708 mThreadController->RequestUpdate();
712 case PAUSED_WHILE_HIDDEN:
714 // When Dali applications are partially visible behind the lock-screen,
715 // the indicator must be updated (therefore allow updates in the PAUSED state)
718 mThreadController->RequestUpdateOnce();
730 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
732 // Only request a notification if the Adaptor is actually running
733 // and we haven't installed the idle notification
734 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
736 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
740 void Adaptor::OnWindowShown()
742 if ( PAUSED_WHILE_HIDDEN == mState )
744 // Adaptor can now be resumed
749 // Force a render task
754 void Adaptor::OnWindowHidden()
756 if ( RUNNING == mState )
760 // Adaptor cannot be resumed until the window is shown
761 mState = PAUSED_WHILE_HIDDEN;
765 // Dali::Internal::Adaptor::Adaptor::OnDamaged
766 void Adaptor::OnDamaged( const DamageArea& area )
768 // This is needed for the case where Dali window is partially obscured
769 RequestUpdate( false );
772 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
774 // let the core know the surface size has changed
775 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
777 mResizedSignal.Emit( mAdaptor );
780 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
782 // flush the event queue to give the update-render thread chance
783 // to start processing messages for new camera setup etc as soon as possible
786 // this method blocks until the render thread has completed the resizing.
787 mThreadController->ResizeSurface();
790 void Adaptor::NotifySceneCreated()
792 GetCore().SceneCreated();
794 // Start thread controller after the scene has been created
795 mThreadController->Start();
797 // process after surface is created (registering to remote surface provider if required)
798 SurfaceInitialized();
803 void Adaptor::NotifyLanguageChanged()
805 mLanguageChangedSignal.Emit( mAdaptor );
808 void Adaptor::RenderOnce()
813 const LogFactoryInterface& Adaptor::GetLogFactory()
815 return *mEnvironmentOptions;
818 void Adaptor::RequestUpdateOnce()
820 if( mThreadController )
822 mThreadController->RequestUpdateOnce();
826 void Adaptor::IndicatorSizeChanged(int height)
828 // let the core know the indicator height is changed
829 mCore->SetTopMargin(height);
832 void Adaptor::ProcessCoreEventsFromIdle()
836 // the idle handle automatically un-installs itself
837 mNotificationOnIdleInstalled = false;
840 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
842 mLanguageChangedSignal(),
846 mThreadController( NULL ),
847 mVSyncMonitor( NULL ),
851 mNativeWindow( nativeWindow ),
853 mPlatformAbstraction( NULL ),
854 mEventHandler( NULL ),
855 mCallbackManager( NULL ),
856 mNotificationOnIdleInstalled( false ),
857 mNotificationTrigger( NULL ),
858 mGestureManager( NULL ),
859 mDaliFeedbackPlugin(),
860 mFeedbackController( NULL ),
863 mDragAndDropDetector(),
864 mDeferredRotationObserver( NULL ),
865 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
866 mPerformanceInterface( NULL ),
869 mTriggerEventFactory(),
870 mObjectProfiler( NULL ),
872 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
873 mUseRemoteSurface( false )
875 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
876 gThreadLocalAdaptor = this;
881 void Adaptor::SetViewMode( ViewMode viewMode )
883 mSurface->SetViewMode( viewMode );
884 mCore->SetViewMode( viewMode );
887 ViewMode Adaptor::GetViewMode() const
889 return mCore->GetViewMode();
892 void Adaptor::SetStereoBase( float stereoBase )
894 mCore->SetStereoBase( stereoBase );
897 float Adaptor::GetStereoBase() const
899 return mCore->GetStereoBase();
902 void Adaptor::SetRootLayoutDirection( std::string locale )
904 Dali::Stage stage = Dali::Stage::GetCurrent();
906 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
907 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
910 } // namespace Adaptor
912 } // namespace Internal