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/stage.h>
23 #include <dali/public-api/actors/layer.h>
24 #include <dali/devel-api/actors/actor-devel.h>
25 #include <dali/integration-api/debug.h>
26 #include <dali/integration-api/core.h>
27 #include <dali/integration-api/context-notifier.h>
28 #include <dali/integration-api/profiling.h>
29 #include <dali/integration-api/input-options.h>
30 #include <dali/integration-api/events/touch-event-integ.h>
33 #include <dali/public-api/dali-adaptor-common.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/internal/accessibility/common/tts-player-impl.h>
42 #include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
43 #include <dali/internal/input/common/gesture-manager.h>
44 #include <dali/internal/window-system/common/event-handler.h>
45 #include <dali/internal/graphics/gles20/gl-proxy-implementation.h>
46 #include <dali/internal/graphics/gles20/gl-implementation.h>
47 #include <dali/internal/graphics/gles20/egl-sync-implementation.h>
48 #include <dali/internal/graphics/common/egl-image-extensions.h>
49 #include <dali/internal/graphics/gles20/egl-factory.h>
50 #include <dali/internal/clipboard/common/clipboard-impl.h>
51 #include <dali/internal/graphics/common/vsync-monitor.h>
52 #include <dali/internal/system/common/object-profiler.h>
53 #include <dali/internal/window-system/common/display-connection.h>
54 #include <dali/internal/window-system/common/window-impl.h>
55 #include <dali/internal/window-system/common/window-render-surface.h>
57 #include <dali/internal/system/common/logging.h>
58 #include <dali/devel-api/adaptor-framework/image-loading.h>
60 #include <dali/internal/system/common/locale-utils.h>
62 using Dali::TextAbstraction::FontClient;
75 thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
76 } // unnamed namespace
78 Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
80 Dali::Adaptor* adaptor = new Dali::Adaptor;
81 Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
82 adaptor->mImpl = impl;
84 impl->Initialize(configuration);
89 Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
91 Any winId = window.GetNativeHandle();
93 Window& windowImpl = Dali::GetImplementation(window);
94 Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
95 windowImpl.SetAdaptor(*adaptor);
99 void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
101 // all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
102 Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
103 mEnvironmentOptions->SetLogFunction( logFunction );
104 mEnvironmentOptions->InstallLogFunction(); // install logging for main thread
106 mPlatformAbstraction = new TizenPlatform::TizenPlatformAbstraction;
109 GetDataStoragePath( path );
110 mPlatformAbstraction->SetDataStoragePath( path );
112 ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
113 if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
115 dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
117 // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
118 // files automatically.
120 if( mEnvironmentOptions->PerformanceServerRequired() )
122 mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
125 mEnvironmentOptions->CreateTraceManager( mPerformanceInterface );
126 mEnvironmentOptions->InstallTraceFunction(); // install tracing for main thread
128 mCallbackManager = CallbackManager::New();
130 PositionSize size = mSurface->GetPositionSize();
132 mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
134 if( mEnvironmentOptions->GetGlesCallTime() > 0 )
136 mGLES = new GlProxyImplementation( *mEnvironmentOptions );
140 mGLES = new GlImplementation();
143 const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() );
144 const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() );
146 mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable );
148 EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
150 mCore = Integration::Core::New( *this,
151 *mPlatformAbstraction,
155 dataRetentionPolicy ,
156 ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
157 depthBufferAvailable,
158 stencilBufferAvailable );
160 const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
161 if( 0u < timeInterval )
163 mObjectProfiler = new ObjectProfiler( timeInterval );
166 mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
168 mVSyncMonitor = new VSyncMonitor;
170 mThreadController = new ThreadController( *this, *mEnvironmentOptions );
172 // Should be called after Core creation
173 if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
175 Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
177 if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
179 Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
181 if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
183 Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
185 if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
187 Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
189 if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
191 Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
193 if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
195 Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
197 if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
199 Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
201 if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
203 Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
205 if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 )
207 Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false );
209 if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 )
211 Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() );
213 if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 )
215 Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false );
217 if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 )
219 Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false );
221 if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 )
223 Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() );
225 if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f )
227 Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() );
229 if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f )
231 Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() );
233 if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 )
235 Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() );
238 // Set max texture size
239 if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
241 Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
244 SetupSystemInformation();
249 // Ensure stop status
252 // set to NULL first as we do not want any access to Adaptor as it is being destroyed.
253 gThreadLocalAdaptor = NULL;
255 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
257 (*iter)->OnDestroy();
260 delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
261 delete mVSyncMonitor;
262 delete mEventHandler;
263 delete mObjectProfiler;
268 delete mGestureManager;
269 delete mPlatformAbstraction;
270 delete mCallbackManager;
271 delete mPerformanceInterface;
273 // uninstall it on this thread (main actor thread)
274 Dali::Integration::Log::UninstallLogFunction();
276 // Delete environment options if we own it
277 if( mEnvironmentOptionsOwned )
279 delete mEnvironmentOptions;
283 void Adaptor::Start()
285 // it doesn't support restart after stop at this moment
286 // to support restarting, need more testing
287 if( READY != mState )
292 // Start the callback manager
293 mCallbackManager->Start();
295 // create event handler
296 mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
298 if( mDeferredRotationObserver != NULL )
300 mEventHandler->SetRotationObserver(mDeferredRotationObserver);
301 mDeferredRotationObserver = NULL;
304 unsigned int dpiHor, dpiVer;
306 mSurface->GetDpi( dpiHor, dpiVer );
308 // tell core about the DPI value
309 mCore->SetDpi(dpiHor, dpiVer);
311 // set the DPI value for font rendering
312 FontClient fontClient = FontClient::Get();
313 fontClient.SetDpi( dpiHor, dpiVer );
315 // Tell the core the size of the surface just before we start the render-thread
316 PositionSize size = mSurface->GetPositionSize();
317 mCore->SurfaceResized( size.width, size.height );
319 // Initialize the thread controller
320 mThreadController->Initialize();
322 ProcessCoreEvents(); // Ensure any startup messages are processed.
324 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
330 // Dali::Internal::Adaptor::Adaptor::Pause
331 void Adaptor::Pause()
333 // Only pause the adaptor if we're actually running.
334 if( RUNNING == mState )
336 // Inform observers that we are about to be paused.
337 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
342 // Reset the event handler when adaptor paused
345 mEventHandler->Pause();
348 mThreadController->Pause();
351 // Ensure any messages queued during pause callbacks are processed by doing another update.
356 // Dali::Internal::Adaptor::Adaptor::Resume
357 void Adaptor::Resume()
359 // Only resume the adaptor if we are in the suspended state.
360 if( PAUSED == mState )
364 // Reset the event handler when adaptor resumed
367 mEventHandler->Resume();
370 // Inform observers that we have resumed.
371 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
376 // trigger processing of events queued up while paused
377 mCore->ProcessEvents();
379 // Do at end to ensure our first update/render after resumption includes the processed messages as well
380 mThreadController->Resume();
386 if( RUNNING == mState ||
388 PAUSED_WHILE_HIDDEN == mState )
390 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
395 mThreadController->Stop();
397 // Delete the TTS player
398 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
402 mTtsPlayers[i].Reset();
406 delete mEventHandler;
407 mEventHandler = NULL;
409 delete mNotificationTrigger;
410 mNotificationTrigger = NULL;
412 mCallbackManager->Stop();
418 void Adaptor::ContextLost()
420 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
423 void Adaptor::ContextRegained()
425 // Inform core, so that texture resources can be reloaded
426 mCore->RecoverFromContextLoss();
428 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
431 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
433 mEventHandler->FeedTouchPoint( point, timeStamp );
436 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
438 mEventHandler->FeedWheelEvent( wheelEvent );
441 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
443 mEventHandler->FeedKeyEvent( keyEvent );
446 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
448 PositionSize positionSize = surface.GetPositionSize();
450 // let the core know the surface size has changed
451 mCore->SurfaceResized( positionSize.width, positionSize.height );
453 mResizedSignal.Emit( mAdaptor );
455 mNativeWindow = nativeWindow;
458 // flush the event queue to give the update-render thread chance
459 // to start processing messages for new camera setup etc as soon as possible
462 // this method blocks until the render thread has completed the replace.
463 mThreadController->ReplaceSurface(mSurface);
466 RenderSurface& Adaptor::GetSurface() const
471 void Adaptor::ReleaseSurfaceLock()
473 mSurface->ReleaseLock();
476 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
478 if(!mTtsPlayers[mode])
480 // Create the TTS player when it needed, because it can reduce launching time.
481 mTtsPlayers[mode] = TtsPlayer::New(mode);
484 return mTtsPlayers[mode];
487 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue, bool forceAdd )
489 bool idleAdded(false);
491 // Only add an idle if the Adaptor is actually running
492 if( RUNNING == mState || READY == mState || forceAdd )
494 idleAdded = mCallbackManager->AddIdleCallback( callback, hasReturnValue );
500 void Adaptor::RemoveIdle( CallbackBase* callback )
502 mCallbackManager->RemoveIdleCallback( callback );
505 Dali::Adaptor& Adaptor::Get()
507 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
508 return gThreadLocalAdaptor->mAdaptor;
511 bool Adaptor::IsAvailable()
513 return gThreadLocalAdaptor != NULL;
516 void Adaptor::SceneCreated()
518 mCore->SceneCreated();
521 Dali::Integration::Core& Adaptor::GetCore()
526 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
528 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
531 void Adaptor::SetUseHardwareVSync( bool useHardware )
533 mVSyncMonitor->SetUseHardwareVSync( useHardware );
536 EglFactory& Adaptor::GetEGLFactory() const
538 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
542 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
547 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
549 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
553 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
555 return *mPlatformAbstraction;
558 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
563 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
565 return *mNotificationTrigger;
568 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
570 return mTriggerEventFactory;
573 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
575 return mSocketFactory;
578 RenderSurface* Adaptor::GetRenderSurfaceInterface()
583 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
585 return mVSyncMonitor;
588 TraceInterface& Adaptor::GetKernelTraceInterface()
590 return mKernelTracer;
593 TraceInterface& Adaptor::GetSystemTraceInterface()
595 return mSystemTracer;
598 PerformanceInterface* Adaptor::GetPerformanceInterface()
600 return mPerformanceInterface;
603 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
605 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
606 return *mPlatformAbstraction;
609 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
611 mDragAndDropDetector = detector;
615 mEventHandler->SetDragAndDropDetector( detector );
619 void Adaptor::SetRotationObserver( RotationObserver* observer )
623 mEventHandler->SetRotationObserver( observer );
625 else if( mState == READY )
627 // Set once event handler exists
628 mDeferredRotationObserver = observer;
632 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
634 if(mTtsPlayers[mode])
636 mTtsPlayers[mode].Reset();
640 void Adaptor::SetMinimumPinchDistance(float distance)
642 if( mGestureManager )
644 mGestureManager->SetMinimumPinchDistance(distance);
648 Any Adaptor::GetNativeWindowHandle()
650 return mNativeWindow;
653 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
655 mUseRemoteSurface = useRemoteSurface;
658 void Adaptor::AddObserver( LifeCycleObserver& observer )
660 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
662 if ( match == mObservers.end() )
664 mObservers.push_back( &observer );
668 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
670 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
672 if ( match != mObservers.end() )
674 mObservers.erase( match );
678 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
682 mCore->QueueEvent(event);
686 void Adaptor::ProcessCoreEvents()
690 if( mPerformanceInterface )
692 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
695 mCore->ProcessEvents();
697 if( mPerformanceInterface )
699 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
704 void Adaptor::RequestUpdate( bool forceUpdate )
710 mThreadController->RequestUpdate();
714 case PAUSED_WHILE_HIDDEN:
716 // When Dali applications are partially visible behind the lock-screen,
717 // the indicator must be updated (therefore allow updates in the PAUSED state)
720 mThreadController->RequestUpdateOnce();
732 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
734 // Only request a notification if the Adaptor is actually running
735 // and we haven't installed the idle notification
736 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
738 mNotificationOnIdleInstalled = AddIdleEnterer( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
742 void Adaptor::OnWindowShown()
744 if ( PAUSED_WHILE_HIDDEN == mState )
746 // Adaptor can now be resumed
751 // Force a render task
756 void Adaptor::OnWindowHidden()
758 if ( RUNNING == mState )
762 // Adaptor cannot be resumed until the window is shown
763 mState = PAUSED_WHILE_HIDDEN;
767 // Dali::Internal::Adaptor::Adaptor::OnDamaged
768 void Adaptor::OnDamaged( const DamageArea& area )
770 // This is needed for the case where Dali window is partially obscured
771 RequestUpdate( false );
774 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
776 // let the core know the surface size has changed
777 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
779 mResizedSignal.Emit( mAdaptor );
782 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
784 // flush the event queue to give the update-render thread chance
785 // to start processing messages for new camera setup etc as soon as possible
788 // this method blocks until the render thread has completed the resizing.
789 mThreadController->ResizeSurface();
792 void Adaptor::NotifySceneCreated()
794 GetCore().SceneCreated();
796 // Start thread controller after the scene has been created
797 mThreadController->Start();
799 // process after surface is created (registering to remote surface provider if required)
800 SurfaceInitialized();
805 void Adaptor::NotifyLanguageChanged()
807 mLanguageChangedSignal.Emit( mAdaptor );
810 void Adaptor::RenderOnce()
815 const LogFactoryInterface& Adaptor::GetLogFactory()
817 return *mEnvironmentOptions;
820 void Adaptor::RequestUpdateOnce()
822 if( mThreadController )
824 mThreadController->RequestUpdateOnce();
828 void Adaptor::IndicatorSizeChanged(int height)
830 // let the core know the indicator height is changed
831 mCore->SetTopMargin(height);
834 bool Adaptor::ProcessCoreEventsFromIdle()
838 // the idle handle automatically un-installs itself
839 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 bool Adaptor::AddIdleEnterer( CallbackBase* callback, bool forceAdd )
916 bool idleAdded( false );
918 // Only add an idle if the Adaptor is actually running
919 if( RUNNING == mState || READY == mState || forceAdd )
921 idleAdded = mCallbackManager->AddIdleEntererCallback( callback );
927 void Adaptor::RemoveIdleEnterer( CallbackBase* callback )
929 mCallbackManager->RemoveIdleEntererCallback( callback );
932 } // namespace Adaptor
934 } // namespace Internal