[Tizen] Add logs - Window, Adaptor and CombinedUpdateRenderController
[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   }
342
343   DALI_LOG_RELEASE_INFO( "Window (%p) Show(): iconified = %d\n", this, mIconified );
344 }
345
346 void Window::Hide()
347 {
348   mVisible = false;
349
350   mWindowBase->Hide();
351
352   if( !mIconified )
353   {
354     WindowVisibilityObserver* observer( mAdaptor );
355     observer->OnWindowHidden();
356   }
357
358   DALI_LOG_RELEASE_INFO( "Window (%p) Hide(): iconified = %d\n", this, mIconified );
359 }
360
361 bool Window::IsVisible() const
362 {
363   return mVisible;
364 }
365
366 unsigned int Window::GetSupportedAuxiliaryHintCount() const
367 {
368   return mWindowBase->GetSupportedAuxiliaryHintCount();
369 }
370
371 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
372 {
373   return mWindowBase->GetSupportedAuxiliaryHint( index );
374 }
375
376 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
377 {
378   return mWindowBase->AddAuxiliaryHint( hint, value );
379 }
380
381 bool Window::RemoveAuxiliaryHint( unsigned int id )
382 {
383   return mWindowBase->RemoveAuxiliaryHint( id );
384 }
385
386 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
387 {
388   return mWindowBase->SetAuxiliaryHintValue( id, value );
389 }
390
391 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
392 {
393   return mWindowBase->GetAuxiliaryHintValue( id );
394 }
395
396 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
397 {
398   return mWindowBase->GetAuxiliaryHintId( hint );
399 }
400
401 void Window::SetInputRegion( const Rect< int >& inputRegion )
402 {
403   mWindowBase->SetInputRegion( inputRegion );
404
405   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 );
406 }
407
408 void Window::SetType( Dali::Window::Type type )
409 {
410   if( type != mType )
411   {
412     mWindowBase->SetType( type );
413
414     mType = type;
415   }
416 }
417
418 Dali::Window::Type Window::GetType() const
419 {
420   return mType;
421 }
422
423 bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
424 {
425   if( mType != Dali::Window::NOTIFICATION )
426   {
427     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
428     return false;
429   }
430
431   return mWindowBase->SetNotificationLevel( level );
432 }
433
434 Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
435 {
436   if( mType != Dali::Window::NOTIFICATION )
437   {
438     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
439     return Dali::Window::NotificationLevel::NONE;
440   }
441
442   return mWindowBase->GetNotificationLevel();
443 }
444
445 void Window::SetOpaqueState( bool opaque )
446 {
447   mOpaqueState = opaque;
448
449   mWindowBase->SetOpaqueState( opaque );
450
451   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
452 }
453
454 bool Window::IsOpaqueState() const
455 {
456   return mOpaqueState;
457 }
458
459 bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
460 {
461   return mWindowBase->SetScreenOffMode( screenOffMode );
462 }
463
464 Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
465 {
466   return mWindowBase->GetScreenOffMode();
467 }
468
469 bool Window::SetBrightness( int brightness )
470 {
471   if( brightness < 0 || brightness > 100 )
472   {
473     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
474     return false;
475   }
476
477   return mWindowBase->SetBrightness( brightness );
478 }
479
480 int Window::GetBrightness() const
481 {
482   return mWindowBase->GetBrightness();
483 }
484
485 void Window::SetSize( Dali::Window::WindowSize size )
486 {
487   if( !mResizeEnabled )
488   {
489     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
490     mResizeEnabled = true;
491   }
492
493   PositionSize oldRect = mSurface->GetPositionSize();
494
495   mSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
496
497   PositionSize newRect = mSurface->GetPositionSize();
498
499   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
500   if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
501   {
502     Uint16Pair newSize( newRect.width, newRect.height );
503
504     mAdaptor->SurfaceResizePrepare( newSize );
505
506     mResizedSignal.Emit( newSize );
507
508     mAdaptor->SurfaceResizeComplete( newSize );
509   }
510 }
511
512 Dali::Window::WindowSize Window::GetSize() const
513 {
514   PositionSize positionSize = mSurface->GetPositionSize();
515
516   return Dali::Window::WindowSize( positionSize.width, positionSize.height );
517 }
518
519 void Window::SetPosition( Dali::Window::WindowPosition position )
520 {
521   if( !mResizeEnabled )
522   {
523     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
524     mResizeEnabled = true;
525   }
526
527   PositionSize oldRect = mSurface->GetPositionSize();
528
529   mSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
530 }
531
532 Dali::Window::WindowPosition Window::GetPosition() const
533 {
534   PositionSize positionSize = mSurface->GetPositionSize();
535
536   return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
537 }
538
539 void Window::SetPositionSize( PositionSize positionSize )
540 {
541   if( !mResizeEnabled )
542   {
543     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
544     mResizeEnabled = true;
545   }
546
547   PositionSize oldRect = mSurface->GetPositionSize();
548
549   mSurface->MoveResize( positionSize );
550
551   PositionSize newRect = mSurface->GetPositionSize();
552
553   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
554   if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
555   {
556     Uint16Pair newSize( newRect.width, newRect.height );
557
558     mAdaptor->SurfaceResizePrepare( newSize );
559
560     mResizedSignal.Emit( newSize );
561
562     mAdaptor->SurfaceResizeComplete( newSize );
563   }
564 }
565
566 void Window::SetTransparency( bool transparent )
567 {
568   mSurface->SetTransparency( transparent );
569 }
570
571 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
572 {
573   return mWindowBase->GrabKey( key, grabMode );
574 }
575
576 bool Window::UngrabKey( Dali::KEY key )
577 {
578   return mWindowBase->UngrabKey( key );
579 }
580
581 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
582 {
583   return mWindowBase->GrabKeyList( key, grabMode, result );
584 }
585
586 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
587 {
588   return mWindowBase->UngrabKeyList( key, result );
589 }
590
591 void Window::RotationDone( int orientation, int width, int height )
592 {
593   mSurface->RequestRotation( orientation, width, height );
594
595   mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
596
597   // Emit signal
598   mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
599
600   mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
601 }
602
603 void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
604 {
605   if( mIndicator == NULL )
606   {
607     if( mIndicatorVisible != Dali::Window::INVISIBLE )
608     {
609       auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
610       mIndicator = windowFactory->CreateIndicator( mAdaptor, mIndicatorOrientation, this );
611       if( mIndicator )
612       {
613         mIndicator->SetOpacityMode( mIndicatorOpacityMode );
614         Dali::Actor actor = mIndicator->GetActor();
615         SetIndicatorActorRotation();
616         mOverlay->Add(actor);
617       }
618     }
619     // else don't create a hidden indicator
620   }
621   else // Already have indicator
622   {
623     if( mIndicatorVisible == Dali::Window::VISIBLE )
624     {
625       // If we are resuming, and rotation has changed,
626       if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
627       {
628         // then close current indicator and open new one
629         mShowRotatedIndicatorOnClose = true;
630         mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
631         // Don't show actor - will contain indicator for old orientation.
632       }
633     }
634   }
635
636   // set indicator visible mode
637   if( mIndicator != NULL )
638   {
639     mIndicator->SetVisible( mIndicatorVisible );
640   }
641
642   bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
643   SetIndicatorProperties( show, lastOrientation );
644   mIndicatorIsShown = show;
645 }
646
647 void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
648 {
649   if( mIndicatorIsShown )
650   {
651     mShowRotatedIndicatorOnClose = true;
652     mNextIndicatorOrientation = orientation;
653     if( mIndicator )
654     {
655       mIndicator->Close(); // May synchronously call IndicatorClosed() callback
656     }
657   }
658   else
659   {
660     // Save orientation for when the indicator is next shown
661     mShowRotatedIndicatorOnClose = false;
662     mNextIndicatorOrientation = orientation;
663   }
664 }
665
666 void Window::SetIndicatorActorRotation()
667 {
668   DALI_LOG_TRACE_METHOD( gWindowLogFilter );
669   if( mIndicator )
670   {
671     Dali::Actor actor = mIndicator->GetActor();
672     switch( mIndicatorOrientation )
673     {
674       case Dali::Window::PORTRAIT:
675         actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
676         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
677         actor.SetOrientation( Degree(0), Vector3::ZAXIS );
678         break;
679       case Dali::Window::PORTRAIT_INVERSE:
680         actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
681         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
682         actor.SetOrientation( Degree(180), Vector3::ZAXIS );
683         break;
684       case Dali::Window::LANDSCAPE:
685         actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
686         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
687         actor.SetOrientation( Degree(270), Vector3::ZAXIS );
688         break;
689       case Dali::Window::LANDSCAPE_INVERSE:
690         actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
691         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
692         actor.SetOrientation( Degree(90), Vector3::ZAXIS );
693         break;
694     }
695   }
696 }
697
698 void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
699 {
700   mWindowBase->SetIndicatorProperties( isShow, lastOrientation );
701 }
702
703 void Window::OnIconifyChanged( bool iconified )
704 {
705   if( iconified )
706   {
707     mIconified = true;
708
709     if( mVisible )
710     {
711       WindowVisibilityObserver* observer( mAdaptor );
712       observer->OnWindowHidden();
713     }
714
715     DALI_LOG_RELEASE_INFO( "Window (%p) Iconified: visible = %d\n", this, mVisible );
716   }
717   else
718   {
719     mIconified = false;
720
721     if( mVisible )
722     {
723       WindowVisibilityObserver* observer( mAdaptor );
724       observer->OnWindowShown();
725     }
726
727     DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified: visible = %d\n", this, mVisible );
728   }
729 }
730
731 void Window::OnFocusChanged( bool focusIn )
732 {
733   mFocusChangedSignal.Emit( focusIn );
734 }
735
736 void Window::OnOutputTransformed()
737 {
738   PositionSize positionSize = mSurface->GetPositionSize();
739   mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
740   mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
741 }
742
743 void Window::OnDeleteRequest()
744 {
745   mDeleteRequestSignal.Emit();
746 }
747
748 void Window::OnIndicatorFlicked()
749 {
750   if( mIndicator )
751   {
752     mIndicator->Flicked();
753   }
754 }
755
756 void Window::IndicatorTypeChanged( IndicatorInterface::Type type )
757 {
758   mWindowBase->IndicatorTypeChanged( type );
759 }
760
761 void Window::IndicatorClosed( IndicatorInterface* indicator )
762 {
763   DALI_LOG_TRACE_METHOD( gWindowLogFilter );
764
765   if( mShowRotatedIndicatorOnClose )
766   {
767     Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
768     if( mIndicator )
769     {
770       mIndicator->Open( mNextIndicatorOrientation );
771     }
772     mIndicatorOrientation = mNextIndicatorOrientation;
773     SetIndicatorActorRotation();
774     DoShowIndicator( currentOrientation );
775   }
776 }
777
778 void Window::IndicatorVisibilityChanged( bool isVisible )
779 {
780   mIndicatorVisibilityChangedSignal.Emit( isVisible );
781 }
782
783 void Window::OnStart()
784 {
785   DoShowIndicator( mIndicatorOrientation );
786 }
787
788 void Window::OnPause()
789 {
790 }
791
792 void Window::OnResume()
793 {
794   // resume indicator status
795   if( mIndicator != NULL )
796   {
797     // Restore own indicator opacity
798     // Send opacity mode to indicator service when app resumed
799     mIndicator->SetOpacityMode( mIndicatorOpacityMode );
800   }
801 }
802
803 void Window::OnStop()
804 {
805   if( mIndicator )
806   {
807     mIndicator->Close();
808   }
809
810   mIndicator.release();
811 }
812
813 void Window::OnDestroy()
814 {
815   mAdaptor = NULL;
816 }
817
818 } // Adaptor
819
820 } // Internal
821
822 } // Dali