/********************************************************************* * * _OnChildHasFocus */ static void _OnChildHasFocus(WM_HWIN hWin, WINDOW_OBJ* pObj, const WM_MESSAGE* pMsg) { if (pMsg->Data.p) { const WM_NOTIFY_CHILD_HAS_FOCUS_INFO * pInfo = (const WM_NOTIFY_CHILD_HAS_FOCUS_INFO *)pMsg->Data.p; int IsDesc = WM__IsAncestorOrSelf(pInfo->hNew, hWin); if (!IsDesc) { /* A child has received the focus, Framewindow needs to be activated */ /* Remember the child which had the focus so we can reactive this child */ if (WM__IsAncestor(pInfo->hOld, hWin)) { pObj->hFocussedChild = pInfo->hOld; } } } }
/********************************************************************* * * WM__IsAncestor * * Return value: * if hChild is indeed a descendent (Child or child of child etc.) : 1 * Else: 0 * * */ int WM__IsAncestorOrSelf(WM_HWIN hChild, WM_HWIN hParent) { if (hChild == hParent) { return 1; } return WM__IsAncestor(hChild, hParent); }