, m_contextID(0)
, m_state(ECORE_IMF_INPUT_PANEL_STATE_HIDE)
, m_inputPickerType(-1)
+ , m_handleKeyDownEvent(false)
+ , m_fakeKeyEventTimer(this, &InputMethodContextEfl::fakeKeyEventTimerFired)
#endif
{
#if !ENABLE(TIZEN_ISF_PORT)
if (!eventInfo || !inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
return;
+ if (!inputMethodContext->m_handleKeyDownEvent)
+ inputMethodContext->requestFakeKeyEvent();
+
Ecore_IMF_Event_Delete_Surrounding* event = static_cast<Ecore_IMF_Event_Delete_Surrounding*>(eventInfo);
inputMethodContext->m_viewImpl->page()->deleteSurroundingText(event->offset, event->n_chars);
}
if (!eventInfo || !inputMethodContext->m_focused)
return;
+ if (!inputMethodContext->m_handleKeyDownEvent)
+ inputMethodContext->requestFakeKeyEvent();
+
inputMethodContext->m_viewImpl->page()->confirmComposition(String::fromUTF8(static_cast<char*>(eventInfo)));
}
if (!page->focusedFrame())
return;
+ if (!inputMethodContext->m_handleKeyDownEvent)
+ inputMethodContext->requestFakeKeyEvent();
+
PageClientImpl* pageClient = inputMethodContext->m_viewImpl->pageClient.get();
IntRect caretRect;
page->getCaretPosition(caretRect);
if (!m_context)
return;
- m_viewImpl->page()->prepareKeyDownEvent();
+ if (m_fakeKeyEventTimer.isActive())
+ m_fakeKeyEventTimer.stop();
+ else
+ m_viewImpl->page()->prepareKeyDownEvent();
+
+ m_handleKeyDownEvent = true;
#endif
Ecore_IMF_Event inputMethodEvent;
ecore_imf_evas_event_key_down_wrap(const_cast<Evas_Event_Key_Down*>(downEvent), &inputMethodEvent.key_down);
*isFiltered = ecore_imf_context_filter_event(m_context.get(), ECORE_IMF_EVENT_KEY_DOWN, &inputMethodEvent);
+
+#if ENABLE(TIZEN_ISF_PORT)
+ m_handleKeyDownEvent = false;
+#endif
}
#if ENABLE(TIZEN_ISF_PORT)
parent = elm_object_parent_widget_get(parent);
}
}
+
+void InputMethodContextEfl::requestFakeKeyEvent()
+{
+ if (m_handleKeyDownEvent || m_fakeKeyEventTimer.isActive())
+ return;
+
+ m_fakeKeyEventTimer.startOneShot(0);
+ m_viewImpl->page()->prepareKeyDownEvent();
+}
+
+void InputMethodContextEfl::fakeKeyEventTimerFired(WebCore::Timer<InputMethodContextEfl>*)
+{
+ const char* text = " ";
+
+ Evas_Event_Key_Down downEvent;
+ memset(&downEvent, 0, sizeof(Evas_Event_Key_Down));
+ downEvent.key = text;
+ downEvent.string = text;
+ m_viewImpl->page()->handleKeyboardEvent(NativeWebKeyboardEvent(&downEvent, true));
+
+ Evas_Event_Key_Up upEvent;
+ memset(&upEvent, 0, sizeof(Evas_Event_Key_Up));
+ upEvent.key = text;
+ upEvent.string = text;
+ m_viewImpl->page()->handleKeyboardEvent(NativeWebKeyboardEvent(&upEvent));
+}
#endif // #if ENABLE(TIZEN_ISF_PORT)
}
if (!currentEvent || !currentEvent->isFiltered())
return false;
+ if (event->type() != eventNames().keypressEvent)
+ return true;
+
Vector<OwnPtr<KeyPressCommand> > commands;
page->swapKeyPressCommands(commands);
switch (commands[i]->type) {
case KeyPressCommandSetComposition: {
const SetCompositionKeyPressCommand* command = reinterpret_cast<const SetCompositionKeyPressCommand*>(commands[i].get());
+ if (i + 1 < size) {
+ int nextType = commands[i + 1]->type;
+ if (nextType == KeyPressCommandSetComposition || nextType == KeyPressCommandConfirmComposition)
+ break;
+ }
page->setComposition(command->compositionString, command->underlines, command->cursorPosition);
break;
}
void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
{
#if ENABLE(TIZEN_ISF_PORT)
- if (event->type() == eventNames().keypressEvent && handleKeyPressCommands(m_page, event))
+ if (handleKeyPressCommands(m_page, event))
return;
#endif
if (!targetFrame)
return;
+#if ENABLE(TIZEN_ISF_PORT)
if (m_prepareKeyDownEvent) {
m_keyPressCommands.append(adoptPtr(new ConfirmCompositionKeyPressCommand(compositionString)));
return;
}
+#endif
targetFrame->editor()->confirmComposition(compositionString);
if (!targetFrame)
return;
+#if ENABLE(TIZEN_ISF_PORT)
+ if (!targetFrame->editor()->hasComposition() && compositionString.isEmpty())
+ return;
+
if (m_prepareKeyDownEvent) {
m_keyPressCommands.append(adoptPtr(new SetCompositionKeyPressCommand(compositionString, underlines, cursorPosition)));
return;
}
-#if ENABLE(TIZEN_ISF_PORT)
if (targetFrame->selection()->rootEditableElement()) {
HTMLTextFormControlElement* textFormControl = toTextFormControl(targetFrame->selection()->rootEditableElement()->shadowAncestorNode());
if (textFormControl && textFormControl->maxLength() >= 0) {