summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
Commit message (Collapse)AuthorAgeFilesLines
* wasm: fix onLoaded delay functionalityMorten Sørvig2024-02-081-0/+17
| | | | | | | | | | | | | | | | | | | | | | | onLoaded and the initial expose/paint should be sequenced such that onLoaded is fired first, followed by the expose. This makes sure that we don't spend any time on painting frames before Qt is completely initialized. Add a "requestUpdateHold" mode to QWasmCompositor (initially on) which disables requestUpdate calls, as well as releaseRequestUpdateHold() which enables requestUpdate calls again. This is a one-way transition; the mode can't be enabled again. This amends commit f2e22774 which implemented the concept of startup tasks, where onLoaded can be delayed until for instance font loading has been completed. After this commit the expose event and initial commit will be delayed as well. Change-Id: Icc784306726174fbabe8785d54485860e968745a Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
* wasm: introduce virtual processPostedEvents()Morten Sørvig2023-07-041-3/+4
| | | | | | | | | | | | | | | Don't re-use processEvents() for the case where we get a callback from the native event loop and want to send events. This makes it clearer that these are two different cases. Align with the Core Foundation event dispatcher where processPostedEvents() is virtual and is overridden by the Gui event dispatcher to send window system events. Pick-to: 6.6 Change-Id: I3ea9c55c1d9c03195c1937c4dcc0e5b689e15448 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: Fix secondary thread event processingMorten Sørvig2023-01-061-4/+0
| | | | | | | | | | | | | | | | Fix test failure in WasmEventDispatcherTest::postEventSecondaryThread() Revert to using qGlobalPostedEventsCount() for determining pending events state, but move the final check to after sending posted events. Also remove a superfluous check. This partially reverts/amends cc60d706. Task-number: QTBUG-109066 Pick-to: 6.5 Change-Id: If4f437ce9379282c3d60b0272845a975794883de Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Fix event dispatching on WASMMikolaj Boc2022-12-161-0/+4
| | | | | | | | | | | | 1) Check only for the events that the dispatcher is able to process, otherwise it enters an endless loop 2) Take care to run the correct wake up callback with Asyncify.handleSleep Fixes: QTBUG-109066 Change-Id: I10d29d18962c3e438e56712e1f43ecadedb6205c Pick-to: 6.5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: Fix up namespacing in wasm platform pluginLorn Potter2022-06-181-0/+4
| | | | | | Pick-to: 6.4 Change-Id: I2fdbb6688b252743578dfcd58f9259eb5ac3cca8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-28/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* wasm: Use new event dispatcher for QtGuiMorten Johan Sørvig2021-12-231-190/+4
| | | | | | | | | | | | | The event dispatcher implementation is now in QtCore, except for the call to QWindowSystemInterface::sendWindowSystemEvents(). Implement QWasmWindow::requestUpdate() using emscripten_request_animation_frame(), instead of the previous registerRequestUpdateCallback() function which now is removed. Pick-to: 6.3 Change-Id: I7a13eb5391d48dba0f2afe4704ef3188b8daa74b Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: Fix source code comment typosJonas Kvinge2021-10-121-1/+1
| | | | | Change-Id: I9b2b76c01880c7bb515fdc1a6c4ef1f0bcf6be95 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: add DialogExec hack back with warningMorten Sørvig2021-08-191-0/+10
| | | | | | | | | | | | | | | Previously, this was implemented in QEventLoop. By moving it to the event dispatcher we can target the warning message better and provide a suggested workaround for the dialog case. The behavior is the same as before: call emscripten_sleep(), which throws a Javascript exception and returns control to the browser while leaking the content of the stack. Pick-to: 6.2 Change-Id: I2979fe4fe5923c27713e85b6725614b60a693e93 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: don’t deadlock on event processingMorten Johan Sørvig2020-11-041-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | emscripten_async_run_in_main_runtime_thread_ schedules an async call on the on the main thread. However, the calls are ordered, also in respect to _synchronous_ calls to the main thread (for example those made during file write/flush). Making a synchronous call from a secondary thread may then cause Emscripten to service previously scheduled async calls during the synchronous call. This can cause a deadlock if: - a secondary thread makes a sync call while holding a lock, and - a previously scheduled async call attempt to acquire the same lock on the main thread. (See https://github.com/emscripten-core/emscripten/issues/10155 for sample code) Avoid this case by adding a second zero-timer async call; this way Qt should process events when the main thread becomes idle. Change-Id: I221fe4e25bbb1a56627e63c3d1809e40ccefb030 Pick-to: 5.15 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Get rid of hasPendingEvents() and flush()Lars Knoll2020-09-061-1/+3
| | | | | | | They are unused. Change-Id: I77383f2be45551401ed9c2f88285511134cc8b0d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: do not try to resume main thread if mainloop has not started yetLorn Potter2020-04-141-1/+2
| | | | | | | (cherry picked from commit d928beb024c240b37d35d2c53f25648c99a484b4) Fixes: QTBUG-83293 Change-Id: Ibd891629d1d023e47d196dd60821cc5c583a178d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: guard nonthreaded builds from using threading.hLorn Potter2020-02-181-0/+2
| | | | | Change-Id: Ib5cd8afc4822cc89371d184ee5645ed8f496c8b0 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Wasm: Support event loop wakeup from secondary threadsMorten Johan Sørvig2020-01-121-0/+23
| | | | | | | | | | | | | | | | | | | | Minimal fix for the missing wakeup issue, in leu of a new event loop implementation. So far, emscripten_async_run_in_main_runtime_thread_ looks to be our option for scheduling calls on the main thread. This function is available on emsdk 1.38.22 and higher. Requires making from QEventDispatcherUNIX::wakeUp() non-final. The future event dispatcher implementation will not inherit QEventDispatcherUNIX, so this is a temporary change. Fixes: QTBUG-75793 Task-number: QTBUG-76007 Change-Id: Ie6f6ee6f7674206fc0673a4fe866ac614432ab65 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* WebAssembly for QtBaseMorten Johan Sørvig2018-08-301-0/+181
This is the squashed diff from wip/webassembly to dev. Done-with: Peng Wu <peng.wu@intopalo.com> Done-with: Sami Enne <sami.enne@intopalo.com> Done-with: Morten Johan Sørvig <morten.sorvig@qt.io> Started-by: Andrew Knight <andrew.knight@intopalo.com> Change-Id: I6562433c0a38d6ec49ab675e0f104f2665f3392d Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>