wasm: deregister event handlers
Pick-to: 5.15 Change-Id: I453b87497c7ed93b92bf9f4c59ab1c8bd1d7712e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
86e90aa346
commit
aed0f34786
@ -337,6 +337,27 @@ QWasmEventTranslator::QWasmEventTranslator(QWasmScreen *screen)
|
||||
initEventHandlers();
|
||||
}
|
||||
|
||||
QWasmEventTranslator::~QWasmEventTranslator()
|
||||
{
|
||||
// deregister event handlers
|
||||
QByteArray canvasSelector = "#" + screen()->canvasId().toUtf8();
|
||||
emscripten_set_keydown_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
emscripten_set_keyup_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
|
||||
emscripten_set_mousedown_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
emscripten_set_mouseup_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
emscripten_set_mousemove_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
|
||||
emscripten_set_focus_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
|
||||
emscripten_set_wheel_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
|
||||
emscripten_set_touchstart_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
emscripten_set_touchend_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
emscripten_set_touchmove_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
emscripten_set_touchcancel_callback(canvasSelector.constData(), 0, 0, NULL);
|
||||
}
|
||||
|
||||
void QWasmEventTranslator::initEventHandlers()
|
||||
{
|
||||
QByteArray canvasSelector = "#" + screen()->canvasId().toUtf8();
|
||||
|
@ -49,6 +49,7 @@ class QWasmEventTranslator : public QObject
|
||||
public:
|
||||
|
||||
explicit QWasmEventTranslator(QWasmScreen *screen);
|
||||
~QWasmEventTranslator();
|
||||
|
||||
static int keyboard_cb(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData);
|
||||
static int mouse_cb(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData);
|
||||
|
Loading…
Reference in New Issue
Block a user