[WK2] Remove input context for fullscreen keypad
authorSeokju Kwon <seokju.kwon@samsung.com>
Sat, 8 Sep 2012 07:25:04 +0000 (16:25 +0900)
committerSeokju Kwon <seokju.kwon@samsung.com>
Sat, 8 Sep 2012 07:31:38 +0000 (16:31 +0900)
[Title] Remove input context for fullscreen keypad
[Issue#] N_SE-8440
[Problem] Default keypad focus in when fullscreen keypad show up
[Cause] Doesn't remove input context
[Solution] Remove input context

Change-Id: I8cfaaec184ed9e50a97b0c667a0a4fe9bf2950be

Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/efl/PageClientImpl.h

index d4aa812..d25619e 100755 (executable)
@@ -218,12 +218,7 @@ PageClientImpl::PageClientImpl(WebContext* context, WebPageGroup* pageGroup, Eva
 PageClientImpl::~PageClientImpl()
 {
 #if ENABLE(TIZEN_ISF_PORT)
-    if (m_inputMethod) {
-        ecore_imf_context_input_panel_event_callback_del(m_inputMethod, ECORE_IMF_INPUT_PANEL_STATE_EVENT, imfInputPanelStateEventCb);
-        ecore_imf_context_event_callback_del(m_inputMethod, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, imfContextDeleteSurroundingCb);
-        ecore_imf_context_event_callback_del(m_inputMethod, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, imfPreeditChangedCb);
-        ecore_imf_context_event_callback_del(m_inputMethod, ECORE_IMF_CALLBACK_COMMIT, imfEventCommittedCb);
-    }
+    terminateInputMethod();
 #endif
 }
 
@@ -855,7 +850,7 @@ void PageClientImpl::setInputMethodState(bool active)
 #if ENABLE(TIZEN_ISF_PORT)
     LOG(ISF, "%s\n", __func__);
 
-    if (!m_inputMethod && !initializeInputMethod())
+    if (!initializeInputMethod())
         return;
 
     Ewk_Setting* ewkSetting = ewk_view_setting_get(m_viewWidget);
@@ -880,7 +875,8 @@ void PageClientImpl::setInputMethodState(bool active)
         }
 
         if (!defaultKeypadEnabled) {
-            LOG(ISF, "[FAIL] Default keypad disabled\n");
+            terminateInputMethod();
+            LOG(ISF, "[FAIL] %s : Default keypad disabled\n", __func__);
             return;
         }
 
@@ -962,7 +958,7 @@ void PageClientImpl::setInputMethodState(bool active)
         setCursorPosition();
     } else if (!active && state != ECORE_IMF_INPUT_PANEL_STATE_HIDE && evas_object_focus_get(m_viewWidget)) {
         if (!defaultKeypadEnabled) {
-            LOG(ISF, "[FAIL] Default keypad disabled\n");
+            LOG(ISF, "[FAIL] %s Default keypad disabled\n", __func__);
             return;
         }
 
@@ -1012,6 +1008,19 @@ bool PageClientImpl::initializeInputMethod()
     return true;
 }
 
+void PageClientImpl::terminateInputMethod()
+{
+    if (m_inputMethod) {
+        ecore_imf_context_input_panel_event_callback_del(m_inputMethod, ECORE_IMF_INPUT_PANEL_STATE_EVENT, imfInputPanelStateEventCb);
+        ecore_imf_context_event_callback_del(m_inputMethod, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, imfContextDeleteSurroundingCb);
+        ecore_imf_context_event_callback_del(m_inputMethod, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, imfPreeditChangedCb);
+        ecore_imf_context_event_callback_del(m_inputMethod, ECORE_IMF_CALLBACK_COMMIT, imfEventCommittedCb);
+        ecore_imf_context_del(m_inputMethod);
+        m_inputMethod = 0;
+    }
+}
+
+
 bool PageClientImpl::getInputMethodState()
 {
     if (!m_inputMethod && !initializeInputMethod())
@@ -1028,9 +1037,6 @@ void PageClientImpl::handleInputMethodMouseRelease()
 {
     LOG(ISF, "%s\n", __func__);
 
-    if (!m_inputMethod && !initializeInputMethod())
-        return;
-
     m_mousePressed = false;
 }
 
@@ -1101,6 +1107,12 @@ void PageClientImpl::handleInputMethodKeydown()
 {
     LOG(ISF, "%s\n", __func__);
 
+    bool defaultKeypadEnabled = ewk_setting_enable_default_keypad_get(ewk_view_setting_get(m_viewWidget));
+    if (!defaultKeypadEnabled) {
+        LOG(ISF, "[FAIL] %s Default keypad disabled\n", __func__);
+        return;
+    }
+
     m_preventNextCompositionCommit = false;
 
     if (m_inputMethod)
@@ -1111,10 +1123,16 @@ void PageClientImpl::handleInputMethodMousePress()
 {
     LOG(ISF, "%s\n", __func__);
 
-    if (!m_inputMethod && !initializeInputMethod())
+    m_mousePressed = true;
+
+    bool defaultKeypadEnabled = ewk_setting_enable_default_keypad_get(ewk_view_setting_get(m_viewWidget));
+    if (!defaultKeypadEnabled) {
+        LOG(ISF, "[FAIL] %s Default keypad disabled\n", __func__);
         return;
+    }
 
-    m_mousePressed = true;
+    if (!initializeInputMethod())
+        return;
 
     m_preventNextCompositionCommit = true;
     ecore_imf_context_reset(m_inputMethod);
index 6774d4e..516f050 100755 (executable)
@@ -114,6 +114,7 @@ public:
     void setCursorPosition(int preeditPosition = 0);
     bool getInputMethodState();
     bool initializeInputMethod();
+    void terminateInputMethod();
 
     void imContextPreeditChanged();
     void imContextCommitted(char*);