From 3d5263e97a62ffc1396ce61419a3752e7b557e4c Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 2 May 2018 13:22:54 +0900 Subject: [PATCH] Indicator refactoring Change-Id: I1f18753d8b7200b6f9352383f37fccda76c4cd79 --- .../common/ecore-server-connection.cpp | 16 +- .../window-system/common/window-factory.h | 58 ++++ .../window-system/common/window-impl.cpp | 88 +++--- .../window-system/common/window-impl.h | 46 +-- dali/internal/window-system/file.list | 6 +- .../indicator-impl-ecore-wl.cpp} | 261 +++++------------- .../indicator-impl-ecore-wl.h} | 56 +--- .../window-base-factory-ecore-wl.h | 40 --- ...ore-wl.cpp => window-factory-ecore-wl.cpp} | 18 +- .../window-factory-ecore-wl.h} | 23 +- ...ecore-x.cpp => window-factory-ecore-x.cpp} | 17 +- ...ory-ecore-x.h => window-factory-ecore-x.h} | 8 +- 12 files changed, 255 insertions(+), 382 deletions(-) create mode 100644 dali/internal/window-system/common/window-factory.h rename dali/internal/window-system/{common/ecore-indicator-impl.cpp => tizen-wayland/indicator-impl-ecore-wl.cpp} (85%) rename dali/internal/window-system/{common/ecore-indicator-impl.h => tizen-wayland/indicator-impl-ecore-wl.h} (88%) delete mode 100644 dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.h rename dali/internal/window-system/tizen-wayland/{window-base-factory-ecore-wl.cpp => window-factory-ecore-wl.cpp} (57%) rename dali/internal/window-system/{common/window-base-factory.h => tizen-wayland/window-factory-ecore-wl.h} (54%) rename dali/internal/window-system/ubuntu-x11/{window-base-factory-ecore-x.cpp => window-factory-ecore-x.cpp} (61%) rename dali/internal/window-system/ubuntu-x11/{window-base-factory-ecore-x.h => window-factory-ecore-x.h} (70%) diff --git a/dali/internal/window-system/common/ecore-server-connection.cpp b/dali/internal/window-system/common/ecore-server-connection.cpp index 4a4145d06..61b48e28d 100644 --- a/dali/internal/window-system/common/ecore-server-connection.cpp +++ b/dali/internal/window-system/common/ecore-server-connection.cpp @@ -43,7 +43,7 @@ namespace Internal namespace Adaptor { #if defined(DEBUG_ENABLED) -extern Debug::Filter* gIndicatorLogFilter; +Debug::Filter* gServerConnectionLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_SERVER_CONNECTION"); #endif ServerConnection::ServerConnection( @@ -67,13 +67,13 @@ ServerConnection::ServerConnection( ipctype = ECORE_IPC_LOCAL_SYSTEM; } - DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "ServerConnection: Connecting to %s %d\n", mService.name, mService.num ); + DALI_LOG_INFO( gServerConnectionLogFilter, Debug::General, "ServerConnection: Connecting to %s %d\n", mService.name, mService.num ); mIpcServer = ecore_ipc_server_connect( ipctype, (char *)mService.name, mService.num, this ); if( !mIpcServer ) { - DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "mIpcServer is null\n" ); + DALI_LOG_INFO( gServerConnectionLogFilter, Debug::General, "mIpcServer is null\n" ); ecore_ipc_shutdown(); } else @@ -145,14 +145,14 @@ bool ServerConnection::SendEvent( int event, int ref, int ref_to, const void *da Eina_Bool ServerConnection::IpcServerAdd( void *data, int /*type*/, void *event ) { - DALI_LOG_INFO(gIndicatorLogFilter, Debug::General, "ServerConnection: IpcServerAdd\n" ); + DALI_LOG_INFO(gServerConnectionLogFilter, Debug::General, "ServerConnection: IpcServerAdd\n" ); return ECORE_CALLBACK_PASS_ON; } Eina_Bool ServerConnection::IpcServerDel( void *data, int /*type*/, void *event ) { - DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "ServerConnection: IpcServerDel\n" ); + DALI_LOG_INFO( gServerConnectionLogFilter, Debug::General, "ServerConnection: IpcServerDel\n" ); Ecore_Ipc_Event_Server_Del *e = static_cast( event ); ServerConnection* connection = static_cast( data ); @@ -171,7 +171,7 @@ Eina_Bool ServerConnection::IpcServerDel( void *data, int /*type*/, void *event Eina_Bool ServerConnection::IpcServerData( void *data, int /*type*/, void *event ) { - DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "ServerConnection: IpcServerData\n" ); + DALI_LOG_INFO( gServerConnectionLogFilter, Debug::General, "ServerConnection: IpcServerData\n" ); Ecore_Ipc_Event_Server_Data *e = static_cast( event ); ServerConnection* connection = static_cast( data ); @@ -200,7 +200,7 @@ void ServerConnection::CloseConnection() { if( mConnected ) { - DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "ServerConnection: CloseConnection\n" ); + DALI_LOG_INFO( gServerConnectionLogFilter, Debug::General, "ServerConnection: CloseConnection\n" ); if( mIpcServer ) { @@ -219,4 +219,4 @@ void ServerConnection::CloseConnection() } // Dali -#pragma GCC diagnostic pop \ No newline at end of file +#pragma GCC diagnostic pop diff --git a/dali/internal/window-system/common/window-factory.h b/dali/internal/window-system/common/window-factory.h new file mode 100644 index 000000000..717a917ac --- /dev/null +++ b/dali/internal/window-system/common/window-factory.h @@ -0,0 +1,58 @@ +#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_FACTORY_H +#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_FACTORY_H + +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include +#include + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ + +class Adaptor; +class WindowBase; +class Window; +class WindowRenderSurface; + +class WindowFactory +{ +public: + + WindowFactory() = default; + virtual ~WindowFactory() = default; + + virtual std::unique_ptr< WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) = 0; + + virtual std::unique_ptr< IndicatorInterface > CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) = 0; +}; + +extern std::unique_ptr< WindowFactory > GetWindowFactory(); + +} // namespace Adaptor +} // namespace Internal +} // namespace Dali + +#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_FACTORY_H diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 715861ee3..0d84262f3 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -27,11 +27,10 @@ // INTERNAL HEADERS #include -#include #include #include #include -#include +#include #include #include @@ -72,7 +71,7 @@ Window::Window() mIconified( false ), mOpaqueState( false ), mResizeEnabled( false ), - mIndicator( NULL ), + mIndicator(), mIndicatorOrientation( Dali::Window::PORTRAIT ), mNextIndicatorOrientation( Dali::Window::PORTRAIT ), mIndicatorOpacityMode( Dali::Window::OPAQUE ), @@ -96,7 +95,6 @@ Window::~Window() Dali::RenderTask indicatorTask = taskList.GetTask(0); mOverlay->GetOverlayRenderTasks().RemoveTask(indicatorTask); mIndicator->Close(); - delete mIndicator; } if ( mAdaptor ) @@ -118,8 +116,8 @@ void Window::Initialize(const PositionSize& positionSize, const std::string& nam mSurface = windowRenderSurface.release(); // create a window base - auto windowBaseFactory = Dali::Internal::Adaptor::GetWindowBaseFactory(); - mWindowBase = windowBaseFactory->CreateWindowBase( this, mSurface ); + auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory(); + mWindowBase = windowFactory->CreateWindowBase( this, mSurface ); mWindowBase->Initialize(); @@ -609,11 +607,15 @@ void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation ) { if( mIndicatorVisible != Dali::Window::INVISIBLE ) { - mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, this ); - mIndicator->SetOpacityMode( mIndicatorOpacityMode ); - Dali::Actor actor = mIndicator->GetActor(); - SetIndicatorActorRotation(); - mOverlay->Add(actor); + auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory(); + mIndicator = windowFactory->CreateIndicator( mAdaptor, mIndicatorOrientation, this ); + if( mIndicator ) + { + mIndicator->SetOpacityMode( mIndicatorOpacityMode ); + Dali::Actor actor = mIndicator->GetActor(); + SetIndicatorActorRotation(); + mOverlay->Add(actor); + } } // else don't create a hidden indicator } @@ -649,7 +651,10 @@ void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation ) { mShowRotatedIndicatorOnClose = true; mNextIndicatorOrientation = orientation; - mIndicator->Close(); // May synchronously call IndicatorClosed() callback + if( mIndicator ) + { + mIndicator->Close(); // May synchronously call IndicatorClosed() callback + } } else { @@ -662,31 +667,32 @@ void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation ) void Window::SetIndicatorActorRotation() { DALI_LOG_TRACE_METHOD( gWindowLogFilter ); - DALI_ASSERT_DEBUG( mIndicator != NULL ); - - Dali::Actor actor = mIndicator->GetActor(); - switch( mIndicatorOrientation ) + if( mIndicator ) { - 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; + 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; + } } } @@ -695,7 +701,7 @@ void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientatio mWindowBase->SetIndicatorProperties( isShow, lastOrientation ); } -void Window::IndicatorTypeChanged(Indicator::Type type) +void Window::IndicatorTypeChanged( IndicatorInterface::Type type ) { mWindowBase->IndicatorTypeChanged( type ); } @@ -707,7 +713,10 @@ void Window::IndicatorClosed( IndicatorInterface* indicator ) if( mShowRotatedIndicatorOnClose ) { Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation; - mIndicator->Open( mNextIndicatorOrientation ); + if( mIndicator ) + { + mIndicator->Open( mNextIndicatorOrientation ); + } mIndicatorOrientation = mNextIndicatorOrientation; SetIndicatorActorRotation(); DoShowIndicator( currentOrientation ); @@ -746,8 +755,7 @@ void Window::OnStop() mIndicator->Close(); } - delete mIndicator; - mIndicator = NULL; + mIndicator.release(); } void Window::OnDestroy() diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 5ff8e1d96..6c6291039 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_WINDOW_H__ -#define __DALI_INTERNAL_WINDOW_H__ +#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H +#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H /* * Copyright (c) 2018 Samsung Electronics Co., Ltd. @@ -456,26 +456,26 @@ public: // Signals private: - WindowRenderSurface* mSurface; - std::unique_ptr< WindowBase > mWindowBase; - Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state - bool mIndicatorIsShown:1; ///< private state - bool mShowRotatedIndicatorOnClose:1; - bool mStarted:1; - bool mIsTransparent:1; - bool mIsFocusAcceptable:1; - bool mVisible:1; - bool mIconified:1; - bool mOpaqueState:1; - bool mResizeEnabled:1; - IndicatorInterface* mIndicator; - Dali::Window::WindowOrientation mIndicatorOrientation; - Dali::Window::WindowOrientation mNextIndicatorOrientation; - Dali::Window::IndicatorBgOpacity mIndicatorOpacityMode; - Integration::SystemOverlay* mOverlay; - Adaptor* mAdaptor; - Dali::DragAndDropDetector mDragAndDropDetector; - Dali::Window::Type mType; + WindowRenderSurface* mSurface; + std::unique_ptr< WindowBase > mWindowBase; + Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state + bool mIndicatorIsShown:1; ///< private state + bool mShowRotatedIndicatorOnClose:1; + bool mStarted:1; + bool mIsTransparent:1; + bool mIsFocusAcceptable:1; + bool mVisible:1; + bool mIconified:1; + bool mOpaqueState:1; + bool mResizeEnabled:1; + std::unique_ptr< IndicatorInterface > mIndicator; + Dali::Window::WindowOrientation mIndicatorOrientation; + Dali::Window::WindowOrientation mNextIndicatorOrientation; + Dali::Window::IndicatorBgOpacity mIndicatorOpacityMode; + Integration::SystemOverlay* mOverlay; + Adaptor* mAdaptor; + Dali::DragAndDropDetector mDragAndDropDetector; + Dali::Window::Type mType; OrientationPtr mOrientation; std::vector mAvailableOrientations; @@ -509,4 +509,4 @@ inline const Internal::Adaptor::Window& GetImplementation(const Dali::Window& wi } // namespace Dali -#endif // __DALI_INTERNAL_WINDOW_H__ +#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H diff --git a/dali/internal/window-system/file.list b/dali/internal/window-system/file.list index cfc7b2768..29f2af0ba 100644 --- a/dali/internal/window-system/file.list +++ b/dali/internal/window-system/file.list @@ -3,7 +3,6 @@ # module: window-system, backend: common adaptor_window_system_common_src_files=\ ${adaptor_window_system_dir}/common/display-connection.cpp \ - ${adaptor_window_system_dir}/common/ecore-indicator-impl.cpp \ ${adaptor_window_system_dir}/common/ecore-server-connection.cpp \ ${adaptor_window_system_dir}/common/indicator-buffer.cpp \ ${adaptor_window_system_dir}/common/native-render-surface-factory.cpp \ @@ -15,11 +14,12 @@ adaptor_window_system_tizen_wayland_src_files=\ ${adaptor_window_system_dir}/tizen-wayland/display-connection-factory-ecore-wl.cpp \ ${adaptor_window_system_dir}/tizen-wayland/display-connection-impl-ecore-wl.cpp \ ${adaptor_window_system_dir}/tizen-wayland/event-handler-ecore-wl.cpp \ + ${adaptor_window_system_dir}/tizen-wayland/indicator-impl-ecore-wl.cpp \ ${adaptor_window_system_dir}/tizen-wayland/native-render-surface-ecore-wl.cpp \ ${adaptor_window_system_dir}/tizen-wayland/render-surface-factory-ecore-wl.cpp \ ${adaptor_window_system_dir}/tizen-wayland/window-render-surface-ecore-wl.cpp \ ${adaptor_window_system_dir}/tizen-wayland/window-base-ecore-wl.cpp \ - ${adaptor_window_system_dir}/tizen-wayland/window-base-factory-ecore-wl.cpp + ${adaptor_window_system_dir}/tizen-wayland/window-factory-ecore-wl.cpp # module: window-system, backend: ubuntu-x11 adaptor_window_system_ubuntu_x11_src_files=\ @@ -31,4 +31,4 @@ adaptor_window_system_ubuntu_x11_src_files=\ ${adaptor_window_system_dir}/ubuntu-x11/window-interface-ecore-x.cpp \ ${adaptor_window_system_dir}/ubuntu-x11/window-render-surface-ecore-x.cpp \ ${adaptor_window_system_dir}/ubuntu-x11/window-base-ecore-x.cpp \ - ${adaptor_window_system_dir}/ubuntu-x11/window-base-factory-ecore-x.cpp + ${adaptor_window_system_dir}/ubuntu-x11/window-factory-ecore-x.cpp diff --git a/dali/internal/window-system/common/ecore-indicator-impl.cpp b/dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.cpp similarity index 85% rename from dali/internal/window-system/common/ecore-indicator-impl.cpp rename to dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.cpp index 3c9a6b1fe..b54492a85 100644 --- a/dali/internal/window-system/common/ecore-indicator-impl.cpp +++ b/dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES // Ecore is littered with C style cast @@ -24,25 +24,16 @@ #pragma GCC diagnostic ignored "-Wold-style-cast" #include #include -#ifdef WAYLAND #include -#else -#include -#endif #include #include #include #include -#include -#include -#include #include -#include #include #include -#include #include #include @@ -52,8 +43,6 @@ #include #include -using Dali::Vector4; - #if defined(DEBUG_ENABLED) #define STATE_DEBUG_STRING(state) (state==DISCONNECTED?"DISCONNECTED":state==CONNECTED?"CONNECTED":"UNKNOWN") #endif @@ -62,8 +51,7 @@ namespace { const float SLIDING_ANIMATION_DURATION( 0.2f ); // 200 milli seconds -const float AUTO_INDICATOR_STAY_DURATION(3.0f); // 3 seconds -const float SHOWING_DISTANCE_HEIGHT_RATE(0.34f); // 20 pixels +const float AUTO_INDICATOR_STAY_DURATION( 3.0f ); // 3 seconds enum { @@ -149,16 +137,11 @@ Dali::Geometry CreateQuadGeometry() return quad; } -const float OPAQUE_THRESHOLD(0.99f); -const float TRANSPARENT_THRESHOLD(0.05f); - // indicator service name const char* INDICATOR_SERVICE_NAME("elm_indicator"); // Copied from ecore_evas_extn_engine.h -#define NBUF 2 - enum // opcodes { OP_RESIZE, @@ -187,7 +170,6 @@ enum // opcodes OP_EV_HOLD, OP_MSG_PARENT, OP_MSG, - OP_PIXMAP_REF, }; // Copied from elm_conform.c @@ -199,11 +181,6 @@ const int MSG_ID_INDICATOR_OPACITY( 0X1004 ); const int MSG_ID_INDICATOR_TYPE( 0X1005 ); const int MSG_ID_INDICATOR_START_ANIMATION( 0X10006 ); -struct IpcDataUpdate -{ - int x, w, y, h; -}; - struct IpcDataResize { int w, h; @@ -352,7 +329,7 @@ Debug::Filter* gIndicatorLogFilter = Debug::Filter::New(Debug::Concise, false, " // Impl to hide EFL implementation. -struct Indicator::Impl +struct IndicatorEcoreWl::Impl { enum // operation mode { @@ -363,17 +340,13 @@ struct Indicator::Impl /** * Constructor */ - Impl(Indicator* indicator) + Impl(IndicatorEcoreWl* indicator) : mIndicator(indicator), mEcoreEventHandler(NULL) { #if defined(DALI_PROFILE_MOBILE) -#if defined(WAYLAND) mEcoreEventHandler = ecore_event_handler_add(ECORE_WL_EVENT_INDICATOR_FLICK, EcoreEventIndicator, this); -#else - mEcoreEventHandler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, EcoreEventClientMessage, this); -#endif -#endif // WAYLAND && DALI_PROFILE_MOBILE +#endif // DALI_PROFILE_MOBILE } /** @@ -389,7 +362,7 @@ struct Indicator::Impl static void SetIndicatorVisibility( void* data, int operation ) { - Indicator::Impl* indicatorImpl((Indicator::Impl*)data); + IndicatorEcoreWl::Impl* indicatorImpl((IndicatorEcoreWl::Impl*)data); if ( indicatorImpl == NULL || indicatorImpl->mIndicator == NULL) { @@ -413,8 +386,8 @@ struct Indicator::Impl } } } + #if defined(DALI_PROFILE_MOBILE) -#if defined(WAYLAND) /** * Called when the Ecore indicator event is received. */ @@ -423,36 +396,14 @@ struct Indicator::Impl SetIndicatorVisibility( data, INDICATOR_STAY_WITH_DURATION ); return ECORE_CALLBACK_PASS_ON; } -#else - /** - * Called when the client messages (i.e. quick panel state) are received. - */ - static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event ) - { - Ecore_X_Event_Client_Message* clientMessageEvent((Ecore_X_Event_Client_Message*)event); - - if ( clientMessageEvent != NULL ) - { - if (clientMessageEvent->message_type == ECORE_X_ATOM_E_INDICATOR_FLICK_DONE) - { - SetIndicatorVisibility( data, INDICATOR_STAY_WITH_DURATION ); - } - else if ( clientMessageEvent->message_type == ECORE_X_ATOM_E_MOVE_QUICKPANEL_STATE ) - { - SetIndicatorVisibility( data, INDICATOR_HIDE ); - } - } - return ECORE_CALLBACK_PASS_ON; - } -#endif -#endif // WAYLAND && DALI_PROFILE_MOBILE +#endif // DALI_PROFILE_MOBILE // Data - Indicator* mIndicator; + IndicatorEcoreWl* mIndicator; Ecore_Event_Handler* mEcoreEventHandler; }; -Indicator::LockFile::LockFile(const std::string filename) +IndicatorEcoreWl::LockFile::LockFile(const std::string filename) : mFilename(filename), mErrorThrown(false) { @@ -465,7 +416,7 @@ Indicator::LockFile::LockFile(const std::string filename) } } -Indicator::LockFile::~LockFile() +IndicatorEcoreWl::LockFile::~LockFile() { // Closing file descriptor also unlocks file. if( mFileDescriptor > 0 ) @@ -474,7 +425,7 @@ Indicator::LockFile::~LockFile() } } -bool Indicator::LockFile::Lock() +bool IndicatorEcoreWl::LockFile::Lock() { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -506,7 +457,7 @@ bool Indicator::LockFile::Lock() return locked; } -void Indicator::LockFile::Unlock() +void IndicatorEcoreWl::LockFile::Unlock() { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -526,14 +477,14 @@ void Indicator::LockFile::Unlock() } } -bool Indicator::LockFile::RetrieveAndClearErrorStatus() +bool IndicatorEcoreWl::LockFile::RetrieveAndClearErrorStatus() { bool error = mErrorThrown; mErrorThrown = false; return error; } -Indicator::ScopedLock::ScopedLock(LockFile* lockFile) +IndicatorEcoreWl::ScopedLock::ScopedLock(LockFile* lockFile) : mLockFile(lockFile), mLocked(false) { @@ -543,7 +494,7 @@ Indicator::ScopedLock::ScopedLock(LockFile* lockFile) } } -Indicator::ScopedLock::~ScopedLock() +IndicatorEcoreWl::ScopedLock::~ScopedLock() { if( mLockFile ) { @@ -551,16 +502,13 @@ Indicator::ScopedLock::~ScopedLock() } } -bool Indicator::ScopedLock::IsLocked() +bool IndicatorEcoreWl::ScopedLock::IsLocked() { return mLocked; } -Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) -: mPixmap( 0 ), - mGestureDeltaY( 0.0f ), - mGestureDetected( false ), - mConnection( this ), +IndicatorEcoreWl::IndicatorEcoreWl( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) +: mConnection( this ), mOpacityMode( Dali::Window::OPAQUE ), mState( DISCONNECTED ), mAdaptor(adaptor), @@ -573,7 +521,6 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat mIsShowing( true ), mIsAnimationPlaying( false ), mCurrentSharedFile( 0 ), - mSharedBufferType( BUFFER_TYPE_SHM ), mImpl( NULL ), mBackgroundVisible( false ), mTopMargin( 0 ) @@ -584,7 +531,7 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat // Indicator image handles the touch event including "leave" mIndicatorContentActor.SetLeaveRequired( true ); - mIndicatorContentActor.TouchSignal().Connect( this, &Indicator::OnTouch ); + mIndicatorContentActor.TouchSignal().Connect( this, &IndicatorEcoreWl::OnTouch ); mIndicatorContentActor.SetColor( Color::BLACK ); mIndicatorActor = Dali::Actor::New(); @@ -600,7 +547,7 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat // It can prevent the problem that scrollview gets pan gesture even indicator area is touched, // since it consumes the pan gesture in advance. mPanDetector = Dali::PanGestureDetector::New(); - mPanDetector.DetectedSignal().Connect( this, &Indicator::OnPan ); + mPanDetector.DetectedSignal().Connect( this, &IndicatorEcoreWl::OnPan ); mPanDetector.Attach( mEventActor ); Open( orientation ); @@ -618,7 +565,7 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat mImpl = new Impl(this); } -Indicator::~Indicator() +IndicatorEcoreWl::~IndicatorEcoreWl() { if(mImpl) { @@ -628,23 +575,23 @@ Indicator::~Indicator() if(mEventActor) { - mEventActor.TouchSignal().Disconnect( this, &Indicator::OnTouch ); + mEventActor.TouchSignal().Disconnect( this, &IndicatorEcoreWl::OnTouch ); } Disconnect(); } -void Indicator::SetAdaptor(Adaptor* adaptor) +void IndicatorEcoreWl::SetAdaptor(Adaptor* adaptor) { mAdaptor = adaptor; mIndicatorBuffer->SetAdaptor( adaptor ); } -Dali::Actor Indicator::GetActor() +Dali::Actor IndicatorEcoreWl::GetActor() { return mIndicatorActor; } -void Indicator::Open( Dali::Window::WindowOrientation orientation ) +void IndicatorEcoreWl::Open( Dali::Window::WindowOrientation orientation ) { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -671,7 +618,7 @@ void Indicator::Open( Dali::Window::WindowOrientation orientation ) } } -void Indicator::Close() +void IndicatorEcoreWl::Close() { DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s", STATE_DEBUG_STRING(mState) ); @@ -688,7 +635,7 @@ void Indicator::Close() SetForegroundImage( emptyTexture ); } -void Indicator::SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) +void IndicatorEcoreWl::SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) { mOpacityMode = mode; @@ -726,7 +673,7 @@ void Indicator::SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) UpdateTopMargin(); } -void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate ) +void IndicatorEcoreWl::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate ) { if ( visibleMode != mVisible || forceUpdate ) { @@ -781,12 +728,12 @@ void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool } } -bool Indicator::IsConnected() +bool IndicatorEcoreWl::IsConnected() { return ( mState == CONNECTED ); } -bool Indicator::SendMessage( int messageDomain, int messageId, const void *data, int size ) +bool IndicatorEcoreWl::SendMessage( int messageDomain, int messageId, const void *data, int size ) { if(IsConnected()) { @@ -798,7 +745,7 @@ bool Indicator::SendMessage( int messageDomain, int messageId, const void *data, } } -bool Indicator::OnTouch(Dali::Actor indicator, const Dali::TouchData& touchData) +bool IndicatorEcoreWl::OnTouch(Dali::Actor indicator, const Dali::TouchData& touchData) { if( mServerConnection ) { @@ -863,7 +810,7 @@ bool Indicator::OnTouch(Dali::Actor indicator, const Dali::TouchData& touchData) return false; } -bool Indicator::Connect() +bool IndicatorEcoreWl::Connect() { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -894,18 +841,18 @@ bool Indicator::Connect() return connected; } -void Indicator::StartReconnectionTimer() +void IndicatorEcoreWl::StartReconnectionTimer() { if( ! mReconnectTimer ) { mReconnectTimer = Dali::Timer::New(1000); mConnection.DisconnectAll(); - mReconnectTimer.TickSignal().Connect( mConnection, &Indicator::OnReconnectTimer ); + mReconnectTimer.TickSignal().Connect( mConnection, &IndicatorEcoreWl::OnReconnectTimer ); } mReconnectTimer.Start(); } -bool Indicator::OnReconnectTimer() +bool IndicatorEcoreWl::OnReconnectTimer() { bool retry = false; @@ -920,7 +867,7 @@ bool Indicator::OnReconnectTimer() return retry; } -void Indicator::Disconnect() +void IndicatorEcoreWl::Disconnect() { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -932,7 +879,7 @@ void Indicator::Disconnect() ClearSharedFileInfo(); } -void Indicator::Resize( int width, int height ) +void IndicatorEcoreWl::Resize( int width, int height ) { if( width < 1 ) { @@ -955,7 +902,7 @@ void Indicator::Resize( int width, int height ) } } -void Indicator::SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent ) +void IndicatorEcoreWl::SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent ) { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -986,7 +933,7 @@ void Indicator::SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent ) } } -void Indicator::SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent ) +void IndicatorEcoreWl::SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent ) { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -1018,7 +965,7 @@ void Indicator::SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent ) } } -void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) +void IndicatorEcoreWl::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -1026,11 +973,6 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) // epcEvent->ref_to == sys // epcEvent->response == buffer num - if ( mSharedBufferType != BUFFER_TYPE_SHM ) - { - return ; - } - int n = epcEvent->response; if( n >= 0 && n < SHARED_FILE_NUMBER ) @@ -1056,7 +998,7 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) mSharedFileInfo[n].mSharedFile = SharedFile::New( sharedFilename.c_str(), mSharedFileInfo[n].mImageWidth * mSharedFileInfo[n].mImageWidth * 4, true ); if( mSharedFileInfo[n].mSharedFile != NULL ) { - mSharedFileInfo[n].mLock = new Indicator::LockFile( mSharedFileInfo[n].mLockFileName ); + mSharedFileInfo[n].mLock = new IndicatorEcoreWl::LockFile( mSharedFileInfo[n].mLockFileName ); if( mSharedFileInfo[n].mLock->RetrieveAndClearErrorStatus() ) { DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() ); @@ -1070,29 +1012,7 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) } } -void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent ) -{ - DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); - - // epcEvent->ref == pixmap id - // epcEvent->ref_to == type - // epcEvent->response == buffer num - - if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) ) - { - mSharedBufferType = (BufferType)(epcEvent->ref_to); - - ClearSharedFileInfo(); - - mPixmap = static_cast(epcEvent->ref); - DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "mPixmap [%x]", mPixmap); - - CreateNewPixmapImage(); - UpdateVisibility(); - } -} - -void Indicator::UpdateTopMargin() +void IndicatorEcoreWl::UpdateTopMargin() { int newMargin = (mVisible == Dali::Window::VISIBLE && mOpacityMode == Dali::Window::OPAQUE) ? mImageHeight : 0; if (mTopMargin != newMargin) @@ -1102,7 +1022,7 @@ void Indicator::UpdateTopMargin() } } -void Indicator::UpdateVisibility() +void IndicatorEcoreWl::UpdateVisibility() { if( CheckVisibleState() ) { @@ -1123,34 +1043,24 @@ void Indicator::UpdateVisibility() SetVisible(mVisible, true); } -void Indicator::UpdateImageData( int bufferNumber ) +void IndicatorEcoreWl::UpdateImageData( int bufferNumber ) { DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s mVisible: %s", STATE_DEBUG_STRING(mState), mVisible?"T":"F" ); if( mState == CONNECTED && mVisible ) { - if(mPixmap == 0) - { - // in case of shm indicator (not pixmap), not sure we can skip it when mIsShowing is false - CopyToBuffer( bufferNumber ); - } - else - { - if(mIsShowing) - { - mAdaptor->RequestUpdateOnce(); - } - } + // not sure we can skip it when mIsShowing is false + CopyToBuffer( bufferNumber ); } } -bool Indicator::CopyToBuffer( int bufferNumber ) +bool IndicatorEcoreWl::CopyToBuffer( int bufferNumber ) { bool success = false; if( mSharedFileInfo[bufferNumber].mLock ) { - Indicator::ScopedLock scopedLock(mSharedFileInfo[bufferNumber].mLock); + IndicatorEcoreWl::ScopedLock scopedLock(mSharedFileInfo[bufferNumber].mLock); if( mSharedFileInfo[bufferNumber].mLock->RetrieveAndClearErrorStatus() ) { // Do nothing here. @@ -1171,38 +1081,7 @@ bool Indicator::CopyToBuffer( int bufferNumber ) return success; } -void Indicator::CreateNewPixmapImage() -{ - DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mImageWidth, mImageHeight ); - Dali::NativeImageSourcePtr nativeImageSource = Dali::NativeImageSource::New( mPixmap ); - -#ifdef ENABLE_INDICATOR_IMAGE_SAVING - SaveIndicatorImage( nativeImageSource ); -#endif - - if( nativeImageSource ) - { - Dali::Texture texture = Dali::Texture::New( *nativeImageSource ); - SetForegroundImage( texture ); - mIndicatorContentActor.SetSize( mImageWidth, mImageHeight ); - mIndicatorActor.SetSize( mImageWidth, mImageHeight ); - mEventActor.SetSize( mImageWidth, mImageHeight ); - UpdateTopMargin(); - } - else - { - DALI_LOG_WARNING("### Cannot create indicator image - disconnecting ###\n"); - Disconnect(); - if( mObserver != NULL ) - { - mObserver->IndicatorClosed( this ); - } - // Don't do connection in this callback - strange things happen! - StartReconnectionTimer(); - } -} - -void Indicator::CreateNewImage( int bufferNumber ) +void IndicatorEcoreWl::CreateNewImage( int bufferNumber ) { DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight ); mIndicatorBuffer = new IndicatorBuffer( mAdaptor, mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight, Pixel::BGRA8888 ); @@ -1224,7 +1103,7 @@ void Indicator::CreateNewImage( int bufferNumber ) } } -Dali::Geometry Indicator::CreateBackgroundGeometry() +Dali::Geometry IndicatorEcoreWl::CreateBackgroundGeometry() { switch( mOpacityMode ) { @@ -1335,7 +1214,7 @@ Dali::Geometry Indicator::CreateBackgroundGeometry() return Dali::Geometry(); } -void Indicator::SetForegroundImage( Dali::Texture texture ) +void IndicatorEcoreWl::SetForegroundImage( Dali::Texture texture ) { if( !mForegroundRenderer && texture ) { @@ -1374,7 +1253,7 @@ void Indicator::SetForegroundImage( Dali::Texture texture ) } } -void Indicator::OnIndicatorTypeChanged( Type indicatorType ) +void IndicatorEcoreWl::OnIndicatorTypeChanged( Type indicatorType ) { if( mObserver != NULL ) { @@ -1382,7 +1261,7 @@ void Indicator::OnIndicatorTypeChanged( Type indicatorType ) } } -void Indicator::DataReceived( void* event ) +void IndicatorEcoreWl::DataReceived( void* event ) { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); Ecore_Ipc_Event_Server_Data *epcEvent = static_cast( event ); @@ -1423,12 +1302,6 @@ void Indicator::DataReceived( void* event ) LoadSharedImage( epcEvent ); break; } - case OP_PIXMAP_REF: - { - DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_PIXMAP_REF\n" ); - LoadPixmapImage( epcEvent ); - break; - } case OP_RESIZE: { DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_RESIZE\n" ); @@ -1489,7 +1362,7 @@ void Indicator::DataReceived( void* event ) } } -void Indicator::ConnectionClosed() +void IndicatorEcoreWl::ConnectionClosed() { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); @@ -1502,7 +1375,7 @@ void Indicator::ConnectionClosed() Connect(); } -bool Indicator::CheckVisibleState() +bool IndicatorEcoreWl::CheckVisibleState() { if( mOrientation == Dali::Window::LANDSCAPE || mOrientation == Dali::Window::LANDSCAPE_INVERSE @@ -1515,7 +1388,7 @@ bool Indicator::CheckVisibleState() return true; } -void Indicator::ClearSharedFileInfo() +void IndicatorEcoreWl::ClearSharedFileInfo() { for( int i = 0; i < SHARED_FILE_NUMBER; i++ ) { @@ -1539,12 +1412,12 @@ void Indicator::ClearSharedFileInfo() * HIDE_NOW = 0 * }; */ -void Indicator::ShowIndicator(float duration) +void IndicatorEcoreWl::ShowIndicator(float duration) { if( !mIndicatorAnimation ) { mIndicatorAnimation = Dali::Animation::New(SLIDING_ANIMATION_DURATION); - mIndicatorAnimation.FinishedSignal().Connect(this, &Indicator::OnAnimationFinished); + mIndicatorAnimation.FinishedSignal().Connect(this, &IndicatorEcoreWl::OnAnimationFinished); } if(mIsShowing && !EqualsZero(duration)) @@ -1586,7 +1459,7 @@ void Indicator::ShowIndicator(float duration) if(!mShowTimer) { mShowTimer = Dali::Timer::New(1000 * duration); - mShowTimer.TickSignal().Connect(this, &Indicator::OnShowTimer); + mShowTimer.TickSignal().Connect(this, &IndicatorEcoreWl::OnShowTimer); } mShowTimer.SetInterval(1000* duration); mShowTimer.Start(); @@ -1594,7 +1467,7 @@ void Indicator::ShowIndicator(float duration) if( mVisible == Dali::Window::AUTO ) { // check the stage touch - Dali::Stage::GetCurrent().TouchSignal().Connect( this, &Indicator::OnStageTouch ); + Dali::Stage::GetCurrent().TouchSignal().Connect( this, &IndicatorEcoreWl::OnStageTouch ); } } else @@ -1607,12 +1480,12 @@ void Indicator::ShowIndicator(float duration) if( mVisible == Dali::Window::AUTO ) { // check the stage touch - Dali::Stage::GetCurrent().TouchSignal().Disconnect( this, &Indicator::OnStageTouch ); + Dali::Stage::GetCurrent().TouchSignal().Disconnect( this, &IndicatorEcoreWl::OnStageTouch ); } } } -bool Indicator::OnShowTimer() +bool IndicatorEcoreWl::OnShowTimer() { // after time up, hide indicator ShowIndicator( HIDE_NOW ); @@ -1620,7 +1493,7 @@ bool Indicator::OnShowTimer() return false; } -void Indicator::OnAnimationFinished(Dali::Animation& animation) +void IndicatorEcoreWl::OnAnimationFinished(Dali::Animation& animation) { mIsAnimationPlaying = false; // once animation is finished and indicator is hidden, take it off stage @@ -1630,12 +1503,12 @@ void Indicator::OnAnimationFinished(Dali::Animation& animation) } } -void Indicator::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture ) +void IndicatorEcoreWl::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture ) { // Nothing to do, but we still want to consume pan } -void Indicator::OnStageTouch(const Dali::TouchData& touchData) +void IndicatorEcoreWl::OnStageTouch(const Dali::TouchData& touchData) { // when stage is touched while indicator is showing temporary, hide it if( mIsShowing && ( CheckVisibleState() == false || mVisible == Dali::Window::AUTO ) ) diff --git a/dali/internal/window-system/common/ecore-indicator-impl.h b/dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.h similarity index 88% rename from dali/internal/window-system/common/ecore-indicator-impl.h rename to dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.h index 67fb74d9e..964583ea7 100644 --- a/dali/internal/window-system/common/ecore-indicator-impl.h +++ b/dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_ECORE_INDICATOR_H__ -#define __DALI_INTERNAL_ECORE_INDICATOR_H__ +#ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_INDICATOR_IMPL_ECORE_WL_H +#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_INDICATOR_IMPL_ECORE_WL_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -35,24 +35,18 @@ namespace Dali { -namespace Integration -{ -class Core; -} - namespace Internal { namespace Adaptor { -class Adaptor; -typedef unsigned int PixmapId; +class Adaptor; /** * The Indicator class connects to the indicator server, and gets and draws the indicator * for the given orientation. */ -class Indicator : public ConnectionTracker, public ServerConnection::Observer, public IndicatorInterface +class IndicatorEcoreWl : public ConnectionTracker, public ServerConnection::Observer, public IndicatorInterface { public: @@ -62,17 +56,6 @@ public: CONNECTED }; - /** - * copied from ecore_evas_extn_engine.h - */ - enum BufferType - { - BUFFER_TYPE_SHM = 0, ///< shared memory-based buffer backend - BUFFER_TYPE_DRI2_PIXMAP, ///< dri2 pixmap-based buffer backend - BUFFER_TYPE_EVASGL_PIXMAP, ///< pixmap backend for Evas GL only (DEPRECATED) - BUFFER_TYPE_GL_PIXMAP, ///< double buffered GL pixmap backend - }; - protected: /** * Class to encapsulate lock file @@ -147,16 +130,19 @@ public: // Dali::Internal::Adaptor::IndicicatorInterface /** * @copydoc Dali::Internal::IndicatorInterface::IndicatorInterface */ - Indicator( Adaptor* adaptor, + IndicatorEcoreWl( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ); /** * @copydoc Dali::Internal::IndicatorInterface::~IndicatorInterface */ - virtual ~Indicator(); + virtual ~IndicatorEcoreWl(); + /** + * @copydoc Dali::Internal::IndicatorInterface::SetAdaptor + */ virtual void SetAdaptor(Adaptor* adaptor); /** @@ -283,12 +269,6 @@ private: */ void LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ); - /** - * Load the pixmap indicator image - * @param[in] epcEvent The event containing the image data - */ - void LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent ); - /** * Update top margin of the stage as much as indicator height */ @@ -319,11 +299,6 @@ private: */ void CreateNewImage( int bufferNumber ); - /** - * Create a new pixmap image for the indicator, and set up signal handling for it. - */ - void CreateNewPixmapImage(); - /** * Indicator type has changed. * Inform observer @@ -409,7 +384,6 @@ private: Dali::Shader mBackgroundShader; ///< Shader used for rendering the background IndicatorBufferPtr mIndicatorBuffer; ///< class which handles indicator rendering - PixmapId mPixmap; ///< Pixmap including indicator content Dali::Renderer mForegroundRenderer; ///< Renderer renders the indicator foreground Dali::Renderer mBackgroundRenderer; ///< Renderer renders the indicator background @@ -417,14 +391,12 @@ private: Dali::Actor mIndicatorActor; ///< Handle to topmost indicator actor Dali::Actor mEventActor; ///< Handle to event Dali::PanGestureDetector mPanDetector; ///< Pan detector to find flick gesture for hidden indicator - float mGestureDeltaY; ///< Checking how much panning moved - bool mGestureDetected; ///< Whether find the flick gesture Dali::Timer mReconnectTimer; ///< Reconnection timer - SlotDelegate< Indicator > mConnection; + SlotDelegate< IndicatorEcoreWl > mConnection; Dali::Window::IndicatorBgOpacity mOpacityMode; ///< Opacity enum for background - Indicator::State mState; ///< The connection state + IndicatorEcoreWl::State mState; ///< The connection state Adaptor* mAdaptor; ServerConnection* mServerConnection; @@ -444,8 +416,6 @@ private: int mCurrentSharedFile; ///< Current shared file number SharedFileInfo mSharedFileInfo[SHARED_FILE_NUMBER]; ///< Table to store shared file info - BufferType mSharedBufferType; ///< Shared buffer type which is used to render indicator - struct Impl; ///< Contains Ecore specific information Impl* mImpl; ///< Created on construction and destroyed on destruction. @@ -457,4 +427,4 @@ private: } // Internal } // Dali -#endif +#endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_INDICATOR_IMPL_ECORE_WL_H diff --git a/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.h b/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.h deleted file mode 100644 index 3bf573780..000000000 --- a/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_FACTORY_ECORE_WL_H -#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_FACTORY_ECORE_WL_H - -/* - * Copyright (c) 2018 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -namespace Dali -{ -namespace Internal -{ -namespace Adaptor -{ - -class WindowBaseFactoryEcoreWl : public WindowBaseFactory -{ -public: - std::unique_ptr< Dali::Internal::Adaptor::WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) override; -}; - -} // namespace Adaptor -} // namespace Internal -} // namespace Dali - -#endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_FACTORY_ECORE_WL_H diff --git a/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/window-factory-ecore-wl.cpp similarity index 57% rename from dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.cpp rename to dali/internal/window-system/tizen-wayland/window-factory-ecore-wl.cpp index 484e4fdd6..723570323 100644 --- a/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.cpp +++ b/dali/internal/window-system/tizen-wayland/window-factory-ecore-wl.cpp @@ -16,10 +16,11 @@ */ // CLASS HEADER -#include +#include // INTERNAL HEADERS #include +#include #include namespace Dali @@ -29,16 +30,21 @@ namespace Internal namespace Adaptor { -std::unique_ptr< Dali::Internal::Adaptor::WindowBase > WindowBaseFactoryEcoreWl::CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) +std::unique_ptr< WindowBase > WindowFactoryEcoreWl::CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) { return Utils::MakeUnique< WindowBaseEcoreWl >( window, windowRenderSurface ); } -// this should be created from somewhere -std::unique_ptr< WindowBaseFactory > GetWindowBaseFactory() +std::unique_ptr< IndicatorInterface > WindowFactoryEcoreWl::CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) { - // returns WindowBase factory - return Utils::MakeUnique< WindowBaseFactoryEcoreWl >(); + return Utils::MakeUnique< IndicatorEcoreWl >( adaptor, orientation, observer ); +} + +// this should be created from Window impl +std::unique_ptr< WindowFactory > GetWindowFactory() +{ + // returns Window factory + return Utils::MakeUnique< WindowFactoryEcoreWl >(); } } // namespace Adaptor diff --git a/dali/internal/window-system/common/window-base-factory.h b/dali/internal/window-system/tizen-wayland/window-factory-ecore-wl.h similarity index 54% rename from dali/internal/window-system/common/window-base-factory.h rename to dali/internal/window-system/tizen-wayland/window-factory-ecore-wl.h index 8944f0955..5ec717f43 100644 --- a/dali/internal/window-system/common/window-base-factory.h +++ b/dali/internal/window-system/tizen-wayland/window-factory-ecore-wl.h @@ -1,5 +1,5 @@ -#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_FACTORY_H -#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_FACTORY_H +#ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_FACTORY_ECORE_WL_H +#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_FACTORY_ECORE_WL_H /* * Copyright (c) 2018 Samsung Electronics Co., Ltd. @@ -18,8 +18,7 @@ * */ -// EXTERNAL INCLUDES -#include +#include namespace Dali { @@ -28,24 +27,16 @@ namespace Internal namespace Adaptor { -class WindowBase; -class Window; -class WindowRenderSurface; - -class WindowBaseFactory +class WindowFactoryEcoreWl : public WindowFactory { public: + std::unique_ptr< WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) override; - WindowBaseFactory() = default; - virtual ~WindowBaseFactory() = default; - - virtual std::unique_ptr< Dali::Internal::Adaptor::WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) = 0; + std::unique_ptr< IndicatorInterface > CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) override; }; -extern std::unique_ptr< WindowBaseFactory > GetWindowBaseFactory(); - } // namespace Adaptor } // namespace Internal } // namespace Dali -#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_FACTORY_H +#endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_FACTORY_ECORE_WL_H diff --git a/dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/window-factory-ecore-x.cpp similarity index 61% rename from dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.cpp rename to dali/internal/window-system/ubuntu-x11/window-factory-ecore-x.cpp index 6b59782ea..2a9d086c3 100644 --- a/dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.cpp +++ b/dali/internal/window-system/ubuntu-x11/window-factory-ecore-x.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // INTERNAL HEADERS #include @@ -29,16 +29,21 @@ namespace Internal namespace Adaptor { -std::unique_ptr< Dali::Internal::Adaptor::WindowBase > WindowBaseFactoryEcoreX::CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) +std::unique_ptr< WindowBase > WindowFactoryEcoreX::CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) { return Utils::MakeUnique< WindowBaseEcoreX >( window, windowRenderSurface ); } -// this should be created from somewhere -std::unique_ptr< WindowBaseFactory > GetWindowBaseFactory() +std::unique_ptr< IndicatorInterface > WindowFactoryEcoreX::CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) { - // returns WindowBase factory - return Utils::MakeUnique< WindowBaseFactoryEcoreX >(); + return std::unique_ptr< IndicatorInterface >( nullptr ); +} + +// this should be created from Window impl +std::unique_ptr< WindowFactory > GetWindowFactory() +{ + // returns Window factory + return Utils::MakeUnique< WindowFactoryEcoreX >(); } } // namespace Adaptor diff --git a/dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.h b/dali/internal/window-system/ubuntu-x11/window-factory-ecore-x.h similarity index 70% rename from dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.h rename to dali/internal/window-system/ubuntu-x11/window-factory-ecore-x.h index 83abc2230..744668eb0 100644 --- a/dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.h +++ b/dali/internal/window-system/ubuntu-x11/window-factory-ecore-x.h @@ -18,7 +18,7 @@ * */ -#include +#include namespace Dali { @@ -27,10 +27,12 @@ namespace Internal namespace Adaptor { -class WindowBaseFactoryEcoreX : public WindowBaseFactory +class WindowFactoryEcoreX : public WindowFactory { public: - std::unique_ptr< Dali::Internal::Adaptor::WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) override; + std::unique_ptr< WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) override; + + std::unique_ptr< IndicatorInterface > CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) override; }; } // namespace Adaptor -- 2.34.1