Defect fix GetFocusedControl
authorkeonpyo.kong <keonpyo.kong@samsung.com>
Thu, 4 Jul 2013 04:34:39 +0000 (13:34 +0900)
committerkeonpyo.kong <keonpyo.kong@samsung.com>
Thu, 4 Jul 2013 04:53:43 +0000 (13:53 +0900)
Change-Id: I717b978fac5aaf6992697e723eb9f358fb904d23
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
apply code review

Change-Id: Ib1d6c22570c493eadc112e7f92b77cf4ae0ede68
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
src/ui/FUi_FocusManagerImpl.cpp
src/ui/controls/FUiCtrl_Frame.cpp

index a75b0e7..9bf749c 100644 (file)
@@ -21,6 +21,7 @@
 *
 */
 
+#include <Ecore.h>
 #include <unique_ptr.h>
 #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);
index af15a84..6cc5b56 100644 (file)
@@ -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<const _Form*>(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();
                }
        }