_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)
{