Add Window::SetPositionSize() and remove redundant value check
[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 oldRect = mSurface->GetPositionSize();
492
493   mSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
494
495   PositionSize newRect = mSurface->GetPositionSize();
496
497   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
498   if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
499   {
500     Uint16Pair newSize( newRect.width, newRect.height );
501
502     mAdaptor->SurfaceResizePrepare( newSize );
503
504     mResizedSignal.Emit( newSize );
505
506     mAdaptor->SurfaceResizeComplete( newSize );
507   }
508 }
509
510 Dali::Window::WindowSize Window::GetSize() const
511 {
512   PositionSize positionSize = mSurface->GetPositionSize();
513
514   return Dali::Window::WindowSize( positionSize.width, positionSize.height );
515 }
516
517 void Window::SetPosition( Dali::Window::WindowPosition position )
518 {
519   if( !mResizeEnabled )
520   {
521     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
522     mResizeEnabled = true;
523   }
524
525   PositionSize oldRect = mSurface->GetPositionSize();
526
527   mSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
528 }
529
530 Dali::Window::WindowPosition Window::GetPosition() const
531 {
532   PositionSize positionSize = mSurface->GetPositionSize();
533
534   return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
535 }
536
537 void Window::SetPositionSize( PositionSize positionSize )
538 {
539   if( !mResizeEnabled )
540   {
541     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
542     mResizeEnabled = true;
543   }
544
545   PositionSize oldRect = mSurface->GetPositionSize();
546
547   mSurface->MoveResize( positionSize );
548
549   PositionSize newRect = mSurface->GetPositionSize();
550
551   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
552   if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
553   {
554     Uint16Pair newSize( newRect.width, newRect.height );
555
556     mAdaptor->SurfaceResizePrepare( newSize );
557
558     mResizedSignal.Emit( newSize );
559
560     mAdaptor->SurfaceResizeComplete( newSize );
561   }
562 }
563
564 void Window::SetTransparency( bool transparent )
565 {
566   mSurface->SetTransparency( transparent );
567 }
568
569 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
570 {
571   return mWindowBase->GrabKey( key, grabMode );
572 }
573
574 bool Window::UngrabKey( Dali::KEY key )
575 {
576   return mWindowBase->UngrabKey( key );
577 }
578
579 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
580 {
581   return mWindowBase->GrabKeyList( key, grabMode, result );
582 }
583
584 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
585 {
586   return mWindowBase->UngrabKeyList( key, result );
587 }
588
589 void Window::RotationDone( int orientation, int width, int height )
590 {
591   mSurface->RequestRotation( orientation, width, height );
592
593   mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
594
595   // Emit signal
596   mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
597
598   mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
599 }
600
601 void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
602 {
603   if( mIndicator == NULL )
604   {
605     if( mIndicatorVisible != Dali::Window::INVISIBLE )
606     {
607       auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
608       mIndicator = windowFactory->CreateIndicator( mAdaptor, mIndicatorOrientation, this );
609       if( mIndicator )
610       {
611         mIndicator->SetOpacityMode( mIndicatorOpacityMode );
612         Dali::Actor actor = mIndicator->GetActor();
613         SetIndicatorActorRotation();
614         mOverlay->Add(actor);
615       }
616     }
617     // else don't create a hidden indicator
618   }
619   else // Already have indicator
620   {
621     if( mIndicatorVisible == Dali::Window::VISIBLE )
622     {
623       // If we are resuming, and rotation has changed,
624       if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
625       {
626         // then close current indicator and open new one
627         mShowRotatedIndicatorOnClose = true;
628         mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
629         // Don't show actor - will contain indicator for old orientation.
630       }
631     }
632   }
633
634   // set indicator visible mode
635   if( mIndicator != NULL )
636   {
637     mIndicator->SetVisible( mIndicatorVisible );
638   }
639
640   bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
641   SetIndicatorProperties( show, lastOrientation );
642   mIndicatorIsShown = show;
643 }
644
645 void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
646 {
647   if( mIndicatorIsShown )
648   {
649     mShowRotatedIndicatorOnClose = true;
650     mNextIndicatorOrientation = orientation;
651     if( mIndicator )
652     {
653       mIndicator->Close(); // May synchronously call IndicatorClosed() callback
654     }
655   }
656   else
657   {
658     // Save orientation for when the indicator is next shown
659     mShowRotatedIndicatorOnClose = false;
660     mNextIndicatorOrientation = orientation;
661   }
662 }
663
664 void Window::SetIndicatorActorRotation()
665 {
666   DALI_LOG_TRACE_METHOD( gWindowLogFilter );
667   if( mIndicator )
668   {
669     Dali::Actor actor = mIndicator->GetActor();
670     switch( mIndicatorOrientation )
671     {
672       case Dali::Window::PORTRAIT:
673         actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
674         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
675         actor.SetOrientation( Degree(0), Vector3::ZAXIS );
676         break;
677       case Dali::Window::PORTRAIT_INVERSE:
678         actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
679         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
680         actor.SetOrientation( Degree(180), Vector3::ZAXIS );
681         break;
682       case Dali::Window::LANDSCAPE:
683         actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
684         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
685         actor.SetOrientation( Degree(270), Vector3::ZAXIS );
686         break;
687       case Dali::Window::LANDSCAPE_INVERSE:
688         actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
689         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
690         actor.SetOrientation( Degree(90), Vector3::ZAXIS );
691         break;
692     }
693   }
694 }
695
696 void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
697 {
698   mWindowBase->SetIndicatorProperties( isShow, lastOrientation );
699 }
700
701 void Window::OnIconifyChanged( bool iconified )
702 {
703   if( iconified )
704   {
705     mIconified = true;
706
707     if( mVisible )
708     {
709       WindowVisibilityObserver* observer( mAdaptor );
710       observer->OnWindowHidden();
711       DALI_LOG_RELEASE_INFO( "Window (%p) Iconified\n", this );
712     }
713   }
714   else
715   {
716     mIconified = false;
717
718     if( mVisible )
719     {
720       WindowVisibilityObserver* observer( mAdaptor );
721       observer->OnWindowShown();
722       DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified\n", this );
723     }
724   }
725 }
726
727 void Window::OnFocusChanged( bool focusIn )
728 {
729   mFocusChangedSignal.Emit( focusIn );
730 }
731
732 void Window::OnOutputTransformed()
733 {
734   PositionSize positionSize = mSurface->GetPositionSize();
735   mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
736   mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
737 }
738
739 void Window::OnDeleteRequest()
740 {
741   mDeleteRequestSignal.Emit();
742 }
743
744 void Window::OnIndicatorFlicked()
745 {
746   if( mIndicator )
747   {
748     mIndicator->Flicked();
749   }
750 }
751
752 void Window::IndicatorTypeChanged( IndicatorInterface::Type type )
753 {
754   mWindowBase->IndicatorTypeChanged( type );
755 }
756
757 void Window::IndicatorClosed( IndicatorInterface* indicator )
758 {
759   DALI_LOG_TRACE_METHOD( gWindowLogFilter );
760
761   if( mShowRotatedIndicatorOnClose )
762   {
763     Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
764     if( mIndicator )
765     {
766       mIndicator->Open( mNextIndicatorOrientation );
767     }
768     mIndicatorOrientation = mNextIndicatorOrientation;
769     SetIndicatorActorRotation();
770     DoShowIndicator( currentOrientation );
771   }
772 }
773
774 void Window::IndicatorVisibilityChanged( bool isVisible )
775 {
776   mIndicatorVisibilityChangedSignal.Emit( isVisible );
777 }
778
779 void Window::OnStart()
780 {
781   DoShowIndicator( mIndicatorOrientation );
782 }
783
784 void Window::OnPause()
785 {
786 }
787
788 void Window::OnResume()
789 {
790   // resume indicator status
791   if( mIndicator != NULL )
792   {
793     // Restore own indicator opacity
794     // Send opacity mode to indicator service when app resumed
795     mIndicator->SetOpacityMode( mIndicatorOpacityMode );
796   }
797 }
798
799 void Window::OnStop()
800 {
801   if( mIndicator )
802   {
803     mIndicator->Close();
804   }
805
806   mIndicator.release();
807 }
808
809 void Window::OnDestroy()
810 {
811   mAdaptor = NULL;
812 }
813
814 } // Adaptor
815
816 } // Internal
817
818 } // Dali