check touchCaptured control inside GetTopmostTouchedWindow
authorminkyu kim <imetjade.kim@samsung.com>
Wed, 10 Apr 2013 11:41:42 +0000 (20:41 +0900)
committerminkyu kim <imetjade.kim@samsung.com>
Wed, 10 Apr 2013 11:41:42 +0000 (20:41 +0900)
Change-Id: I304a6a469f2fc9e13d4279b42741c419d222b766

src/ui/FUi_ControlManager.cpp

index 090bb2e..5148a9a 100644 (file)
@@ -1172,6 +1172,63 @@ _ControlManager::GetTopmostTouchedControl(const Point& point)
        _Control* pControl = null;
        _Window* pTopWindow = null;
 
+       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+       SysTryReturn(NID_UI, pTouchManager, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+       _Control* pCapturedControl = pTouchManager->GetCapturedControl();
+
+       if (pCapturedControl)
+       {
+               if (pTouchManager->IsCaptureAllowedOwnerBounds())
+               {
+                       if (pTouchManager->IsCaptureAllowedOutOfBounds())
+                       {
+                               pControl = pCapturedControl;
+                       }
+
+                       _Window * pWindow = dynamic_cast<_Window*>(pCapturedControl);
+                       if (pWindow)
+                       {
+                               _Control* pOwner = pWindow->GetOwner();
+                               if (pOwner)
+                               {
+                                       Tizen::Graphics::Rectangle ownerRc(pOwner->GetAbsoluteBounds());
+                                       if ((point.x >= ownerRc.x) && (point.x <= (ownerRc.x + ownerRc.width)) && (point.y >= ownerRc.y) && (point.y <= (ownerRc.y + ownerRc.height)))
+                                       {
+                                               pControl = pOwner;
+                                       }
+                               }
+                       }
+
+                       Tizen::Graphics::Rectangle rc(pCapturedControl->GetAbsoluteBounds());
+                       if ((point.x >= rc.x) && (point.x <= (rc.x + rc.width)) && (point.y >= rc.y) && (point.y <= (rc.y + rc.height)))
+                       {
+                               pControl = pCapturedControl;
+                       }
+               }
+               else
+               {
+                       if (pTouchManager->IsCaptureAllowedOutOfBounds())
+                       {
+                               pControl = pCapturedControl;
+                       }
+                       else
+                       {
+                               Tizen::Graphics::Rectangle rc(pCapturedControl->GetAbsoluteBounds());
+
+                               if ((point.x < rc.x) || (point.x > (rc.x + rc.width)) || (point.y < rc.y) || (point.y > (rc.y + rc.height)))
+                               {
+                                       pControl = pCapturedControl;
+                               }
+                       }
+               }
+
+               if (pControl != null)
+               {
+                       return pControl;
+               }
+       }
+
        int count = GetWindowCount();
        if (count != 0)
        {