2 * Copyright (c) 2020 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/graphics/gles/egl-graphics.h>
36 #include <dali/internal/window-system/common/event-handler.h>
37 #include <dali/internal/window-system/common/orientation-impl.h>
38 #include <dali/internal/window-system/common/render-surface-factory.h>
39 #include <dali/internal/window-system/common/window-factory.h>
40 #include <dali/internal/window-system/common/window-base.h>
41 #include <dali/internal/window-system/common/window-system.h>
42 #include <dali/internal/window-system/common/window-render-surface.h>
43 #include <dali/internal/window-system/common/window-visibility-observer.h>
55 #if defined(DEBUG_ENABLED)
56 Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
59 } // unnamed namespace
61 Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
64 return Window::New(surface, positionSize, name, className, isTransparent);
67 Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
69 Window* window = new Window();
70 window->mIsTransparent = isTransparent;
71 window->Initialize(surface, positionSize, name, className);
76 : mWindowSurface( nullptr ),
78 mIsTransparent( false ),
79 mIsFocusAcceptable( true ),
81 mOpaqueState( false ),
82 mResizeEnabled( false ),
83 mType( Dali::Window::NORMAL ),
84 mParentWindow( NULL ),
85 mPreferredAngle( Dali::Window::NO_ORIENTATION_PREFERENCE ),
89 mOrientationMode( Internal::Adaptor::Window::OrientationMode::PORTRAIT ),
90 mNativeWindowId( -1 ),
91 mDeleteRequestSignal(),
94 mVisibilityChangedSignal(),
95 mTransitionEffectEventSignal(),
96 mKeyboardRepeatSettingsChangedSignal()
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 );
123 mWindowBase->KeyboardRepeatSettingsChangedSignal().Connect( this, &Window::OnKeyboardRepeatSettingsChanged );
125 mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
127 if( !positionSize.IsEmpty() )
129 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
130 mResizeEnabled = true;
133 SetClass( name, className );
135 mWindowSurface->Map();
137 mOrientation = Orientation::New( this );
139 // Get OrientationMode
140 int screenWidth, screenHeight;
141 WindowSystem::GetScreenSize( screenWidth, screenHeight );
142 if( screenWidth > screenHeight )
144 mOrientationMode = Internal::Adaptor::Window::OrientationMode::LANDSCAPE;
148 mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT;
151 mNativeWindowId = mWindowBase->GetNativeWindowId();
154 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
156 mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface, *mAdaptor ) );
157 mEventHandler->AddObserver( *this );
160 void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface )
162 mWindowSurface = static_cast<WindowRenderSurface*>( surface );
165 void Window::SetClass( std::string name, std::string className )
168 mClassName = className;
169 mWindowBase->SetClass( name, className );
172 std::string Window::GetClassName() const
179 mWindowBase->Raise();
181 mSurface->SetFullSwapNextFrame();
183 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId );
188 mWindowBase->Lower();
190 mSurface->SetFullSwapNextFrame();
192 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId );
195 void Window::Activate()
197 mWindowBase->Activate();
199 mSurface->SetFullSwapNextFrame();
201 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId );
204 uint32_t Window::GetLayerCount() const
206 return mScene.GetLayerCount();
209 Dali::Layer Window::GetLayer( uint32_t depth ) const
211 return mScene.GetLayer( depth );
214 Dali::RenderTaskList Window::GetRenderTaskList() const
216 return mScene.GetRenderTaskList();
219 void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
221 if( IsOrientationAvailable( orientation ) == false )
227 int convertedAngle = ConvertToAngle( orientation );
228 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), AddAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
229 for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
231 if( mAvailableAngles[i] == convertedAngle )
240 mAvailableAngles.push_back( convertedAngle );
241 SetAvailableAnlges( mAvailableAngles );
245 void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
247 if( IsOrientationAvailable( orientation ) == false )
252 int convertedAngle = ConvertToAngle( orientation );
253 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), RemoveAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
254 for( std::vector< int >::iterator iter = mAvailableAngles.begin();
255 iter != mAvailableAngles.end(); ++iter )
257 if( *iter == convertedAngle )
259 mAvailableAngles.erase( iter );
264 SetAvailableAnlges( mAvailableAngles );
267 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
269 if( orientation < Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
271 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation );
274 mPreferredAngle = ConvertToAngle( orientation );
275 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
276 mWindowBase->SetPreferredAngle( mPreferredAngle );
279 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
281 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
282 Dali::Window::WindowOrientation preferredOrientation = ConvertToOrientation( mPreferredAngle );
283 return preferredOrientation;
286 void Window::SetAvailableAnlges( const std::vector< int >& angles )
288 if( angles.size() > 4 )
290 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size() );
294 mWindowBase->SetAvailableAnlges( angles );
297 int Window::ConvertToAngle( Dali::Window::WindowOrientation orientation )
299 int convertAngle = static_cast< int >( orientation );
300 if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
302 switch( orientation )
304 case Dali::Window::LANDSCAPE:
309 case Dali::Window::PORTRAIT:
314 case Dali::Window::LANDSCAPE_INVERSE:
319 case Dali::Window::PORTRAIT_INVERSE:
324 case Dali::Window::NO_ORIENTATION_PREFERENCE:
334 Dali::Window::WindowOrientation Window::ConvertToOrientation( int angle ) const
336 Dali::Window::WindowOrientation orientation = static_cast< Dali::Window::WindowOrientation >( angle );
337 if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
343 orientation = Dali::Window::LANDSCAPE;
348 orientation = Dali::Window::PORTRAIT;
353 orientation = Dali::Window::LANDSCAPE_INVERSE;
358 orientation = Dali::Window::PORTRAIT_INVERSE;
363 orientation = Dali::Window::NO_ORIENTATION_PREFERENCE;
371 bool Window::IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const
373 if( orientation <= Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
375 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation );
381 Dali::Any Window::GetNativeHandle() const
383 return mWindowSurface->GetNativeWindow();
386 void Window::SetAcceptFocus( bool accept )
388 mIsFocusAcceptable = accept;
390 mWindowBase->SetAcceptFocus( accept );
393 bool Window::IsFocusAcceptable() const
395 return mIsFocusAcceptable;
406 WindowVisibilityObserver* observer( mAdaptor );
407 observer->OnWindowShown();
409 Dali::Window handle( this );
410 mVisibilityChangedSignal.Emit( handle, true );
413 mSurface->SetFullSwapNextFrame();
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 );
582 mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
584 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
586 Dali::Window handle( this );
587 mResizeSignal.Emit( handle, newSize );
589 mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
592 mSurface->SetFullSwapNextFrame();
595 Dali::Window::WindowSize Window::GetSize() const
597 PositionSize positionSize = mSurface->GetPositionSize();
599 return Dali::Window::WindowSize( positionSize.width, positionSize.height );
602 void Window::SetPosition( Dali::Window::WindowPosition position )
604 if( !mResizeEnabled )
606 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
607 mResizeEnabled = true;
610 PositionSize oldRect = mSurface->GetPositionSize();
612 mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
614 mSurface->SetFullSwapNextFrame();
617 Dali::Window::WindowPosition Window::GetPosition() const
619 PositionSize positionSize = mSurface->GetPositionSize();
621 return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
624 void Window::SetPositionSize( PositionSize positionSize )
626 if( !mResizeEnabled )
628 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
629 mResizeEnabled = true;
632 PositionSize oldRect = mSurface->GetPositionSize();
634 mWindowSurface->MoveResize( positionSize );
636 PositionSize newRect = mSurface->GetPositionSize();
638 // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
639 if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
641 Uint16Pair newSize( newRect.width, newRect.height );
645 mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
647 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
648 Dali::Window handle( this );
649 mResizeSignal.Emit( handle, newSize );
650 mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
653 mSurface->SetFullSwapNextFrame();
656 Dali::Layer Window::GetRootLayer() const
658 return mScene.GetRootLayer();
661 void Window::SetTransparency( bool transparent )
663 mWindowSurface->SetTransparency( transparent );
666 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
668 return mWindowBase->GrabKey( key, grabMode );
671 bool Window::UngrabKey( Dali::KEY key )
673 return mWindowBase->UngrabKey( key );
676 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
678 return mWindowBase->GrabKeyList( key, grabMode, result );
681 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
683 return mWindowBase->UngrabKeyList( key, result );
686 void Window::OnIconifyChanged( bool iconified )
694 WindowVisibilityObserver* observer( mAdaptor );
695 observer->OnWindowHidden();
697 Dali::Window handle( this );
698 mVisibilityChangedSignal.Emit( handle, false );
701 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible );
709 WindowVisibilityObserver* observer( mAdaptor );
710 observer->OnWindowShown();
712 Dali::Window handle( this );
713 mVisibilityChangedSignal.Emit( handle, true );
716 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible );
719 mSurface->SetFullSwapNextFrame();
722 void Window::OnFocusChanged( bool focusIn )
724 Dali::Window handle( this );
725 mFocusChangeSignal.Emit( handle, focusIn );
727 mSurface->SetFullSwapNextFrame();
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::OnKeyboardRepeatSettingsChanged()
751 Dali::Window handle( this );
752 mKeyboardRepeatSettingsChangedSignal.Emit();
755 void Window::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
757 FeedTouchPoint( point, timeStamp );
760 void Window::OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
762 FeedWheelEvent( wheelEvent );
765 void Window::OnKeyEvent( Dali::Integration::KeyEvent& keyEvent )
767 FeedKeyEvent( keyEvent );
770 void Window::OnRotation( const RotationEvent& rotation )
772 mRotationAngle = rotation.angle;
773 mWindowWidth = rotation.width;
774 mWindowHeight = rotation.height;
776 // Notify that the orientation is changed
777 mOrientation->OnOrientationChange( rotation );
779 mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
783 mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
785 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight );
787 Dali::Window handle( this );
788 mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
790 mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
793 void Window::OnPause()
797 mEventHandler->Pause();
801 void Window::OnResume()
805 mEventHandler->Resume();
808 mSurface->SetFullSwapNextFrame();
811 void Window::RecalculateTouchPosition( Integration::Point& point )
813 Vector2 position = point.GetScreenPosition();
814 Vector2 convertedPosition;
816 switch( mRotationAngle )
820 convertedPosition.x = static_cast<float>( mWindowWidth ) - position.y;
821 convertedPosition.y = position.x;
826 convertedPosition.x = static_cast<float>( mWindowWidth ) - position.x;
827 convertedPosition.y = static_cast<float>( mWindowHeight ) - position.y;
832 convertedPosition.x = position.y;
833 convertedPosition.y = static_cast<float>( mWindowHeight ) - position.x;
838 convertedPosition = position;
843 point.SetScreenPosition( convertedPosition );
846 Dali::Window Window::Get( Dali::Actor actor )
848 Internal::Adaptor::Window* windowImpl = nullptr;
850 if ( Internal::Adaptor::Adaptor::IsAvailable() )
852 Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() );
853 windowImpl = dynamic_cast<Internal::Adaptor::Window*>( adaptor.GetWindow( actor ) );
856 return Dali::Window( windowImpl );
860 return Dali::Window();
863 void Window::SetParent( Dali::Window& parent )
865 if ( DALI_UNLIKELY( parent ) )
867 mParentWindow = parent;
868 Dali::Window self = Dali::Window( this );
869 // check circular parent window setting
870 if ( Dali::DevelWindow::GetParent( parent ) == self )
872 Dali::DevelWindow::Unparent( parent );
874 mWindowBase->SetParent( GetImplementation( mParentWindow ).mWindowBase );
878 void Window::Unparent()
880 mWindowBase->SetParent( nullptr );
881 mParentWindow.Reset();
884 Dali::Window Window::GetParent()
886 return mParentWindow;
889 Dali::Window::WindowOrientation Window::GetCurrentOrientation() const
891 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle );
892 return ConvertToOrientation( mRotationAngle );
895 void Window::SetAvailableOrientations( const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
897 Dali::Vector<float>::SizeType count = orientations.Count();
898 for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
900 if( IsOrientationAvailable( orientations[index] ) == false )
902 DALI_LOG_ERROR("Window::SetAvailableOrientations, invalid orientation: %d\n", orientations[index]);
907 int convertedAngle = ConvertToAngle( orientations[index] );
909 for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
911 if( mAvailableAngles[i] == convertedAngle )
920 DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle );
921 mAvailableAngles.push_back( convertedAngle );
924 SetAvailableAnlges( mAvailableAngles );
927 int32_t Window::GetNativeId() const
929 return mWindowBase->GetNativeWindowId();