N_SE-44734 : ignore key input event until window visible state changed to true
authorminkyu kim <imetjade.kim@samsung.com>
Wed, 10 Jul 2013 10:55:13 +0000 (19:55 +0900)
committerminkyu kim <imetjade.kim@samsung.com>
Wed, 10 Jul 2013 10:55:13 +0000 (19:55 +0900)
Change-Id: I2c8312ee46c8b3311084b1c400e9ed61be5fb82d

src/ui/FUi_EflUiEventManager.cpp
src/ui/FUi_Window.cpp
src/ui/controls/FUiCtrl_Frame.cpp
src/ui/inc/FUi_Window.h

index 5b908b9..b0695dc 100644 (file)
@@ -296,6 +296,10 @@ public:
                , __keyInfo(keyState, keyCode, keyModifier, pUserData)
        {
                __pTarget = GetTarget(keyCode);
+               if (IsNativeWindowActivated(__pTarget) == false)
+               {
+                       SysTryReturnVoidResult(NID_UI, IsNativeWindowActivated(__pTarget), E_SYSTEM, "[E_SYSTEM] NativeWindow is not activated yet");
+               }
        }
 
        virtual ~_KeyEvent(void)
@@ -409,6 +413,27 @@ private:
                return pControl;
        }
 
+       bool
+       IsNativeWindowActivated(_Control* pControl)
+       {
+               bool nativeWindowActivated = false;
+               _Control* pParent = pControl;
+
+               while (pParent)
+               {
+                       _Window* pWindow = dynamic_cast<_Window*>(pParent);
+                       if (pWindow
+                               && (pWindow->GetNativeWindowActivated() == true || (pWindow->GetNativeWindowActivated() == false && pWindow->GetWindowType() == _WINDOW_TYPE_VE)))
+                       {
+                               nativeWindowActivated = true;
+                               break;
+                       }
+
+                       pParent = pParent->GetParent();
+               }
+               return nativeWindowActivated;
+       }
+
 private:
        _Control* __pTarget;
        _KeyInfo __keyInfo;
@@ -1180,6 +1205,12 @@ OnKeyPressed(void* pData __UNUSED__, int type __UNUSED__, void* pEventInfo)
        }
 
        _KeyEvent event(KEY_PRESSED, _KeyEvent::GetKeyCode(pEv->keyname), _KeyEvent::GetKeyModifier(pEv->modifiers), pEv);
+       result r = GetLastResult();
+       if (r != E_SUCCESS)
+       {
+               SysLog(NID_UI, "[%s] Propagating.", GetErrorMessage(r));
+               return ECORE_CALLBACK_PASS_ON;
+       }
        SysSecureLog(NID_UI, "KeyName = %s, KeyCode = %d, KeyModifier = %x", pEv->keyname, _KeyEvent::GetKeyCode(pEv->keyname), _KeyEvent::GetKeyModifier(pEv->modifiers));
        event.Send();
 
@@ -1209,6 +1240,12 @@ OnKeyReleased(void* pData __UNUSED__, int type __UNUSED__, void* pEventInfo)
        }
 
        _KeyEvent event(KEY_RELEASED, _KeyEvent::GetKeyCode(pEv->keyname), _KeyEvent::GetKeyModifier(pEv->modifiers), pEv);
+       result r = GetLastResult();
+       if (r != E_SUCCESS)
+       {
+               SysLog(NID_UI, "[%s] Propagating.", GetErrorMessage(r));
+               return ECORE_CALLBACK_PASS_ON;
+       }
        SysSecureLog(NID_UI, "KeyName = %s, KeyCode = %d, KeyModifier = %x", pEv->keyname, _KeyEvent::GetKeyCode(pEv->keyname), _KeyEvent::GetKeyModifier(pEv->modifiers));
        event.Send();
 
index d314ca1..501280a 100644 (file)
@@ -423,6 +423,18 @@ _Window::IsActivationEnabled(void)
        return enable;
 }
 
+void
+_Window::SetNativeWindowActivated(bool activated)
+{
+       __nativeWindowActivated = activated;
+}
+
+bool
+_Window::GetNativeWindowActivated(void)
+{
+       return __nativeWindowActivated;
+}
+
 _RootVisualElement*
 _Window::GetRootVisualElement(void) const
 {
@@ -520,8 +532,13 @@ _Window::OnNotifiedN(const _Control& source, IList* pArgs)
                obscured = pObscured->ToInt();
                if (obscured == 0)
                {
+                       SetNativeWindowActivated(true);
                        GetWindowDelegate().OnNativeWindowActivated();
                }
+               else
+               {
+                       SetNativeWindowActivated(false);
+               }
 
                pArgs->RemoveAll(true);
                delete pArgs;
@@ -871,6 +888,7 @@ _Window::_Window()
        , __rotation(-1)
        , __preferredRotation(false)
        , __orientationCallbackMode(false)
+       , __nativeWindowActivated(false)
 {
        SetControlDelegate(*this);
        SetWindowDelegate(*this);
index 4a84c2d..48336c7 100644 (file)
@@ -227,11 +227,13 @@ _Frame::OnNotifiedN(const _Control& source, IList* pArgs)
                obscured = pObscured->ToInt();
                if (obscured == 0)
                {
+                       SetNativeWindowActivated(true);
                        __activated = true;
                        OnFrameActivated();
                }
                else
                {
+                       SetNativeWindowActivated(false);
                        __activated = false;
                        OnFrameDeactivated();
                }
index b03c221..627f6c2 100644 (file)
@@ -108,6 +108,8 @@ public:
 
        void SetActivationEnabled(bool enable);
        bool IsActivationEnabled(void);
+       void SetNativeWindowActivated(bool activated);
+       bool GetNativeWindowActivated(void);
 
        Tizen::Ui::Animations::_RootVisualElement* GetRootVisualElement(void) const;
        NativeWindowHandle GetNativeHandle(void) const;
@@ -159,6 +161,7 @@ private:
        _Control* __pOwner;
        _IWindowDelegate* __pWindowDelegate;
        bool __activated;
+       bool __nativeWindowActivated;
        bool __destroying;
 
        Tizen::Ui::Animations::_RootVisualElement* __pRootVisualElement;