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>
31 #include <dali/integration-api/graphics/graphics.h>
34 #include <dali/public-api/dali-adaptor-common.h>
35 #include <dali/internal/system/common/thread-controller.h>
36 #include <dali/internal/system/common/performance-interface-factory.h>
37 #include <dali/internal/adaptor/common/lifecycle-observer.h>
39 #include <dali/devel-api/text-abstraction/font-client.h>
41 #include <dali/internal/system/common/callback-manager.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/clipboard/common/clipboard-impl.h>
52 #include <dali/internal/graphics/common/vsync-monitor.h>
53 #include <dali/internal/system/common/object-profiler.h>
54 #include <dali/internal/window-system/common/display-connection.h>
55 #include <dali/internal/window-system/common/window-impl.h>
56 #include <dali/internal/window-system/common/window-render-surface.h>
57 #include <dali/internal/graphics/vulkan/x11/vk-surface-xlib2xcb.h>
59 #include <dali/internal/system/common/logging.h>
60 #include <dali/devel-api/adaptor-framework/image-loading.h>
62 #include <dali/internal/system/common/locale-utils.h>
64 using Dali::TextAbstraction::FontClient;
77 thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
78 } // unnamed namespace
80 Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
82 Dali::Adaptor* adaptor = new Dali::Adaptor;
83 Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
84 adaptor->mImpl = impl;
86 impl->Initialize(configuration);
91 Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
93 Any winId = window.GetNativeHandle();
95 Window& windowImpl = Dali::GetImplementation(window);
96 Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
97 windowImpl.SetAdaptor(*adaptor);
101 void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
103 // all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
104 Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
105 mEnvironmentOptions->SetLogFunction( logFunction );
106 mEnvironmentOptions->InstallLogFunction(); // install logging for main thread
108 mPlatformAbstraction = new TizenPlatform::TizenPlatformAbstraction;
111 GetDataStoragePath( path );
112 mPlatformAbstraction->SetDataStoragePath( path );
114 ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
115 if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
117 dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
119 // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
120 // files automatically.
122 if( mEnvironmentOptions->PerformanceServerRequired() )
124 mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
127 mEnvironmentOptions->CreateTraceManager( mPerformanceInterface );
128 mEnvironmentOptions->InstallTraceFunction(); // install tracing for main thread
130 mCallbackManager = CallbackManager::New();
132 PositionSize size = mSurface->GetPositionSize();
134 mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
136 if( mEnvironmentOptions->GetGlesCallTime() > 0 )
138 mGLES = new GlProxyImplementation( *mEnvironmentOptions );
142 mGLES = new GlImplementation();
145 const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() );
146 const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() );
148 mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable );
150 EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
152 // todo: add somewhere MakeUnique to make it cleaner
153 mGraphics = std::unique_ptr<Dali::Integration::Graphics::Graphics>(
154 new Dali::Integration::Graphics::Graphics()
157 // todo: surface shouldn't really be create here :((((
158 auto xlibSurface = std::unique_ptr<Dali::Graphics::Vulkan::VkSurfaceXlib2Xcb>(
159 new Dali::Graphics::Vulkan::VkSurfaceXlib2Xcb( *mSurface )
162 mGraphics->Create( std::move(xlibSurface) );
164 mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGraphics, *mGLES, *eglSyncImpl, *mGestureManager, dataRetentionPolicy,
165 ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
166 depthBufferAvailable,
167 stencilBufferAvailable );
169 const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
170 if( 0u < timeInterval )
172 mObjectProfiler = new ObjectProfiler( timeInterval );
175 mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
177 mVSyncMonitor = new VSyncMonitor;
179 mThreadController = new ThreadController( *this, *mEnvironmentOptions );
181 // Should be called after Core creation
182 if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
184 Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
186 if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
188 Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
190 if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
192 Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
194 if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
196 Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
198 if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
200 Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
202 if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
204 Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
206 if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
208 Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
210 if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
212 Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
214 if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 )
216 Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false );
218 if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 )
220 Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() );
222 if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 )
224 Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false );
226 if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 )
228 Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false );
230 if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 )
232 Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() );
234 if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f )
236 Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() );
238 if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f )
240 Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() );
242 if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 )
244 Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() );
247 // Set max texture size
248 if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
250 Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
253 SetupSystemInformation();
258 // Ensure stop status
261 // set to NULL first as we do not want any access to Adaptor as it is being destroyed.
262 gThreadLocalAdaptor = NULL;
264 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
266 (*iter)->OnDestroy();
269 delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
270 delete mVSyncMonitor;
271 delete mEventHandler;
272 delete mObjectProfiler;
277 delete mGestureManager;
278 delete mPlatformAbstraction;
279 delete mCallbackManager;
280 delete mPerformanceInterface;
282 // uninstall it on this thread (main actor thread)
283 Dali::Integration::Log::UninstallLogFunction();
285 // Delete environment options if we own it
286 if( mEnvironmentOptionsOwned )
288 delete mEnvironmentOptions;
292 void Adaptor::Start()
294 // it doesn't support restart after stop at this moment
295 // to support restarting, need more testing
296 if( READY != mState )
301 // Start the callback manager
302 mCallbackManager->Start();
304 // create event handler
305 mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
307 if( mDeferredRotationObserver != NULL )
309 mEventHandler->SetRotationObserver(mDeferredRotationObserver);
310 mDeferredRotationObserver = NULL;
313 unsigned int dpiHor, dpiVer;
315 mSurface->GetDpi( dpiHor, dpiVer );
317 // tell core about the DPI value
318 mCore->SetDpi(dpiHor, dpiVer);
320 // set the DPI value for font rendering
321 FontClient fontClient = FontClient::Get();
322 fontClient.SetDpi( dpiHor, dpiVer );
324 // Tell the core the size of the surface just before we start the render-thread
325 PositionSize size = mSurface->GetPositionSize();
326 mCore->SurfaceResized( size.width, size.height );
328 // Initialize the thread controller
329 mThreadController->Initialize();
331 ProcessCoreEvents(); // Ensure any startup messages are processed.
333 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
339 // Dali::Internal::Adaptor::Adaptor::Pause
340 void Adaptor::Pause()
342 // Only pause the adaptor if we're actually running.
343 if( RUNNING == mState )
345 // Inform observers that we are about to be paused.
346 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
351 // Reset the event handler when adaptor paused
354 mEventHandler->Pause();
357 mThreadController->Pause();
360 // Ensure any messages queued during pause callbacks are processed by doing another update.
365 // Dali::Internal::Adaptor::Adaptor::Resume
366 void Adaptor::Resume()
368 // Only resume the adaptor if we are in the suspended state.
369 if( PAUSED == mState )
373 // Reset the event handler when adaptor resumed
376 mEventHandler->Resume();
379 // Inform observers that we have resumed.
380 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
385 // trigger processing of events queued up while paused
386 mCore->ProcessEvents();
388 // Do at end to ensure our first update/render after resumption includes the processed messages as well
389 mThreadController->Resume();
395 if( RUNNING == mState ||
397 PAUSED_WHILE_HIDDEN == mState )
399 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
404 mThreadController->Stop();
406 // Delete the TTS player
407 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
411 mTtsPlayers[i].Reset();
415 delete mEventHandler;
416 mEventHandler = NULL;
418 delete mNotificationTrigger;
419 mNotificationTrigger = NULL;
421 mCallbackManager->Stop();
427 void Adaptor::ContextLost()
429 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
432 void Adaptor::ContextRegained()
434 // Inform core, so that texture resources can be reloaded
435 mCore->RecoverFromContextLoss();
437 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
440 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
442 mEventHandler->FeedTouchPoint( point, timeStamp );
445 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
447 mEventHandler->FeedWheelEvent( wheelEvent );
450 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
452 mEventHandler->FeedKeyEvent( keyEvent );
455 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
457 PositionSize positionSize = surface.GetPositionSize();
459 // let the core know the surface size has changed
460 mCore->SurfaceResized( positionSize.width, positionSize.height );
462 mResizedSignal.Emit( mAdaptor );
464 mNativeWindow = nativeWindow;
467 // flush the event queue to give the update-render thread chance
468 // to start processing messages for new camera setup etc as soon as possible
471 // this method blocks until the render thread has completed the replace.
472 mThreadController->ReplaceSurface(mSurface);
475 RenderSurface& Adaptor::GetSurface() const
480 void Adaptor::ReleaseSurfaceLock()
482 mSurface->ReleaseLock();
485 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
487 if(!mTtsPlayers[mode])
489 // Create the TTS player when it needed, because it can reduce launching time.
490 mTtsPlayers[mode] = TtsPlayer::New(mode);
493 return mTtsPlayers[mode];
496 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
498 bool idleAdded(false);
500 // Only add an idle if the Adaptor is actually running
501 if( RUNNING == mState || READY == mState || forceAdd )
503 idleAdded = mCallbackManager->AddIdleCallback( callback );
509 void Adaptor::RemoveIdle( CallbackBase* callback )
511 mCallbackManager->RemoveIdleCallback( callback );
514 Dali::Adaptor& Adaptor::Get()
516 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
517 return gThreadLocalAdaptor->mAdaptor;
520 bool Adaptor::IsAvailable()
522 return gThreadLocalAdaptor != NULL;
525 void Adaptor::SceneCreated()
527 mCore->SceneCreated();
530 Dali::Integration::Core& Adaptor::GetCore()
535 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
537 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
540 void Adaptor::SetUseHardwareVSync( bool useHardware )
542 mVSyncMonitor->SetUseHardwareVSync( useHardware );
545 EglFactory& Adaptor::GetEGLFactory() const
547 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
551 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
556 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
558 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
562 Dali::Integration::Graphics::Graphics& Adaptor::GetGraphics() const
567 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
569 return *mPlatformAbstraction;
572 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
577 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
579 return *mNotificationTrigger;
582 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
584 return mTriggerEventFactory;
587 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
589 return mSocketFactory;
592 RenderSurface* Adaptor::GetRenderSurfaceInterface()
597 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
599 return mVSyncMonitor;
602 TraceInterface& Adaptor::GetKernelTraceInterface()
604 return mKernelTracer;
607 TraceInterface& Adaptor::GetSystemTraceInterface()
609 return mSystemTracer;
612 PerformanceInterface* Adaptor::GetPerformanceInterface()
614 return mPerformanceInterface;
617 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
619 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
620 return *mPlatformAbstraction;
623 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
625 mDragAndDropDetector = detector;
629 mEventHandler->SetDragAndDropDetector( detector );
633 void Adaptor::SetRotationObserver( RotationObserver* observer )
637 mEventHandler->SetRotationObserver( observer );
639 else if( mState == READY )
641 // Set once event handler exists
642 mDeferredRotationObserver = observer;
646 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
648 if(mTtsPlayers[mode])
650 mTtsPlayers[mode].Reset();
654 void Adaptor::SetMinimumPinchDistance(float distance)
656 if( mGestureManager )
658 mGestureManager->SetMinimumPinchDistance(distance);
662 Any Adaptor::GetNativeWindowHandle()
664 return mNativeWindow;
667 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
669 mUseRemoteSurface = useRemoteSurface;
672 void Adaptor::AddObserver( LifeCycleObserver& observer )
674 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
676 if ( match == mObservers.end() )
678 mObservers.push_back( &observer );
682 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
684 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
686 if ( match != mObservers.end() )
688 mObservers.erase( match );
692 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
696 mCore->QueueEvent(event);
700 void Adaptor::ProcessCoreEvents()
704 if( mPerformanceInterface )
706 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
709 mCore->ProcessEvents();
711 if( mPerformanceInterface )
713 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
718 void Adaptor::RequestUpdate( bool forceUpdate )
724 mThreadController->RequestUpdate();
728 case PAUSED_WHILE_HIDDEN:
730 // When Dali applications are partially visible behind the lock-screen,
731 // the indicator must be updated (therefore allow updates in the PAUSED state)
734 mThreadController->RequestUpdateOnce();
746 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
748 // Only request a notification if the Adaptor is actually running
749 // and we haven't installed the idle notification
750 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
752 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
756 void Adaptor::OnWindowShown()
758 if ( PAUSED_WHILE_HIDDEN == mState )
760 // Adaptor can now be resumed
765 // Force a render task
770 void Adaptor::OnWindowHidden()
772 if ( RUNNING == mState )
776 // Adaptor cannot be resumed until the window is shown
777 mState = PAUSED_WHILE_HIDDEN;
781 // Dali::Internal::Adaptor::Adaptor::OnDamaged
782 void Adaptor::OnDamaged( const DamageArea& area )
784 // This is needed for the case where Dali window is partially obscured
785 RequestUpdate( false );
788 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
790 // let the core know the surface size has changed
791 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
793 mResizedSignal.Emit( mAdaptor );
796 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
798 // flush the event queue to give the update-render thread chance
799 // to start processing messages for new camera setup etc as soon as possible
802 // this method blocks until the render thread has completed the resizing.
803 mThreadController->ResizeSurface();
806 void Adaptor::NotifySceneCreated()
808 GetCore().SceneCreated();
810 // Start thread controller after the scene has been created
811 mThreadController->Start();
813 // process after surface is created (registering to remote surface provider if required)
814 SurfaceInitialized();
819 void Adaptor::NotifyLanguageChanged()
821 mLanguageChangedSignal.Emit( mAdaptor );
824 void Adaptor::RenderOnce()
829 const LogFactoryInterface& Adaptor::GetLogFactory()
831 return *mEnvironmentOptions;
834 void Adaptor::RequestUpdateOnce()
836 if( mThreadController )
838 mThreadController->RequestUpdateOnce();
842 void Adaptor::IndicatorSizeChanged(int height)
844 // let the core know the indicator height is changed
845 mCore->SetTopMargin(height);
848 void Adaptor::ProcessCoreEventsFromIdle()
852 // the idle handle automatically un-installs itself
853 mNotificationOnIdleInstalled = false;
856 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
858 mLanguageChangedSignal(),
862 mThreadController( NULL ),
863 mVSyncMonitor( NULL ),
867 mNativeWindow( nativeWindow ),
869 mPlatformAbstraction( NULL ),
870 mEventHandler( NULL ),
871 mCallbackManager( NULL ),
872 mNotificationOnIdleInstalled( false ),
873 mNotificationTrigger( NULL ),
874 mGestureManager( NULL ),
875 mDaliFeedbackPlugin(),
876 mFeedbackController( NULL ),
879 mDragAndDropDetector(),
880 mDeferredRotationObserver( NULL ),
881 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
882 mPerformanceInterface( NULL ),
885 mTriggerEventFactory(),
886 mObjectProfiler( NULL ),
888 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
889 mUseRemoteSurface( false )
891 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
892 gThreadLocalAdaptor = this;
897 void Adaptor::SetViewMode( ViewMode viewMode )
899 mSurface->SetViewMode( viewMode );
900 mCore->SetViewMode( viewMode );
903 ViewMode Adaptor::GetViewMode() const
905 return mCore->GetViewMode();
908 void Adaptor::SetStereoBase( float stereoBase )
910 mCore->SetStereoBase( stereoBase );
913 float Adaptor::GetStereoBase() const
915 return mCore->GetStereoBase();
918 void Adaptor::SetRootLayoutDirection( std::string locale )
920 Dali::Stage stage = Dali::Stage::GetCurrent();
922 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
923 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
926 } // namespace Adaptor
928 } // namespace Internal