Window& windowImpl = Dali::GetImplementation(window);
Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
+
+ Internal::Adaptor::Adaptor::GetImplementation( *adaptor ).SetWindow( window );
windowImpl.SetAdaptor(*adaptor);
return adaptor;
}
EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
- mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGLES, *eglSyncImpl, *mGestureManager, dataRetentionPolicy );
+ mCore = Integration::Core::New( *this,
+ *mPlatformAbstraction,
+ *mGLES,
+ *eglSyncImpl,
+ *mGestureManager,
+ dataRetentionPolicy ,
+ 0u != mEnvironmentOptions->GetRenderToFboInterval() );
const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
if( 0u < timeInterval )
// Initialize the thread controller
mThreadController->Initialize();
- mState = RUNNING;
-
ProcessCoreEvents(); // Ensure any startup messages are processed.
for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
}
mThreadController->Pause();
- mCore->Suspend();
mState = PAUSED;
+
+ // Process remained events and rendering in the update thread
+ RequestUpdateOnce();
}
}
(*iter)->OnResume();
}
- // Resume core so it processes any requests as well
- mCore->Resume();
+ // trigger processing of events queued up while paused
+ mCore->ProcessEvents();
// Do at end to ensure our first update/render after resumption includes the processed messages as well
mThreadController->Resume();
}
mThreadController->Stop();
- mCore->Suspend();
// Delete the TTS player
for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
return mTtsPlayers[mode];
}
-bool Adaptor::AddIdle( CallbackBase* callback )
+bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
{
bool idleAdded(false);
// Only add an idle if the Adaptor is actually running
- if( RUNNING == mState )
+ if( RUNNING == mState || forceAdd )
{
idleAdded = mCallbackManager->AddIdleCallback( callback );
}
}
}
-void Adaptor::RequestUpdate()
+void Adaptor::RequestUpdate( bool forceUpdate )
{
- // When Dali applications are partially visible behind the lock-screen,
- // the indicator must be updated (therefore allow updates in the PAUSED state)
- if ( PAUSED == mState ||
- RUNNING == mState )
+ switch( mState )
{
- mThreadController->RequestUpdate();
+ case RUNNING:
+ {
+ mThreadController->RequestUpdate();
+ break;
+ }
+ case PAUSED:
+ case PAUSED_WHILE_HIDDEN:
+ {
+ // When Dali applications are partially visible behind the lock-screen,
+ // the indicator must be updated (therefore allow updates in the PAUSED state)
+ if( forceUpdate )
+ {
+ mThreadController->RequestUpdateOnce();
+ }
+ break;
+ }
+ default:
+ {
+ // Do nothing
+ break;
+ }
}
}
-void Adaptor::RequestProcessEventsOnIdle()
+void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
{
// Only request a notification if the Adaptor is actually running
// and we haven't installed the idle notification
- if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState ) )
+ if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || forceProcess ) )
{
- mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ) );
+ mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
}
}
void Adaptor::OnWindowHidden()
{
- if ( STOPPED != mState )
+ if ( RUNNING == mState )
{
Pause();
void Adaptor::OnDamaged( const DamageArea& area )
{
// This is needed for the case where Dali window is partially obscured
- RequestUpdate();
+ RequestUpdate( false );
}
void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
// process after surface is created (registering to remote surface provider if required)
SurfaceInitialized();
+
+ mState = RUNNING;
}
void Adaptor::NotifyLanguageChanged()
void Adaptor::RequestUpdateOnce()
{
- if( PAUSED_WHILE_HIDDEN != mState )
+ if( mThreadController )
{
- if( mThreadController )
- {
- mThreadController->RequestUpdateOnce();
- }
+ mThreadController->RequestUpdateOnce();
}
}
mTriggerEventFactory(),
mObjectProfiler( NULL ),
mSocketFactory(),
+ mWindow(),
mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
mUseRemoteSurface( false )
{
static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
}
+void Adaptor::SetWindow( Dali::Window window )
+{
+ mWindow = window;
+}
+
+Dali::Window Adaptor::GetWindow()
+{
+ return mWindow;
+}
+
} // namespace Adaptor
} // namespace Internal