From 84dd1dc772ca608d92db9ae32aba83493d02b4ad Mon Sep 17 00:00:00 2001 From: "keonpyo.kong" Date: Thu, 4 Jul 2013 13:34:39 +0900 Subject: [PATCH] Defect fix GetFocusedControl Change-Id: I717b978fac5aaf6992697e723eb9f358fb904d23 Signed-off-by: keonpyo.kong apply code review Change-Id: Ib1d6c22570c493eadc112e7f92b77cf4ae0ede68 Signed-off-by: keonpyo.kong --- src/ui/FUi_FocusManagerImpl.cpp | 9 +++++++++ src/ui/controls/FUiCtrl_Frame.cpp | 36 ++++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/ui/FUi_FocusManagerImpl.cpp b/src/ui/FUi_FocusManagerImpl.cpp index a75b0e7..9bf749c 100644 --- a/src/ui/FUi_FocusManagerImpl.cpp +++ b/src/ui/FUi_FocusManagerImpl.cpp @@ -21,6 +21,7 @@ * */ +#include #include #include "FUi_FocusManagerImpl.h" #include "FUi_ControlImpl.h" @@ -406,6 +407,14 @@ _FocusManagerImpl::StartFocusTraversal(_Control* pControl, FocusDirection focusD bool _FocusManagerImpl::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) { + Ecore_X_Window rootWindow = ecore_x_window_root_first_get(); + Ecore_X_Atom keyboardExist = ecore_x_atom_get("X External Keyboard Exist"); + unsigned int keyboardNumber = 0; + int ret = ecore_x_window_prop_card32_get(rootWindow, keyboardExist, &keyboardNumber, 1); + if (keyboardNumber == 0) + { + return false; + } _KeyCode keyCode = keyInfo.GetKeyCode(); FocusDirection focusDirection = FOCUS_DIRECTION_DOWNWARD; _Control* pControl = const_cast<_Control*> (&source); diff --git a/src/ui/controls/FUiCtrl_Frame.cpp b/src/ui/controls/FUiCtrl_Frame.cpp index af15a84..6cc5b56 100644 --- a/src/ui/controls/FUiCtrl_Frame.cpp +++ b/src/ui/controls/FUiCtrl_Frame.cpp @@ -778,17 +778,27 @@ _Control* _Frame::GetFocusControl(const _Control* pControl) const { const _Form* pForm = null; - while(pControl) + _Frame* pFrame = null; + const _Control* pTempControl = pControl; + while(pTempControl) { - pForm = dynamic_cast(pControl); + pForm = dynamic_cast<_Form*>(const_cast<_Control*>(pTempControl)); if (pForm) { - break; + pFrame = dynamic_cast<_Frame*>(pForm->GetParent()); + if (pFrame) + { + break; + } + else + { + pTempControl = pTempControl->GetParent(); + } } else { - pControl = pControl->GetParent(); + pTempControl = pTempControl->GetParent(); } } if (pForm) @@ -886,17 +896,27 @@ _Control* _Frame::GetFocusTraversalControl(_Control* pControl) const { _Form* pForm = null; - while(pControl) + _Control* pTempControl = pControl; + _Frame* pFrame = null; + while(pTempControl) { - pForm = dynamic_cast<_Form*>(const_cast<_Control*>(pControl)); + pForm = dynamic_cast<_Form*>(const_cast<_Control*>(pTempControl)); if (pForm) { - break; + pFrame = dynamic_cast<_Frame*>(pForm->GetParent()); + if (pFrame) + { + break; + } + else + { + pTempControl = pTempControl->GetParent(); + } } else { - pControl = pControl->GetParent(); + pTempControl = pTempControl->GetParent(); } } -- 2.7.4