From ad2c7f588321f8c671cb9419f90a1e24887ed562 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Wed, 14 Nov 2018 18:10:25 +0100 Subject: Windows QPA: Fix input context visibility status QWindowsInputContext::isInputPanelVisible() was ignoring the visibility status of the IME, only returning the status of the Win10 virtual keyboard. This issue caused qtwebengine to try to show the IME multiple times, breaking Asian languages input. Task-number: QTBUG-71753 Change-Id: Iaa4cef37b7dc98a9e0a787750a34d2e98a87a777 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Alexandru Croitor Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsinputcontext.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 30da0da1de..d1e99c037b 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -242,7 +242,18 @@ QRectF QWindowsInputContext::keyboardRect() const bool QWindowsInputContext::isInputPanelVisible() const { HWND hwnd = getVirtualKeyboardWindowHandle(); - return hwnd && ::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd); + if (hwnd && ::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd)) + return true; + // check if the Input Method Editor is open + if (inputMethodAccepted()) { + if (QWindow *window = QGuiApplication::focusWindow()) { + if (QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(window)) { + if (HIMC himc = ImmGetContext(platformWindow->handle())) + return ImmGetOpenStatus(himc); + } + } + } + return false; } void QWindowsInputContext::showInputPanel() -- cgit v1.2.3