Heap Alloc of the keyEventInfo, Modify TouchEvent GetTarget sequence
authorminkyu kim <imetjade.kim@samsung.com>
Mon, 15 Jul 2013 09:50:24 +0000 (18:50 +0900)
committerminkyu kim <imetjade.kim@samsung.com>
Mon, 15 Jul 2013 09:50:24 +0000 (18:50 +0900)
Change-Id: I5371c81a5d77fa8bd158a0925cc4f085eeb6babc

src/ui/FUi_ControlImpl.cpp
src/ui/FUi_EflUiEventManager.cpp

index 98dcf76..2a38813 100644 (file)
@@ -1820,7 +1820,7 @@ public:
        , __public(impl.GetPublic())
        , __pTimer(null)
        , __isKeyPressed(false)
-       , __pKeyInfo(null)
+       , __keyInfo(KEY_PRESSED, _KEY_INVALID, 0, null)
        {
        }
 
@@ -1841,7 +1841,7 @@ public:
                {
                        SysTryReturnVoidResult(NID_UI, __impl.__pCoreKeyEvent, E_SYSTEM, "[E_SYSTEM] System error occurred.");
 
-                       __impl.__pCoreKeyEvent->ProcessListener(KEY_LONGPRESSED, __pKeyInfo->GetKeyCode());
+                       __impl.__pCoreKeyEvent->ProcessListener(KEY_LONGPRESSED, __keyInfo.GetKeyCode());
                }
        }
 
@@ -1940,7 +1940,7 @@ public:
                                if (r == E_SUCCESS)
                                {
                                        __isKeyPressed = true;
-                                       __pKeyInfo = const_cast<_KeyInfo*>(&keyInfo);
+                                       __keyInfo = keyInfo;
                                }
                        }
 
@@ -2010,7 +2010,6 @@ public:
                if (&source == &__core)
                {
                        __isKeyPressed = false;
-                       __pKeyInfo = null;
 
                        if (__pTimer != null)
                        {
@@ -2142,7 +2141,7 @@ private:
 
        Tizen::Base::Runtime::Timer* __pTimer;
        bool __isKeyPressed;
-       _KeyInfo* __pKeyInfo;
+       _KeyInfo __keyInfo;
 };
 
 Rectangle
index b0695dc..5814238 100644 (file)
@@ -687,6 +687,38 @@ private:
                _Control* pCapturedControl = pTouchManager->GetCapturedControl();
                _Control* pControl = null;
 
+               _ControlManager* pControlManager = _ControlManager::GetInstance();
+               SysTryReturn(NID_UI, pControlManager, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+               Tizen::Graphics::FloatPoint ptf(static_cast<float>(x), static_cast<float>(y));
+
+               _ControlVisualElement* pRootControlElement = null;
+               if (pRootControl)
+               {
+                       pRootControlElement = dynamic_cast<_ControlVisualElement*>(pRootControl->GetVisualElement());
+               }
+               else
+               {
+                       _Window* pWindow = null;
+                       pWindow = pControlManager->GetTouchedWindow();
+                       SysTryReturn(NID_UI, pWindow, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+                       Rectangle winBounds = pWindow->GetBounds();
+
+                       ptf.x = static_cast<float>(x - winBounds.x);
+                       ptf.y = static_cast<float>(y - winBounds.y);
+
+                       pRootControlElement = dynamic_cast <_ControlVisualElement*>(pWindow->GetVisualElement());
+               }
+
+               SysTryReturn(NID_UI, pRootControlElement, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+               _ControlVisualElement* pControlVisualElement = pRootControlElement->GetControlChildAtPoint(ptf);
+               SysTryReturn(NID_UI, pControlVisualElement, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+               pControl = static_cast <_Control*>(pControlVisualElement->GetUserData());
+               SysTryReturn(NID_UI, pControl, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
                if (pCapturedControl)
                {
                        if (pTouchManager->IsCaptureAllowedOwnerBounds())
@@ -739,38 +771,6 @@ private:
                        }
                }
 
-               _ControlManager* pControlManager = _ControlManager::GetInstance();
-               SysTryReturn(NID_UI, pControlManager, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
-
-               Tizen::Graphics::FloatPoint ptf(static_cast<float>(x), static_cast<float>(y));
-
-               _ControlVisualElement* pRootControlElement = null;
-               if (pRootControl)
-               {
-                       pRootControlElement = dynamic_cast<_ControlVisualElement*>(pRootControl->GetVisualElement());
-               }
-               else
-               {
-                       _Window* pWindow = null;
-                       pWindow = pControlManager->GetTouchedWindow();
-                       SysTryReturn(NID_UI, pWindow, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
-
-                       Rectangle winBounds = pWindow->GetBounds();
-
-                       ptf.x = static_cast<float>(x - winBounds.x);
-                       ptf.y = static_cast<float>(y - winBounds.y);
-
-                       pRootControlElement = dynamic_cast <_ControlVisualElement*>(pWindow->GetVisualElement());
-               }
-
-               SysTryReturn(NID_UI, pRootControlElement, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
-
-               _ControlVisualElement* pControlVisualElement = pRootControlElement->GetControlChildAtPoint(ptf);
-               SysTryReturn(NID_UI, pControlVisualElement, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
-
-               pControl = static_cast <_Control*>(pControlVisualElement->GetUserData());
-               SysTryReturn(NID_UI, pControl, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
-
                return pControl;
        }