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