summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmcursor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* WASM builds now handle bitmap and pixmap cursorsKevin Keating2024-02-081-5/+22
| | | | | | | | | | | [ChangeLog][QtGui][Platform Specific Changes][wasm] Previously, bitmap and pixmap cursors were nonfunctional in wasm builds and would trigger warnings. These cursors now work as expected. Fixes: QTBUG-116796 Pick-to: 6.5 6.6 6.7 Change-Id: Idd9aa4d458a36452fd5b49f72cc595756fc50923 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: restore windowCursor nullptr checkMorten Sørvig2023-03-141-4/+3
| | | | | | | | | | This check was accidentally removed in commit 783b63ce. If the cursor is null, set the default cursor. Pick-to: 6.5 6.5.0 Change-Id: I894d5e04cd7b49041bd0d3b59fc816a8b7efffe7 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* Set the cursor in QWasmWindowMikolaj Boc2023-01-241-84/+35
| | | | | | | Also, trim QWasmCursor as some of it was dead code. Change-Id: If6fee3390e4c2a2c66ceaef5917d7387f8dbd46c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Add QString<->emscripten::val conversion functionsMikolaj Boc2023-01-131-1/+0
| | | | | | | | Following the QRect, add functions converting the QString to native emscripten::val and back: fromJsString, toJsString Change-Id: I2d0625ede3bbf7249e2e91b8de298b5b91df8ba2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Use the browser compositor for drawing windows on WASMMikolaj Boc2022-11-261-4/+1
| | | | | | | | | | | | | | | | Make the browser compositor draw the window non-client area (using css + html). Get rid of OpenGL usage in non-OpenGL windows and use canvas 2d context instead to blit the texture (QImage). Also, as part of the change, remove the deprecated canvas element support in QScreen. Fixes: QTBUG-107116 Fixes: QTBUG-107219 Change-Id: I65f0d91831c806315685ca681ac0e416673f5cd5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* Refactor code focused around QWasmCompositor::processMouseMikolaj Boc2022-07-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactoring of the logic around QWasmCompositor::processMouse has been performed for readability and easier modification, in preparation for further fixes for event delivery and handling in windows. There should be no logic changes, just cleaner code. Change groups: Members of QWasmCompositor have been prefixed by m_ for easier discerning of stateful and stateless variables in functions. Variables renamed to more descriptive, e.g. window2->targetWindow, globalPoint->targetPointInScreenCoords. Magic numbers eliminated, e.g. mouseEvent->button == 0 is now button == Qt::MouseButton::LeftButton. Some common condition checks have been wrapped into single constants, e.g. !(htmlWindow->m_windowState & Qt::WindowFullScreen) && !(htmlWindow->m_windowState & Qt::WindowMaximized) == isTargetWindowResizable Some nested if-conditions were collapsed. Some unnecessary checks have been moved to outer if conditions (e.g. for draggedWindow in EMSCRIPTEN_EVENT_MOUSEMOVE, since the code would crash anyway because only some parts are guarded against it being nullptr). Consts introduced so that variables are only used for one purpose. Made QWasmEventTranslator::translateMouseButton constexpr Made QWasmWindow::isPointOnTitle behave correctly when the window has no title bar so that no flag probing is needed prior to calling it. Made QWasmCursor::setOverrideWasmCursor accept a const ref - having it accept pointer suggested it might dangle. Change-Id: I8910622fddad764ee86eb0260b5ad23c7ee7f97a Reviewed-by: David Skoland <david.skoland@qt.io>
* wasm: Fix up namespacing in wasm platform pluginLorn Potter2022-06-181-0/+3
| | | | | | 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: ensure cursor reverts after window resizeLorn Potter2022-01-121-5/+21
| | | | | | | | | | | | | | This partially reverts 97be0cca174a3b92c24062c557bf4df34db23f7b but without the crash We temporarily override the wasm cursor while leaving the application/window cursor alone to mimic what desktop application behavior is like. Pick-to: 6.3 Fixes: QTBUG-99111 Change-Id: I23df48b2eaa82830593f1753ec23d14fe375b70c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix changing cursor shapeLorn Potter2021-10-291-6/+10
| | | | | | | | | | | | | The previous implementation would occasionally result in a crash when a window was closed. Apparently 'auto' cursor does not work so well, so we now use 'default' name. Fixes: QTBUG-96178 Pick-to: 6.2 5.15 Change-Id: I0179d20dbdc01f0e3021d746324e1e39c678a298 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: store and pass canvases as emscripten::valMorten Johan Sørvig2020-02-121-3/+1
| | | | | | | | | | | | | | | | | | | | Store and pass canvases as emscripten::val instead of a QString containing the element id. This simplifies code which interacts with the canvas using the emscripten::val API, by removing the need to look up with getElementById. The Emscripten C event API does not accept emscripten::val, and using the element id is still needed here. emscripten::val does not provide a hash key suitable for use with QHash, but does provide an equality-compare in the form of val::equals(). Change the canvas->screen mapping code to use a QVector instead of a QHash. Change-Id: I1dbdbbc8fb06bb869031f1500e83ae2d64780a7f Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: fix redundant string conversions between wasm and JavaScriptAlexandra Cherdantseva2020-01-221-3/+4
| | | | | | | | | | | | | | | Avoid redundant conversions from UTF16 to UTF8 to UTF16 with help of new class QWasmString static methods: + QWasmString::fromQString to convert QString to js string using js Module.UTF16ToString + QWasmString::toQString to convert js string to QString using js Module.stringToUTF16 Fixed document.getElementById calls for cavasId with unicode characters. Change-Id: I3fc55bfeb6aeda75fa3acd85d22cea667b542f38 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: do not get canvas as property of js global objectAlexandra Cherdantseva2020-01-131-2/+6
| | | | | | | | | You cannot be sure that property with specified key in a global object is really a canvas. Should use `document.getElementById`. Change-Id: Ife55adaad5517aed64122b0c9bff32489cf19a2f Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: support all cursor shapesAlexandra Cherdantseva2019-12-301-7/+14
| | | | | | | | Every Qt::CursorShape is supported. Tested in Chrome, Firefox and Safari. Change-Id: I38c9024dba4af70af789ac84ad7e38f749c847d7 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: support rendering to multiple canvasesMorten Johan Sørvig2019-03-081-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt (via the the qtloader.js API) now supports rendering to multiple canvases. The application sees each canvas as a QScreen. Make qtloader.js support multiple canvases: var qtloader = QtLoader({ canvasElements : [array-of-canvas], showCanvas: function() { // make canvas(es) visible }, }); The canvases were previously created/returned by showCanvas(), however this function is called after the Qt app has been started and adding screens that that point is too late. (This worked before since there was only one screen, and no need to connect each screen instance to specific canvas.) Remove QWasmScreen, QWasmCompositor, and QWasmEventTranslator singletons from QWasmIntegration. These are are now crated per-screen and are owned by the QWasmScreen. Task-number: QTBUG-64079 Change-Id: I24689929fd5bfb7ff0ba076f66937728fa4bc4e4 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: make setting the cursor shape work againMorten Johan Sørvig2019-02-211-1/+2
| | | | | | | | | Commit 960af0d64 ported away from EM_ASM but also changed the logic. Set the canvas.style.cursor property, like it originally did. Change-Id: Ie4b23abeae54173894bff1db000a305c459684bb Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: remove EM_ASM calls in wasm platform pluginLorn Potter2019-02-131-5/+2
| | | | | | Change-Id: I8453836b6730d18eaaa4ffe1fb9cb3933079ebee Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* WebAssembly for QtBaseMorten Johan Sørvig2018-08-301-0/+131
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>