2 * Copyright (c) 2014 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 "adaptor-impl.h"
22 #include <boost/thread/tss.hpp>
23 #include <dali/public-api/common/dali-common.h>
24 #include <dali/integration-api/debug.h>
25 #include <dali/integration-api/core.h>
26 #include <dali/integration-api/context-notifier.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>
32 #include <base/update-render-controller.h>
33 #include <base/environment-variables.h>
34 #include <base/performance-logging/performance-interface-factory.h>
35 #include <base/lifecycle-observer.h>
37 #include <callback-manager.h>
38 #include <trigger-event.h>
39 #include <window-render-surface.h>
40 #include <render-surface-impl.h>
41 #include <tts-player-impl.h>
42 #include <accessibility-manager-impl.h>
43 #include <timer-impl.h>
44 #include <events/gesture-manager.h>
45 #include <events/event-handler.h>
46 #include <feedback/feedback-controller.h>
47 #include <feedback/feedback-plugin-proxy.h>
48 #include <gl/gl-proxy-implementation.h>
49 #include <gl/gl-implementation.h>
50 #include <gl/egl-sync-implementation.h>
51 #include <gl/egl-image-extensions.h>
52 #include <gl/egl-factory.h>
53 #include <imf-manager-impl.h>
54 #include <clipboard-impl.h>
55 #include <vsync-monitor.h>
56 #include <object-profiler.h>
58 #include <slp-logging.h>
73 boost::thread_specific_ptr<Adaptor> gThreadLocalAdaptor;
75 unsigned int GetIntegerEnvironmentVariable( const char* variable, unsigned int defaultValue )
77 const char* variableParameter = std::getenv(variable);
79 // if the parameter exists convert it to an integer, else return the default value
80 unsigned int intValue = variableParameter ? atoi(variableParameter) : defaultValue;
84 bool GetIntegerEnvironmentVariable( const char* variable, int& intValue )
86 const char* variableParameter = std::getenv(variable);
88 if( !variableParameter )
92 // if the parameter exists convert it to an integer, else return the default value
93 intValue = atoi(variableParameter);
97 bool GetFloatEnvironmentVariable( const char* variable, float& floatValue )
99 const char* variableParameter = std::getenv(variable);
101 if( !variableParameter )
105 // if the parameter exists convert it to an integer, else return the default value
106 floatValue = atof(variableParameter);
110 } // unnamed namespace
112 Dali::Adaptor* Adaptor::New( RenderSurface *surface, const DeviceLayout& baseLayout,
113 Dali::Configuration::ContextLoss configuration )
115 DALI_ASSERT_ALWAYS( surface->GetType() != Dali::RenderSurface::NO_SURFACE && "No surface for adaptor" );
117 Dali::Adaptor* adaptor = new Dali::Adaptor;
118 Adaptor* impl = new Adaptor( *adaptor, surface, baseLayout );
119 adaptor->mImpl = impl;
121 impl->Initialize(configuration);
126 void Adaptor::ParseEnvironmentOptions()
128 // get logging options
129 unsigned int logFrameRateFrequency = GetIntegerEnvironmentVariable( DALI_ENV_FPS_TRACKING, 0 );
130 unsigned int logupdateStatusFrequency = GetIntegerEnvironmentVariable( DALI_ENV_UPDATE_STATUS_INTERVAL, 0 );
131 unsigned int logPerformanceLevel = GetIntegerEnvironmentVariable( DALI_ENV_LOG_PERFORMANCE, 0 );
132 unsigned int logPanGesture = GetIntegerEnvironmentVariable( DALI_ENV_LOG_PAN_GESTURE, 0 );
134 // all threads here (event, update, and render) will send their logs to SLP Platform's LogMessage handler.
135 Dali::Integration::Log::LogFunction logFunction(Dali::SlpPlatform::LogMessage);
137 mEnvironmentOptions.SetLogOptions( logFunction, logFrameRateFrequency, logupdateStatusFrequency, logPerformanceLevel, logPanGesture );
140 if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_PREDICTION_MODE, predictionMode) )
142 mEnvironmentOptions.SetPanGesturePredictionMode(predictionMode);
144 int predictionAmount(-1);
145 if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_PREDICTION_AMOUNT, predictionAmount) )
147 if( predictionAmount < 0 )
149 // do not support times in the past
150 predictionAmount = 0;
152 mEnvironmentOptions.SetPanGesturePredictionAmount(predictionAmount);
154 int minPredictionAmount(-1);
155 if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MIN_PREDICTION_AMOUNT, minPredictionAmount) )
157 if( minPredictionAmount < 0 )
159 // do not support times in the past
160 minPredictionAmount = 0;
162 mEnvironmentOptions.SetPanGestureMinimumPredictionAmount(minPredictionAmount);
164 int maxPredictionAmount(-1);
165 if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MAX_PREDICTION_AMOUNT, maxPredictionAmount) )
167 if( minPredictionAmount > -1 && maxPredictionAmount < minPredictionAmount )
169 // maximum amount should not be smaller than minimum amount
170 maxPredictionAmount = minPredictionAmount;
172 mEnvironmentOptions.SetPanGestureMaximumPredictionAmount(maxPredictionAmount);
174 int predictionAmountAdjustment(-1);
175 if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_PREDICTION_AMOUNT_ADJUSTMENT, predictionAmountAdjustment) )
177 if( predictionAmountAdjustment < 0 )
179 // negative amount doesn't make sense
180 predictionAmountAdjustment = 0;
182 mEnvironmentOptions.SetPanGesturePredictionAmountAdjustment(predictionAmountAdjustment);
185 if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_SMOOTHING_MODE, smoothingMode) )
187 mEnvironmentOptions.SetPanGestureSmoothingMode(smoothingMode);
189 float smoothingAmount = 1.0f;
190 if( GetFloatEnvironmentVariable(DALI_ENV_PAN_SMOOTHING_AMOUNT, smoothingAmount) )
192 smoothingAmount = Clamp(smoothingAmount, 0.0f, 1.0f);
193 mEnvironmentOptions.SetPanGestureSmoothingAmount(smoothingAmount);
196 int minimumDistance(-1);
197 if ( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MINIMUM_DISTANCE, minimumDistance ))
199 mEnvironmentOptions.SetMinimumPanDistance( minimumDistance );
202 int minimumEvents(-1);
203 if ( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MINIMUM_EVENTS, minimumEvents ))
205 mEnvironmentOptions.SetMinimumPanEvents( minimumEvents );
209 if ( GetIntegerEnvironmentVariable(DALI_GLES_CALL_TIME, glesCallTime ))
211 mEnvironmentOptions.SetGlesCallTime( glesCallTime );
214 mEnvironmentOptions.InstallLogFunction();
217 void Adaptor::Initialize(Dali::Configuration::ContextLoss configuration)
219 ParseEnvironmentOptions();
221 mPlatformAbstraction = new SlpPlatform::SlpPlatformAbstraction;
223 ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
224 if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
226 dataRetentionPolicy = ResourcePolicy::DALI_RETAINS_MESH_DATA;
228 // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
229 // files automatically.
231 if( mEnvironmentOptions.GetPerformanceLoggingLevel() > 0 )
233 mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, mEnvironmentOptions );
236 mCallbackManager = CallbackManager::New();
238 PositionSize size = mSurface->GetPositionSize();
240 mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, mEnvironmentOptions);
242 if( mEnvironmentOptions.GetGlesCallTime() > 0 )
244 mGLES = new GlProxyImplementation( mEnvironmentOptions );
248 mGLES = new GlImplementation();
251 mEglFactory = new EglFactory();
253 EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
255 mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGLES, *eglSyncImpl, *mGestureManager, dataRetentionPolicy );
257 mObjectProfiler = new ObjectProfiler();
259 mNotificationTrigger = new TriggerEvent( boost::bind(&Adaptor::ProcessCoreEvents, this) );
261 mVSyncMonitor = new VSyncMonitor;
263 mUpdateRenderController = new UpdateRenderController( *this, mEnvironmentOptions );
265 mDaliFeedbackPlugin = new FeedbackPluginProxy( FeedbackPluginProxy::DEFAULT_OBJECT_NAME );
267 // Should be called after Core creation
268 if( mEnvironmentOptions.GetPanGestureLoggingLevel() )
270 Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
272 if( mEnvironmentOptions.GetPanGesturePredictionMode() >= 0 )
274 Integration::SetPanGesturePredictionMode(mEnvironmentOptions.GetPanGesturePredictionMode());
276 if( mEnvironmentOptions.GetPanGesturePredictionAmount() >= 0 )
278 Integration::SetPanGesturePredictionAmount(mEnvironmentOptions.GetPanGesturePredictionAmount());
280 if( mEnvironmentOptions.GetPanGestureMaximumPredictionAmount() >= 0 )
282 Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions.GetPanGestureMaximumPredictionAmount());
284 if( mEnvironmentOptions.GetPanGestureMinimumPredictionAmount() >= 0 )
286 Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions.GetPanGestureMinimumPredictionAmount());
288 if( mEnvironmentOptions.GetPanGesturePredictionAmountAdjustment() >= 0 )
290 Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions.GetPanGesturePredictionAmountAdjustment());
292 if( mEnvironmentOptions.GetPanGestureSmoothingMode() >= 0 )
294 Integration::SetPanGestureSmoothingMode(mEnvironmentOptions.GetPanGestureSmoothingMode());
296 if( mEnvironmentOptions.GetPanGestureSmoothingAmount() >= 0.0f )
298 Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions.GetPanGestureSmoothingAmount());
304 // Ensure stop status
307 // Release first as we do not want any access to Adaptor as it is being destroyed.
308 gThreadLocalAdaptor.release();
310 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
312 (*iter)->OnDestroy();
315 delete mUpdateRenderController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
316 delete mVSyncMonitor;
317 delete mEventHandler;
318 delete mObjectProfiler;
322 // Delete feedback controller before feedback plugin & style monitor dependencies
323 delete mFeedbackController;
324 delete mDaliFeedbackPlugin;
326 delete mGestureManager;
327 delete mPlatformAbstraction;
328 delete mCallbackManager;
329 delete mPerformanceInterface;
331 // uninstall it on this thread (main actor thread)
332 Dali::Integration::Log::UninstallLogFunction();
335 void Adaptor::Start()
337 // it doesn't support restart after stop at this moment
338 // to support restarting, need more testing
339 if( READY != mState )
344 // Start the callback manager
345 mCallbackManager->Start();
347 // create event handler
348 mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
350 if( mDeferredRotationObserver != NULL )
352 mEventHandler->SetRotationObserver(mDeferredRotationObserver);
353 mDeferredRotationObserver = NULL;
356 // guarantee map the surface before starting render-thread.
359 // NOTE: dpi must be set before starting the render thread
360 // use default or command line settings if not run on device
362 // set the DPI value for font rendering
363 unsigned int dpiHor, dpiVer;
365 mSurface->GetDpi(dpiHor, dpiVer);
367 // tell core about the value
368 mCore->SetDpi(dpiHor, dpiVer);
370 mCore->SetDpi(mHDpi, mVDpi);
373 // Tell the core the size of the surface just before we start the render-thread
374 PositionSize size = mSurface->GetPositionSize();
375 mCore->SurfaceResized( size.width, size.height );
377 // Start the update & render threads
378 mUpdateRenderController->Start();
382 ProcessCoreEvents(); // Ensure any startup messages are processed.
384 if ( !mFeedbackController )
386 // Start sound & haptic feedback
387 mFeedbackController = new FeedbackController( *mDaliFeedbackPlugin );
390 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
396 // Dali::Internal::Adaptor::Adaptor::Pause
397 void Adaptor::Pause()
399 // Only pause the adaptor if we're actually running.
400 if( RUNNING == mState )
402 // Inform observers that we are about to be paused.
403 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
408 // Reset the event handler when adaptor paused
411 mEventHandler->Reset();
414 mUpdateRenderController->Pause();
420 // Dali::Internal::Adaptor::Adaptor::Resume
421 void Adaptor::Resume()
423 // Only resume the adaptor if we are in the suspended state.
424 if( PAUSED == mState )
426 // We put ResumeFrameTime first, as this was originally called at the start of mCore->Resume()
427 // If there were events pending, mCore->Resume() will call
428 // RenderController->RequestUpdate()
429 // UpdateRenderController->RequestUpdate()
430 // UpdateRenderSynchronization->RequestUpdate()
431 // and we should have reset the frame timers before allowing Core->Update() to be called.
432 //@todo Should we call UpdateRenderController->Resume before mCore->Resume()?
434 mUpdateRenderController->ResumeFrameTime();
436 mUpdateRenderController->Resume();
440 // Reset the event handler when adaptor resumed
443 mEventHandler->Reset();
446 // Inform observers that we have resumed.
447 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
452 ProcessCoreEvents(); // Ensure any outstanding messages are processed
458 if( RUNNING == mState ||
460 PAUSED_WHILE_HIDDEN == mState )
462 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
467 mUpdateRenderController->Stop();
470 // Delete the TTS player
471 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
475 mTtsPlayers[i].Reset();
479 delete mEventHandler;
480 mEventHandler = NULL;
482 delete mNotificationTrigger;
483 mNotificationTrigger = NULL;
485 mCallbackManager->Stop();
491 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
493 mEventHandler->FeedTouchPoint( point, timeStamp );
496 void Adaptor::FeedWheelEvent( MouseWheelEvent& wheelEvent )
498 mEventHandler->FeedWheelEvent( wheelEvent );
501 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
503 mEventHandler->FeedKeyEvent( keyEvent );
506 bool Adaptor::MoveResize( const PositionSize& positionSize )
508 PositionSize old = mSurface->GetPositionSize();
510 // just resize the surface. The driver should automatically resize the egl Surface (untested)
511 // EGL Spec says : EGL window surfaces need to be resized when their corresponding native window
512 // is resized. Implementations typically use hooks into the OS and native window
513 // system to perform this resizing on demand, transparently to the client.
514 mSurface->MoveResize( positionSize );
516 if(old.width != positionSize.width || old.height != positionSize.height)
518 SurfaceSizeChanged(positionSize);
524 void Adaptor::SurfaceResized( const PositionSize& positionSize )
526 PositionSize old = mSurface->GetPositionSize();
528 // Called by an application, when it has resized a window outside of Dali.
529 // The EGL driver automatically detects X Window resize calls, and resizes
530 // the EGL surface for us.
531 mSurface->MoveResize( positionSize );
533 if(old.width != positionSize.width || old.height != positionSize.height)
535 SurfaceSizeChanged(positionSize);
539 void Adaptor::ReplaceSurface( Dali::RenderSurface& surface )
541 // adaptor implementation needs the implementation of
542 RenderSurface* internalSurface = dynamic_cast<Internal::Adaptor::RenderSurface*>( &surface );
543 DALI_ASSERT_ALWAYS( internalSurface && "Incorrect surface" );
545 ECore::WindowRenderSurface* windowSurface = dynamic_cast<Internal::Adaptor::ECore::WindowRenderSurface*>( &surface);
546 if( windowSurface != NULL )
548 windowSurface->Map();
549 // @todo Restart event handler with new surface
552 mSurface = internalSurface;
554 SurfaceSizeChanged( internalSurface->GetPositionSize() );
556 // flush the event queue to give update and render threads chance
557 // to start processing messages for new camera setup etc as soon as possible
560 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
562 // this method blocks until the render thread has completed the replace.
563 mUpdateRenderController->ReplaceSurface(internalSurface);
565 // Inform core, so that texture resources can be reloaded
566 mCore->RecoverFromContextLoss();
568 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
571 Dali::RenderSurface& Adaptor::GetSurface() const
576 void Adaptor::ReleaseSurfaceLock()
578 mSurface->ReleaseLock();
581 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
583 if(!mTtsPlayers[mode])
585 // Create the TTS player when it needed, because it can reduce launching time.
586 mTtsPlayers[mode] = TtsPlayer::New(mode);
589 return mTtsPlayers[mode];
592 bool Adaptor::AddIdle(boost::function<void(void)> callBack)
594 bool idleAdded(false);
596 // Only add an idle if the Adaptor is actually running
597 if( RUNNING == mState )
599 idleAdded = mCallbackManager->AddCallback(callBack, CallbackManager::IDLE_PRIORITY);
605 bool Adaptor::CallFromMainLoop(boost::function<void(void)> callBack)
607 bool callAdded(false);
609 // Only allow the callback if the Adaptor is actually running
610 if ( RUNNING == mState )
612 callAdded = mCallbackManager->AddCallback(callBack, CallbackManager::DEFAULT_PRIORITY);
618 Dali::Adaptor& Adaptor::Get()
620 DALI_ASSERT_ALWAYS( gThreadLocalAdaptor.get() != NULL && "Adaptor not instantiated" );
621 return gThreadLocalAdaptor->mAdaptor;
624 bool Adaptor::IsAvailable()
626 return gThreadLocalAdaptor.get() != NULL;
629 Dali::Integration::Core& Adaptor::GetCore()
634 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
636 mUpdateRenderController->SetRenderRefreshRate( numberOfVSyncsPerRender );
639 void Adaptor::SetUseHardwareVSync( bool useHardware )
641 mVSyncMonitor->SetUseHardwareVSync( useHardware );
644 void Adaptor::SetDpi(size_t hDpi, size_t vDpi)
650 EglFactory& Adaptor::GetEGLFactory() const
652 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
656 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
661 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
663 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
667 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
669 return *mPlatformAbstraction;
672 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
677 TriggerEventInterface& Adaptor::GetTriggerEventInterface()
679 return *mNotificationTrigger;
681 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
683 return mTriggerEventFactory;
685 RenderSurface* Adaptor::GetRenderSurfaceInterface()
689 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
691 return mVSyncMonitor;
694 KernelTraceInterface& Adaptor::GetKernelTraceInterface()
696 return mKernelTracer;
699 PerformanceInterface* Adaptor::GetPerformanceInterface()
701 return mPerformanceInterface;
704 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
706 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
707 return *mPlatformAbstraction;
710 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
712 mDragAndDropDetector = detector;
716 mEventHandler->SetDragAndDropDetector( detector );
720 void Adaptor::SetRotationObserver( RotationObserver* observer )
724 mEventHandler->SetRotationObserver( observer );
726 else if( mState == READY )
728 // Set once event handler exists
729 mDeferredRotationObserver = observer;
733 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
735 if(mTtsPlayers[mode])
737 mTtsPlayers[mode].Reset();
741 void Adaptor::SetMinimumPinchDistance(float distance)
743 if( mGestureManager )
745 mGestureManager->SetMinimumPinchDistance(distance);
750 void Adaptor::AddObserver( LifeCycleObserver& observer )
752 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
754 if ( match == mObservers.end() )
756 mObservers.push_back( &observer );
760 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
762 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
764 if ( match != mObservers.end() )
766 mObservers.erase( match );
770 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
774 mCore->QueueEvent(event);
778 void Adaptor::ProcessCoreEvents()
782 if( mPerformanceInterface )
784 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
787 mCore->ProcessEvents();
789 if( mPerformanceInterface )
791 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
796 void Adaptor::RequestUpdate()
798 // When Dali applications are partially visible behind the lock-screen,
799 // the indicator must be updated (therefore allow updates in the PAUSED state)
800 if ( PAUSED == mState ||
803 mUpdateRenderController->RequestUpdate();
807 void Adaptor::RequestProcessEventsOnIdle()
809 // Only request a notification if the Adaptor is actually running
810 // and we haven't installed the idle notification
811 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState ) )
813 mNotificationOnIdleInstalled = AddIdle( boost::bind( &Adaptor::ProcessCoreEventsFromIdle, this ) );
817 void Adaptor::OnWindowShown()
819 if ( PAUSED_WHILE_HIDDEN == mState )
821 // Adaptor can now be resumed
826 // Force a render task
831 void Adaptor::OnWindowHidden()
833 if ( STOPPED != mState )
837 // Adaptor cannot be resumed until the window is shown
838 mState = PAUSED_WHILE_HIDDEN;
842 // Dali::Internal::Adaptor::Adaptor::OnDamaged
843 void Adaptor::OnDamaged( const DamageArea& area )
845 // This is needed for the case where Dali window is partially obscured
849 void Adaptor::SurfaceSizeChanged(const PositionSize& positionSize)
851 // let the core know the surface size has changed
852 mCore->SurfaceResized(positionSize.width, positionSize.height);
854 mResizedSignal.Emit( mAdaptor );
857 void Adaptor::NotifyLanguageChanged()
859 mLanguageChangedSignal.Emit( mAdaptor );
862 void Adaptor::RequestUpdateOnce()
864 if( PAUSED_WHILE_HIDDEN != mState )
866 if( mUpdateRenderController )
868 mUpdateRenderController->RequestUpdateOnce();
873 void Adaptor::ProcessCoreEventsFromIdle()
877 // the idle handle automatically un-installs itself
878 mNotificationOnIdleInstalled = false;
881 Adaptor::Adaptor(Dali::Adaptor& adaptor, RenderSurface* surface, const DeviceLayout& baseLayout)
883 mLanguageChangedSignal(),
887 mUpdateRenderController(NULL),
892 mPlatformAbstraction( NULL ),
893 mEventHandler( NULL ),
894 mCallbackManager( NULL ),
895 mNotificationOnIdleInstalled( false ),
896 mNotificationTrigger(NULL),
897 mGestureManager(NULL),
900 mDaliFeedbackPlugin(NULL),
901 mFeedbackController(NULL),
903 mDragAndDropDetector(),
904 mDeferredRotationObserver(NULL),
905 mBaseLayout(baseLayout),
906 mEnvironmentOptions(),
907 mPerformanceInterface(NULL),
908 mObjectProfiler(NULL)
910 DALI_ASSERT_ALWAYS( gThreadLocalAdaptor.get() == NULL && "Cannot create more than one Adaptor per thread" );
911 gThreadLocalAdaptor.reset(this);
916 void Adaptor::SetViewMode( ViewMode viewMode )
918 mSurface->SetViewMode( viewMode );
919 mCore->SetViewMode( viewMode );
922 ViewMode Adaptor::GetViewMode() const
924 return mCore->GetViewMode();
927 void Adaptor::SetStereoBase( float stereoBase )
929 mCore->SetStereoBase( stereoBase );
932 float Adaptor::GetStereoBase() const
934 return mCore->GetStereoBase();
937 } // namespace Adaptor
939 } // namespace Internal