wasm: add iOS to platform detection

Add iPad and move iPhone platform to iOS

Fixes: QTBUG-114446
Change-Id: I3f601fbe5f3899c0658ee65acf72bbf37d51bf73
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 65f09d4e10e435846b6669945e37f807de127199)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Lorn Potter 2023-06-12 16:49:50 +10:00 committed by Qt Cherry-pick Bot
parent 75d5ad3ac9
commit 5bc7d8b2e8
3 changed files with 6 additions and 5 deletions

View File

@ -66,7 +66,7 @@ QWasmInputContext::QWasmInputContext()
} }
if (platform() == Platform::MacOS || platform() == Platform::iPhone) { if (platform() == Platform::MacOS || platform() == Platform::iOS) {
auto callback = [=](emscripten::val) { auto callback = [=](emscripten::val) {
m_inputElement["parentElement"].call<void>("removeChild", m_inputElement); m_inputElement["parentElement"].call<void>("removeChild", m_inputElement);
inputPanelIsOpen = false; inputPanelIsOpen = false;
@ -118,7 +118,7 @@ void QWasmInputContext::showInputPanel()
// screen element. // screen element.
if (platform() == Platform::MacOS // keep for compatibility if (platform() == Platform::MacOS // keep for compatibility
|| platform() == Platform::iPhone || platform() == Platform::iOS
|| platform() == Platform::Windows) { || platform() == Platform::Windows) {
emscripten::val inputWrapper = inputHandlerElementForFocusedWindow(); emscripten::val inputWrapper = inputHandlerElementForFocusedWindow();
if (inputWrapper.isUndefined()) if (inputWrapper.isUndefined())

View File

@ -13,8 +13,9 @@ Platform platform()
if (rawPlatform.call<bool>("includes", emscripten::val("Mac"))) if (rawPlatform.call<bool>("includes", emscripten::val("Mac")))
return Platform::MacOS; return Platform::MacOS;
if (rawPlatform.call<bool>("includes", emscripten::val("iPhone"))) if (rawPlatform.call<bool>("includes", emscripten::val("iPhone"))
return Platform::iPhone; || rawPlatform.call<bool>("includes", emscripten::val("iPad")))
return Platform::iOS;
if (rawPlatform.call<bool>("includes", emscripten::val("Win32"))) if (rawPlatform.call<bool>("includes", emscripten::val("Win32")))
return Platform::Windows; return Platform::Windows;
if (rawPlatform.call<bool>("includes", emscripten::val("Linux"))) { if (rawPlatform.call<bool>("includes", emscripten::val("Linux"))) {

View File

@ -19,7 +19,7 @@ enum class Platform {
Windows, Windows,
Linux, Linux,
Android, Android,
iPhone, iOS
}; };
Platform platform(); Platform platform();