wasm: fix linux touchscreen keyboard input
Fixes: QTBUG-124366 Change-Id: I9bd83ecb75b94efbf12b13055e292a74e6e9edcd Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io> (cherry picked from commit d374dd6f84c74e6e0adf441f19af31a31074f7ec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d40f29353e
commit
5f7324b20e
@ -49,7 +49,15 @@ QWasmInputContext::QWasmInputContext()
|
|||||||
m_inputElement.set("style", "position:absolute;left:-1000px;top:-1000px"); // offscreen
|
m_inputElement.set("style", "position:absolute;left:-1000px;top:-1000px"); // offscreen
|
||||||
m_inputElement.set("contenteditable","true");
|
m_inputElement.set("contenteditable","true");
|
||||||
|
|
||||||
if (platform() == Platform::Android || platform() == Platform::Windows) {
|
if (platform() == Platform::MacOS || platform() == Platform::iOS) {
|
||||||
|
auto callback = [=](emscripten::val) {
|
||||||
|
m_inputElement["parentElement"].call<void>("removeChild", m_inputElement);
|
||||||
|
inputPanelIsOpen = false;
|
||||||
|
};
|
||||||
|
m_blurEventHandler.reset(new EventCallback(m_inputElement, "blur", callback));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
const std::string inputType = platform() == Platform::Windows ? "textInput" : "input";
|
const std::string inputType = platform() == Platform::Windows ? "textInput" : "input";
|
||||||
|
|
||||||
document.call<void>("addEventListener", inputType,
|
document.call<void>("addEventListener", inputType,
|
||||||
@ -61,14 +69,6 @@ QWasmInputContext::QWasmInputContext()
|
|||||||
body.call<void>("appendChild", m_inputElement);
|
body.call<void>("appendChild", m_inputElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platform() == Platform::MacOS || platform() == Platform::iOS) {
|
|
||||||
auto callback = [=](emscripten::val) {
|
|
||||||
m_inputElement["parentElement"].call<void>("removeChild", m_inputElement);
|
|
||||||
inputPanelIsOpen = false;
|
|
||||||
};
|
|
||||||
m_blurEventHandler.reset(new EventCallback(m_inputElement, "blur", callback));
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject::connect(qGuiApp, &QGuiApplication::focusWindowChanged, this,
|
QObject::connect(qGuiApp, &QGuiApplication::focusWindowChanged, this,
|
||||||
&QWasmInputContext::focusWindowChanged);
|
&QWasmInputContext::focusWindowChanged);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user