Overlay RenderTaskList should be created by the Window instead of the Overlay
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/window-system/common/window-impl.h>
20
21 // EXTERNAL HEADERS
22 #include <dali/integration-api/core.h>
23 #include <dali/integration-api/system-overlay.h>
24 #include <dali/integration-api/render-task-list-integ.h>
25 #include <dali/public-api/actors/camera-actor.h>
26 #include <dali/public-api/render-tasks/render-task.h>
27 #include <dali/public-api/render-tasks/render-task-list.h>
28 #include <dali/devel-api/adaptor-framework/orientation.h>
29
30 // INTERNAL HEADERS
31 #include <dali/internal/input/common/drag-and-drop-detector-impl.h>
32 #include <dali/internal/window-system/common/window-visibility-observer.h>
33 #include <dali/internal/window-system/common/orientation-impl.h>
34 #include <dali/internal/window-system/common/render-surface-factory.h>
35 #include <dali/internal/window-system/common/window-factory.h>
36 #include <dali/internal/window-system/common/window-base.h>
37 #include <dali/internal/window-system/common/window-render-surface.h>
38
39 namespace Dali
40 {
41 namespace Internal
42 {
43 namespace Adaptor
44 {
45
46 namespace
47 {
48
49 #if defined(DEBUG_ENABLED)
50 Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
51 #endif
52
53 } // unnamed namespace
54
55 Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
56 {
57   Window* window = new Window();
58   window->mIsTransparent = isTransparent;
59   window->Initialize( positionSize, name, className );
60   return window;
61 }
62
63 Window::Window()
64 : mSurface( NULL ),
65   mWindowBase(),
66   mIndicatorVisible( Dali::Window::INVISIBLE ),   // TODO: Enable this after indicator implementation based on tizen 5.
67   mIndicatorIsShown( false ),
68   mShowRotatedIndicatorOnClose( false ),
69   mStarted( false ),
70   mIsTransparent( false ),
71   mIsFocusAcceptable( true ),
72   mVisible( true ),
73   mIconified( false ),
74   mOpaqueState( false ),
75   mResizeEnabled( false ),
76   mIndicator(),
77   mIndicatorOrientation( Dali::Window::PORTRAIT ),
78   mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
79   mIndicatorOpacityMode( Dali::Window::OPAQUE ),
80   mOverlay( NULL ),
81   mAdaptor( NULL ),
82   mType( Dali::Window::NORMAL ),
83   mPreferredOrientation( Dali::Window::PORTRAIT ),
84   mIndicatorVisibilityChangedSignal(),
85   mFocusChangedSignal(),
86   mResizedSignal(),
87   mDeleteRequestSignal()
88 {
89 }
90
91 Window::~Window()
92 {
93   if( mIndicator )
94   {
95     mOverlay->Remove( mIndicator->GetActor() );
96     Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
97     Dali::RenderTask indicatorTask = taskList.GetTask(0);
98     mOverlay->GetOverlayRenderTasks().RemoveTask(indicatorTask);
99     mIndicator->Close();
100   }
101
102   if ( mAdaptor )
103   {
104     mAdaptor->RemoveObserver( *this );
105     mAdaptor->SetDragAndDropDetector( NULL );
106     mAdaptor = NULL;
107   }
108
109   delete mSurface;
110 }
111
112 void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
113 {
114   // Create a window render surface
115   Any surface;
116   auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
117   auto windowRenderSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
118   mSurface = windowRenderSurface.release();
119
120   // Get a window base
121   mWindowBase = mSurface->GetWindowBase();
122
123   // Connect signals
124   mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
125   mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
126   mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
127   mWindowBase->IndicatorFlickedSignal().Connect( this, &Window::OnIndicatorFlicked );
128
129   mSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
130
131   if( !positionSize.IsEmpty() )
132   {
133     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
134     mResizeEnabled = true;
135   }
136
137   SetClass( name, className );
138
139   mSurface->Map();
140
141   mOrientation = Orientation::New( this );
142 }
143
144 void Window::SetAdaptor(Dali::Adaptor& adaptor)
145 {
146   DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
147   mStarted = true;
148
149   // Create one overlay for the main window only
150   Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
151   Integration::Core& core = adaptorImpl.GetCore();
152   mOverlay = &core.GetSystemOverlay();
153
154   // Only create render task list for the overlay once
155   if (!mOverlay->GetOverlayRenderTasks())
156   {
157     Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
158
159     Dali::Actor overlayRootActor = mOverlay->GetDefaultRootActor();
160     Dali::CameraActor overlayCameraActor = mOverlay->GetDefaultCameraActor();
161     Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
162
163     mOverlay->SetOverlayRenderTasks( overlayRenderTaskList );
164   }
165
166   mAdaptor = &adaptorImpl;
167   mAdaptor->AddObserver( *this );
168
169   // Can only create the detector when we know the Core has been instantiated.
170   mDragAndDropDetector = DragAndDropDetector::New();
171   mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) );
172
173   if( mOrientation )
174   {
175     mOrientation->SetAdaptor(adaptor);
176   }
177
178   if( mIndicator != NULL )
179   {
180     mIndicator->SetAdaptor(mAdaptor);
181   }
182 }
183
184 WindowRenderSurface* Window::GetSurface()
185 {
186   return mSurface;
187 }
188
189 void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
190 {
191   // TODO: Enable this after indicator implementation based on tizen 5.
192 //  mIndicatorVisible = visibleMode;
193
194   mWindowBase->ShowIndicator( mIndicatorVisible, mIndicatorOpacityMode );
195
196   DoShowIndicator( mIndicatorOrientation );
197 }
198
199 void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
200 {
201   mIndicatorOpacityMode = opacityMode;
202
203   if( mIndicator != NULL )
204   {
205     mIndicator->SetOpacityMode( opacityMode );
206   }
207 }
208
209 void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
210 {
211   // TODO: Enable this after indicator implementation based on tizen 5.
212 //  mIndicatorVisible = mode;
213 }
214
215 void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
216 {
217   DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation );
218
219   DoRotateIndicator( orientation );
220 }
221
222 void Window::SetClass( std::string name, std::string className )
223 {
224   mWindowBase->SetClass( name, className );
225 }
226
227 void Window::Raise()
228 {
229   mWindowBase->Raise();
230 }
231
232 void Window::Lower()
233 {
234   mWindowBase->Lower();
235 }
236
237 void Window::Activate()
238 {
239   mWindowBase->Activate();
240 }
241
242 void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
243 {
244   bool found = false;
245
246   if( orientation <= Dali::Window::LANDSCAPE_INVERSE )
247   {
248     for( std::size_t i = 0; i < mAvailableOrientations.size(); i++ )
249     {
250       if( mAvailableOrientations[i] == orientation )
251       {
252         found = true;
253         break;
254       }
255     }
256
257     if( !found )
258     {
259       mAvailableOrientations.push_back( orientation );
260       SetAvailableOrientations( mAvailableOrientations );
261     }
262   }
263 }
264
265 void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
266 {
267   for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
268        iter != mAvailableOrientations.end(); ++iter )
269   {
270     if( *iter == orientation )
271     {
272       mAvailableOrientations.erase( iter );
273       break;
274     }
275   }
276   SetAvailableOrientations( mAvailableOrientations );
277 }
278
279 void Window::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
280 {
281   if( orientations.size() > 4 )
282   {
283     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableOrientations: Invalid vector size! [%d]\n", orientations.size() );
284     return;
285   }
286
287   mAvailableOrientations = orientations;
288
289   mWindowBase->SetAvailableOrientations( mAvailableOrientations );
290 }
291
292 const std::vector< Dali::Window::WindowOrientation >& Window::GetAvailableOrientations()
293 {
294   return mAvailableOrientations;
295 }
296
297 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
298 {
299   mPreferredOrientation = orientation;
300
301   mWindowBase->SetPreferredOrientation( mPreferredOrientation );
302 }
303
304 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
305 {
306   return mPreferredOrientation;
307 }
308
309 Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
310 {
311   return mDragAndDropDetector;
312 }
313
314 Dali::Any Window::GetNativeHandle() const
315 {
316   return mSurface->GetNativeWindow();
317 }
318
319 void Window::SetAcceptFocus( bool accept )
320 {
321   mIsFocusAcceptable = accept;
322
323   mWindowBase->SetAcceptFocus( accept );
324 }
325
326 bool Window::IsFocusAcceptable() const
327 {
328   return mIsFocusAcceptable;
329 }
330
331 void Window::Show()
332 {
333   mVisible = true;
334
335   mWindowBase->Show();
336
337   if( !mIconified )
338   {
339     WindowVisibilityObserver* observer( mAdaptor );
340     observer->OnWindowShown();
341     DALI_LOG_RELEASE_INFO( "Window (%p) ::Show()\n", this );
342   }
343 }
344
345 void Window::Hide()
346 {
347   mVisible = false;
348
349   mWindowBase->Hide();
350
351   if( !mIconified )
352   {
353     WindowVisibilityObserver* observer( mAdaptor );
354     observer->OnWindowHidden();
355     DALI_LOG_RELEASE_INFO( "Window (%p) ::Hide() \n", this );
356   }
357 }
358
359 bool Window::IsVisible() const
360 {
361   return mVisible;
362 }
363
364 unsigned int Window::GetSupportedAuxiliaryHintCount() const
365 {
366   return mWindowBase->GetSupportedAuxiliaryHintCount();
367 }
368
369 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
370 {
371   return mWindowBase->GetSupportedAuxiliaryHint( index );
372 }
373
374 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
375 {
376   return mWindowBase->AddAuxiliaryHint( hint, value );
377 }
378
379 bool Window::RemoveAuxiliaryHint( unsigned int id )
380 {
381   return mWindowBase->RemoveAuxiliaryHint( id );
382 }
383
384 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
385 {
386   return mWindowBase->SetAuxiliaryHintValue( id, value );
387 }
388
389 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
390 {
391   return mWindowBase->GetAuxiliaryHintValue( id );
392 }
393
394 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
395 {
396   return mWindowBase->GetAuxiliaryHintId( hint );
397 }
398
399 void Window::SetInputRegion( const Rect< int >& inputRegion )
400 {
401   mWindowBase->SetInputRegion( inputRegion );
402
403   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
404 }
405
406 void Window::SetType( Dali::Window::Type type )
407 {
408   if( type != mType )
409   {
410     mWindowBase->SetType( type );
411
412     mType = type;
413   }
414 }
415
416 Dali::Window::Type Window::GetType() const
417 {
418   return mType;
419 }
420
421 bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
422 {
423   if( mType != Dali::Window::NOTIFICATION )
424   {
425     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
426     return false;
427   }
428
429   return mWindowBase->SetNotificationLevel( level );
430 }
431
432 Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
433 {
434   if( mType != Dali::Window::NOTIFICATION )
435   {
436     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
437     return Dali::Window::NotificationLevel::NONE;
438   }
439
440   return mWindowBase->GetNotificationLevel();
441 }
442
443 void Window::SetOpaqueState( bool opaque )
444 {
445   mOpaqueState = opaque;
446
447   mWindowBase->SetOpaqueState( opaque );
448
449   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
450 }
451
452 bool Window::IsOpaqueState() const
453 {
454   return mOpaqueState;
455 }
456
457 bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
458 {
459   return mWindowBase->SetScreenOffMode( screenOffMode );
460 }
461
462 Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
463 {
464   return mWindowBase->GetScreenOffMode();
465 }
466
467 bool Window::SetBrightness( int brightness )
468 {
469   if( brightness < 0 || brightness > 100 )
470   {
471     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
472     return false;
473   }
474
475   return mWindowBase->SetBrightness( brightness );
476 }
477
478 int Window::GetBrightness() const
479 {
480   return mWindowBase->GetBrightness();
481 }
482
483 void Window::SetSize( Dali::Window::WindowSize size )
484 {
485   if( !mResizeEnabled )
486   {
487     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
488     mResizeEnabled = true;
489   }
490
491   PositionSize positionSize = mSurface->GetPositionSize();
492
493   if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
494   {
495     positionSize.width = size.GetWidth();
496     positionSize.height = size.GetHeight();
497
498     mSurface->MoveResize( positionSize );
499
500     mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
501
502     // Emit signal
503     mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
504
505     mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
506   }
507 }
508
509 Dali::Window::WindowSize Window::GetSize() const
510 {
511   PositionSize positionSize = mSurface->GetPositionSize();
512
513   return Dali::Window::WindowSize( positionSize.width, positionSize.height );
514 }
515
516 void Window::SetPosition( Dali::Window::WindowPosition position )
517 {
518   if( !mResizeEnabled )
519   {
520     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
521     mResizeEnabled = true;
522   }
523
524   PositionSize positionSize = mSurface->GetPositionSize();
525
526   if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
527   {
528     positionSize.x = position.GetX();
529     positionSize.y = position.GetY();
530
531     mSurface->MoveResize( positionSize );
532   }
533 }
534
535 Dali::Window::WindowPosition Window::GetPosition() const
536 {
537   PositionSize positionSize = mSurface->GetPositionSize();
538
539   return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
540 }
541
542 void Window::SetTransparency( bool transparent )
543 {
544   mSurface->SetTransparency( transparent );
545 }
546
547 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
548 {
549   return mWindowBase->GrabKey( key, grabMode );
550 }
551
552 bool Window::UngrabKey( Dali::KEY key )
553 {
554   return mWindowBase->UngrabKey( key );
555 }
556
557 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
558 {
559   return mWindowBase->GrabKeyList( key, grabMode, result );
560 }
561
562 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
563 {
564   return mWindowBase->UngrabKeyList( key, result );
565 }
566
567 void Window::RotationDone( int orientation, int width, int height )
568 {
569   mSurface->RequestRotation( orientation, width, height );
570
571   mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
572
573   // Emit signal
574   mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
575
576   mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
577 }
578
579 void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
580 {
581   if( mIndicator == NULL )
582   {
583     if( mIndicatorVisible != Dali::Window::INVISIBLE )
584     {
585       auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
586       mIndicator = windowFactory->CreateIndicator( mAdaptor, mIndicatorOrientation, this );
587       if( mIndicator )
588       {
589         mIndicator->SetOpacityMode( mIndicatorOpacityMode );
590         Dali::Actor actor = mIndicator->GetActor();
591         SetIndicatorActorRotation();
592         mOverlay->Add(actor);
593       }
594     }
595     // else don't create a hidden indicator
596   }
597   else // Already have indicator
598   {
599     if( mIndicatorVisible == Dali::Window::VISIBLE )
600     {
601       // If we are resuming, and rotation has changed,
602       if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
603       {
604         // then close current indicator and open new one
605         mShowRotatedIndicatorOnClose = true;
606         mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
607         // Don't show actor - will contain indicator for old orientation.
608       }
609     }
610   }
611
612   // set indicator visible mode
613   if( mIndicator != NULL )
614   {
615     mIndicator->SetVisible( mIndicatorVisible );
616   }
617
618   bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
619   SetIndicatorProperties( show, lastOrientation );
620   mIndicatorIsShown = show;
621 }
622
623 void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
624 {
625   if( mIndicatorIsShown )
626   {
627     mShowRotatedIndicatorOnClose = true;
628     mNextIndicatorOrientation = orientation;
629     if( mIndicator )
630     {
631       mIndicator->Close(); // May synchronously call IndicatorClosed() callback
632     }
633   }
634   else
635   {
636     // Save orientation for when the indicator is next shown
637     mShowRotatedIndicatorOnClose = false;
638     mNextIndicatorOrientation = orientation;
639   }
640 }
641
642 void Window::SetIndicatorActorRotation()
643 {
644   DALI_LOG_TRACE_METHOD( gWindowLogFilter );
645   if( mIndicator )
646   {
647     Dali::Actor actor = mIndicator->GetActor();
648     switch( mIndicatorOrientation )
649     {
650       case Dali::Window::PORTRAIT:
651         actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
652         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
653         actor.SetOrientation( Degree(0), Vector3::ZAXIS );
654         break;
655       case Dali::Window::PORTRAIT_INVERSE:
656         actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
657         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
658         actor.SetOrientation( Degree(180), Vector3::ZAXIS );
659         break;
660       case Dali::Window::LANDSCAPE:
661         actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
662         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
663         actor.SetOrientation( Degree(270), Vector3::ZAXIS );
664         break;
665       case Dali::Window::LANDSCAPE_INVERSE:
666         actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
667         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
668         actor.SetOrientation( Degree(90), Vector3::ZAXIS );
669         break;
670     }
671   }
672 }
673
674 void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
675 {
676   mWindowBase->SetIndicatorProperties( isShow, lastOrientation );
677 }
678
679 void Window::OnIconifyChanged( bool iconified )
680 {
681   if( iconified )
682   {
683     mIconified = true;
684
685     if( mVisible )
686     {
687       WindowVisibilityObserver* observer( mAdaptor );
688       observer->OnWindowHidden();
689       DALI_LOG_RELEASE_INFO( "Window (%p) Iconified\n", this );
690     }
691   }
692   else
693   {
694     mIconified = false;
695
696     if( mVisible )
697     {
698       WindowVisibilityObserver* observer( mAdaptor );
699       observer->OnWindowShown();
700       DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified\n", this );
701     }
702   }
703 }
704
705 void Window::OnFocusChanged( bool focusIn )
706 {
707   mFocusChangedSignal.Emit( focusIn );
708 }
709
710 void Window::OnOutputTransformed()
711 {
712   PositionSize positionSize = mSurface->GetPositionSize();
713   mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
714   mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
715 }
716
717 void Window::OnDeleteRequest()
718 {
719   mDeleteRequestSignal.Emit();
720 }
721
722 void Window::OnIndicatorFlicked()
723 {
724   if( mIndicator )
725   {
726     mIndicator->Flicked();
727   }
728 }
729
730 void Window::IndicatorTypeChanged( IndicatorInterface::Type type )
731 {
732   mWindowBase->IndicatorTypeChanged( type );
733 }
734
735 void Window::IndicatorClosed( IndicatorInterface* indicator )
736 {
737   DALI_LOG_TRACE_METHOD( gWindowLogFilter );
738
739   if( mShowRotatedIndicatorOnClose )
740   {
741     Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
742     if( mIndicator )
743     {
744       mIndicator->Open( mNextIndicatorOrientation );
745     }
746     mIndicatorOrientation = mNextIndicatorOrientation;
747     SetIndicatorActorRotation();
748     DoShowIndicator( currentOrientation );
749   }
750 }
751
752 void Window::IndicatorVisibilityChanged( bool isVisible )
753 {
754   mIndicatorVisibilityChangedSignal.Emit( isVisible );
755 }
756
757 void Window::OnStart()
758 {
759   DoShowIndicator( mIndicatorOrientation );
760 }
761
762 void Window::OnPause()
763 {
764 }
765
766 void Window::OnResume()
767 {
768   // resume indicator status
769   if( mIndicator != NULL )
770   {
771     // Restore own indicator opacity
772     // Send opacity mode to indicator service when app resumed
773     mIndicator->SetOpacityMode( mIndicatorOpacityMode );
774   }
775 }
776
777 void Window::OnStop()
778 {
779   if( mIndicator )
780   {
781     mIndicator->Close();
782   }
783
784   mIndicator.release();
785 }
786
787 void Window::OnDestroy()
788 {
789   mAdaptor = NULL;
790 }
791
792 } // Adaptor
793
794 } // Internal
795
796 } // Dali