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()
104 mEventHandler->RemoveObserver( *this );
108 void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className)
110 // Create a window render surface
111 auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
112 mSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
113 mWindowSurface = static_cast<WindowRenderSurface*>( mSurface.get() );
116 mWindowBase = mWindowSurface->GetWindowBase();
119 mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
120 mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
121 mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
122 mWindowBase->TransitionEffectEventSignal().Connect( this, &Window::OnTransitionEffectEvent );
124 mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
126 if( !positionSize.IsEmpty() )
128 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
129 mResizeEnabled = true;
132 SetClass( name, className );
134 mWindowSurface->Map();
136 mOrientation = Orientation::New( this );
138 // Get OrientationMode
139 int screenWidth, screenHeight;
140 WindowSystem::GetScreenSize( screenWidth, screenHeight );
141 if( screenWidth > screenHeight )
143 mOrientationMode = Internal::Adaptor::Window::OrientationMode::LANDSCAPE;
147 mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT;
150 mNativeWindowId = mWindowBase->GetNativeWindowId();
153 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
155 mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface, *mAdaptor ) );
156 mEventHandler->AddObserver( *this );
159 void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface )
161 mWindowSurface = static_cast<WindowRenderSurface*>( surface );
164 void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
168 void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
172 void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
176 void Window::SetClass( std::string name, std::string className )
179 mClassName = className;
180 mWindowBase->SetClass( name, className );
183 std::string Window::GetClassName() const
190 mWindowBase->Raise();
191 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId );
196 mWindowBase->Lower();
197 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId );
200 void Window::Activate()
202 mWindowBase->Activate();
203 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId );
206 uint32_t Window::GetLayerCount() const
208 return mScene.GetLayerCount();
211 Dali::Layer Window::GetLayer( uint32_t depth ) const
213 return mScene.GetLayer( depth );
216 Dali::RenderTaskList Window::GetRenderTaskList() const
218 return mScene.GetRenderTaskList();
221 void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
223 if( IsOrientationAvailable( orientation ) == false )
229 int convertedAngle = ConvertToAngle( orientation );
230 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), AddAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
231 for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
233 if( mAvailableAngles[i] == convertedAngle )
242 mAvailableAngles.push_back( convertedAngle );
243 SetAvailableAnlges( mAvailableAngles );
247 void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
249 if( IsOrientationAvailable( orientation ) == false )
254 int convertedAngle = ConvertToAngle( orientation );
255 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), RemoveAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
256 for( std::vector< int >::iterator iter = mAvailableAngles.begin();
257 iter != mAvailableAngles.end(); ++iter )
259 if( *iter == convertedAngle )
261 mAvailableAngles.erase( iter );
266 SetAvailableAnlges( mAvailableAngles );
269 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
271 if( orientation < Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
273 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation );
276 mPreferredAngle = ConvertToAngle( orientation );
277 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
278 mWindowBase->SetPreferredAngle( mPreferredAngle );
281 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
283 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
284 Dali::Window::WindowOrientation preferredOrientation = ConvertToOrientation( mPreferredAngle );
285 return preferredOrientation;
288 void Window::SetAvailableAnlges( const std::vector< int >& angles )
290 if( angles.size() > 4 )
292 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size() );
296 mWindowBase->SetAvailableAnlges( angles );
299 int Window::ConvertToAngle( Dali::Window::WindowOrientation orientation )
301 int convertAngle = static_cast< int >( orientation );
302 if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
304 switch( orientation )
306 case Dali::Window::LANDSCAPE:
311 case Dali::Window::PORTRAIT:
316 case Dali::Window::LANDSCAPE_INVERSE:
321 case Dali::Window::PORTRAIT_INVERSE:
326 case Dali::Window::NO_ORIENTATION_PREFERENCE:
336 Dali::Window::WindowOrientation Window::ConvertToOrientation( int angle ) const
338 Dali::Window::WindowOrientation orientation = static_cast< Dali::Window::WindowOrientation >( angle );
339 if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
345 orientation = Dali::Window::LANDSCAPE;
350 orientation = Dali::Window::PORTRAIT;
355 orientation = Dali::Window::LANDSCAPE_INVERSE;
360 orientation = Dali::Window::PORTRAIT_INVERSE;
365 orientation = Dali::Window::NO_ORIENTATION_PREFERENCE;
373 bool Window::IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const
375 if( orientation <= Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
377 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation );
383 Dali::Any Window::GetNativeHandle() const
385 return mWindowSurface->GetNativeWindow();
388 void Window::SetAcceptFocus( bool accept )
390 mIsFocusAcceptable = accept;
392 mWindowBase->SetAcceptFocus( accept );
395 bool Window::IsFocusAcceptable() const
397 return mIsFocusAcceptable;
408 WindowVisibilityObserver* observer( mAdaptor );
409 observer->OnWindowShown();
411 Dali::Window handle( this );
412 mVisibilityChangedSignal.Emit( handle, true );
415 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
426 WindowVisibilityObserver* observer( mAdaptor );
427 observer->OnWindowHidden();
429 Dali::Window handle( this );
430 mVisibilityChangedSignal.Emit( handle, false );
433 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
436 bool Window::IsVisible() const
438 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), IsVisible(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
439 return mVisible && !mIconified;
442 unsigned int Window::GetSupportedAuxiliaryHintCount() const
444 return mWindowBase->GetSupportedAuxiliaryHintCount();
447 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
449 return mWindowBase->GetSupportedAuxiliaryHint( index );
452 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
454 return mWindowBase->AddAuxiliaryHint( hint, value );
457 bool Window::RemoveAuxiliaryHint( unsigned int id )
459 return mWindowBase->RemoveAuxiliaryHint( id );
462 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
464 return mWindowBase->SetAuxiliaryHintValue( id, value );
467 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
469 return mWindowBase->GetAuxiliaryHintValue( id );
472 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
474 return mWindowBase->GetAuxiliaryHintId( hint );
477 void Window::SetInputRegion( const Rect< int >& inputRegion )
479 mWindowBase->SetInputRegion( inputRegion );
481 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 );
484 void Window::SetType( Dali::Window::Type type )
488 mWindowBase->SetType( type );
494 Dali::Window::Type Window::GetType() const
499 bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
501 if( mType != Dali::Window::NOTIFICATION )
503 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
507 return mWindowBase->SetNotificationLevel( level );
510 Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
512 if( mType != Dali::Window::NOTIFICATION )
514 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
515 return Dali::Window::NotificationLevel::NONE;
518 return mWindowBase->GetNotificationLevel();
521 void Window::SetOpaqueState( bool opaque )
523 mOpaqueState = opaque;
525 mWindowBase->SetOpaqueState( opaque );
527 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
530 bool Window::IsOpaqueState() const
535 bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
537 return mWindowBase->SetScreenOffMode( screenOffMode );
540 Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
542 return mWindowBase->GetScreenOffMode();
545 bool Window::SetBrightness( int brightness )
547 if( brightness < 0 || brightness > 100 )
549 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
553 return mWindowBase->SetBrightness( brightness );
556 int Window::GetBrightness() const
558 return mWindowBase->GetBrightness();
561 void Window::SetSize( Dali::Window::WindowSize size )
563 if( !mResizeEnabled )
565 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
566 mResizeEnabled = true;
569 PositionSize oldRect = mSurface->GetPositionSize();
571 mWindowSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
573 PositionSize newRect = mSurface->GetPositionSize();
575 // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
576 if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
578 Uint16Pair newSize( newRect.width, newRect.height );
580 bool forceUpdate = false;
581 if( mWindowBase->IsEglWindowRotationSupported() )
586 SurfaceResized( forceUpdate );
588 mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
590 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
592 Dali::Window handle( this );
593 mResizedSignal.Emit( newSize );
594 mResizeSignal.Emit( handle, newSize );
596 mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
600 Dali::Window::WindowSize Window::GetSize() const
602 PositionSize positionSize = mSurface->GetPositionSize();
604 return Dali::Window::WindowSize( positionSize.width, positionSize.height );
607 void Window::SetPosition( Dali::Window::WindowPosition position )
609 if( !mResizeEnabled )
611 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
612 mResizeEnabled = true;
615 PositionSize oldRect = mSurface->GetPositionSize();
617 mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
620 Dali::Window::WindowPosition Window::GetPosition() const
622 PositionSize positionSize = mSurface->GetPositionSize();
624 return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
627 void Window::SetPositionSize( PositionSize positionSize )
629 if( !mResizeEnabled )
631 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
632 mResizeEnabled = true;
635 PositionSize oldRect = mSurface->GetPositionSize();
637 mWindowSurface->MoveResize( positionSize );
639 PositionSize newRect = mSurface->GetPositionSize();
641 // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
642 if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
644 Uint16Pair newSize( newRect.width, newRect.height );
646 bool forceUpdate = false;
647 if( mWindowBase->IsEglWindowRotationSupported() )
652 SurfaceResized( forceUpdate );
654 mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
656 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
657 Dali::Window handle( this );
658 mResizedSignal.Emit( newSize );
659 mResizeSignal.Emit( handle, newSize );
660 mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
664 Dali::Layer Window::GetRootLayer() const
666 return mScene.GetRootLayer();
669 void Window::SetTransparency( bool transparent )
671 mWindowSurface->SetTransparency( transparent );
674 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
676 return mWindowBase->GrabKey( key, grabMode );
679 bool Window::UngrabKey( Dali::KEY key )
681 return mWindowBase->UngrabKey( key );
684 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
686 return mWindowBase->GrabKeyList( key, grabMode, result );
689 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
691 return mWindowBase->UngrabKeyList( key, result );
694 void Window::OnIconifyChanged( bool iconified )
702 WindowVisibilityObserver* observer( mAdaptor );
703 observer->OnWindowHidden();
705 Dali::Window handle( this );
706 mVisibilityChangedSignal.Emit( handle, false );
709 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible );
717 WindowVisibilityObserver* observer( mAdaptor );
718 observer->OnWindowShown();
720 Dali::Window handle( this );
721 mVisibilityChangedSignal.Emit( handle, true );
724 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible );
728 void Window::OnFocusChanged( bool focusIn )
730 Dali::Window handle( this );
731 mFocusChangedSignal.Emit( focusIn );
732 mFocusChangeSignal.Emit( handle, focusIn );
735 void Window::OnOutputTransformed()
737 bool forceUpdate = false;
738 if( mWindowBase->IsEglWindowRotationSupported() )
742 SurfaceResized( forceUpdate );
744 PositionSize positionSize = mSurface->GetPositionSize();
745 mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
746 mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
749 void Window::OnDeleteRequest()
751 mDeleteRequestSignal.Emit();
754 void Window::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
756 Dali::Window handle( this );
757 mTransitionEffectEventSignal.Emit( handle, state, type );
760 void Window::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
762 FeedTouchPoint( point, timeStamp );
765 void Window::OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
767 FeedWheelEvent( wheelEvent );
770 void Window::OnKeyEvent( Dali::Integration::KeyEvent& keyEvent )
772 FeedKeyEvent( keyEvent );
775 void Window::OnRotation( const RotationEvent& rotation )
777 mRotationAngle = rotation.angle;
778 mWindowWidth = rotation.width;
779 mWindowHeight = rotation.height;
781 // Notify that the orientation is changed
782 mOrientation->OnOrientationChange( rotation );
784 mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
786 bool forceUpdate = false;
787 if( mWindowBase->IsEglWindowRotationSupported() )
792 SurfaceResized( forceUpdate );
794 mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
796 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight );
798 Dali::Window handle( this );
799 mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
800 mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
802 mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
805 void Window::OnPause()
809 mEventHandler->Pause();
813 void Window::OnResume()
817 mEventHandler->Resume();
821 void Window::RecalculateTouchPosition( Integration::Point& point )
823 Vector2 position = point.GetScreenPosition();
824 Vector2 convertedPosition;
826 switch( mRotationAngle )
830 convertedPosition.x = static_cast<float>( mWindowWidth ) - position.y;
831 convertedPosition.y = position.x;
836 convertedPosition.x = static_cast<float>( mWindowWidth ) - position.x;
837 convertedPosition.y = static_cast<float>( mWindowHeight ) - position.y;
842 convertedPosition.x = position.y;
843 convertedPosition.y = static_cast<float>( mWindowHeight ) - position.x;
848 convertedPosition = position;
853 point.SetScreenPosition( convertedPosition );
856 Dali::Window Window::Get( Dali::Actor actor )
858 Internal::Adaptor::Window* windowImpl = nullptr;
860 if ( Internal::Adaptor::Adaptor::IsAvailable() )
862 Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() );
863 windowImpl = dynamic_cast<Internal::Adaptor::Window*>( adaptor.GetWindow( actor ) );
866 return Dali::Window( windowImpl );
870 return Dali::Window();
873 void Window::SetParent( Dali::Window& parent )
875 if ( DALI_UNLIKELY( parent ) )
877 mParentWindow = parent;
878 Dali::Window self = Dali::Window( this );
879 // check circular parent window setting
880 if ( Dali::DevelWindow::GetParent( parent ) == self )
882 Dali::DevelWindow::Unparent( parent );
884 mWindowBase->SetParent( GetImplementation( mParentWindow ).mWindowBase );
888 void Window::Unparent()
890 mWindowBase->SetParent( nullptr );
891 mParentWindow.Reset();
894 Dali::Window Window::GetParent()
896 return mParentWindow;
899 Dali::Window::WindowOrientation Window::GetCurrentOrientation() const
901 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle );
902 return ConvertToOrientation( mRotationAngle );
905 void Window::SetAvailableOrientations( const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
907 Dali::Vector<float>::SizeType count = orientations.Count();
908 for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
910 if( IsOrientationAvailable( orientations[index] ) == false )
912 DALI_LOG_ERROR("Window::SetAvailableOrientations, invalid orientation: %d\n", orientations[index]);
917 int convertedAngle = ConvertToAngle( orientations[index] );
919 for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
921 if( mAvailableAngles[i] == convertedAngle )
930 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle );
931 mAvailableAngles.push_back( convertedAngle );
934 SetAvailableAnlges( mAvailableAngles );
937 int32_t Window::GetNativeId() const
939 return mWindowBase->GetNativeWindowId();