Add virtual keyboard geometry support to Windows port
Overrides keyboardRect() and isInputPanelVisible() in QWindowsInputContext in order to provide support for virtual keyboard geometry and visibility information in the Windows platform. Change-Id: I15382e604dc076929d253c0c1fbe64ea7da853ce Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
1798f0aa37
commit
9f405f98a4
@ -221,6 +221,28 @@ void QWindowsInputContext::setFocusObject(QObject *)
|
||||
updateEnabled();
|
||||
}
|
||||
|
||||
HWND QWindowsInputContext::getVirtualKeyboardWindowHandle() const
|
||||
{
|
||||
return ::FindWindowA("IPTip_Main_Window", nullptr);
|
||||
}
|
||||
|
||||
QRectF QWindowsInputContext::keyboardRect() const
|
||||
{
|
||||
if (HWND hwnd = getVirtualKeyboardWindowHandle()) {
|
||||
RECT rect;
|
||||
if (::GetWindowRect(hwnd, &rect)) {
|
||||
return QRectF(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
|
||||
}
|
||||
}
|
||||
return QRectF();
|
||||
}
|
||||
|
||||
bool QWindowsInputContext::isInputPanelVisible() const
|
||||
{
|
||||
HWND hwnd = getVirtualKeyboardWindowHandle();
|
||||
return hwnd && ::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd);
|
||||
}
|
||||
|
||||
void QWindowsInputContext::updateEnabled()
|
||||
{
|
||||
if (!QGuiApplication::focusObject())
|
||||
|
@ -79,6 +79,9 @@ public:
|
||||
void invokeAction(QInputMethod::Action, int cursorPosition) override;
|
||||
void setFocusObject(QObject *object) override;
|
||||
|
||||
QRectF keyboardRect() const override;
|
||||
bool isInputPanelVisible() const override;
|
||||
|
||||
bool startComposition(HWND hwnd);
|
||||
bool composition(HWND hwnd, LPARAM lParam);
|
||||
bool endComposition(HWND hwnd);
|
||||
@ -98,6 +101,7 @@ private:
|
||||
void startContextComposition();
|
||||
void endContextComposition();
|
||||
void updateEnabled();
|
||||
HWND getVirtualKeyboardWindowHandle() const;
|
||||
|
||||
const DWORD m_WM_MSIME_MOUSE;
|
||||
static HIMC m_defaultContext;
|
||||
|
Loading…
Reference in New Issue
Block a user