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>
bb10
Lorn Potter 2022-03-04 09:28:09 +10:00
parent 49722de995
commit f3150368c3
3 changed files with 11 additions and 5 deletions

View File

@ -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())

View File

@ -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"))) {

View File

@ -66,7 +66,8 @@ public:
MacOSPlatform,
WindowsPlatform,
LinuxPlatform,
AndroidPlatform
AndroidPlatform,
iPhonePlatform
};
QWasmIntegration();