From: Joogab Yun Date: Fri, 27 Dec 2019 09:18:02 +0000 (+0900) Subject: Revert "Apply multi Instance for widget" X-Git-Tag: accepted/tizen/5.5/unified/20200102.013926~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dca9bd8f79e50b4fc20f37fdb8945a53d6dc77b3;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Revert "Apply multi Instance for widget" This reverts commit 947dcbb602f1e15b8ca06db9c480228ba9bfed4d. --- diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 872eb7e..1fc3f4e 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -1061,14 +1061,6 @@ void Adaptor::UnregisterProcessor( Integration::Processor& processor ) GetCore().UnregisterProcessor(processor); } -bool Adaptor::IsMultipleWindowSupported() const -{ - auto eglGraphics = static_cast( mGraphics ); - EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); - bool ret = eglImpl.IsSurfacelessContextSupported(); - return ret; -} - void Adaptor::RequestUpdateOnce() { if( mThreadController ) diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index fd39a3a..c151865 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -438,11 +438,6 @@ public: */ void UnregisterProcessor( Integration::Processor& processor ); - /** - * Check MultipleWindow is supported - */ - bool IsMultipleWindowSupported() const; - public: //AdaptorInternalServices /** diff --git a/dali/internal/system/tizen-wayland/widget-application-impl-tizen.cpp b/dali/internal/system/tizen-wayland/widget-application-impl-tizen.cpp index ff22534..9393dd8 100644 --- a/dali/internal/system/tizen-wayland/widget-application-impl-tizen.cpp +++ b/dali/internal/system/tizen-wayland/widget-application-impl-tizen.cpp @@ -47,26 +47,8 @@ int OnInstanceInit(widget_base_instance_h instanceHandle, bundle *content, int w Dali::Internal::Adaptor::WidgetApplicationTizen* application = static_cast(classData); - Dali::Window window; - if( application->GetWidgetCount() == 0) - { - window = application->GetWindow(); - DALI_LOG_RELEASE_INFO("Widget Instance use default Window(win:%p), so it need to bind widget (%dx%d) (id:%s) \n",window, w, h, std::string(id).c_str()); - } - else - { - window = Dali::Window::New(PositionSize(0,0,w,h) ,"", false); - if( window ) - { - DALI_LOG_RELEASE_INFO("Widget Instance create new Window (win:%p, cnt:%d) (%dx%d) (id:%s )\n", window, application->GetWidgetCount(), w, h, std::string(id).c_str()); - } - else - { - DALI_LOG_ERROR("This device can't support Multi Widget. it means UI may not be properly drawn."); - window = application->GetWindow(); - } - } - + // After DALi can support multi window, this part should be changed. + Dali::Window window = application->GetWindow(); Any nativeHandle = window.GetNativeHandle(); #ifdef ECORE_WAYLAND2 @@ -82,7 +64,7 @@ int OnInstanceInit(widget_base_instance_h instanceHandle, bundle *content, int w Dali::WidgetApplication::CreateWidgetFunction createFunction = pair.second; Dali::Widget widgetInstance = createFunction( pair.first ); - application->AddWidget( instanceHandle, widgetInstance , window ); + application->AddWidget( instanceHandle, widgetInstance ); Dali::Internal::Adaptor::Widget::Impl *widgetImpl = new Dali::Internal::Adaptor::WidgetImplTizen(instanceHandle); Internal::Adaptor::GetImplementation(widgetInstance).SetImpl( widgetImpl ); @@ -175,7 +157,8 @@ int OnInstanceResize(widget_base_instance_h instanceHandle, int w, int h, void * // Get Dali::Widget instance. Dali::Widget widgetInstance = application->GetWidget( instanceHandle ); - Dali::Window window = application->GetWindowFromWidget( instanceHandle ); + + Dali::Window window = application->GetWindow(); window.SetSize( Dali::Window::WindowSize(w, h) ); Internal::Adaptor::GetImplementation(widgetInstance).OnResize(window); @@ -261,11 +244,9 @@ void WidgetApplicationTizen::AddWidgetCreatingFunctionPair( CreateWidgetFunction WidgetApplicationTizen::CreateWidgetFunctionPair WidgetApplicationTizen::GetWidgetCreatingFunctionPair( const std::string& widgetName ) { - int idx = widgetName.find(":"); - std::string widgetID = widgetName.substr( idx + 1 ); for( CreateWidgetFunctionContainer::const_iterator iter = mCreateWidgetFunctionContainer.begin(); iter != mCreateWidgetFunctionContainer.end(); ++iter ) { - if( widgetID.compare((*iter).first) == 0) + if( widgetName.find((*iter).first) != std::string::npos ) { return *iter; } @@ -274,19 +255,18 @@ WidgetApplicationTizen::CreateWidgetFunctionPair WidgetApplicationTizen::GetWidg return CreateWidgetFunctionPair( "", NULL ); } -void WidgetApplicationTizen::AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget , Dali::Window window ) +void WidgetApplicationTizen::AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget ) { mWidgetInstanceContainer.push_back( WidgetInstancePair(widgetBaseInstance, widget) ); - mWindowInstanceContainer.push_back( WindowInstancePair(widgetBaseInstance, window) ); } -Dali::Widget WidgetApplicationTizen::GetWidget( widget_base_instance_h widgetBaseInstance ) const +Dali::Widget WidgetApplicationTizen::GetWidget( widget_base_instance_h widgetBaseInstance ) { - for( auto&& iter : mWidgetInstanceContainer ) + for( WidgetInstanceContainer::const_iterator iter = mWidgetInstanceContainer.begin(); iter != mWidgetInstanceContainer.end(); ++iter ) { - if( (iter).first == widgetBaseInstance ) + if( (*iter).first == widgetBaseInstance ) { - return (iter).second; + return (*iter).second; } } return Dali::Widget(); @@ -294,45 +274,14 @@ Dali::Widget WidgetApplicationTizen::GetWidget( widget_base_instance_h widgetBas void WidgetApplicationTizen::DeleteWidget( widget_base_instance_h widgetBaseInstance ) { - // Delete WidgetInstance - auto widgetInstance = std::find_if( mWidgetInstanceContainer.begin(), - mWidgetInstanceContainer.end(), - [widgetBaseInstance]( WidgetInstancePair pair ) - { return (pair.first == widgetBaseInstance); } ); - - if(widgetInstance != mWidgetInstanceContainer.end()) + for( WidgetInstanceContainer::const_iterator iter = mWidgetInstanceContainer.begin(); iter != mWidgetInstanceContainer.end(); ++iter ) { - mWidgetInstanceContainer.erase(widgetInstance); - } - - // Delete WindowInstance - auto windowInstance = std::find_if( mWindowInstanceContainer.begin(), - mWindowInstanceContainer.end(), - [widgetBaseInstance]( WindowInstancePair pair ) - { return (pair.first == widgetBaseInstance); } ); - - if(windowInstance != mWindowInstanceContainer.end()) - { - mWindowInstanceContainer.erase(windowInstance); - } -} - -Dali::Window WidgetApplicationTizen::GetWindowFromWidget( widget_base_instance_h widgetBaseInstance ) const -{ - for( auto&& iter : mWindowInstanceContainer ) - { - if( (iter).first == widgetBaseInstance ) + if( (*iter).first == widgetBaseInstance ) { - Dali::Window ret = (iter).second; - return ret; + mWidgetInstanceContainer.erase(iter); + break; } } - return Dali::Window(); -} - -int WidgetApplicationTizen::GetWidgetCount() -{ - return mWidgetInstanceContainer.size(); } void WidgetApplicationTizen::OnInit() diff --git a/dali/internal/system/tizen-wayland/widget-application-impl-tizen.h b/dali/internal/system/tizen-wayland/widget-application-impl-tizen.h index b7b12a8..9e94388 100644 --- a/dali/internal/system/tizen-wayland/widget-application-impl-tizen.h +++ b/dali/internal/system/tizen-wayland/widget-application-impl-tizen.h @@ -24,7 +24,6 @@ // INTERNAL INCLUDES #include #include -#include namespace Dali { @@ -81,28 +80,18 @@ public: /** * Add widget_base_instance_h - Widget instance pair to container. */ - void AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget , Dali::Window window ); + void AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget ); /** * Find and get Widget instance in container by widget_base_instance_h. */ - Dali::Widget GetWidget( widget_base_instance_h widgetBaseInstance ) const; + Dali::Widget GetWidget( widget_base_instance_h widgetBaseInstance ); /** * Delete widget_base_instance_h - Widget instance pair in container. */ void DeleteWidget( widget_base_instance_h widgetBaseInstance ); - /** - * Find and get Window instance in container by widget_base_instance_h. - */ - Dali::Window GetWindowFromWidget( widget_base_instance_h widgetBaseInstance ) const; - - /** - * Get the number of created widget. - */ - int32_t GetWidgetCount(); - protected: /** @@ -129,9 +118,6 @@ private: CreateWidgetFunctionContainer mCreateWidgetFunctionContainer; WidgetInstanceContainer mWidgetInstanceContainer; - typedef std::pair< widget_base_instance_h, Dali::Window > WindowInstancePair; - typedef std::vector< WindowInstancePair > WindowInstanceContainer; - WindowInstanceContainer mWindowInstanceContainer; }; } // namespace Adaptor diff --git a/dali/public-api/adaptor-framework/widget-impl.cpp b/dali/public-api/adaptor-framework/widget-impl.cpp index 7d67815..7bf34c6 100644 --- a/dali/public-api/adaptor-framework/widget-impl.cpp +++ b/dali/public-api/adaptor-framework/widget-impl.cpp @@ -19,6 +19,7 @@ #include "widget-impl.h" // INTERNAL INCLUDES +#include #include namespace Dali diff --git a/dali/public-api/adaptor-framework/widget-impl.h b/dali/public-api/adaptor-framework/widget-impl.h index 75b61da..c30ddc6 100644 --- a/dali/public-api/adaptor-framework/widget-impl.h +++ b/dali/public-api/adaptor-framework/widget-impl.h @@ -24,10 +24,10 @@ // INTERNAL INCLUDES #include -#include namespace Dali { +class Window; /** * @addtogroup dali_adaptor_framework diff --git a/dali/public-api/adaptor-framework/widget.h b/dali/public-api/adaptor-framework/widget.h index 9332298..a0f6991 100755 --- a/dali/public-api/adaptor-framework/widget.h +++ b/dali/public-api/adaptor-framework/widget.h @@ -42,6 +42,7 @@ class Widget; } +class Window; /** * @brief Widget class is the base class for custom widget. diff --git a/dali/public-api/adaptor-framework/window.cpp b/dali/public-api/adaptor-framework/window.cpp index 08562d0..2edfae3 100644 --- a/dali/public-api/adaptor-framework/window.cpp +++ b/dali/public-api/adaptor-framework/window.cpp @@ -36,18 +36,10 @@ Window Window::New(PositionSize posSize, const std::string& name, bool isTranspa Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent); Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get(); - if( Internal::Adaptor::Adaptor::GetImplementation( adaptor ).IsMultipleWindowSupported() ) - { - Integration::SceneHolder sceneHolder = Integration::SceneHolder( window ); - Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, "", isTransparent ); + Integration::SceneHolder sceneHolder = Integration::SceneHolder( window ); + Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, "", isTransparent ); - return Window(window); - } - else - { - DALI_LOG_ERROR("This device can't support multiple windows.\n"); - return Window(); - } + return Window(window); } Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent) @@ -55,18 +47,10 @@ Window Window::New(PositionSize posSize, const std::string& name, const std::str Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent); Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get(); - if( Internal::Adaptor::Adaptor::GetImplementation( adaptor ).IsMultipleWindowSupported() ) - { - Integration::SceneHolder sceneHolder = Integration::SceneHolder( window ); - Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, className, isTransparent ); - - return Window(window); - } - else - { - DALI_LOG_ERROR("This device can't support multiple windows.\n"); - return Window(); - } + Integration::SceneHolder sceneHolder = Integration::SceneHolder( window ); + Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, className, isTransparent ); + + return Window(window); } Window::Window()