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