summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qeventdispatcher_wasm.cpp
Commit message (Collapse)AuthorAgeFilesLines
* wasm: fix native timer update for the no-timer caseMorten Johan Sørvig2021-11-111-2/+10
| | | | | | | | | | | | | QTimerInfoList::timerWait() does not update the timespec out argument if there are no active timers, which caused the current code to calculate an arbitrary toWaitDuration. Instead use the timerWait() return value, and clear any native timers if there are no active Qt timers. Pick-to: 6.2 Change-Id: I7d5ec4c2930000bece6f6ea6c63e76f4df543b04 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: make timers work for the new event dispatcherMorten Johan Sørvig2021-11-111-3/+0
| | | | | | | | | | Don’t exit from the timer callback if there is no main thread event dispatcher, since it could be that the main thread event dispatcher is of the old event dispatcher type. Pick-to: 6.2 Change-Id: Ibb7a34a99e2001b52d2a985022f5baa7cd2152bf Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: enable event dispatcher asyncify supportMorten Johan Sørvig2021-11-041-22/+8
| | | | | | | | | | | | | | | | | | | | | Misc. fixes, including: Fix a couple of typos in the JavaScript code. Also, macros- within-macros don’t work, (without resorting to preprocessor token pasting), so remove the debug output for now. Limit the exec() “simulateInfiniteLoop” workaround to top-level application exec() only. This way, asyncify can be used for nested QEventLoop::exec() calls. (Emscripten supports one level of suspend only, so we don’t want to use that for the top-level exec(), but instead use it for dialogs and such). Use the new QEventLoop::ProcessEventsFlag::ApplicationExec enum value to detect the exec() call type. Change-Id: Ic702bfc31faf2e9f84ac5d3ccf43d067c5c61bf0 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QEventDispatcherWasm: Fix typo in debug messageJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 6.2 Change-Id: I183de5fd477b9529dd5272c88a196b9bebf4ab66 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* corelib: Fix typos in source code commentsJonas Kvinge2021-10-121-3/+3
| | | | | | Pick-to: 6.2 Change-Id: Ic78afb67143112468c6f84677ac88f27a74b53aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* wasm: fix runOnMainThread()Morten Johan Sørvig2021-10-011-6/+10
| | | | | | | | | | | Calling emscripten_async_run_in_main_runtime_thread_() with a pointer to a static lambda was too clever, use an anonymous function as callback instead. Pick-to: 6.2 Task-number: QTBUG-94344 Change-Id: I2d8a8b0ffc2dd1d02018aa5902550216d00f641d Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: limit exec() workarounds to the main threadMorten Johan Sørvig2021-09-301-4/+6
| | | | | | | | | | This fixes a bug where calling exec() on a secondary thread would make the thread exit. Task-number: QTBUG-94344 Pick-to: 6.2 Change-Id: I259c7ebbd53271609af88aca141d88c282cbcd34 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QEventDispatcherWasm: handle EventLoopExecMorten Johan Sørvig2021-09-151-0/+18
| | | | | | | | | Call emscripten_set_main_loop like the old GUI event dispatcher did, with one difference that requestAnimationFrame updates are now no longer handled by the event dispatcher. Change-Id: If02d90ae9c45d7b38999567d733a237af842cded Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: add DialogExec hack/warning to event dispatcherMorten Johan Sørvig2021-09-081-0/+18
| | | | | | | | Show the warning (and call emscripten_sleep) for the standard build, but not for the asyncify build. Change-Id: I695a580ea60897872beee6fa2b6ae70acb9e7dcf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: add new event dispatcher implementationMorten Johan Sørvig2021-08-271-0/+545
Add QEventDispatcherWasm to QtCore. The event dispatcher supports managing event queue wakeups and timers, both for the main thread or for secondary threads. Blocking in processEvents() (using QEventLoop::WaitForMoreEvents) is supported when running on a secondary thread, or on the main thread when Qt is built with Emscripten’s asyncify support. Code is shared for all both modes as far as possible, with breakout functions which handle main and secondary thread as well as asyncify specifics,. Some functions like wakeUp() can be called from any thread, and needs to take the calling thread into consideration as well. The current asyncify implementation in Emscripten is restricted to one level of suspend, and this restriction carries over to Qt as well. In practice this means we support one level of exec()-like API. Note that this commit does not _enable_ use of the new event dispatcher. This will be done in separate commits. Task-number: QTBUG-76007 Task-number: QTBUG-64020 Change-Id: I77dc9ba34bcff59ef05dd23a46dbf1873cbe6780 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>