X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fx11%2Fwindow-impl-x.cpp;h=d760aa808907e561c37bfd2e75cdf11c7b1bac32;hb=1f2153d4febc92138f74ee6b51f2007255fb90b4;hp=7f9e909fe7f7cc8c33e467e198b13e792f9ff208;hpb=8583e530f0fa4dfce777d78267d20bbb7db7ceab;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/x11/window-impl-x.cpp b/adaptors/x11/window-impl-x.cpp index 7f9e909..d760aa8 100644 --- a/adaptors/x11/window-impl-x.cpp +++ b/adaptors/x11/window-impl-x.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,6 +19,9 @@ #include "window-impl.h" // EXTERNAL HEADERS +// Ecore is littered with C style cast +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" #include #include @@ -222,11 +225,11 @@ struct Window::EventHandler }; -Window* Window::New(const PositionSize& posSize, const std::string& name, const std::string& className, bool isTransparent) +Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent ) { Window* window = new Window(); window->mIsTransparent = isTransparent; - window->Initialize(posSize, name, className); + window->Initialize( positionSize, name, className ); return window; } @@ -344,26 +347,25 @@ Window::Window() mWMRotationAppSet( false ), mEcoreEventHander( true ), mIsFocusAcceptable( true ), + mVisible( true ), + mOpaqueState( false ), + mResizeEnabled( true ), mIndicator( NULL ), mIndicatorOrientation( Dali::Window::PORTRAIT ), mNextIndicatorOrientation( Dali::Window::PORTRAIT ), mIndicatorOpacityMode( Dali::Window::OPAQUE ), mOverlay( NULL ), mAdaptor( NULL ), + mType( Dali::DevelWindow::NORMAL ), mEventHandler( NULL ), - mPreferredOrientation( Dali::Window::PORTRAIT ) + mPreferredOrientation( Dali::Window::PORTRAIT ), + mSupportedAuxiliaryHints(), + mAuxiliaryHints(), + mIndicatorVisibilityChangedSignal(), + mFocusChangedSignal(), + mResizedSignal(), + mDeleteRequestSignal() { - - // Detect if we're not running in a ecore main loop (e.g. libuv). - // Typically ecore_x_init is called by app_efl_main->elm_init - // but if we're not using app_efl_main then we have to call it ourselves - // This is a hack until we create a pure X Window class - if( ecore_x_display_get() == NULL ) - { - mEcoreEventHander = false; - ecore_x_init (NULL); // internally calls _ecore_x_input_init - } - } Window::~Window() @@ -390,11 +392,11 @@ Window::~Window() delete mSurface; } -void Window::Initialize(const PositionSize& windowPosition, const std::string& name, const std::string& className) +void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className) { // create an X11 window by default Any surface; - ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( windowPosition, surface, name, className, mIsTransparent ); + ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( positionSize, surface, name, className, mIsTransparent ); windowSurface->Map(); mSurface = windowSurface; @@ -743,6 +745,45 @@ bool Window::IsFocusAcceptable() return mIsFocusAcceptable; } +void Window::Show() +{ + ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface ); + if( x11Window ) + { + Ecore_X_Window win = x11Window->GetXWindow(); + ecore_x_window_show( win ); + + // Need an update request + if( mAdaptor ) + { + mAdaptor->RequestUpdateOnce(); + } + } +} + +void Window::Hide() +{ + ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface ); + if( x11Window ) + { + Ecore_X_Window win = x11Window->GetXWindow(); + ecore_x_window_hide( win ); + } +} + +bool Window::IsVisible() const +{ + bool visible = false; + + ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface ); + if( x11Window ) + { + Ecore_X_Window win = x11Window->GetXWindow(); + visible = static_cast< bool >( ecore_x_window_visible_get( win ) ); + } + return visible; +} + void Window::RotationDone( int orientation, int width, int height ) { // Tell window manager we're done @@ -767,11 +808,166 @@ void Window::RotationDone( int orientation, int width, int height ) ecore_x_window_prop_property_set( ecoreWindow, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, ECORE_X_ATOM_CARDINAL, 32, &angles, 2 ); + + mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) ); + + // Emit signal + mResizedSignal.Emit( Dali::DevelWindow::WindowSize( width, height ) ); + + mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) ); #endif // DALI_PROFILE_UBUNTU } } +void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode ) +{ + mIndicatorVisible = mode; +} + +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; +} + +void Window::SetSize( Dali::DevelWindow::WindowSize size ) +{ + PositionSize positionSize = mSurface->GetPositionSize(); + + if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() ) + { + positionSize.width = size.GetWidth(); + positionSize.height = size.GetHeight(); + + mSurface->MoveResize( positionSize ); + + mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) ); + + // Emit signal + mResizedSignal.Emit( Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height ) ); + + mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) ); + } +} + +Dali::DevelWindow::WindowSize Window::GetSize() +{ + PositionSize positionSize = mSurface->GetPositionSize(); + + return Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height ); +} + +void Window::SetPosition( Dali::DevelWindow::WindowPosition position ) +{ + PositionSize positionSize = mSurface->GetPositionSize(); + + if( positionSize.x != position.GetX() || positionSize.y != position.GetY() ) + { + positionSize.x = position.GetX(); + positionSize.y = position.GetY(); + + mSurface->MoveResize( positionSize ); + } +} + +Dali::DevelWindow::WindowPosition Window::GetPosition() +{ + PositionSize positionSize = mSurface->GetPositionSize(); + + return Dali::DevelWindow::WindowPosition( positionSize.x, positionSize.y ); +} + +void Window::SetTransparency( bool transparent ) +{ +} } // Adaptor + } // Internal + } // Dali + +#pragma GCC diagnostic pop