From d91e3bc3f23331f2f28a91468ee8b50682402f7a Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Mon, 12 Jun 2023 16:49:50 +1000 Subject: wasm: add iOS to platform detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add iPad and move iPhone platform to iOS Fixes: QTBUG-114446 Change-Id: I3f601fbe5f3899c0658ee65acf72bbf37d51bf73 Reviewed-by: MikoĊ‚aj Boc (cherry picked from commit 65f09d4e10e435846b6669945e37f807de127199) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/wasm/qwasminputcontext.cpp | 4 ++-- src/plugins/platforms/wasm/qwasmplatform.cpp | 5 +++-- src/plugins/platforms/wasm/qwasmplatform.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasminputcontext.cpp b/src/plugins/platforms/wasm/qwasminputcontext.cpp index 0fd3e7befe..f2c4c93fe4 100644 --- a/src/plugins/platforms/wasm/qwasminputcontext.cpp +++ b/src/plugins/platforms/wasm/qwasminputcontext.cpp @@ -66,7 +66,7 @@ QWasmInputContext::QWasmInputContext() } - if (platform() == Platform::MacOS || platform() == Platform::iPhone) { + if (platform() == Platform::MacOS || platform() == Platform::iOS) { auto callback = [=](emscripten::val) { m_inputElement["parentElement"].call("removeChild", m_inputElement); inputPanelIsOpen = false; @@ -118,7 +118,7 @@ void QWasmInputContext::showInputPanel() // screen element. if (platform() == Platform::MacOS // keep for compatibility - || platform() == Platform::iPhone + || platform() == Platform::iOS || platform() == Platform::Windows) { emscripten::val inputWrapper = inputHandlerElementForFocusedWindow(); if (inputWrapper.isUndefined()) diff --git a/src/plugins/platforms/wasm/qwasmplatform.cpp b/src/plugins/platforms/wasm/qwasmplatform.cpp index c641e345e4..e54992be1d 100644 --- a/src/plugins/platforms/wasm/qwasmplatform.cpp +++ b/src/plugins/platforms/wasm/qwasmplatform.cpp @@ -13,8 +13,9 @@ Platform platform() if (rawPlatform.call("includes", emscripten::val("Mac"))) return Platform::MacOS; - if (rawPlatform.call("includes", emscripten::val("iPhone"))) - return Platform::iPhone; + if (rawPlatform.call("includes", emscripten::val("iPhone")) + || rawPlatform.call("includes", emscripten::val("iPad"))) + return Platform::iOS; if (rawPlatform.call("includes", emscripten::val("Win32"))) return Platform::Windows; if (rawPlatform.call("includes", emscripten::val("Linux"))) { diff --git a/src/plugins/platforms/wasm/qwasmplatform.h b/src/plugins/platforms/wasm/qwasmplatform.h index 239efdeae9..5b32e43633 100644 --- a/src/plugins/platforms/wasm/qwasmplatform.h +++ b/src/plugins/platforms/wasm/qwasmplatform.h @@ -19,7 +19,7 @@ enum class Platform { Windows, Linux, Android, - iPhone, + iOS }; Platform platform(); -- cgit v1.2.3