summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhan Quang Minh <phanquangminh217@gmail.com>2022-10-07 13:52:38 +0700
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-30 19:42:13 +0000
commit99cc3802d127a8569dcba267c0338e9333d36d51 (patch)
tree9f44e3c9eea47c0c298dd969c943da8edef68df6
parentcc641080d4f3803f2d9683c2a9181fee7c4bd12a (diff)
ibus: check object validity before honoring `inputMethodAccepted()`
`inputMethodAccepted()` always return false if there is no current focus object. This means QIBusPlatformInputContext will fail to send the necessary `FocusOut` request to the input context, causing IBus to not send the appropriate content type information to the panel service when the application regains focus and issue a `FocusIn` request. This results in issues like https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5346, which can happen when a Qt application is in foreground as the IBus daemon fails to propagate the content type information to GNOME Shell, which acts as the panel service on GNOME systems. Fix this by checking for the validity of `object` before honoring the result of `inputMethodAccepted()`. Change-Id: I6b79ffc7c5f03ffc05527c29e52a0859f3594bfa Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 95b4cfb1af9aefe3ff3aa151804f464388329c63) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index f39737785c..e02b669e61 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -289,7 +289,7 @@ void QIBusPlatformInputContext::setFocusObject(QObject *object)
// 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())
+ if (object && !inputMethodAccepted())
return;
if (debug)