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/profiling.h>
28 #include <dali/integration-api/input-options.h>
29 #include <dali/integration-api/events/touch-event-integ.h>
30 #include <dali/integration-api/graphics/graphics.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/common/egl-image-extensions.h>
46 #include <dali/internal/graphics/gles20/egl-factory.h>
47 #include <dali/internal/graphics/vulkan/x11/vk-surface-xlib2xcb.h>
48 #include <dali/internal/clipboard/common/clipboard-impl.h>
49 #include <dali/internal/graphics/common/vsync-monitor.h>
50 #include <dali/internal/system/common/object-profiler.h>
51 #include <dali/internal/window-system/common/display-connection.h>
52 #include <dali/internal/window-system/common/window-impl.h>
53 #include <dali/internal/window-system/common/window-render-surface.h>
54 #include <dali/internal/graphics/vulkan/x11/vk-surface-xlib2xcb.h>
56 #include <dali/internal/system/common/logging.h>
57 #include <dali/devel-api/adaptor-framework/image-loading.h>
59 #include <dali/internal/system/common/locale-utils.h>
61 using Dali::TextAbstraction::FontClient;
74 thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
75 } // unnamed namespace
77 Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
79 Dali::Adaptor* adaptor = new Dali::Adaptor;
80 Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
81 adaptor->mImpl = impl;
83 impl->Initialize(configuration);
88 Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
90 Any winId = window.GetNativeHandle();
92 Window& windowImpl = Dali::GetImplementation(window);
93 Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
94 windowImpl.SetAdaptor(*adaptor);
98 void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
100 // all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
101 Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
102 mEnvironmentOptions->SetLogFunction( logFunction );
103 mEnvironmentOptions->InstallLogFunction(); // install logging for main thread
105 mPlatformAbstraction = new TizenPlatform::TizenPlatformAbstraction;
108 GetDataStoragePath( path );
109 mPlatformAbstraction->SetDataStoragePath( path );
111 ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
112 if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
114 dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
116 // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
117 // files automatically.
119 if( mEnvironmentOptions->PerformanceServerRequired() )
121 mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
124 mEnvironmentOptions->CreateTraceManager( mPerformanceInterface );
125 mEnvironmentOptions->InstallTraceFunction(); // install tracing for main thread
127 mCallbackManager = CallbackManager::New();
129 PositionSize size = mSurface->GetPositionSize();
131 mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
133 const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() );
134 const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() );
136 mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable );
138 // @todo: add somewhere MakeUnique to make it cleaner
139 mGraphics = std::unique_ptr<Dali::Integration::Graphics::Graphics>(
140 new Dali::Integration::Graphics::Graphics()
143 // @todo: surface shouldn't really be create here :((((
144 auto xlibSurface = std::unique_ptr<Dali::Graphics::Vulkan::VkSurfaceXlib2Xcb>(
145 new Dali::Graphics::Vulkan::VkSurfaceXlib2Xcb( *mSurface )
148 mGraphics->Create( std::move(xlibSurface) );
150 mCore = Integration::Core::New( *this,
151 *mPlatformAbstraction,
154 dataRetentionPolicy ,
155 ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
156 depthBufferAvailable,
157 stencilBufferAvailable );
159 const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
160 if( 0u < timeInterval )
162 mObjectProfiler = new ObjectProfiler( timeInterval );
165 mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
167 mVSyncMonitor = new VSyncMonitor;
169 mThreadController = new ThreadController( *this, *mEnvironmentOptions );
171 // Should be called after Core creation
172 if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
174 Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
176 if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
178 Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
180 if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
182 Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
184 if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
186 Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
188 if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
190 Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
192 if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
194 Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
196 if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
198 Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
200 if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
202 Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
204 if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 )
206 Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false );
208 if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 )
210 Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() );
212 if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 )
214 Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false );
216 if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 )
218 Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false );
220 if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 )
222 Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() );
224 if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f )
226 Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() );
228 if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f )
230 Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() );
232 if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 )
234 Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() );
237 // Set max texture size
238 if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
240 Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
243 SetupSystemInformation();
248 // Ensure stop status
251 // set to NULL first as we do not want any access to Adaptor as it is being destroyed.
252 gThreadLocalAdaptor = NULL;
254 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
256 (*iter)->OnDestroy();
259 delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
260 delete mVSyncMonitor;
261 delete mEventHandler;
262 delete mObjectProfiler;
266 delete mGestureManager;
267 delete mPlatformAbstraction;
268 delete mCallbackManager;
269 delete mPerformanceInterface;
271 // uninstall it on this thread (main actor thread)
272 Dali::Integration::Log::UninstallLogFunction();
274 // Delete environment options if we own it
275 if( mEnvironmentOptionsOwned )
277 delete mEnvironmentOptions;
281 void Adaptor::Start()
283 // it doesn't support restart after stop at this moment
284 // to support restarting, need more testing
285 if( READY != mState )
290 // Start the callback manager
291 mCallbackManager->Start();
293 // create event handler
294 mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
296 if( mDeferredRotationObserver != NULL )
298 mEventHandler->SetRotationObserver(mDeferredRotationObserver);
299 mDeferredRotationObserver = NULL;
302 unsigned int dpiHor, dpiVer;
304 mSurface->GetDpi( dpiHor, dpiVer );
306 // tell core about the DPI value
307 mCore->SetDpi(dpiHor, dpiVer);
309 // set the DPI value for font rendering
310 FontClient fontClient = FontClient::Get();
311 fontClient.SetDpi( dpiHor, dpiVer );
313 // Tell the core the size of the surface just before we start the render-thread
314 PositionSize size = mSurface->GetPositionSize();
315 mCore->SurfaceResized( size.width, size.height );
317 // Initialize the thread controller
318 mThreadController->Initialize();
320 ProcessCoreEvents(); // Ensure any startup messages are processed.
322 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
328 // Dali::Internal::Adaptor::Adaptor::Pause
329 void Adaptor::Pause()
331 // Only pause the adaptor if we're actually running.
332 if( RUNNING == mState )
334 // Inform observers that we are about to be paused.
335 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
340 // Reset the event handler when adaptor paused
343 mEventHandler->Pause();
346 mThreadController->Pause();
349 // Ensure any messages queued during pause callbacks are processed by doing another update.
354 // Dali::Internal::Adaptor::Adaptor::Resume
355 void Adaptor::Resume()
357 // Only resume the adaptor if we are in the suspended state.
358 if( PAUSED == mState )
362 // Reset the event handler when adaptor resumed
365 mEventHandler->Resume();
368 // Inform observers that we have resumed.
369 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
374 // trigger processing of events queued up while paused
375 mCore->ProcessEvents();
377 // Do at end to ensure our first update/render after resumption includes the processed messages as well
378 mThreadController->Resume();
384 if( RUNNING == mState ||
386 PAUSED_WHILE_HIDDEN == mState )
388 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
393 mThreadController->Stop();
395 // Delete the TTS player
396 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
400 mTtsPlayers[i].Reset();
404 delete mEventHandler;
405 mEventHandler = NULL;
407 delete mNotificationTrigger;
408 mNotificationTrigger = NULL;
410 mCallbackManager->Stop();
416 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
418 mEventHandler->FeedTouchPoint( point, timeStamp );
421 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
423 mEventHandler->FeedWheelEvent( wheelEvent );
426 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
428 mEventHandler->FeedKeyEvent( keyEvent );
431 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
433 PositionSize positionSize = surface.GetPositionSize();
435 // let the core know the surface size has changed
436 mCore->SurfaceResized( positionSize.width, positionSize.height );
438 mResizedSignal.Emit( mAdaptor );
440 mNativeWindow = nativeWindow;
443 // flush the event queue to give the update-render thread chance
444 // to start processing messages for new camera setup etc as soon as possible
447 // this method blocks until the render thread has completed the replace.
448 mThreadController->ReplaceSurface(mSurface);
451 RenderSurface& Adaptor::GetSurface() const
456 void Adaptor::ReleaseSurfaceLock()
458 mSurface->ReleaseLock();
461 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
463 if(!mTtsPlayers[mode])
465 // Create the TTS player when it needed, because it can reduce launching time.
466 mTtsPlayers[mode] = TtsPlayer::New(mode);
469 return mTtsPlayers[mode];
472 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
474 bool idleAdded(false);
476 // Only add an idle if the Adaptor is actually running
477 if( RUNNING == mState || READY == mState || forceAdd )
479 idleAdded = mCallbackManager->AddIdleCallback( callback );
485 void Adaptor::RemoveIdle( CallbackBase* callback )
487 mCallbackManager->RemoveIdleCallback( callback );
490 Dali::Adaptor& Adaptor::Get()
492 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
493 return gThreadLocalAdaptor->mAdaptor;
496 bool Adaptor::IsAvailable()
498 return gThreadLocalAdaptor != NULL;
501 void Adaptor::SceneCreated()
503 mCore->SceneCreated();
506 Dali::Integration::Core& Adaptor::GetCore()
511 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
513 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
516 void Adaptor::SetUseHardwareVSync( bool useHardware )
518 mVSyncMonitor->SetUseHardwareVSync( useHardware );
521 EglFactory& Adaptor::GetEGLFactory() const
523 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
527 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
532 Integration::Graphics::Graphics& Adaptor::GetGraphics() const
537 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
539 return *mPlatformAbstraction;
542 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
544 return *mNotificationTrigger;
547 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
549 return mTriggerEventFactory;
552 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
554 return mSocketFactory;
557 RenderSurface* Adaptor::GetRenderSurfaceInterface()
562 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
564 return mVSyncMonitor;
567 TraceInterface& Adaptor::GetKernelTraceInterface()
569 return mKernelTracer;
572 TraceInterface& Adaptor::GetSystemTraceInterface()
574 return mSystemTracer;
577 PerformanceInterface* Adaptor::GetPerformanceInterface()
579 return mPerformanceInterface;
582 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
584 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
585 return *mPlatformAbstraction;
588 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
590 mDragAndDropDetector = detector;
594 mEventHandler->SetDragAndDropDetector( detector );
598 void Adaptor::SetRotationObserver( RotationObserver* observer )
602 mEventHandler->SetRotationObserver( observer );
604 else if( mState == READY )
606 // Set once event handler exists
607 mDeferredRotationObserver = observer;
611 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
613 if(mTtsPlayers[mode])
615 mTtsPlayers[mode].Reset();
619 void Adaptor::SetMinimumPinchDistance(float distance)
621 if( mGestureManager )
623 mGestureManager->SetMinimumPinchDistance(distance);
627 Any Adaptor::GetNativeWindowHandle()
629 return mNativeWindow;
632 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
634 mUseRemoteSurface = useRemoteSurface;
637 void Adaptor::AddObserver( LifeCycleObserver& observer )
639 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
641 if ( match == mObservers.end() )
643 mObservers.push_back( &observer );
647 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
649 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
651 if ( match != mObservers.end() )
653 mObservers.erase( match );
657 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
661 mCore->QueueEvent(event);
665 void Adaptor::ProcessCoreEvents()
669 if( mPerformanceInterface )
671 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
674 mCore->ProcessEvents();
676 if( mPerformanceInterface )
678 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
683 void Adaptor::RequestUpdate( bool forceUpdate )
689 mThreadController->RequestUpdate();
693 case PAUSED_WHILE_HIDDEN:
695 // When Dali applications are partially visible behind the lock-screen,
696 // the indicator must be updated (therefore allow updates in the PAUSED state)
699 mThreadController->RequestUpdateOnce();
711 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
713 // Only request a notification if the Adaptor is actually running
714 // and we haven't installed the idle notification
715 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
717 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
721 void Adaptor::OnWindowShown()
723 if ( PAUSED_WHILE_HIDDEN == mState )
725 // Adaptor can now be resumed
730 // Force a render task
735 void Adaptor::OnWindowHidden()
737 if ( RUNNING == mState )
741 // Adaptor cannot be resumed until the window is shown
742 mState = PAUSED_WHILE_HIDDEN;
746 // Dali::Internal::Adaptor::Adaptor::OnDamaged
747 void Adaptor::OnDamaged( const DamageArea& area )
749 // This is needed for the case where Dali window is partially obscured
750 RequestUpdate( false );
753 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
755 // let the core know the surface size has changed
756 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
758 mResizedSignal.Emit( mAdaptor );
761 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
763 // flush the event queue to give the update-render thread chance
764 // to start processing messages for new camera setup etc as soon as possible
767 // this method blocks until the render thread has completed the resizing.
768 mThreadController->ResizeSurface();
771 void Adaptor::NotifySceneCreated()
773 GetCore().SceneCreated();
775 // Start thread controller after the scene has been created
776 mThreadController->Start();
778 // process after surface is created (registering to remote surface provider if required)
779 SurfaceInitialized();
784 void Adaptor::NotifyLanguageChanged()
786 mLanguageChangedSignal.Emit( mAdaptor );
789 void Adaptor::RenderOnce()
794 const LogFactoryInterface& Adaptor::GetLogFactory()
796 return *mEnvironmentOptions;
799 void Adaptor::RequestUpdateOnce()
801 if( mThreadController )
803 mThreadController->RequestUpdateOnce();
807 void Adaptor::IndicatorSizeChanged(int height)
809 // let the core know the indicator height is changed
810 mCore->SetTopMargin(height);
813 void Adaptor::ProcessCoreEventsFromIdle()
817 // the idle handle automatically un-installs itself
818 mNotificationOnIdleInstalled = false;
821 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
823 mLanguageChangedSignal(),
827 mThreadController( NULL ),
828 mVSyncMonitor( NULL ),
830 mNativeWindow( nativeWindow ),
832 mPlatformAbstraction( NULL ),
833 mEventHandler( NULL ),
834 mCallbackManager( NULL ),
835 mNotificationOnIdleInstalled( false ),
836 mNotificationTrigger( NULL ),
837 mGestureManager( NULL ),
838 mDaliFeedbackPlugin(),
839 mFeedbackController( NULL ),
842 mDragAndDropDetector(),
843 mDeferredRotationObserver( NULL ),
844 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
845 mPerformanceInterface( NULL ),
848 mTriggerEventFactory(),
849 mObjectProfiler( NULL ),
851 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
852 mUseRemoteSurface( false )
854 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
855 gThreadLocalAdaptor = this;
860 void Adaptor::SetViewMode( ViewMode viewMode )
862 mSurface->SetViewMode( viewMode );
863 mCore->SetViewMode( viewMode );
866 ViewMode Adaptor::GetViewMode() const
868 return mCore->GetViewMode();
871 void Adaptor::SetStereoBase( float stereoBase )
873 mCore->SetStereoBase( stereoBase );
876 float Adaptor::GetStereoBase() const
878 return mCore->GetStereoBase();
881 void Adaptor::SetRootLayoutDirection( std::string locale )
883 Dali::Stage stage = Dali::Stage::GetCurrent();
885 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
886 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
889 } // namespace Adaptor
891 } // namespace Internal