From ab7d48625aed1c1bb56148f57f958371e810cf4c Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 15 Feb 2018 15:45:51 +0100 Subject: Fix read-only text browser sometimes jump to the top of the document MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Respect the inputMethodAccepted() attribute of QPlatformInputContext in the ibus input context plugin. This is what for example the windows input context plugin does, too. A text browser that is read-only should not receive input method events that include a cursor placement. So when it receives the focus, we must only convey the received-focus information to the input method if the widget is editable (or accepts input method events generally speaking), because as soon as the ibus process learns about it, it will send an input method event that looks like a "let us reset the state a clean start and place the cursor at the beginning" message. We are not interested in reaching that state with the ibus process. Task-number: QTBUG-63066 Change-Id: I1b0e5f8a396bc31169d6081f9325092b447cf60a Reviewed-by: Tor Arne Vestbø --- .../platforminputcontexts/ibus/qibusplatforminputcontext.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/platforminputcontexts/ibus') diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 02f92bbb18..f339938f86 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -254,6 +254,12 @@ void QIBusPlatformInputContext::setFocusObject(QObject *object) if (!d->busConnected) return; + // It would seem natural here to call FocusOut() on the input method if we + // transition from an IME accepted focus object to one that does not accept it. + // Mysteriously however that is not sufficient to fix bug QTBUG-63066. + if (!inputMethodAccepted()) + return; + if (debug) qDebug() << "setFocusObject" << object; if (object) -- cgit v1.2.3