2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/window-system/common/window-impl.h>
23 #include <dali/integration-api/core.h>
24 #include <dali/public-api/actors/actor.h>
25 #include <dali/public-api/actors/layer.h>
26 #include <dali/public-api/actors/camera-actor.h>
27 #include <dali/public-api/render-tasks/render-task.h>
28 #include <dali/public-api/render-tasks/render-task-list.h>
29 #include <dali/public-api/rendering/frame-buffer.h>
30 #include <dali/devel-api/adaptor-framework/orientation.h>
31 #include <dali/integration-api/events/touch-event-integ.h>
34 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
35 #include <dali/internal/window-system/common/event-handler.h>
36 #include <dali/internal/window-system/common/orientation-impl.h>
37 #include <dali/internal/window-system/common/render-surface-factory.h>
38 #include <dali/internal/window-system/common/window-factory.h>
39 #include <dali/internal/window-system/common/window-base.h>
40 #include <dali/internal/window-system/common/window-system.h>
41 #include <dali/internal/window-system/common/window-render-surface.h>
42 #include <dali/internal/window-system/common/window-visibility-observer.h>
54 #if defined(DEBUG_ENABLED)
55 Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
58 } // unnamed namespace
60 Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
63 return Window::New(surface, positionSize, name, className, isTransparent);
66 Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
68 Window* window = new Window();
69 window->mIsTransparent = isTransparent;
70 window->Initialize(surface, positionSize, name, className);
75 : mWindowSurface( nullptr ),
77 mIsTransparent( false ),
78 mIsFocusAcceptable( true ),
80 mOpaqueState( false ),
81 mResizeEnabled( false ),
82 mType( Dali::Window::NORMAL ),
83 mParentWindow( NULL ),
84 mPreferredAngle( Dali::Window::NO_ORIENTATION_PREFERENCE ),
88 mOrientationMode( Internal::Adaptor::Window::OrientationMode::PORTRAIT ),
89 mNativeWindowId( -1 ),
90 mFocusChangedSignal(),
92 mDeleteRequestSignal(),
95 mVisibilityChangedSignal(),
96 mTransitionEffectEventSignal()
102 mIsBeingDeleted = true;
104 while ( mAdaptor && mAdaptor->IsRenderingWindows() )
106 std::this_thread::yield(); // to allow other threads to run
111 mEventHandler->RemoveObserver( *this );
115 void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className)
117 // Create a window render surface
118 auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
119 mSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
120 mWindowSurface = static_cast<WindowRenderSurface*>( mSurface.get() );
123 mWindowBase = mWindowSurface->GetWindowBase();
126 mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
127 mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
128 mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
129 mWindowBase->TransitionEffectEventSignal().Connect( this, &Window::OnTransitionEffectEvent );
131 mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
133 if( !positionSize.IsEmpty() )
135 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
136 mResizeEnabled = true;
139 SetClass( name, className );
141 mWindowSurface->Map();
143 mOrientation = Orientation::New( this );
145 // Get OrientationMode
146 int screenWidth, screenHeight;
147 WindowSystem::GetScreenSize( screenWidth, screenHeight );
148 if( screenWidth > screenHeight )
150 mOrientationMode = Internal::Adaptor::Window::OrientationMode::LANDSCAPE;
154 mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT;
157 mNativeWindowId = mWindowBase->GetNativeWindowId();
160 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
162 mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface, *mAdaptor ) );
163 mEventHandler->AddObserver( *this );
166 void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface )
168 mWindowSurface = static_cast<WindowRenderSurface*>( surface );
171 void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
175 void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
179 void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
183 void Window::SetClass( std::string name, std::string className )
186 mClassName = className;
187 mWindowBase->SetClass( name, className );
190 std::string Window::GetClassName() const
197 mWindowBase->Raise();
198 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId );
203 mWindowBase->Lower();
204 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId );
207 void Window::Activate()
209 mWindowBase->Activate();
210 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId );
213 uint32_t Window::GetLayerCount() const
215 return mScene.GetLayerCount();
218 Dali::Layer Window::GetLayer( uint32_t depth ) const
220 return mScene.GetLayer( depth );
223 Dali::RenderTaskList Window::GetRenderTaskList() const
225 return mScene.GetRenderTaskList();
228 void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
230 if( IsOrientationAvailable( orientation ) == false )
236 int convertedAngle = ConvertToAngle( orientation );
237 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), AddAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
238 for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
240 if( mAvailableAngles[i] == convertedAngle )
249 mAvailableAngles.push_back( convertedAngle );
250 SetAvailableAnlges( mAvailableAngles );
254 void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
256 if( IsOrientationAvailable( orientation ) == false )
261 int convertedAngle = ConvertToAngle( orientation );
262 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), RemoveAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
263 for( std::vector< int >::iterator iter = mAvailableAngles.begin();
264 iter != mAvailableAngles.end(); ++iter )
266 if( *iter == convertedAngle )
268 mAvailableAngles.erase( iter );
273 SetAvailableAnlges( mAvailableAngles );
276 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
278 if( orientation < Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
280 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation );
283 mPreferredAngle = ConvertToAngle( orientation );
284 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
285 mWindowBase->SetPreferredAngle( mPreferredAngle );
288 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
290 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
291 Dali::Window::WindowOrientation preferredOrientation = ConvertToOrientation( mPreferredAngle );
292 return preferredOrientation;
295 void Window::SetAvailableAnlges( const std::vector< int >& angles )
297 if( angles.size() > 4 )
299 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size() );
303 mWindowBase->SetAvailableAnlges( angles );
306 int Window::ConvertToAngle( Dali::Window::WindowOrientation orientation )
308 int convertAngle = static_cast< int >( orientation );
309 if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
311 switch( orientation )
313 case Dali::Window::LANDSCAPE:
318 case Dali::Window::PORTRAIT:
323 case Dali::Window::LANDSCAPE_INVERSE:
328 case Dali::Window::PORTRAIT_INVERSE:
333 case Dali::Window::NO_ORIENTATION_PREFERENCE:
343 Dali::Window::WindowOrientation Window::ConvertToOrientation( int angle ) const
345 Dali::Window::WindowOrientation orientation = static_cast< Dali::Window::WindowOrientation >( angle );
346 if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
352 orientation = Dali::Window::LANDSCAPE;
357 orientation = Dali::Window::PORTRAIT;
362 orientation = Dali::Window::LANDSCAPE_INVERSE;
367 orientation = Dali::Window::PORTRAIT_INVERSE;
372 orientation = Dali::Window::NO_ORIENTATION_PREFERENCE;
380 bool Window::IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const
382 if( orientation <= Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
384 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation );
390 Dali::Any Window::GetNativeHandle() const
392 return mWindowSurface->GetNativeWindow();
395 void Window::SetAcceptFocus( bool accept )
397 mIsFocusAcceptable = accept;
399 mWindowBase->SetAcceptFocus( accept );
402 bool Window::IsFocusAcceptable() const
404 return mIsFocusAcceptable;
415 WindowVisibilityObserver* observer( mAdaptor );
416 observer->OnWindowShown();
418 Dali::Window handle( this );
419 mVisibilityChangedSignal.Emit( handle, true );
422 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
433 WindowVisibilityObserver* observer( mAdaptor );
434 observer->OnWindowHidden();
436 Dali::Window handle( this );
437 mVisibilityChangedSignal.Emit( handle, false );
440 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
443 bool Window::IsVisible() const
445 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), IsVisible(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
446 return mVisible && !mIconified;
449 unsigned int Window::GetSupportedAuxiliaryHintCount() const
451 return mWindowBase->GetSupportedAuxiliaryHintCount();
454 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
456 return mWindowBase->GetSupportedAuxiliaryHint( index );
459 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
461 return mWindowBase->AddAuxiliaryHint( hint, value );
464 bool Window::RemoveAuxiliaryHint( unsigned int id )
466 return mWindowBase->RemoveAuxiliaryHint( id );
469 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
471 return mWindowBase->SetAuxiliaryHintValue( id, value );
474 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
476 return mWindowBase->GetAuxiliaryHintValue( id );
479 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
481 return mWindowBase->GetAuxiliaryHintId( hint );
484 void Window::SetInputRegion( const Rect< int >& inputRegion )
486 mWindowBase->SetInputRegion( inputRegion );
488 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 );
491 void Window::SetType( Dali::Window::Type type )
495 mWindowBase->SetType( type );
501 Dali::Window::Type Window::GetType() const
506 bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
508 if( mType != Dali::Window::NOTIFICATION )
510 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
514 return mWindowBase->SetNotificationLevel( level );
517 Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
519 if( mType != Dali::Window::NOTIFICATION )
521 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
522 return Dali::Window::NotificationLevel::NONE;
525 return mWindowBase->GetNotificationLevel();
528 void Window::SetOpaqueState( bool opaque )
530 mOpaqueState = opaque;
532 mWindowBase->SetOpaqueState( opaque );
534 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
537 bool Window::IsOpaqueState() const
542 bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
544 return mWindowBase->SetScreenOffMode( screenOffMode );
547 Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
549 return mWindowBase->GetScreenOffMode();
552 bool Window::SetBrightness( int brightness )
554 if( brightness < 0 || brightness > 100 )
556 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
560 return mWindowBase->SetBrightness( brightness );
563 int Window::GetBrightness() const
565 return mWindowBase->GetBrightness();
568 void Window::SetSize( Dali::Window::WindowSize size )
570 if( !mResizeEnabled )
572 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
573 mResizeEnabled = true;
576 PositionSize oldRect = mSurface->GetPositionSize();
578 mWindowSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
580 PositionSize newRect = mSurface->GetPositionSize();
582 // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
583 if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
585 Uint16Pair newSize( newRect.width, newRect.height );
589 mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
591 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
593 Dali::Window handle( this );
594 mResizedSignal.Emit( newSize );
595 mResizeSignal.Emit( handle, newSize );
597 mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
601 Dali::Window::WindowSize Window::GetSize() const
603 PositionSize positionSize = mSurface->GetPositionSize();
605 return Dali::Window::WindowSize( positionSize.width, positionSize.height );
608 void Window::SetPosition( Dali::Window::WindowPosition position )
610 if( !mResizeEnabled )
612 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
613 mResizeEnabled = true;
616 PositionSize oldRect = mSurface->GetPositionSize();
618 mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
621 Dali::Window::WindowPosition Window::GetPosition() const
623 PositionSize positionSize = mSurface->GetPositionSize();
625 return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
628 void Window::SetPositionSize( PositionSize positionSize )
630 if( !mResizeEnabled )
632 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
633 mResizeEnabled = true;
636 PositionSize oldRect = mSurface->GetPositionSize();
638 mWindowSurface->MoveResize( positionSize );
640 PositionSize newRect = mSurface->GetPositionSize();
642 // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
643 if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
645 Uint16Pair newSize( newRect.width, newRect.height );
649 mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
651 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
652 Dali::Window handle( this );
653 mResizedSignal.Emit( newSize );
654 mResizeSignal.Emit( handle, newSize );
655 mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
659 Dali::Layer Window::GetRootLayer() const
661 return mScene.GetRootLayer();
664 void Window::SetTransparency( bool transparent )
666 mWindowSurface->SetTransparency( transparent );
669 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
671 return mWindowBase->GrabKey( key, grabMode );
674 bool Window::UngrabKey( Dali::KEY key )
676 return mWindowBase->UngrabKey( key );
679 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
681 return mWindowBase->GrabKeyList( key, grabMode, result );
684 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
686 return mWindowBase->UngrabKeyList( key, result );
689 void Window::OnIconifyChanged( bool iconified )
697 WindowVisibilityObserver* observer( mAdaptor );
698 observer->OnWindowHidden();
700 Dali::Window handle( this );
701 mVisibilityChangedSignal.Emit( handle, false );
704 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible );
712 WindowVisibilityObserver* observer( mAdaptor );
713 observer->OnWindowShown();
715 Dali::Window handle( this );
716 mVisibilityChangedSignal.Emit( handle, true );
719 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible );
723 void Window::OnFocusChanged( bool focusIn )
725 Dali::Window handle( this );
726 mFocusChangedSignal.Emit( focusIn );
727 mFocusChangeSignal.Emit( handle, focusIn );
730 void Window::OnOutputTransformed()
732 PositionSize positionSize = mSurface->GetPositionSize();
734 mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
735 mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
738 void Window::OnDeleteRequest()
740 mDeleteRequestSignal.Emit();
743 void Window::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
745 Dali::Window handle( this );
746 mTransitionEffectEventSignal.Emit( handle, state, type );
749 void Window::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
751 FeedTouchPoint( point, timeStamp );
754 void Window::OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
756 FeedWheelEvent( wheelEvent );
759 void Window::OnKeyEvent( Dali::Integration::KeyEvent& keyEvent )
761 FeedKeyEvent( keyEvent );
764 void Window::OnRotation( const RotationEvent& rotation )
766 mRotationAngle = rotation.angle;
767 mWindowWidth = rotation.width;
768 mWindowHeight = rotation.height;
770 // Notify that the orientation is changed
771 mOrientation->OnOrientationChange( rotation );
773 mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
777 mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
779 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight );
781 Dali::Window handle( this );
782 mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
783 mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
785 mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
788 void Window::OnPause()
792 mEventHandler->Pause();
796 void Window::OnResume()
800 mEventHandler->Resume();
804 void Window::RecalculateTouchPosition( Integration::Point& point )
806 Vector2 position = point.GetScreenPosition();
807 Vector2 convertedPosition;
809 switch( mRotationAngle )
813 convertedPosition.x = static_cast<float>( mWindowWidth ) - position.y;
814 convertedPosition.y = position.x;
819 convertedPosition.x = static_cast<float>( mWindowWidth ) - position.x;
820 convertedPosition.y = static_cast<float>( mWindowHeight ) - position.y;
825 convertedPosition.x = position.y;
826 convertedPosition.y = static_cast<float>( mWindowHeight ) - position.x;
831 convertedPosition = position;
836 point.SetScreenPosition( convertedPosition );
839 Dali::Window Window::Get( Dali::Actor actor )
841 Internal::Adaptor::Window* windowImpl = nullptr;
843 if ( Internal::Adaptor::Adaptor::IsAvailable() )
845 Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() );
846 windowImpl = dynamic_cast<Internal::Adaptor::Window*>( adaptor.GetWindow( actor ) );
849 return Dali::Window( windowImpl );
853 return Dali::Window();
856 void Window::SetParent( Dali::Window& parent )
858 if ( DALI_UNLIKELY( parent ) )
860 mParentWindow = parent;
861 Dali::Window self = Dali::Window( this );
862 // check circular parent window setting
863 if ( Dali::DevelWindow::GetParent( parent ) == self )
865 Dali::DevelWindow::Unparent( parent );
867 mWindowBase->SetParent( GetImplementation( mParentWindow ).mWindowBase );
871 void Window::Unparent()
873 mWindowBase->SetParent( nullptr );
874 mParentWindow.Reset();
877 Dali::Window Window::GetParent()
879 return mParentWindow;
882 Dali::Window::WindowOrientation Window::GetCurrentOrientation() const
884 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle );
885 return ConvertToOrientation( mRotationAngle );
888 void Window::SetAvailableOrientations( const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
890 Dali::Vector<float>::SizeType count = orientations.Count();
891 for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
893 if( IsOrientationAvailable( orientations[index] ) == false )
895 DALI_LOG_ERROR("Window::SetAvailableOrientations, invalid orientation: %d\n", orientations[index]);
900 int convertedAngle = ConvertToAngle( orientations[index] );
902 for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
904 if( mAvailableAngles[i] == convertedAngle )
913 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle );
914 mAvailableAngles.push_back( convertedAngle );
917 SetAvailableAnlges( mAvailableAngles );