wasm: make input callback returns consistent

Change-Id: I43d9db1723d85eef69cfa2e51da4a6a640e8b3c5
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Lorn Potter 2022-02-10 06:32:21 +10:00
parent db5b8bbea3
commit 5a7b836ca7

View File

@ -969,16 +969,13 @@ QOpenGLContext *QWasmCompositor::context()
int QWasmCompositor::keyboard_cb(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) int QWasmCompositor::keyboard_cb(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)
{ {
QWasmCompositor *wasmCompositor = reinterpret_cast<QWasmCompositor *>(userData); QWasmCompositor *wasmCompositor = reinterpret_cast<QWasmCompositor *>(userData);
bool accepted = wasmCompositor->processKeyboard(eventType, keyEvent); return static_cast<int>(wasmCompositor->processKeyboard(eventType, keyEvent));
return accepted ? 1 : 0;
} }
int QWasmCompositor::mouse_cb(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) int QWasmCompositor::mouse_cb(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
{ {
QWasmCompositor *compositor = (QWasmCompositor*)userData; QWasmCompositor *compositor = (QWasmCompositor*)userData;
bool accepted = compositor->processMouse(eventType, mouseEvent); return static_cast<int>(compositor->processMouse(eventType, mouseEvent));
return accepted;
} }
int QWasmCompositor::focus_cb(int /*eventType*/, const EmscriptenFocusEvent */*focusEvent*/, void */*userData*/) int QWasmCompositor::focus_cb(int /*eventType*/, const EmscriptenFocusEvent */*focusEvent*/, void */*userData*/)
@ -989,14 +986,13 @@ int QWasmCompositor::focus_cb(int /*eventType*/, const EmscriptenFocusEvent */*f
int QWasmCompositor::wheel_cb(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData) int QWasmCompositor::wheel_cb(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)
{ {
QWasmCompositor *compositor = (QWasmCompositor *) userData; QWasmCompositor *compositor = (QWasmCompositor *) userData;
bool accepted = compositor->processWheel(eventType, wheelEvent); return static_cast<int>(compositor->processWheel(eventType, wheelEvent));
return accepted ? 1 : 0;
} }
int QWasmCompositor::touchCallback(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData) int QWasmCompositor::touchCallback(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)
{ {
auto compositor = reinterpret_cast<QWasmCompositor*>(userData); auto compositor = reinterpret_cast<QWasmCompositor*>(userData);
return compositor->handleTouch(eventType, touchEvent); return static_cast<int>(compositor->handleTouch(eventType, touchEvent));
} }
bool QWasmCompositor::processMouse(int eventType, const EmscriptenMouseEvent *mouseEvent) bool QWasmCompositor::processMouse(int eventType, const EmscriptenMouseEvent *mouseEvent)