2 * Copyright (c) 2018 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 mEnvironmentOptions->CreateTraceManager( mPerformanceInterface );
127 mEnvironmentOptions->InstallTraceFunction(); // install tracing for main thread
129 mCallbackManager = CallbackManager::New();
131 PositionSize size = mSurface->GetPositionSize();
133 mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
135 if( mEnvironmentOptions->GetGlesCallTime() > 0 )
137 mGLES = new GlProxyImplementation( *mEnvironmentOptions );
141 mGLES = new GlImplementation();
144 const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() );
145 const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() );
147 mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable );
149 EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
151 mCore = Integration::Core::New( *this,
152 *mPlatformAbstraction,
156 dataRetentionPolicy ,
157 ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
158 depthBufferAvailable,
159 stencilBufferAvailable );
161 const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
162 if( 0u < timeInterval )
164 mObjectProfiler = new ObjectProfiler( timeInterval );
167 mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
169 mVSyncMonitor = new VSyncMonitor;
171 mThreadController = new ThreadController( *this, *mEnvironmentOptions );
173 // Should be called after Core creation
174 if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
176 Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
178 if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
180 Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
182 if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
184 Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
186 if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
188 Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
190 if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
192 Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
194 if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
196 Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
198 if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
200 Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
202 if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
204 Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
206 if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 )
208 Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false );
210 if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 )
212 Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() );
214 if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 )
216 Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false );
218 if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 )
220 Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false );
222 if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 )
224 Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() );
226 if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f )
228 Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() );
230 if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f )
232 Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() );
234 if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 )
236 Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() );
239 // Set max texture size
240 if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
242 Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
245 SetupSystemInformation();
250 // Ensure stop status
253 // set to NULL first as we do not want any access to Adaptor as it is being destroyed.
254 gThreadLocalAdaptor = NULL;
256 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
258 (*iter)->OnDestroy();
261 delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
262 delete mVSyncMonitor;
263 delete mEventHandler;
264 delete mObjectProfiler;
269 delete mGestureManager;
270 delete mPlatformAbstraction;
271 delete mCallbackManager;
272 delete mPerformanceInterface;
274 // uninstall it on this thread (main actor thread)
275 Dali::Integration::Log::UninstallLogFunction();
277 // Delete environment options if we own it
278 if( mEnvironmentOptionsOwned )
280 delete mEnvironmentOptions;
284 void Adaptor::Start()
286 // it doesn't support restart after stop at this moment
287 // to support restarting, need more testing
288 if( READY != mState )
293 // Start the callback manager
294 mCallbackManager->Start();
296 // create event handler
297 mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
299 if( mDeferredRotationObserver != NULL )
301 mEventHandler->SetRotationObserver(mDeferredRotationObserver);
302 mDeferredRotationObserver = NULL;
305 unsigned int dpiHor, dpiVer;
307 Dali::DisplayConnection::GetDpi(dpiHor, dpiVer);
309 // tell core about the DPI value
310 mCore->SetDpi(dpiHor, dpiVer);
312 // set the DPI value for font rendering
313 FontClient fontClient = FontClient::Get();
314 fontClient.SetDpi( dpiHor, dpiVer );
316 // Tell the core the size of the surface just before we start the render-thread
317 PositionSize size = mSurface->GetPositionSize();
318 mCore->SurfaceResized( size.width, size.height );
320 // Initialize the thread controller
321 mThreadController->Initialize();
323 ProcessCoreEvents(); // Ensure any startup messages are processed.
325 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
331 // Dali::Internal::Adaptor::Adaptor::Pause
332 void Adaptor::Pause()
334 // Only pause the adaptor if we're actually running.
335 if( RUNNING == mState )
337 // Inform observers that we are about to be paused.
338 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
343 // Reset the event handler when adaptor paused
346 mEventHandler->Pause();
349 mThreadController->Pause();
352 // Ensure any messages queued during pause callbacks are processed by doing another update.
357 // Dali::Internal::Adaptor::Adaptor::Resume
358 void Adaptor::Resume()
360 // Only resume the adaptor if we are in the suspended state.
361 if( PAUSED == mState )
365 // Reset the event handler when adaptor resumed
368 mEventHandler->Resume();
371 // Inform observers that we have resumed.
372 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
377 // trigger processing of events queued up while paused
378 mCore->ProcessEvents();
380 // Do at end to ensure our first update/render after resumption includes the processed messages as well
381 mThreadController->Resume();
387 if( RUNNING == mState ||
389 PAUSED_WHILE_HIDDEN == mState )
391 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
396 mThreadController->Stop();
398 // Delete the TTS player
399 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
403 mTtsPlayers[i].Reset();
407 delete mEventHandler;
408 mEventHandler = NULL;
410 delete mNotificationTrigger;
411 mNotificationTrigger = NULL;
413 mCallbackManager->Stop();
419 void Adaptor::ContextLost()
421 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
424 void Adaptor::ContextRegained()
426 // Inform core, so that texture resources can be reloaded
427 mCore->RecoverFromContextLoss();
429 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
432 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
434 mEventHandler->FeedTouchPoint( point, timeStamp );
437 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
439 mEventHandler->FeedWheelEvent( wheelEvent );
442 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
444 mEventHandler->FeedKeyEvent( keyEvent );
447 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
449 PositionSize positionSize = surface.GetPositionSize();
451 // let the core know the surface size has changed
452 mCore->SurfaceResized( positionSize.width, positionSize.height );
454 mResizedSignal.Emit( mAdaptor );
456 mNativeWindow = nativeWindow;
459 // flush the event queue to give the update-render thread chance
460 // to start processing messages for new camera setup etc as soon as possible
463 // this method blocks until the render thread has completed the replace.
464 mThreadController->ReplaceSurface(mSurface);
467 RenderSurface& Adaptor::GetSurface() const
472 void Adaptor::ReleaseSurfaceLock()
474 mSurface->ReleaseLock();
477 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
479 if(!mTtsPlayers[mode])
481 // Create the TTS player when it needed, because it can reduce launching time.
482 mTtsPlayers[mode] = TtsPlayer::New(mode);
485 return mTtsPlayers[mode];
488 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
490 bool idleAdded(false);
492 // Only add an idle if the Adaptor is actually running
493 if( RUNNING == mState || READY == mState || forceAdd )
495 idleAdded = mCallbackManager->AddIdleCallback( callback );
501 void Adaptor::RemoveIdle( CallbackBase* callback )
503 mCallbackManager->RemoveIdleCallback( callback );
506 Dali::Adaptor& Adaptor::Get()
508 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
509 return gThreadLocalAdaptor->mAdaptor;
512 bool Adaptor::IsAvailable()
514 return gThreadLocalAdaptor != NULL;
517 void Adaptor::SceneCreated()
519 mCore->SceneCreated();
522 Dali::Integration::Core& Adaptor::GetCore()
527 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
529 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
532 void Adaptor::SetUseHardwareVSync( bool useHardware )
534 mVSyncMonitor->SetUseHardwareVSync( useHardware );
537 EglFactory& Adaptor::GetEGLFactory() const
539 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
543 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
548 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
550 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
554 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
556 return *mPlatformAbstraction;
559 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
564 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
566 return *mNotificationTrigger;
569 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
571 return mTriggerEventFactory;
574 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
576 return mSocketFactory;
579 RenderSurface* Adaptor::GetRenderSurfaceInterface()
584 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
586 return mVSyncMonitor;
589 TraceInterface& Adaptor::GetKernelTraceInterface()
591 return mKernelTracer;
594 TraceInterface& Adaptor::GetSystemTraceInterface()
596 return mSystemTracer;
599 PerformanceInterface* Adaptor::GetPerformanceInterface()
601 return mPerformanceInterface;
604 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
606 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
607 return *mPlatformAbstraction;
610 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
612 mDragAndDropDetector = detector;
616 mEventHandler->SetDragAndDropDetector( detector );
620 void Adaptor::SetRotationObserver( RotationObserver* observer )
624 mEventHandler->SetRotationObserver( observer );
626 else if( mState == READY )
628 // Set once event handler exists
629 mDeferredRotationObserver = observer;
633 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
635 if(mTtsPlayers[mode])
637 mTtsPlayers[mode].Reset();
641 void Adaptor::SetMinimumPinchDistance(float distance)
643 if( mGestureManager )
645 mGestureManager->SetMinimumPinchDistance(distance);
649 Any Adaptor::GetNativeWindowHandle()
651 return mNativeWindow;
654 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
656 mUseRemoteSurface = useRemoteSurface;
659 void Adaptor::AddObserver( LifeCycleObserver& observer )
661 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
663 if ( match == mObservers.end() )
665 mObservers.push_back( &observer );
669 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
671 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
673 if ( match != mObservers.end() )
675 mObservers.erase( match );
679 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
683 mCore->QueueEvent(event);
687 void Adaptor::ProcessCoreEvents()
691 if( mPerformanceInterface )
693 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
696 mCore->ProcessEvents();
698 if( mPerformanceInterface )
700 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
705 void Adaptor::RequestUpdate( bool forceUpdate )
711 mThreadController->RequestUpdate();
715 case PAUSED_WHILE_HIDDEN:
717 // When Dali applications are partially visible behind the lock-screen,
718 // the indicator must be updated (therefore allow updates in the PAUSED state)
721 mThreadController->RequestUpdateOnce();
733 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
735 // Only request a notification if the Adaptor is actually running
736 // and we haven't installed the idle notification
737 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
739 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
743 void Adaptor::OnWindowShown()
745 if ( PAUSED_WHILE_HIDDEN == mState )
747 // Adaptor can now be resumed
752 // Force a render task
757 void Adaptor::OnWindowHidden()
759 if ( RUNNING == mState )
763 // Adaptor cannot be resumed until the window is shown
764 mState = PAUSED_WHILE_HIDDEN;
768 // Dali::Internal::Adaptor::Adaptor::OnDamaged
769 void Adaptor::OnDamaged( const DamageArea& area )
771 // This is needed for the case where Dali window is partially obscured
772 RequestUpdate( false );
775 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
777 // let the core know the surface size has changed
778 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
780 mResizedSignal.Emit( mAdaptor );
783 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
785 // flush the event queue to give the update-render thread chance
786 // to start processing messages for new camera setup etc as soon as possible
789 // this method blocks until the render thread has completed the resizing.
790 mThreadController->ResizeSurface();
793 void Adaptor::NotifySceneCreated()
795 GetCore().SceneCreated();
797 // Start thread controller after the scene has been created
798 mThreadController->Start();
800 // process after surface is created (registering to remote surface provider if required)
801 SurfaceInitialized();
806 void Adaptor::NotifyLanguageChanged()
808 mLanguageChangedSignal.Emit( mAdaptor );
811 void Adaptor::RenderOnce()
816 const LogFactoryInterface& Adaptor::GetLogFactory()
818 return *mEnvironmentOptions;
821 void Adaptor::RequestUpdateOnce()
823 if( mThreadController )
825 mThreadController->RequestUpdateOnce();
829 void Adaptor::IndicatorSizeChanged(int height)
831 // let the core know the indicator height is changed
832 mCore->SetTopMargin(height);
835 void Adaptor::ProcessCoreEventsFromIdle()
839 // the idle handle automatically un-installs itself
840 mNotificationOnIdleInstalled = false;
843 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
845 mLanguageChangedSignal(),
849 mThreadController( NULL ),
850 mVSyncMonitor( NULL ),
854 mNativeWindow( nativeWindow ),
856 mPlatformAbstraction( NULL ),
857 mEventHandler( NULL ),
858 mCallbackManager( NULL ),
859 mNotificationOnIdleInstalled( false ),
860 mNotificationTrigger( NULL ),
861 mGestureManager( NULL ),
862 mDaliFeedbackPlugin(),
863 mFeedbackController( NULL ),
866 mDragAndDropDetector(),
867 mDeferredRotationObserver( NULL ),
868 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
869 mPerformanceInterface( NULL ),
872 mTriggerEventFactory(),
873 mObjectProfiler( NULL ),
875 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
876 mUseRemoteSurface( false )
878 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
879 gThreadLocalAdaptor = this;
884 void Adaptor::SetViewMode( ViewMode viewMode )
886 mSurface->SetViewMode( viewMode );
887 mCore->SetViewMode( viewMode );
890 ViewMode Adaptor::GetViewMode() const
892 return mCore->GetViewMode();
895 void Adaptor::SetStereoBase( float stereoBase )
897 mCore->SetStereoBase( stereoBase );
900 float Adaptor::GetStereoBase() const
902 return mCore->GetStereoBase();
905 void Adaptor::SetRootLayoutDirection( std::string locale )
907 Dali::Stage stage = Dali::Stage::GetCurrent();
909 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
910 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
913 } // namespace Adaptor
915 } // namespace Internal