X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fwayland%2Fwindow-impl-wl.cpp;h=631681fe05123e194cda31f8f63ff1841e3bd4ea;hb=a6b0ac5016d7c6aa09d2e774529faaad10ae0ce3;hp=fc325edfb20649319c1919fabf3db0fb437dd7f2;hpb=be4ee64028665c440bab586cb4cdd5b0a2d1022c;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/wayland/window-impl-wl.cpp b/adaptors/wayland/window-impl-wl.cpp index fc325ed..631681f 100644 --- a/adaptors/wayland/window-impl-wl.cpp +++ b/adaptors/wayland/window-impl-wl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,6 @@ #include "window-impl.h" // EXTERNAL HEADERS -#include -#include - #include #include #include @@ -29,18 +26,12 @@ #include // INTERNAL HEADERS -#include +#include "render-surface/render-surface-wl.h" #include -#include #include #include -namespace -{ -const float INDICATOR_ANIMATION_DURATION( 0.18f ); // 180 milli seconds -const float INDICATOR_SHOW_Y_POSITION( 0.0f ); -const float INDICATOR_HIDE_Y_POSITION( -52.0f ); -} + namespace Dali { @@ -52,58 +43,11 @@ namespace Adaptor Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_WINDOW"); #endif -/** - * TODO: Abstract Window class out and move this into a window implementation for Ecore - */ struct Window::EventHandler { - /** - * Constructor - * @param[in] window A pointer to the window class. - */ - EventHandler( Window* window ) - : mWindow( window ), - mEcoreWindow( 0 ) - { - } - - /** - * Destructor - */ - ~EventHandler() - { - if ( mWindowPropertyHandler ) - { - ecore_event_handler_del( mWindowPropertyHandler ); - } - if ( mClientMessagehandler ) - { - ecore_event_handler_del( mClientMessagehandler ); - } - } - - // Static methods - - /// Called when the window properties are changed. - static Eina_Bool EcoreEventWindowPropertyChanged( void* data, int type, void* event ) - { - return EINA_FALSE; - } - - /// Called when the window properties are changed. - static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event ) - { - return EINA_FALSE; - } - - // Data - Window* mWindow; - Ecore_Event_Handler* mWindowPropertyHandler; - Ecore_Event_Handler* mClientMessagehandler; - Ecore_Wl_Window* mEcoreWindow; + // place holder }; - Window* Window::New(const PositionSize& posSize, const std::string& name, const std::string& className, bool isTransparent) { Window* window = new Window(); @@ -132,15 +76,7 @@ void Window::SetAdaptor(Dali::Adaptor& adaptor) mDragAndDropDetector = DragAndDropDetector::New(); mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) ); - if( mOrientation ) - { - mOrientation->SetAdaptor(adaptor); - } - if( mIndicator != NULL ) - { - mIndicator->SetAdaptor(mAdaptor); - } } RenderSurface* Window::GetSurface() @@ -150,27 +86,15 @@ RenderSurface* Window::GetSurface() void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode ) { - DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "visible : %d\n", visibleMode ); - DALI_ASSERT_DEBUG(mOverlay); - DoShowIndicator( mIndicatorOrientation ); } void Window::RotateIndicator(Dali::Window::WindowOrientation orientation) { - DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation ); - - DoRotateIndicator( orientation ); } void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode ) { - mIndicatorOpacityMode = opacityMode; - - if( mIndicator != NULL ) - { - mIndicator->SetOpacityMode( opacityMode ); - } } void Window::SetClass(std::string name, std::string klass) @@ -178,32 +102,34 @@ void Window::SetClass(std::string name, std::string klass) } Window::Window() -: mSurface(NULL), - mIndicatorVisible(Dali::Window::VISIBLE), - mIndicatorIsShown(false), - mShowRotatedIndicatorOnClose(false), - mStarted(false), - mIsTransparent(false), - mWMRotationAppSet(false), - mIndicator(NULL), - mIndicatorOrientation(Dali::Window::PORTRAIT), - mNextIndicatorOrientation(Dali::Window::PORTRAIT), - mIndicatorOpacityMode(Dali::Window::OPAQUE), - mOverlay(NULL), - mAdaptor(NULL) -{ +: mSurface( NULL ), + mIndicatorVisible( Dali::Window::VISIBLE ), + mIndicatorIsShown( false ), + mShowRotatedIndicatorOnClose( false ), + mStarted( false ), + mIsTransparent( false ), + mWMRotationAppSet( false ), + mIsFocusAcceptable( true ), + mVisible( true ), + mOpaqueState( false ), + mIndicator( NULL ), + mIndicatorOrientation( Dali::Window::PORTRAIT ), + mNextIndicatorOrientation( Dali::Window::PORTRAIT ), + mIndicatorOpacityMode( Dali::Window::OPAQUE ), + mOverlay( NULL ), + mAdaptor( NULL ), + mType( Dali::DevelWindow::NORMAL ), + mPreferredOrientation( Dali::Window::PORTRAIT ), + mSupportedAuxiliaryHints(), + mAuxiliaryHints() +{ + mEventHandler = NULL; } Window::~Window() { delete mEventHandler; - if( mIndicator ) - { - mIndicator->Close(); - delete mIndicator; - } - if ( mAdaptor ) { mAdaptor->RemoveObserver( *this ); @@ -218,130 +144,45 @@ void Window::Initialize(const PositionSize& windowPosition, const std::string& n { // create an Wayland window by default Any surface; - ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( windowPosition, surface, name, mIsTransparent ); - SetClass( name, className ); - windowSurface->Map(); + Wayland::RenderSurface* windowSurface = new Wayland::RenderSurface( windowPosition, surface, name, mIsTransparent ); mSurface = windowSurface; mOrientation = Orientation::New(this); - // create event handler for Wayland window - mEventHandler = new EventHandler( this ); } void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation ) { - if( mIndicator == NULL ) - { - if( mIndicatorVisible != Dali::Window::INVISIBLE ) - { - mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, this ); - mIndicator->SetOpacityMode( mIndicatorOpacityMode ); - Dali::Actor actor = mIndicator->GetActor(); - SetIndicatorActorRotation(); - mOverlay->Add(actor); - } - // else don't create a hidden indicator - } - else // Already have indicator - { - if( mIndicatorVisible == Dali::Window::VISIBLE ) - { - // If we are resuming, and rotation has changed, - if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation ) - { - // then close current indicator and open new one - mShowRotatedIndicatorOnClose = true; - mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion - // Don't show actor - will contain indicator for old orientation. - } - } - } - - // set indicator visible mode - if( mIndicator != NULL ) - { - mIndicator->SetVisible( mIndicatorVisible ); - } - bool show = (mIndicatorVisible != Dali::Window::INVISIBLE ); - SetIndicatorProperties( show, lastOrientation ); - mIndicatorIsShown = show; } void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation ) { - if( mIndicatorIsShown ) - { - mShowRotatedIndicatorOnClose = true; - mNextIndicatorOrientation = orientation; - mIndicator->Close(); // May synchronously call IndicatorClosed() callback - } - else - { - // Save orientation for when the indicator is next shown - mShowRotatedIndicatorOnClose = false; - mNextIndicatorOrientation = orientation; - } + } void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) { } -void Window::IndicatorTypeChanged(Indicator::Type type) +void Window::IndicatorTypeChanged(IndicatorInterface::Type type) { } -void Window::IndicatorClosed( Indicator* indicator ) +void Window::IndicatorClosed( IndicatorInterface* indicator ) { - DALI_LOG_TRACE_METHOD( gWindowLogFilter ); - if( mShowRotatedIndicatorOnClose ) - { - Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation; - mIndicator->Open(mNextIndicatorOrientation); - mIndicatorOrientation = mNextIndicatorOrientation; - SetIndicatorActorRotation(); - DoShowIndicator(currentOrientation); - } } void Window::IndicatorVisibilityChanged(bool isVisible) { - mIndicatorVisibilityChangedSignal.Emit(isVisible); + } void Window::SetIndicatorActorRotation() { - DALI_LOG_TRACE_METHOD( gWindowLogFilter ); - DALI_ASSERT_DEBUG( mIndicator != NULL ); - Dali::Actor actor = mIndicator->GetActor(); - switch( mIndicatorOrientation ) - { - case Dali::Window::PORTRAIT: - actor.SetParentOrigin( ParentOrigin::TOP_CENTER ); - actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - actor.SetOrientation( Degree(0), Vector3::ZAXIS ); - break; - case Dali::Window::PORTRAIT_INVERSE: - actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - actor.SetOrientation( Degree(180), Vector3::ZAXIS ); - break; - case Dali::Window::LANDSCAPE: - actor.SetParentOrigin( ParentOrigin::CENTER_LEFT ); - actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - actor.SetOrientation( Degree(270), Vector3::ZAXIS ); - break; - case Dali::Window::LANDSCAPE_INVERSE: - actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT ); - actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - actor.SetOrientation( Degree(90), Vector3::ZAXIS ); - break; - } } void Window::Raise() @@ -363,19 +204,13 @@ Dali::DragAndDropDetector Window::GetDragAndDropDetector() const Dali::Any Window::GetNativeHandle() const { - if(mEventHandler) - { - return mEventHandler->mEcoreWindow; - } - else - { - return Dali::Any(); - } + Wayland::RenderSurface* surface = static_cast< Wayland::RenderSurface* >( mSurface ); + + return surface->GetWindow(); } void Window::OnStart() { - DoShowIndicator( mIndicatorOrientation ); } void Window::OnPause() @@ -384,24 +219,10 @@ void Window::OnPause() void Window::OnResume() { - // resume indicator status - if( mIndicator != NULL ) - { - // Restore own indicator opacity - // Send opacity mode to indicator service when app resumed - mIndicator->SetOpacityMode( mIndicatorOpacityMode ); - } } void Window::OnStop() { - if( mIndicator ) - { - mIndicator->Close(); - } - - delete mIndicator; - mIndicator = NULL; } void Window::OnDestroy() @@ -463,10 +284,124 @@ Dali::Window::WindowOrientation Window::GetPreferredOrientation() return mPreferredOrientation; } +void Window::SetAcceptFocus( bool accept ) +{ + mIsFocusAcceptable = accept; +} + +bool Window::IsFocusAcceptable() +{ + return mIsFocusAcceptable; +} + +void Window::Show() +{ + mVisible = true; +} + +void Window::Hide() +{ + mVisible = false; +} + +bool Window::IsVisible() const +{ + return mVisible; +} + + void Window::RotationDone( int orientation, int width, int height ) { } +unsigned int Window::GetSupportedAuxiliaryHintCount() +{ + return 0; +} + +std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) +{ + return std::string(); +} + +unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value ) +{ + return -1; +} + +bool Window::RemoveAuxiliaryHint( unsigned int id ) +{ + return false; +} + +bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value ) +{ + return false; +} + +std::string Window::GetAuxiliaryHintValue( unsigned int id ) const +{ + return std::string(); +} + +unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const +{ + return -1; +} + +void Window::SetInputRegion( const Rect< int >& inputRegion ) +{ +} + +void Window::SetType( Dali::DevelWindow::Type type ) +{ + mType = type; +} + +Dali::DevelWindow::Type Window::GetType() const +{ + return mType; +} + +bool Window::SetNotificationLevel( Dali::DevelWindow::NotificationLevel::Type level ) +{ + return false; +} + +Dali::DevelWindow::NotificationLevel::Type Window::GetNotificationLevel() +{ + return Dali::DevelWindow::NotificationLevel::NONE; +} + +void Window::SetOpaqueState( bool opaque ) +{ + mOpaqueState = opaque; +} + +bool Window::IsOpaqueState() +{ + return mOpaqueState; +} + +bool Window::SetScreenMode( Dali::DevelWindow::ScreenMode::Type screenMode ) +{ + return false; +} + +Dali::DevelWindow::ScreenMode::Type Window::GetScreenMode() +{ + return Dali::DevelWindow::ScreenMode::DEFAULT; +} + +bool Window::SetBrightness( int brightness ) +{ + return false; +} + +int Window::GetBrightness() +{ + return 0; +} } // Adaptor } // Internal