From 90d0e4c7e1929b9fabfdd41ce76e001b045d4327 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 7 Jan 2015 22:31:43 +0200 Subject: Set the composing string of the wayland input method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-43346 Change-Id: I9bc6d804ddca59a7a0173b8f0d3ec2f268fe9a59 Reviewed-by: Jørgen Lind --- src/client/qwaylandinputcontext.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/client/qwaylandinputcontext.cpp') diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp index 8a711955e..e189b9451 100644 --- a/src/client/qwaylandinputcontext.cpp +++ b/src/client/qwaylandinputcontext.cpp @@ -124,6 +124,18 @@ void QWaylandTextInput::updateState() commit_state(++m_serial); } +void QWaylandTextInput::text_input_preedit_string(uint32_t serial, const QString &text, const QString &commit) +{ + Q_UNUSED(serial) + if (!QGuiApplication::focusObject()) + return; + + m_commit = commit; + QList attributes; + QInputMethodEvent event(text, attributes); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); +} + void QWaylandTextInput::text_input_commit_string(uint32_t serial, const QString &text) { Q_UNUSED(serial); @@ -133,6 +145,8 @@ void QWaylandTextInput::text_input_commit_string(uint32_t serial, const QString QInputMethodEvent event; event.setCommitString(text); QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + + m_commit = QString(); } void QWaylandTextInput::text_input_enter(wl_surface *) @@ -143,6 +157,8 @@ void QWaylandTextInput::text_input_enter(wl_surface *) void QWaylandTextInput::text_input_leave() { + if (!m_commit.isEmpty()) + text_input_commit_string(0, m_commit); } void QWaylandTextInput::text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) -- cgit v1.2.3