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;
308 Dali::DisplayConnection::GetDpi( mNativeWindow, dpiHor, dpiVer );
310 Dali::DisplayConnection::GetDpi( dpiHor, dpiVer );
313 // tell core about the DPI value
314 mCore->SetDpi(dpiHor, dpiVer);
316 // set the DPI value for font rendering
317 FontClient fontClient = FontClient::Get();
318 fontClient.SetDpi( dpiHor, dpiVer );
320 // Tell the core the size of the surface just before we start the render-thread
321 PositionSize size = mSurface->GetPositionSize();
322 mCore->SurfaceResized( size.width, size.height );
324 // Initialize the thread controller
325 mThreadController->Initialize();
327 ProcessCoreEvents(); // Ensure any startup messages are processed.
329 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
335 // Dali::Internal::Adaptor::Adaptor::Pause
336 void Adaptor::Pause()
338 // Only pause the adaptor if we're actually running.
339 if( RUNNING == mState )
341 // Inform observers that we are about to be paused.
342 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
347 // Reset the event handler when adaptor paused
350 mEventHandler->Pause();
353 mThreadController->Pause();
356 // Ensure any messages queued during pause callbacks are processed by doing another update.
361 // Dali::Internal::Adaptor::Adaptor::Resume
362 void Adaptor::Resume()
364 // Only resume the adaptor if we are in the suspended state.
365 if( PAUSED == mState )
369 // Reset the event handler when adaptor resumed
372 mEventHandler->Resume();
375 // Inform observers that we have resumed.
376 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
381 // trigger processing of events queued up while paused
382 mCore->ProcessEvents();
384 // Do at end to ensure our first update/render after resumption includes the processed messages as well
385 mThreadController->Resume();
391 if( RUNNING == mState ||
393 PAUSED_WHILE_HIDDEN == mState )
395 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
400 mThreadController->Stop();
402 // Delete the TTS player
403 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
407 mTtsPlayers[i].Reset();
411 delete mEventHandler;
412 mEventHandler = NULL;
414 delete mNotificationTrigger;
415 mNotificationTrigger = NULL;
417 mCallbackManager->Stop();
423 void Adaptor::ContextLost()
425 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
428 void Adaptor::ContextRegained()
430 // Inform core, so that texture resources can be reloaded
431 mCore->RecoverFromContextLoss();
433 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
436 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
438 mEventHandler->FeedTouchPoint( point, timeStamp );
441 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
443 mEventHandler->FeedWheelEvent( wheelEvent );
446 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
448 mEventHandler->FeedKeyEvent( keyEvent );
451 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
453 PositionSize positionSize = surface.GetPositionSize();
455 // let the core know the surface size has changed
456 mCore->SurfaceResized( positionSize.width, positionSize.height );
458 mResizedSignal.Emit( mAdaptor );
460 mNativeWindow = nativeWindow;
463 // flush the event queue to give the update-render thread chance
464 // to start processing messages for new camera setup etc as soon as possible
467 // this method blocks until the render thread has completed the replace.
468 mThreadController->ReplaceSurface(mSurface);
471 RenderSurface& Adaptor::GetSurface() const
476 void Adaptor::ReleaseSurfaceLock()
478 mSurface->ReleaseLock();
481 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
483 if(!mTtsPlayers[mode])
485 // Create the TTS player when it needed, because it can reduce launching time.
486 mTtsPlayers[mode] = TtsPlayer::New(mode);
489 return mTtsPlayers[mode];
492 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
494 bool idleAdded(false);
496 // Only add an idle if the Adaptor is actually running
497 if( RUNNING == mState || READY == mState || forceAdd )
499 idleAdded = mCallbackManager->AddIdleCallback( callback );
505 void Adaptor::RemoveIdle( CallbackBase* callback )
507 mCallbackManager->RemoveIdleCallback( callback );
510 Dali::Adaptor& Adaptor::Get()
512 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
513 return gThreadLocalAdaptor->mAdaptor;
516 bool Adaptor::IsAvailable()
518 return gThreadLocalAdaptor != NULL;
521 void Adaptor::SceneCreated()
523 mCore->SceneCreated();
526 Dali::Integration::Core& Adaptor::GetCore()
531 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
533 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
536 void Adaptor::SetUseHardwareVSync( bool useHardware )
538 mVSyncMonitor->SetUseHardwareVSync( useHardware );
541 EglFactory& Adaptor::GetEGLFactory() const
543 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
547 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
552 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
554 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
558 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
560 return *mPlatformAbstraction;
563 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
568 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
570 return *mNotificationTrigger;
573 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
575 return mTriggerEventFactory;
578 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
580 return mSocketFactory;
583 RenderSurface* Adaptor::GetRenderSurfaceInterface()
588 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
590 return mVSyncMonitor;
593 TraceInterface& Adaptor::GetKernelTraceInterface()
595 return mKernelTracer;
598 TraceInterface& Adaptor::GetSystemTraceInterface()
600 return mSystemTracer;
603 PerformanceInterface* Adaptor::GetPerformanceInterface()
605 return mPerformanceInterface;
608 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
610 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
611 return *mPlatformAbstraction;
614 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
616 mDragAndDropDetector = detector;
620 mEventHandler->SetDragAndDropDetector( detector );
624 void Adaptor::SetRotationObserver( RotationObserver* observer )
628 mEventHandler->SetRotationObserver( observer );
630 else if( mState == READY )
632 // Set once event handler exists
633 mDeferredRotationObserver = observer;
637 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
639 if(mTtsPlayers[mode])
641 mTtsPlayers[mode].Reset();
645 void Adaptor::SetMinimumPinchDistance(float distance)
647 if( mGestureManager )
649 mGestureManager->SetMinimumPinchDistance(distance);
653 Any Adaptor::GetNativeWindowHandle()
655 return mNativeWindow;
658 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
660 mUseRemoteSurface = useRemoteSurface;
663 void Adaptor::AddObserver( LifeCycleObserver& observer )
665 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
667 if ( match == mObservers.end() )
669 mObservers.push_back( &observer );
673 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
675 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
677 if ( match != mObservers.end() )
679 mObservers.erase( match );
683 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
687 mCore->QueueEvent(event);
691 void Adaptor::ProcessCoreEvents()
695 if( mPerformanceInterface )
697 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
700 mCore->ProcessEvents();
702 if( mPerformanceInterface )
704 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
709 void Adaptor::RequestUpdate( bool forceUpdate )
715 mThreadController->RequestUpdate();
719 case PAUSED_WHILE_HIDDEN:
721 // When Dali applications are partially visible behind the lock-screen,
722 // the indicator must be updated (therefore allow updates in the PAUSED state)
725 mThreadController->RequestUpdateOnce();
737 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
739 // Only request a notification if the Adaptor is actually running
740 // and we haven't installed the idle notification
741 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
743 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
747 void Adaptor::OnWindowShown()
749 if ( PAUSED_WHILE_HIDDEN == mState )
751 // Adaptor can now be resumed
756 // Force a render task
761 void Adaptor::OnWindowHidden()
763 if ( RUNNING == mState )
767 // Adaptor cannot be resumed until the window is shown
768 mState = PAUSED_WHILE_HIDDEN;
772 // Dali::Internal::Adaptor::Adaptor::OnDamaged
773 void Adaptor::OnDamaged( const DamageArea& area )
775 // This is needed for the case where Dali window is partially obscured
776 RequestUpdate( false );
779 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
781 // let the core know the surface size has changed
782 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
784 mResizedSignal.Emit( mAdaptor );
787 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
789 // flush the event queue to give the update-render thread chance
790 // to start processing messages for new camera setup etc as soon as possible
793 // this method blocks until the render thread has completed the resizing.
794 mThreadController->ResizeSurface();
797 void Adaptor::NotifySceneCreated()
799 GetCore().SceneCreated();
801 // Start thread controller after the scene has been created
802 mThreadController->Start();
804 // process after surface is created (registering to remote surface provider if required)
805 SurfaceInitialized();
810 void Adaptor::NotifyLanguageChanged()
812 mLanguageChangedSignal.Emit( mAdaptor );
815 void Adaptor::RenderOnce()
820 const LogFactoryInterface& Adaptor::GetLogFactory()
822 return *mEnvironmentOptions;
825 void Adaptor::RequestUpdateOnce()
827 if( mThreadController )
829 mThreadController->RequestUpdateOnce();
833 void Adaptor::IndicatorSizeChanged(int height)
835 // let the core know the indicator height is changed
836 mCore->SetTopMargin(height);
839 void Adaptor::ProcessCoreEventsFromIdle()
843 // the idle handle automatically un-installs itself
844 mNotificationOnIdleInstalled = false;
847 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
849 mLanguageChangedSignal(),
853 mThreadController( NULL ),
854 mVSyncMonitor( NULL ),
858 mNativeWindow( nativeWindow ),
860 mPlatformAbstraction( NULL ),
861 mEventHandler( NULL ),
862 mCallbackManager( NULL ),
863 mNotificationOnIdleInstalled( false ),
864 mNotificationTrigger( NULL ),
865 mGestureManager( NULL ),
866 mDaliFeedbackPlugin(),
867 mFeedbackController( NULL ),
870 mDragAndDropDetector(),
871 mDeferredRotationObserver( NULL ),
872 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
873 mPerformanceInterface( NULL ),
876 mTriggerEventFactory(),
877 mObjectProfiler( NULL ),
879 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
880 mUseRemoteSurface( false )
882 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
883 gThreadLocalAdaptor = this;
888 void Adaptor::SetViewMode( ViewMode viewMode )
890 mSurface->SetViewMode( viewMode );
891 mCore->SetViewMode( viewMode );
894 ViewMode Adaptor::GetViewMode() const
896 return mCore->GetViewMode();
899 void Adaptor::SetStereoBase( float stereoBase )
901 mCore->SetStereoBase( stereoBase );
904 float Adaptor::GetStereoBase() const
906 return mCore->GetStereoBase();
909 void Adaptor::SetRootLayoutDirection( std::string locale )
911 Dali::Stage stage = Dali::Stage::GetCurrent();
913 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
914 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
917 } // namespace Adaptor
919 } // namespace Internal