From 8ee8dc0820ccf5c5a4f49eb44c2a9fd098960fad Mon Sep 17 00:00:00 2001 From: choimunseok Date: Mon, 10 Feb 2014 21:10:03 +0900 Subject: [PATCH] Fixed to resume a background app with task switcher Change-Id: Id4362c09a72b73e88fab60dad358d66e60aee3cf Signed-off-by: choimunseok --- src/ui/FUi_Window.cpp | 2 +- src/ui/animations/FUiAnim_NativeLayer.cpp | 32 +++++----- src/ui/animations/FUiAnim_NativeWindow.h | 4 +- .../animations/platform/FUiAnim_NativeWindow.cpp | 11 +++- src/ui/animations/platform/FUiAnim_X11Window.cpp | 15 +++-- src/ui/controls/FUiCtrl_Frame.cpp | 74 ++++++++++++++++++++++ src/ui/inc/FUiAnim_NativeLayer.h | 7 +- src/ui/inc/FUiCtrl_Frame.h | 1 + 8 files changed, 120 insertions(+), 26 deletions(-) diff --git a/src/ui/FUi_Window.cpp b/src/ui/FUi_Window.cpp index 90b1769..f706c4e 100644 --- a/src/ui/FUi_Window.cpp +++ b/src/ui/FUi_Window.cpp @@ -417,7 +417,7 @@ _Window::CreateLayer(void) else #endif { - __pLayer = _NativeLayer::CreateInstanceN(); + __pLayer = _NativeLayer::CreateInstanceN(true); SysAssert(__pLayer); _GlLayer* pLayer = static_cast<_GlLayer*>(__pLayer); diff --git a/src/ui/animations/FUiAnim_NativeLayer.cpp b/src/ui/animations/FUiAnim_NativeLayer.cpp index 39a963e..4b5561e 100644 --- a/src/ui/animations/FUiAnim_NativeLayer.cpp +++ b/src/ui/animations/FUiAnim_NativeLayer.cpp @@ -63,6 +63,7 @@ _NativeLayer::_NativeLayer(void) , _bounds(0.0f, 0.0f, 0.0f, 0.0f) , _pDisplayContext(null) , __needFlush(false) + , __isTransparent(false) // , __needUpdateRenderObjects(false) // , __didSyncPresentation(false) , __type(_LAYER_TYPE_GL) @@ -121,36 +122,37 @@ _NativeLayer::~_NativeLayer(void) } _NativeLayer* -_NativeLayer::CreateInstanceN(void) +_NativeLayer::CreateInstanceN(bool isTransparent) { _GlLayer* pLayer = new (std::nothrow) _GlLayer(); if (pLayer) { - pLayer->Construct(); + pLayer->Construct(isTransparent); } return pLayer; } #if defined (ENABLE_VE_EFL) -_NativeLayer* -_NativeLayer::CreateInstanceN(bool isMainType) -{ - _EflLayer* pLayer = new (std::nothrow) _EflLayer(isMainType); - - if (pLayer) - { - pLayer->Construct(null); - } - return pLayer; -} +//_NativeLayer* +//_NativeLayer::CreateInstanceN(bool isMainType) +//{ +// _EflLayer* pLayer = new (std::nothrow) _EflLayer(isMainType); +// +// if (pLayer) +// { +// pLayer->Construct(null); +// } +// return pLayer; +//} #endif result -_NativeLayer::Construct(void) +_NativeLayer::Construct(bool isTransparent) { FloatRectangle bounds(0.0f ,0.0f ,10.0f ,10.0f); - _NativeWindow* pWindow = _NativeWindow::CreateNativeWindow(null, bounds, null, 0); + __isTransparent = isTransparent; + _NativeWindow* pWindow = _NativeWindow::CreateNativeWindow(null, bounds, null, 0, __isTransparent); _isWindowOwner = true; return Construct(pWindow); diff --git a/src/ui/animations/FUiAnim_NativeWindow.h b/src/ui/animations/FUiAnim_NativeWindow.h index b26177a..6ee6945 100644 --- a/src/ui/animations/FUiAnim_NativeWindow.h +++ b/src/ui/animations/FUiAnim_NativeWindow.h @@ -40,7 +40,7 @@ namespace Tizen { namespace Ui { namespace Animations { class _NativeWindow { public: - static _NativeWindow* CreateNativeWindow(const _NativeWindow* pParent, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Base::String* pExtension, Handle handle); + static _NativeWindow* CreateNativeWindow(const _NativeWindow* pParent, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Base::String* pExtension, Handle handle, bool isTransparent); static result DestroyNativeWindow(_NativeWindow* pWindow); Handle GetDisplay(void); @@ -50,6 +50,7 @@ public: bool GetShowState(void) const; result SetOpacity(float opacity); float GetOpacity(void) const; + result SetTransparent(bool value); bool IsMapped(void) const {return __isMapped;} Handle GetHandle(void) const; @@ -78,6 +79,7 @@ protected: bool __showState; float __opacity; bool __isMapped; + bool __isTransparent; }; diff --git a/src/ui/animations/platform/FUiAnim_NativeWindow.cpp b/src/ui/animations/platform/FUiAnim_NativeWindow.cpp index 86da9e6..d170148 100644 --- a/src/ui/animations/platform/FUiAnim_NativeWindow.cpp +++ b/src/ui/animations/platform/FUiAnim_NativeWindow.cpp @@ -22,7 +22,7 @@ using namespace Tizen::Ui; namespace Tizen { namespace Ui { namespace Animations { _NativeWindow* -_NativeWindow::CreateNativeWindow(const _NativeWindow* pParent, const FloatRectangle& bounds, const String* pExtension, Handle handle) +_NativeWindow::CreateNativeWindow(const _NativeWindow* pParent, const FloatRectangle& bounds, const String* pExtension, Handle handle, bool isTransparent) { _NativeWindow* pWindow = null; @@ -49,6 +49,7 @@ _NativeWindow::CreateNativeWindow(const _NativeWindow* pParent, const FloatRecta else { pWindow = new (std::nothrow) _EcoreXWindow; + pWindow->SetTransparent(isTransparent); pWindow->SetBounds(bounds); pWindow->Construct(); } @@ -107,6 +108,7 @@ _NativeWindow::_NativeWindow() , __showState(false) , __opacity(0) , __isMapped(false) + , __isTransparent(false) { } @@ -191,6 +193,13 @@ _NativeWindow::GetOpacity() const return __opacity; } +result +_NativeWindow::SetTransparent(bool value) +{ + __isTransparent = value; + return E_SUCCESS; +} + Handle _NativeWindow::GetHandle() const { diff --git a/src/ui/animations/platform/FUiAnim_X11Window.cpp b/src/ui/animations/platform/FUiAnim_X11Window.cpp index 1051d60..b814f05 100644 --- a/src/ui/animations/platform/FUiAnim_X11Window.cpp +++ b/src/ui/animations/platform/FUiAnim_X11Window.cpp @@ -37,11 +37,16 @@ _X11Window::~_X11Window() Handle _X11Window::OnConstructing() { -//#ifndef BUILD_UI_CORE - Handle window = XCreateArgbWindow(null, __bounds.x, __bounds.y, __bounds.width, __bounds.height, true); -//#else -// Handle window = XCreateWindow(null, __bounds.x, __bounds.y, __bounds.width, __bounds.height, true); -//#endif + Handle window = None; + if (__isTransparent == true) + { + window = XCreateArgbWindow(null, __bounds.x, __bounds.y, __bounds.width, __bounds.height, true); + } + else + { + window = XCreateWindow(null, __bounds.x, __bounds.y, __bounds.width, __bounds.height, true); + } + if (window == None) { return (Handle)0; diff --git a/src/ui/controls/FUiCtrl_Frame.cpp b/src/ui/controls/FUiCtrl_Frame.cpp index 4922a13..99ad1ba 100644 --- a/src/ui/controls/FUiCtrl_Frame.cpp +++ b/src/ui/controls/FUiCtrl_Frame.cpp @@ -48,6 +48,8 @@ #include "FUiAnim_EflLayer.h" #endif #include "FUi_AccessibilityManager.h" +#include "FUiAnim_DisplayManager.h" +#include "FUiAnim_GlLayer.h" using namespace Tizen::App; using namespace Tizen::Ui::Animations; @@ -906,6 +908,78 @@ _Frame::SetChangingBoundsEnabled(bool enable) __changingBoundsEnabled = enable; } +result +_Frame::CreateLayer(void) +{ + _DisplayManager* pDisplayManager = _DisplayManager::GetInstance(); + SysAssert(pDisplayManager); + +#if 0 +//#ifdef ENABLE_VE_EFL + if (__type == _WINDOW_TYPE_EFL) + { + __pLayer = _NativeLayer::CreateInstanceN(true); + + SysAssert(__pLayer); + + _EflLayer* pLayer = static_cast<_EflLayer*>(__pLayer); + SysAssert(pLayer); + + int rootWindowW = 0; + int rootWindowH = 0; + ecore_x_window_size_get(ecore_x_window_root_get((Ecore_X_Window)ecore_evas_window_get(pLayer->GetEcoreEvas())), &rootWindowW, &rootWindowH); + + if (IsOrientationRoot()) + { + pLayer->SetSize(FloatDimension((float)rootWindowW, (float)rootWindowH)); + } + else + { + pLayer->SetBounds(FloatRectangle(0.0f, 0.0f, (float)rootWindowW, (float)rootWindowH)); + } + + pLayer->SetOpacity(0); + + __pRootVisualElement = __pLayer->GetRootVisualElement(); + __pRootVisualElement->SetName(L"Root"); + + _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); + if (pEcoreEvas) + { + String osp(L"OSP_"); + String appName = _AppInfo::GetAppName(); + osp.Append(appName); + + pEcoreEvas->SetWindowName(*this, osp); + } + + } + else +#endif + { + _NativeLayer* pLayer = _NativeLayer::CreateInstanceN(false); + SysAssert(pLayer); + + _GlLayer* pGlLayer = static_cast<_GlLayer*>(pLayer); + SysAssert(pGlLayer); + + int rootWindowW = 720; + int rootWindowH = 1280; + + pGlLayer->SetBounds(FloatRectangle(0.0f, 0.0f, (float)rootWindowW, (float)rootWindowH)); + pGlLayer->SetOpacity(0); + + _RootVisualElement* pRootVE = pLayer->GetRootVisualElement(); + pRootVE->SetName(L"Root"); + + SetRootVisualElement(*pRootVE); + SetLayer(*pLayer); + } + //need to add sub type? + + return E_SUCCESS; +} + Tizen::Base::Collection::IListT<_Control*>* _Frame::GetFocusList(void) const { diff --git a/src/ui/inc/FUiAnim_NativeLayer.h b/src/ui/inc/FUiAnim_NativeLayer.h index e1c8142..b924726 100644 --- a/src/ui/inc/FUiAnim_NativeLayer.h +++ b/src/ui/inc/FUiAnim_NativeLayer.h @@ -63,7 +63,7 @@ public: * @return instance of the native layer. * @remarks This method make a instance of native layer by configuration.And call the Construct() method. */ - static _NativeLayer* CreateInstanceN(void); + static _NativeLayer* CreateInstanceN(bool isTransparent = false); #if defined (ENABLE_VE_EFL) /** @@ -73,7 +73,7 @@ public: * @return instance of the native layer. * @remarks This method make a instance of native layer by configuration.And call the Construct() method. */ - static _NativeLayer* CreateInstanceN(bool isMainType); +// static _NativeLayer* CreateInstanceN(bool isMainType); #endif public: @@ -85,7 +85,7 @@ public: * * @see OnConstructed() */ - result Construct(void); + result Construct(bool isTransparent); result Construct(_NativeWindow* pNativeWindow); @@ -284,6 +284,7 @@ protected: private: unsigned long __id; bool __needFlush; + bool __isTransparent; // bool __needUpdateRenderObjects; // bool __didSyncPresentation; diff --git a/src/ui/inc/FUiCtrl_Frame.h b/src/ui/inc/FUiCtrl_Frame.h index e1f1784..419717e 100644 --- a/src/ui/inc/FUiCtrl_Frame.h +++ b/src/ui/inc/FUiCtrl_Frame.h @@ -98,6 +98,7 @@ public: // Internal void SetChangingBoundsEnabled(bool enable); + virtual result CreateLayer(void); protected: result SetPresenter(const _FramePresenter& framePresenter); -- 2.7.4