wasm: fix compile error due to EM_BOOL type change

emsdk 3.1.62 changes the EM_BOOL type from int to  bool. We were
using int in two places in the wasm platform plugin.

Use EM_BOOL instead to stay compatible with emsdk editions earlier 
and and later than 3.1.62

Pick-to: 6.7
Change-Id: I837e76f869225859643dd5a98a28a1eefb5f14a4
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
(cherry picked from commit 48beca4e7635cf2031c6707042d623c4daf44778)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Morten Sørvig 2024-08-14 16:18:45 +02:00 committed by Qt Cherry-pick Bot
parent 1bd96b5f40
commit 9313c60cd9
2 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ void QWasmCompositor::requestUpdate()
if (m_requestUpdateHoldEnabled)
return;
static auto frame = [](double frameTime, void *context) -> int {
static auto frame = [](double frameTime, void *context) -> EM_BOOL {
Q_UNUSED(frameTime);
QWasmCompositor *compositor = reinterpret_cast<QWasmCompositor *>(context);
@ -87,7 +87,7 @@ void QWasmCompositor::requestUpdate()
compositor->m_requestAnimationFrameId = -1;
compositor->deliverUpdateRequests();
return 0;
return EM_FALSE;
};
m_requestAnimationFrameId = emscripten_request_animation_frame(frame, this);
}

View File

@ -126,14 +126,14 @@ QWasmIntegration::QWasmIntegration()
// install browser window resize handler
emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, EM_TRUE,
[](int, const EmscriptenUiEvent *, void *) -> int {
[](int, const EmscriptenUiEvent *, void *) -> EM_BOOL {
// This resize event is called when the HTML window is
// resized. Depending on the page layout the elements might
// also have been resized, so we update the Qt screen sizes
// (and canvas render sizes).
if (QWasmIntegration *integration = QWasmIntegration::get())
integration->resizeAllScreens();
return 0;
return EM_FALSE;
});
// install visualViewport resize handler which picks up size and scale change on mobile.