, m_context(context)
, m_focused(false)
#if ENABLE(TIZEN_ISF_PORT)
- , m_tryToShow(false)
+ , m_useInputMethod(false)
, m_state(ECORE_IMF_INPUT_PANEL_STATE_HIDE)
#endif
{
*isFiltered = ecore_imf_context_filter_event(m_context.get(), ECORE_IMF_EVENT_KEY_DOWN, &inputMethodEvent);
}
+#if ENABLE(TIZEN_ISF_PORT)
void InputMethodContextEfl::updateTextInputState()
{
-#if !ENABLE(TIZEN_ISF_PORT)
- if (!m_context)
- return;
-#endif
-
const EditorState& editor = m_viewImpl->page()->editorState();
-#if ENABLE(TIZEN_ISF_PORT)
- bool isActive = !editor.selectionIsNone && (editor.isContentEditable || m_tryToShow);
-#else
- bool isActive = editor.isContentEditable;
-#endif
+ if (m_focused)
+ ecore_imf_context_cursor_position_set(m_context.get(), editor.cursorPosition);
- if (isActive) {
-#if ENABLE(TIZEN_ISF_PORT)
- if (m_context)
- ecore_imf_context_cursor_position_set(m_context.get(), editor.cursorPosition);
-#endif
+ if (editor.shouldIgnoreCompositionSelectionChange)
+ return;
+ if (editor.isContentEditable && m_useInputMethod) {
if (m_focused)
return;
-#if ENABLE(TIZEN_ISF_PORT)
Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
bool defaultKeypadEnabled = ewk_settings_default_keypad_enabled_get(settings);
m_focused = true;
return;
}
-#endif
ecore_imf_context_reset(m_context.get());
ecore_imf_context_focus_in(m_context.get());
-#if ENABLE(TIZEN_ISF_PORT)
ecore_imf_context_input_panel_show(m_context.get());
// input field zoom for external keyboard
ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
-#endif
+ m_focused = true;
+ } else
+ hideIMFContext();
+}
+#else
+void InputMethodContextEfl::updateTextInputState()
+{
+ if (!m_context)
+ return;
+
+ const EditorState& editor = m_viewImpl->page()->editorState();
+
+ if (editor.isContentEditable) {
+ if (m_focused)
+ return;
+
+ ecore_imf_context_reset(m_context.get());
+ ecore_imf_context_focus_in(m_context.get());
m_focused = true;
} else {
if (!m_focused)
m_focused = false;
ecore_imf_context_reset(m_context.get());
ecore_imf_context_focus_out(m_context.get());
-#if ENABLE(TIZEN_ISF_PORT)
- ecore_imf_context_input_panel_hide(m_context.get());
- revertIMFContext();
-#endif
}
}
+#endif
#if ENABLE(TIZEN_ISF_PORT)
void InputMethodContextEfl::initializeIMFContext(Ecore_IMF_Context* context, Ecore_IMF_Input_Panel_Layout layout)
ecore_imf_context_input_panel_layout_set(m_context.get(), layout);
}
+void InputMethodContextEfl::setUseInputMethod(bool use)
+{
+ m_useInputMethod = use;
+ updateTextInputState();
+}
+
void InputMethodContextEfl::setType(const String& type)
{
Ecore_IMF_Input_Panel_Layout layout;
void InputMethodContextEfl::hideIMFContext()
{
- if (!m_context)
+ if (!m_context || !m_focused)
return;
+ if (m_viewImpl->page()->editorState().hasComposition)
+ m_viewImpl->page()->cancelComposition();
+
+ m_focused = false;
+
if (ecore_imf_context_input_panel_state_get(m_context.get()) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
ecore_imf_context_reset(m_context.get());
ecore_imf_context_input_panel_hide(m_context.get());