diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-08-20 14:51:53 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-08-25 11:41:04 +0000 |
commit | b14550fa45395d6b57d958bb4a4e42212ba0da0f (patch) | |
tree | 231d5af5f6c637481adfbd6ba9ac8ff4f055d3cf /src/plugins/platforms/windows/qwindowsinputcontext.cpp | |
parent | 2518c4c9079efdaa10f33c3c049f62f0c0c44373 (diff) |
Windows/Input context: Update enabling of IME in in update(), too.
Amend change b55f88caba339a49bf0ebabfa324dde523c2b866 by splitting
out the enabling into a separate function and call that when
QWindowsInputContext::update() is triggered to reflect updates
of the microfocus in QGraphicsView or item view widgets.
Task-number: QTBUG-47679
Task-number: QTBUG-47705
Task-number: QTBUG-40691
Change-Id: I84a6647944f1aaedcd72d7060cc90e29a177f577
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsinputcontext.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsinputcontext.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index c943438570..68e38dc4a6 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -200,18 +200,27 @@ void QWindowsInputContext::reset() doneContext(); } -void QWindowsInputContext::setFocusObject(QObject *object) +void QWindowsInputContext::setFocusObject(QObject *) { // ### fixme: On Windows 8.1, it has been observed that the Input context // remains active when this happens resulting in a lock-up. Consecutive // key events still have VK_PROCESSKEY set and are thus ignored. if (m_compositionContext.isComposing) reset(); + updateEnabled(); +} +void QWindowsInputContext::updateEnabled() +{ + if (!QGuiApplication::focusObject()) + return; const QWindow *window = QGuiApplication::focusWindow(); - if (object && window && window->handle()) { + if (window && window->handle()) { QWindowsWindow *platformWindow = QWindowsWindow::baseWindowOf(window); - if (inputMethodAccepted()) { + const bool accepted = inputMethodAccepted(); + if (QWindowsContext::verbose > 1) + qCDebug(lcQpaInputMethods) << __FUNCTION__ << window << "accepted=" << accepted; + if (accepted) { // Re-enable IME by associating default context saved on first disabling. if (platformWindow->testFlag(QWindowsWindow::InputMethodDisabled)) { ImmAssociateContext(platformWindow->handle(), QWindowsInputContext::m_defaultContext); @@ -235,6 +244,8 @@ void QWindowsInputContext::setFocusObject(QObject *object) void QWindowsInputContext::update(Qt::InputMethodQueries queries) { + if (queries & Qt::ImEnabled) + updateEnabled(); QPlatformInputContext::update(queries); } |