summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@gmail.com>2022-03-04 09:28:09 +1000
committerLorn Potter <lorn.potter@gmail.com>2022-03-05 15:59:47 +1000
commitf3150368c36a8ec89b278617f959a9a617a4153e (patch)
tree9218308dd14b90b3d01c44fb3c123ed020c958e2
parent49722de99527a97373df517dcb457f3170693a4f (diff)
wasm: fix native keyboard on iOS
Apple added iPhonePlatform to navigator properties and so use that Fixes: QTBUG-101441 Change-Id: I5a0f27fc18dfa224b6373c5d809cf884d51c880a Pick-to: 6.3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--src/plugins/platforms/wasm/qwasminputcontext.cpp11
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp2
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.h3
3 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/platforms/wasm/qwasminputcontext.cpp b/src/plugins/platforms/wasm/qwasminputcontext.cpp
index f50395c059..20a6da9ebd 100644
--- a/src/plugins/platforms/wasm/qwasminputcontext.cpp
+++ b/src/plugins/platforms/wasm/qwasminputcontext.cpp
@@ -80,12 +80,14 @@ QWasmInputContext::QWasmInputContext()
&androidKeyboardCallback);
}
- if (QWasmIntegration::get()->platform == QWasmIntegration::MacOSPlatform)
+ if (QWasmIntegration::get()->platform == QWasmIntegration::MacOSPlatform ||
+ QWasmIntegration::get()->platform == QWasmIntegration::iPhonePlatform)
{
auto callback = [=](emscripten::val) {
- m_inputElement["parentElement"].call<void>("removeChild", m_inputElement); };
+ m_inputElement["parentElement"].call<void>("removeChild", m_inputElement);
+ inputPanelIsOpen = false;
+ };
m_blurEventHandler.reset(new EventCallback(m_inputElement, "blur", callback));
- inputPanelIsOpen = false;
}
QObject::connect(qGuiApp, &QGuiApplication::focusWindowChanged, this,
@@ -132,7 +134,8 @@ void QWasmInputContext::showInputPanel()
// captured by the keyboard event handler installed on the
// canvas.
- if (QWasmIntegration::get()->platform == QWasmIntegration::MacOSPlatform
+ if (QWasmIntegration::get()->platform == QWasmIntegration::MacOSPlatform // keep for compatibility
+ || QWasmIntegration::get()->platform == QWasmIntegration::iPhonePlatform
|| QWasmIntegration::get()->platform == QWasmIntegration::WindowsPlatform) {
emscripten::val canvas = focusCanvas();
if (canvas == emscripten::val::undefined())
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp
index 01fb9f1cd0..765f89052e 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.cpp
+++ b/src/plugins/platforms/wasm/qwasmintegration.cpp
@@ -113,6 +113,8 @@ QWasmIntegration::QWasmIntegration()
if (rawPlatform.call<bool>("includes", emscripten::val("Mac")))
platform = MacOSPlatform;
+ if (rawPlatform.call<bool>("includes", emscripten::val("iPhone")))
+ platform = iPhonePlatform;
if (rawPlatform.call<bool>("includes", emscripten::val("Win32")))
platform = WindowsPlatform;
if (rawPlatform.call<bool>("includes", emscripten::val("Linux"))) {
diff --git a/src/plugins/platforms/wasm/qwasmintegration.h b/src/plugins/platforms/wasm/qwasmintegration.h
index 316f6eef40..cba5057f09 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.h
+++ b/src/plugins/platforms/wasm/qwasmintegration.h
@@ -66,7 +66,8 @@ public:
MacOSPlatform,
WindowsPlatform,
LinuxPlatform,
- AndroidPlatform
+ AndroidPlatform,
+ iPhonePlatform
};
QWasmIntegration();