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;
305 Dali::DisplayConnection::GetDpi( mNativeWindow, dpiHor, dpiVer );
307 Dali::DisplayConnection::GetDpi( dpiHor, dpiVer );
310 // tell core about the DPI value
311 mCore->SetDpi(dpiHor, dpiVer);
313 // set the DPI value for font rendering
314 FontClient fontClient = FontClient::Get();
315 fontClient.SetDpi( dpiHor, dpiVer );
317 // Tell the core the size of the surface just before we start the render-thread
318 PositionSize size = mSurface->GetPositionSize();
319 mCore->SurfaceResized( size.width, size.height );
321 // Initialize the thread controller
322 mThreadController->Initialize();
324 ProcessCoreEvents(); // Ensure any startup messages are processed.
326 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
332 // Dali::Internal::Adaptor::Adaptor::Pause
333 void Adaptor::Pause()
335 // Only pause the adaptor if we're actually running.
336 if( RUNNING == mState )
338 // Inform observers that we are about to be paused.
339 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
344 // Reset the event handler when adaptor paused
347 mEventHandler->Pause();
350 mThreadController->Pause();
353 // Ensure any messages queued during pause callbacks are processed by doing another update.
358 // Dali::Internal::Adaptor::Adaptor::Resume
359 void Adaptor::Resume()
361 // Only resume the adaptor if we are in the suspended state.
362 if( PAUSED == mState )
366 // Reset the event handler when adaptor resumed
369 mEventHandler->Resume();
372 // Inform observers that we have resumed.
373 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
378 // trigger processing of events queued up while paused
379 mCore->ProcessEvents();
381 // Do at end to ensure our first update/render after resumption includes the processed messages as well
382 mThreadController->Resume();
388 if( RUNNING == mState ||
390 PAUSED_WHILE_HIDDEN == mState )
392 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
397 mThreadController->Stop();
399 // Delete the TTS player
400 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
404 mTtsPlayers[i].Reset();
408 delete mEventHandler;
409 mEventHandler = NULL;
411 delete mNotificationTrigger;
412 mNotificationTrigger = NULL;
414 mCallbackManager->Stop();
420 void Adaptor::ContextLost()
422 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
425 void Adaptor::ContextRegained()
427 // Inform core, so that texture resources can be reloaded
428 mCore->RecoverFromContextLoss();
430 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
433 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
435 mEventHandler->FeedTouchPoint( point, timeStamp );
438 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
440 mEventHandler->FeedWheelEvent( wheelEvent );
443 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
445 mEventHandler->FeedKeyEvent( keyEvent );
448 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
450 PositionSize positionSize = surface.GetPositionSize();
452 // let the core know the surface size has changed
453 mCore->SurfaceResized( positionSize.width, positionSize.height );
455 mResizedSignal.Emit( mAdaptor );
457 mNativeWindow = nativeWindow;
460 // flush the event queue to give the update-render thread chance
461 // to start processing messages for new camera setup etc as soon as possible
464 // this method blocks until the render thread has completed the replace.
465 mThreadController->ReplaceSurface(mSurface);
468 RenderSurface& Adaptor::GetSurface() const
473 void Adaptor::ReleaseSurfaceLock()
475 mSurface->ReleaseLock();
478 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
480 if(!mTtsPlayers[mode])
482 // Create the TTS player when it needed, because it can reduce launching time.
483 mTtsPlayers[mode] = TtsPlayer::New(mode);
486 return mTtsPlayers[mode];
489 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
491 bool idleAdded(false);
493 // Only add an idle if the Adaptor is actually running
494 if( RUNNING == mState || READY == mState || forceAdd )
496 idleAdded = mCallbackManager->AddIdleCallback( callback );
502 void Adaptor::RemoveIdle( CallbackBase* callback )
504 mCallbackManager->RemoveIdleCallback( callback );
507 Dali::Adaptor& Adaptor::Get()
509 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
510 return gThreadLocalAdaptor->mAdaptor;
513 bool Adaptor::IsAvailable()
515 return gThreadLocalAdaptor != NULL;
518 void Adaptor::SceneCreated()
520 mCore->SceneCreated();
523 Dali::Integration::Core& Adaptor::GetCore()
528 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
530 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
533 void Adaptor::SetUseHardwareVSync( bool useHardware )
535 mVSyncMonitor->SetUseHardwareVSync( useHardware );
538 EglFactory& Adaptor::GetEGLFactory() const
540 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
544 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
549 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
551 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
555 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
557 return *mPlatformAbstraction;
560 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
565 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
567 return *mNotificationTrigger;
570 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
572 return mTriggerEventFactory;
575 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
577 return mSocketFactory;
580 RenderSurface* Adaptor::GetRenderSurfaceInterface()
585 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
587 return mVSyncMonitor;
590 TraceInterface& Adaptor::GetKernelTraceInterface()
592 return mKernelTracer;
595 TraceInterface& Adaptor::GetSystemTraceInterface()
597 return mSystemTracer;
600 PerformanceInterface* Adaptor::GetPerformanceInterface()
602 return mPerformanceInterface;
605 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
607 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
608 return *mPlatformAbstraction;
611 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
613 mDragAndDropDetector = detector;
617 mEventHandler->SetDragAndDropDetector( detector );
621 void Adaptor::SetRotationObserver( RotationObserver* observer )
625 mEventHandler->SetRotationObserver( observer );
627 else if( mState == READY )
629 // Set once event handler exists
630 mDeferredRotationObserver = observer;
634 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
636 if(mTtsPlayers[mode])
638 mTtsPlayers[mode].Reset();
642 void Adaptor::SetMinimumPinchDistance(float distance)
644 if( mGestureManager )
646 mGestureManager->SetMinimumPinchDistance(distance);
650 Any Adaptor::GetNativeWindowHandle()
652 return mNativeWindow;
655 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
657 mUseRemoteSurface = useRemoteSurface;
660 void Adaptor::AddObserver( LifeCycleObserver& observer )
662 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
664 if ( match == mObservers.end() )
666 mObservers.push_back( &observer );
670 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
672 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
674 if ( match != mObservers.end() )
676 mObservers.erase( match );
680 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
684 mCore->QueueEvent(event);
688 void Adaptor::ProcessCoreEvents()
692 if( mPerformanceInterface )
694 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
697 mCore->ProcessEvents();
699 if( mPerformanceInterface )
701 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
706 void Adaptor::RequestUpdate( bool forceUpdate )
712 mThreadController->RequestUpdate();
716 case PAUSED_WHILE_HIDDEN:
718 // When Dali applications are partially visible behind the lock-screen,
719 // the indicator must be updated (therefore allow updates in the PAUSED state)
722 mThreadController->RequestUpdateOnce();
734 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
736 // Only request a notification if the Adaptor is actually running
737 // and we haven't installed the idle notification
738 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
740 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
744 void Adaptor::OnWindowShown()
746 if ( PAUSED_WHILE_HIDDEN == mState )
748 // Adaptor can now be resumed
753 // Force a render task
758 void Adaptor::OnWindowHidden()
760 if ( RUNNING == mState )
764 // Adaptor cannot be resumed until the window is shown
765 mState = PAUSED_WHILE_HIDDEN;
769 // Dali::Internal::Adaptor::Adaptor::OnDamaged
770 void Adaptor::OnDamaged( const DamageArea& area )
772 // This is needed for the case where Dali window is partially obscured
773 RequestUpdate( false );
776 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
778 // let the core know the surface size has changed
779 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
781 mResizedSignal.Emit( mAdaptor );
784 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
786 // flush the event queue to give the update-render thread chance
787 // to start processing messages for new camera setup etc as soon as possible
790 // this method blocks until the render thread has completed the resizing.
791 mThreadController->ResizeSurface();
794 void Adaptor::NotifySceneCreated()
796 GetCore().SceneCreated();
798 // Start thread controller after the scene has been created
799 mThreadController->Start();
801 // process after surface is created (registering to remote surface provider if required)
802 SurfaceInitialized();
807 void Adaptor::NotifyLanguageChanged()
809 mLanguageChangedSignal.Emit( mAdaptor );
812 void Adaptor::RenderOnce()
817 const LogFactoryInterface& Adaptor::GetLogFactory()
819 return *mEnvironmentOptions;
822 void Adaptor::RequestUpdateOnce()
824 if( mThreadController )
826 mThreadController->RequestUpdateOnce();
830 void Adaptor::IndicatorSizeChanged(int height)
832 // let the core know the indicator height is changed
833 mCore->SetTopMargin(height);
836 void Adaptor::ProcessCoreEventsFromIdle()
840 // the idle handle automatically un-installs itself
841 mNotificationOnIdleInstalled = false;
844 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
846 mLanguageChangedSignal(),
850 mThreadController( NULL ),
851 mVSyncMonitor( NULL ),
855 mNativeWindow( nativeWindow ),
857 mPlatformAbstraction( NULL ),
858 mEventHandler( NULL ),
859 mCallbackManager( NULL ),
860 mNotificationOnIdleInstalled( false ),
861 mNotificationTrigger( NULL ),
862 mGestureManager( NULL ),
863 mDaliFeedbackPlugin(),
864 mFeedbackController( NULL ),
867 mDragAndDropDetector(),
868 mDeferredRotationObserver( NULL ),
869 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
870 mPerformanceInterface( NULL ),
873 mTriggerEventFactory(),
874 mObjectProfiler( NULL ),
876 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
877 mUseRemoteSurface( false )
879 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
880 gThreadLocalAdaptor = this;
885 void Adaptor::SetViewMode( ViewMode viewMode )
887 mSurface->SetViewMode( viewMode );
888 mCore->SetViewMode( viewMode );
891 ViewMode Adaptor::GetViewMode() const
893 return mCore->GetViewMode();
896 void Adaptor::SetStereoBase( float stereoBase )
898 mCore->SetStereoBase( stereoBase );
901 float Adaptor::GetStereoBase() const
903 return mCore->GetStereoBase();
906 void Adaptor::SetRootLayoutDirection( std::string locale )
908 Dali::Stage stage = Dali::Stage::GetCurrent();
910 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
911 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
914 } // namespace Adaptor
916 } // namespace Internal