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>
22 #include <dali/integration-api/core.h>
23 #include <dali/public-api/actors/actor.h>
24 #include <dali/public-api/actors/layer.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/public-api/rendering/frame-buffer.h>
29 #include <dali/devel-api/adaptor-framework/orientation.h>
30 #include <dali/integration-api/events/touch-event-integ.h>
33 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
34 #include <dali/internal/window-system/common/event-handler.h>
35 #include <dali/internal/window-system/common/orientation-impl.h>
36 #include <dali/internal/window-system/common/render-surface-factory.h>
37 #include <dali/internal/window-system/common/window-factory.h>
38 #include <dali/internal/window-system/common/window-base.h>
39 #include <dali/internal/window-system/common/window-system.h>
40 #include <dali/internal/window-system/common/window-render-surface.h>
41 #include <dali/internal/window-system/common/window-visibility-observer.h>
53 #if defined(DEBUG_ENABLED)
54 Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
57 } // unnamed namespace
59 Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
62 return Window::New(surface, positionSize, name, className, isTransparent);
65 Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
67 Window* window = new Window();
68 window->mIsTransparent = isTransparent;
69 window->Initialize(surface, positionSize, name, className);
74 : mWindowSurface( nullptr ),
76 mIsTransparent( false ),
77 mIsFocusAcceptable( true ),
79 mOpaqueState( false ),
80 mResizeEnabled( false ),
81 mType( Dali::Window::NORMAL ),
82 mParentWindow( NULL ),
83 mPreferredAngle( Dali::Window::NO_ORIENTATION_PREFERENCE ),
87 mOrientationMode( Internal::Adaptor::Window::OrientationMode::PORTRAIT ),
88 mNativeWindowId( -1 ),
89 mFocusChangedSignal(),
91 mDeleteRequestSignal(),
94 mVisibilityChangedSignal(),
95 mTransitionEffectEventSignal()
103 mEventHandler->RemoveObserver( *this );
107 void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className)
109 // Create a window render surface
110 auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
111 mSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
112 mWindowSurface = static_cast<WindowRenderSurface*>( mSurface.get() );
115 mWindowBase = mWindowSurface->GetWindowBase();
118 mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
119 mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
120 mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
121 mWindowBase->TransitionEffectEventSignal().Connect( this, &Window::OnTransitionEffectEvent );
123 mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
125 if( !positionSize.IsEmpty() )
127 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
128 mResizeEnabled = true;
131 SetClass( name, className );
133 mWindowSurface->Map();
135 mOrientation = Orientation::New( this );
137 // Get OrientationMode
138 int screenWidth, screenHeight;
139 WindowSystem::GetScreenSize( screenWidth, screenHeight );
140 if( screenWidth > screenHeight )
142 mOrientationMode = Internal::Adaptor::Window::OrientationMode::LANDSCAPE;
146 mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT;
149 mNativeWindowId = mWindowBase->GetNativeWindowId();
152 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
154 mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface, *mAdaptor ) );
155 mEventHandler->AddObserver( *this );
158 void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface )
160 mWindowSurface = static_cast<WindowRenderSurface*>( surface );
163 void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
167 void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
171 void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
175 void Window::SetClass( std::string name, std::string className )
178 mClassName = className;
179 mWindowBase->SetClass( name, className );
182 std::string Window::GetClassName() const
189 mWindowBase->Raise();
190 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId );
195 mWindowBase->Lower();
196 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId );
199 void Window::Activate()
201 mWindowBase->Activate();
202 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId );
205 uint32_t Window::GetLayerCount() const
207 return mScene.GetLayerCount();
210 Dali::Layer Window::GetLayer( uint32_t depth ) const
212 return mScene.GetLayer( depth );
215 Dali::RenderTaskList Window::GetRenderTaskList() const
217 return mScene.GetRenderTaskList();
220 void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
222 if( IsOrientationAvailable( orientation ) == false )
228 int convertedAngle = ConvertToAngle( orientation );
229 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), AddAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
230 for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
232 if( mAvailableAngles[i] == convertedAngle )
241 mAvailableAngles.push_back( convertedAngle );
242 SetAvailableAnlges( mAvailableAngles );
246 void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
248 if( IsOrientationAvailable( orientation ) == false )
253 int convertedAngle = ConvertToAngle( orientation );
254 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), RemoveAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
255 for( std::vector< int >::iterator iter = mAvailableAngles.begin();
256 iter != mAvailableAngles.end(); ++iter )
258 if( *iter == convertedAngle )
260 mAvailableAngles.erase( iter );
265 SetAvailableAnlges( mAvailableAngles );
268 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
270 if( orientation < Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
272 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation );
275 mPreferredAngle = ConvertToAngle( orientation );
276 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
277 mWindowBase->SetPreferredAngle( mPreferredAngle );
280 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
282 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
283 Dali::Window::WindowOrientation preferredOrientation = ConvertToOrientation( mPreferredAngle );
284 return preferredOrientation;
287 void Window::SetAvailableAnlges( const std::vector< int >& angles )
289 if( angles.size() > 4 )
291 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size() );
295 mWindowBase->SetAvailableAnlges( angles );
298 int Window::ConvertToAngle( Dali::Window::WindowOrientation orientation )
300 int convertAngle = static_cast< int >( orientation );
301 if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
303 switch( orientation )
305 case Dali::Window::LANDSCAPE:
310 case Dali::Window::PORTRAIT:
315 case Dali::Window::LANDSCAPE_INVERSE:
320 case Dali::Window::PORTRAIT_INVERSE:
325 case Dali::Window::NO_ORIENTATION_PREFERENCE:
335 Dali::Window::WindowOrientation Window::ConvertToOrientation( int angle ) const
337 Dali::Window::WindowOrientation orientation = static_cast< Dali::Window::WindowOrientation >( angle );
338 if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
344 orientation = Dali::Window::LANDSCAPE;
349 orientation = Dali::Window::PORTRAIT;
354 orientation = Dali::Window::LANDSCAPE_INVERSE;
359 orientation = Dali::Window::PORTRAIT_INVERSE;
364 orientation = Dali::Window::NO_ORIENTATION_PREFERENCE;
372 bool Window::IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const
374 if( orientation <= Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
376 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation );
382 Dali::Any Window::GetNativeHandle() const
384 return mWindowSurface->GetNativeWindow();
387 void Window::SetAcceptFocus( bool accept )
389 mIsFocusAcceptable = accept;
391 mWindowBase->SetAcceptFocus( accept );
394 bool Window::IsFocusAcceptable() const
396 return mIsFocusAcceptable;
407 WindowVisibilityObserver* observer( mAdaptor );
408 observer->OnWindowShown();
410 Dali::Window handle( this );
411 mVisibilityChangedSignal.Emit( handle, true );
414 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
425 WindowVisibilityObserver* observer( mAdaptor );
426 observer->OnWindowHidden();
428 Dali::Window handle( this );
429 mVisibilityChangedSignal.Emit( handle, false );
432 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
435 bool Window::IsVisible() const
437 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), IsVisible(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
438 return mVisible && !mIconified;
441 unsigned int Window::GetSupportedAuxiliaryHintCount() const
443 return mWindowBase->GetSupportedAuxiliaryHintCount();
446 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
448 return mWindowBase->GetSupportedAuxiliaryHint( index );
451 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
453 return mWindowBase->AddAuxiliaryHint( hint, value );
456 bool Window::RemoveAuxiliaryHint( unsigned int id )
458 return mWindowBase->RemoveAuxiliaryHint( id );
461 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
463 return mWindowBase->SetAuxiliaryHintValue( id, value );
466 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
468 return mWindowBase->GetAuxiliaryHintValue( id );
471 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
473 return mWindowBase->GetAuxiliaryHintId( hint );
476 void Window::SetInputRegion( const Rect< int >& inputRegion )
478 mWindowBase->SetInputRegion( inputRegion );
480 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 );
483 void Window::SetType( Dali::Window::Type type )
487 mWindowBase->SetType( type );
493 Dali::Window::Type Window::GetType() const
498 bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
500 if( mType != Dali::Window::NOTIFICATION )
502 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
506 return mWindowBase->SetNotificationLevel( level );
509 Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
511 if( mType != Dali::Window::NOTIFICATION )
513 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
514 return Dali::Window::NotificationLevel::NONE;
517 return mWindowBase->GetNotificationLevel();
520 void Window::SetOpaqueState( bool opaque )
522 mOpaqueState = opaque;
524 mWindowBase->SetOpaqueState( opaque );
526 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
529 bool Window::IsOpaqueState() const
534 bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
536 return mWindowBase->SetScreenOffMode( screenOffMode );
539 Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
541 return mWindowBase->GetScreenOffMode();
544 bool Window::SetBrightness( int brightness )
546 if( brightness < 0 || brightness > 100 )
548 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
552 return mWindowBase->SetBrightness( brightness );
555 int Window::GetBrightness() const
557 return mWindowBase->GetBrightness();
560 void Window::SetSize( Dali::Window::WindowSize size )
562 if( !mResizeEnabled )
564 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
565 mResizeEnabled = true;
568 PositionSize oldRect = mSurface->GetPositionSize();
570 mWindowSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
572 PositionSize newRect = mSurface->GetPositionSize();
574 // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
575 if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
577 Uint16Pair newSize( newRect.width, newRect.height );
579 bool forceUpdate = false;
580 if( mWindowBase->IsEglWindowRotationSupported() )
585 SurfaceResized( forceUpdate );
587 mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
589 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
591 Dali::Window handle( this );
592 mResizedSignal.Emit( newSize );
593 mResizeSignal.Emit( handle, newSize );
595 mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
599 Dali::Window::WindowSize Window::GetSize() const
601 PositionSize positionSize = mSurface->GetPositionSize();
603 return Dali::Window::WindowSize( positionSize.width, positionSize.height );
606 void Window::SetPosition( Dali::Window::WindowPosition position )
608 if( !mResizeEnabled )
610 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
611 mResizeEnabled = true;
614 PositionSize oldRect = mSurface->GetPositionSize();
616 mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
619 Dali::Window::WindowPosition Window::GetPosition() const
621 PositionSize positionSize = mSurface->GetPositionSize();
623 return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
626 void Window::SetPositionSize( PositionSize positionSize )
628 if( !mResizeEnabled )
630 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
631 mResizeEnabled = true;
634 PositionSize oldRect = mSurface->GetPositionSize();
636 mWindowSurface->MoveResize( positionSize );
638 PositionSize newRect = mSurface->GetPositionSize();
640 // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
641 if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
643 Uint16Pair newSize( newRect.width, newRect.height );
645 bool forceUpdate = false;
646 if( mWindowBase->IsEglWindowRotationSupported() )
651 SurfaceResized( forceUpdate );
653 mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
655 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
656 Dali::Window handle( this );
657 mResizedSignal.Emit( newSize );
658 mResizeSignal.Emit( handle, newSize );
659 mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
663 Dali::Layer Window::GetRootLayer() const
665 return mScene.GetRootLayer();
668 void Window::SetTransparency( bool transparent )
670 mWindowSurface->SetTransparency( transparent );
673 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
675 return mWindowBase->GrabKey( key, grabMode );
678 bool Window::UngrabKey( Dali::KEY key )
680 return mWindowBase->UngrabKey( key );
683 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
685 return mWindowBase->GrabKeyList( key, grabMode, result );
688 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
690 return mWindowBase->UngrabKeyList( key, result );
693 void Window::OnIconifyChanged( bool iconified )
701 WindowVisibilityObserver* observer( mAdaptor );
702 observer->OnWindowHidden();
704 Dali::Window handle( this );
705 mVisibilityChangedSignal.Emit( handle, false );
708 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible );
716 WindowVisibilityObserver* observer( mAdaptor );
717 observer->OnWindowShown();
719 Dali::Window handle( this );
720 mVisibilityChangedSignal.Emit( handle, true );
723 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible );
727 void Window::OnFocusChanged( bool focusIn )
729 Dali::Window handle( this );
730 mFocusChangedSignal.Emit( focusIn );
731 mFocusChangeSignal.Emit( handle, focusIn );
734 void Window::OnOutputTransformed()
736 bool forceUpdate = false;
737 if( mWindowBase->IsEglWindowRotationSupported() )
741 SurfaceResized( forceUpdate );
743 PositionSize positionSize = mSurface->GetPositionSize();
744 mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
745 mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
748 void Window::OnDeleteRequest()
750 mDeleteRequestSignal.Emit();
753 void Window::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
755 Dali::Window handle( this );
756 mTransitionEffectEventSignal.Emit( handle, state, type );
759 void Window::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
761 FeedTouchPoint( point, timeStamp );
764 void Window::OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
766 FeedWheelEvent( wheelEvent );
769 void Window::OnKeyEvent( Dali::Integration::KeyEvent& keyEvent )
771 FeedKeyEvent( keyEvent );
774 void Window::OnRotation( const RotationEvent& rotation )
776 mRotationAngle = rotation.angle;
777 mWindowWidth = rotation.width;
778 mWindowHeight = rotation.height;
780 // Notify that the orientation is changed
781 mOrientation->OnOrientationChange( rotation );
783 mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
785 bool forceUpdate = false;
786 if( mWindowBase->IsEglWindowRotationSupported() )
791 SurfaceResized( forceUpdate );
793 mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
795 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight );
797 Dali::Window handle( this );
798 mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
799 mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
801 mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
804 void Window::OnPause()
808 mEventHandler->Pause();
812 void Window::OnResume()
816 mEventHandler->Resume();
820 void Window::RecalculateTouchPosition( Integration::Point& point )
822 Vector2 position = point.GetScreenPosition();
823 Vector2 convertedPosition;
825 switch( mRotationAngle )
829 convertedPosition.x = static_cast<float>( mWindowWidth ) - position.y;
830 convertedPosition.y = position.x;
835 convertedPosition.x = static_cast<float>( mWindowWidth ) - position.x;
836 convertedPosition.y = static_cast<float>( mWindowHeight ) - position.y;
841 convertedPosition.x = position.y;
842 convertedPosition.y = static_cast<float>( mWindowHeight ) - position.x;
847 convertedPosition = position;
852 point.SetScreenPosition( convertedPosition );
855 Dali::Window Window::Get( Dali::Actor actor )
857 Internal::Adaptor::Window* windowImpl = nullptr;
859 if ( Internal::Adaptor::Adaptor::IsAvailable() )
861 Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() );
862 windowImpl = dynamic_cast<Internal::Adaptor::Window*>( adaptor.GetWindow( actor ) );
865 return Dali::Window( windowImpl );
869 return Dali::Window();
872 void Window::SetParent( Dali::Window& parent )
874 if ( DALI_UNLIKELY( parent ) )
876 mParentWindow = parent;
877 Dali::Window self = Dali::Window( this );
878 // check circular parent window setting
879 if ( Dali::DevelWindow::GetParent( parent ) == self )
881 Dali::DevelWindow::Unparent( parent );
883 mWindowBase->SetParent( GetImplementation( mParentWindow ).mWindowBase );
887 void Window::Unparent()
889 mWindowBase->SetParent( nullptr );
890 mParentWindow.Reset();
893 Dali::Window Window::GetParent()
895 return mParentWindow;
898 Dali::Window::WindowOrientation Window::GetCurrentOrientation() const
900 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle );
901 return ConvertToOrientation( mRotationAngle );
904 void Window::SetAvailableOrientations( const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
906 Dali::Vector<float>::SizeType count = orientations.Count();
907 for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
909 if( IsOrientationAvailable( orientations[index] ) == false )
911 DALI_LOG_ERROR("Window::SetAvailableOrientations, invalid orientation: %d\n", orientations[index]);
916 int convertedAngle = ConvertToAngle( orientations[index] );
918 for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
920 if( mAvailableAngles[i] == convertedAngle )
929 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle );
930 mAvailableAngles.push_back( convertedAngle );
933 SetAvailableAnlges( mAvailableAngles );