summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard2022-05-1637-1036/+74
| | | | | | | | | | | | | 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>
* qtloader.js: remove "getProcAddress" error filteringMorten Sørvig2022-05-131-6/+0
| | | | | | | | | Emscripten no longer prints an error for each getProcAddress lookup failure and this code can be removed. Change-Id: I082f420772677196c8eb82c49546825c750377ae Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* qtloader.js: forward stdErr to console.warn()Morten Sørvig2022-05-131-1/+1
| | | | | | | | | This is the correct mapping, and as a bonus the Chrome browser provides a stack trace on all output from console.warn(). Change-Id: I4a1b95475679d6b54a0690f51c23683514fe7985 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* wasm: fix specialHtmlTargets codeMorten Sørvig2022-05-121-3/+2
| | | | | | | | Remove .as_handle() call, which was left over from the previous EM_ASM-based code; see 0ec75f4b9. Change-Id: I220304074f4d17e706726dab086c0330edc9ef25 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: remove window from requestUpdate queue on removeWindow()Morten Sørvig2022-05-121-0/+1
| | | | | | | | | | Don't deliver update requests to windows which have been deleted or are not on screen. Change-Id: Ia2972e8dbef46eaf91a45a84962353917d436da6 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: David Skoland <david.skoland@qt.io>
* wasm: always call destroy() before deleting a screenMorten Sørvig2022-05-123-7/+6
| | | | | | | | | | | | | | | | | | | QWasmCompositor currently has the requirement that destroying it requires freeing a GL texture, which requires a valid GL context, which requires a valid screen, in order to get to the native context on the canvas. For this reason QWasmScreen has a destroy() function which is called before deleting the QScreen and QPlatformScreen. Make sure we call destroy() also when deleting all screens in the QWasmIntegration destructor. Move the common logic into a new deleteScreen() function which replaces destroy(). Change-Id: I628f13c868808db539effff9b29ecbefac23abc9 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: David Skoland <david.skoland@qt.io>
* wasm: add support for drag into browser windowLorn Potter2022-05-107-2/+349
| | | | | | | | | Drag and drop into the browser will work. Drag and drop out of the browser will not. Fixes: QTBUG-102242 Change-Id: Id9981ab6f9514535e1409bec18068790833a67a6 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix window states and transitions in wasmDavid Skoland2022-05-062-27/+53
| | | | | | | | | | | | | | | | | Window states and their transitions do not currently work correctly in wasm (eg. showFullScreen -> showNormal). In order to fix this, we need to conform to Qt's way of handling windows and their geometry, which involves deferring much of the actual geometry changes to when it actually becomes visible, or else the QWidget code interferes with what we're trying to do. Change-Id: I8c7da0be76760363e444dc5dc676036e70863f6e Fixes: QTBUG-102190 Pick-to: 6.3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: destroy compositor and screen in orderMorten Sørvig2022-05-061-2/+5
| | | | | | | | | | | | | | The QWasmCompositor destructor deregisters event handlers, which means it needs to look up the the canvas element, which again means that this needs to happen before we clear the canvas from specialHTMLTargets. Also, calling destroy() is not needed since the QWasmCompositor destructor makes this call. Change-Id: I3004b94d0459c28642d3bd8bf9fe794c9b658477 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Mark mouseEvent in wasm compositor as unusedDavid Skoland2022-05-041-0/+1
| | | | | | | | If this is not there, compiling fails for all-warnings-are-errors, which seems to be enabled by default. Change-Id: Id4cafaa635be201b649012ce8fc75f7cb5fb88a3 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Plugins: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-043-4/+10
| | | | | | | | | As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Task-number: QTBUG-98434 Change-Id: I7fadd3cf27ad099028d70f05956303e3af62c0f5 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* wasm: fix window leave and enter eventsLorn Potter2022-04-282-2/+60
| | | | | | | | | | | | Leave and enter events are not happening when the mouse enters or leaves the browser window/canvas. Done-with: Alexandra Cherdantseva <neluhus.vagus@gmail.com> Change-Id: I702584980c6bea6a36143281de658e566e4c155b Pick-to: 6.3 Fixes: QTBUG-100950 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: don't show the resize cursor for fullscreen windowsMorten Sørvig2022-04-251-1/+5
| | | | | | | | | | The compositor should not show the resize cursor for fullscreen and maximized windows, since windows in those states aren't resizable. Pick-to: 6.3 Change-Id: I58762b7729a02f9a3c78edafe5d9d5b364fb552f Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: initialize htmlCursorName to "default"Morten Sørvig2022-04-251-1/+1
| | | | | | | | | | | | | | | The canvas cursor should always be restored to "default" if no cursor is set, otherwise we get the I-beam cursor since the canvas is contenteditable. The code which handles setting and restoring the override cursors handles this correctly, however we also need to set the default htmlCursorName for cases where setOverrideWasmCursor() is not called. Pick-to: 6.3 Change-Id: I23be7847d3a30ab78e3a8c9ec402285246bfefec Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: fix initial window paint eventLorn Potter2022-04-201-3/+0
| | | | | | | | | | | | | | | | | We were requesting to activate the window too soon, when the window was still in the initial size of 600x600, in which case, the paint event was not getting called. This would require the user to have to click the window in order to see it. Removal of this does not seem to effect showing of tooltips, which it was added initially. Change-Id: I3efa86be99a3d9e1d9eda87b7537fff1e96e6774 Fixes: QTBUG-102005 Pick-to: 6.3 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* wasm: propagate QWindow format to backing storeMorten Sørvig2022-04-191-5/+10
| | | | | | | | | | | | | | | Qt backing store images should have alpha iff that was requested by the QWindow's surface format. This changes wasm to be in line with the other platforms, and enables use of transparency for Qt windows. Change beginPaint() to clear the backing store only if the format/image has alpha. This is also established behavior Qt's backing stores. Change-Id: Idafe658e24d864f7c4f9e68ee39cb409982b5852 Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: David Skoland <david.skoland@qt.io>
* wasm: use emscripten::val for specialHTMLTargetsLorn Potter2022-04-151-6/+8
| | | | | | | | | | | We need to add specialHTMLTargets to EXPORTED_RUNTIME_METHODS in order to use it, as Emscripten does not export it. Also, EM_ASM is not allowed for SIDE_MODULES, so it's better to use emscripten::val methods. Change-Id: I9b352ac98e2a961157f5bb36456bec3e35891270 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: use “specialHtmlTargets” for canvas lookupMorten Johan Sørvig2022-04-054-8/+33
| | | | | | | | | | | | | | | | | | We’d like to support use cases which require using multiple html documents, for example when displaying application content using more than one browser window. Normally Emscripten uses the primary html document when looking up elements by id, which means that targeting elements on secondary documents is not possible. Emscripten does provide a workaround: the application can create custom id mappings to any html element on the “specialHtmlTargets” object, and then use the “!id” syntax instead of normal “#id” lookup. Change-Id: I4dda920868cfbc6f8991425daf8933144c0ffad8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: rename “canvas” API to “container”Morten Johan Sørvig2022-04-011-25/+25
| | | | | | | | | | We now accept using div element as the root element for application content, instead of a canvas. Rename API and variables accordingly, where “container” covers both the div and canvas cases. Change-Id: Ibc2e096bcd5ca7e08609da348c53a404a4955c94 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: fix android input when fast typingLorn Potter2022-04-011-7/+18
| | | | | | | | | | | | | This fixes two issues: When user fast types, more than one character would get sent sometimes. Also, occasionally, 'Process' would appear along side of the typed character. Change-Id: I2ea3bfcbe987703bcbf298e0a0301bed6b8fccb3 Done-with: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Pick-to: 6.3 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: Support non-canvas container elementsMorten Johan Sørvig2022-03-316-21/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Support specifying that Qt should use a div element as the root container, in which case canvas management is moved to Qt C++ code. This enables us to take ownership of the canvas and its configuration. In addition, it allows creating child elements for the Qt container (canvas element children have a special role are as fallback elements displayed in case the browser can’t show the canvas) Remove support for reading Module.canvas, which was deprecated in Qt 5. Add support for reading Module.qtContainerElements, which can be either a canvas element (legacy) or a div element (preferred). Deprecate qtCanvasElements and print warning on usage. Change QWasmScreen to accept either a canvas or any html element. In the latter case, create the canvas and configure it as required by Qt. Change-Id: I57df8fb5772b2bfbba081af3f572b8b0e7d51897 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: Use % instead of vh for canvas dimensionsAleksandr Reviakin2022-03-131-1/+1
| | | | | | | Pick-to: 6.3 Fixes: QTBUG-95067 Change-Id: I19e439eb81200728c2b773ab6799bb205caa1231 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Compose render-to-texture widgets through QRhiLaszlo Agocs2022-03-112-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QPlatformTextureList holds a QRhiTexture instead of GLuint. A QPlatformBackingStore now optionally can own a QRhi and a QRhiSwapChain for the associated window. Non-GL rendering must use this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still rely on resource sharing between contexts. A widget tells that it wants QRhi and the desired configuration in a new virtual function in QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is evaluated (among a top-level's all children) upon create() before creating the repaint manager and the QWidgetWindow. In QOpenGLWidget what do request is obvious: it will request an OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget) will be more interesting: it needs to honor the standard Qt Quick env.vars. and QQuickWindow APIs (or, in whatever way the user configured the QRhiWidget), and so will set up the config struct accordingly. In addition, the rhiconfig and surface type is (re)evaluated when (re)parenting a widget to a new tlw. If needed, this will now trigger a destroy - create on the tlw. This should be be safe to do in setParent. When multiple child widgets report an enabled rhiconfig, the first one (the first child encountered) wins. So e.g. attempting to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same top-level window will fail one of the widgets (it likely won't render). RasterGLSurface is no longer used by widgets. Rather, the appropriate surface type is chosen. The rhi support in the backingstore is usable without widgets as well. To make rhiFlush() functional, one needs to call setRhiConfig() after creating the QBackingStore. (like QWidget does to top-level windows) Most of the QT_NO_OPENGL ifdefs are eliminated all over the place. Everything with QRhi is unconditional code at compile time, except the actual initialization. Having to plumb the widget tlw's shareContext (or, now, the QRhi) through QWindowPrivate is no longer needed. The old approach does not scale: to implement composeAndFlush (now rhiFlush) we need more than just a QRhi object, and this way we no longer pollute everything starting from the widget level (QWidget's topextra -> QWidgetWindow -> QWindowPrivate) just to send data around. The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split is all gone. Instead, there is a QBackingStoreDefaultCompositor in QtGui which is what the default implementations of composeAndFlush and toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs should continue working mostly as-is, apart from adapting to the texture list changes and getting the native OpenGL texture id out of the QRhiTexture) As QQuickWidget is way too complicated to just port as-is, an rhi manual test (rhiwidget) is introduced as a first step, in ordewr to exercise a simple, custom render-to-texture widget that does something using a (not necessarily OpenGL-backed) QRhi and acts as fully functional QWidget (modeled after QOpenGLWidget). This can also form the foundation of a potential future QRhiWidget. It is also possible to force the QRhi-based flushing always, regardless of the presence of render-to-texture widgets. To exercise this, set the env.var. QT_WIDGETS_RHI=1. This picks a platform-specific default, and can be overridden with QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be extended to query the platform plugin as well to check if the platform plugin prefers to always do flushes with a 3D API. QOpenGLWidget should work like before from the user's perspective, while internally it has to do some things differently to play nice and prevent regressions with the new rendering architecture. To exercise this better, the qopenglwidget example gets a new tab-based view (that could perhaps replace the example's main window later on?). The openglwidget manual test is made compatible with Qt 6, and gets a counterpart in form of the dockedopenglwidget manual test, which is a modified version of the cube example that features dock widgets. This is relevant in particular because render-to-texture widgets within a QDockWidget has its own specific quirks, with logic taking this into account, hence testing is essential. For existing applications there are two important consequences with this patch in place: - Once the rhi-based composition is enabled, it stays active for the lifetime of the top-level window. - Dynamically creating and parenting the first render-to-texture widget to an already created tlw will destroy and recreate the tlw (and the underlying window). The visible effects of this depend on the platform. (e.g. the window may disappear and reappear on some, whereas with other windowing systems it is not noticeable at all - this is not really different from similar situtions with reparenting or when moving windows between screens, so should be acceptable in practice) - On iOS raster windows are flushed with Metal (and rhi) from now on (previously this was through OpenGL by making flush() call composeAndFlush(). Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: fix native keyboard on iOSLorn Potter2022-03-053-5/+11
| | | | | | | | | Apple added iPhonePlatform to navigator properties and so use that Fixes: QTBUG-101441 Change-Id: I5a0f27fc18dfa224b6373c5d809cf884d51c880a Pick-to: 6.3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: enable mobile native keyboardingLorn Potter2022-03-039-15/+301
| | | | | | | | | | | | | | | | | | | | | | | | | | | This works on iOS and Android, and Windows with touchscreen. On Android, we need to listen to the input event of a hidden text element and synthesize Qt keyboard events from that in order to get input events into Qt. On Windows, we need to be more creative about bringing the native virtual keyboard up. Because the entire canvas is contenteditable, we need to specify the inputmode is set to 'none', otherwise the v keyboard pops up when user clicks anywhere on the canvas. Therefore we set a hidden element as contenteditable, which pops up keyboard when Qt needs it for editable widgets. On Android, this is the same element that is used to proxy the keyboard input. [ChangeLog][wasm] Add support for native mobile keyboard Done-with: Morten Johan Sørvig <morten.sorvig@qt.io> Fixes: QTBUG-83064 Fixes: QTBUG-88803 Change-Id: I769fe344fc10c17971bd1c0a603501040fe82653 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Close WASM popups on non-accepted clicksDavid Skoland2022-03-021-1/+5
| | | | | | | | | | Generally, all clicks that weren't in a window or weren't handled should trigger a closing of all popups. Fixes: QTBUG-90990 Pick-to: 6.3 6.2 Change-Id: I40e6351b265e95e0570e7c5d42f3d5b222538453 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: make input callback returns consistentLorn Potter2022-02-201-8/+4
| | | | | | Change-Id: I43d9db1723d85eef69cfa2e51da4a6a640e8b3c5 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: reliably determine QScreen positionMorten Johan Sørvig2022-02-171-8/+9
| | | | | | | | | | | | | | | | | | | | | | Fix bug where QWindow content would be drawn with an offset from the QScreen’s topLeft if the page was scrolled. On Qt for WebAssembly, screen geometry is equivalent to canvas geometry, where the canvas position is the position of the canvas on the document body. getBoundingClientRect() is the correct function to use here, however it returns a rect relative to the viewport. Offsetting this rect by offsetLeft/Top can work in some bases, but this offset is relative to HTMLElement.offsetParent and not necessarily to the document body. Determine the correct QScreen position by subtracting the body position from the canvas position (both relative to the viewport). Change-Id: Ifb7fd28adedbf997d63f79f9b626cfcf3664ff54 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: move canvas configuration to Qt implementationMorten Johan Sørvig2022-02-163-7/+23
| | | | | | | | | | | | | | The required canvas configuration is an implementation detail; move it out of the .html file (which we expect that users will replace), and into the QWasmScreen constructor. This also enables using a div element as the container element (instead of a canvas), since Qt then can create and configure the canvas during QWasmScreen construction. Change-Id: Ia849517d00fa3e8ec307065a524c0c91296dd490 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: fix installation when staging prefix is usedSamuli Piippo2022-01-201-1/+2
| | | | | Change-Id: I2f9acdd977702f78c75eaeb67fc67f1b82836ff7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Move input event logic into QWasmCompositorDavid Skoland2022-01-179-598/+658
| | | | | | | | | | | | | | | | | | | | | Move the window logic and state out of QWasmEventTranslator and into QWasmCompositor. The reasoning for this change is that the state of the windowing system was split between QWasmCompositor (eg. window stack) and QWasmEventTranslator (eg. dragged and pressed windows). This change moves the input handling and state to QWasmCompositor and demotes QWasmEventTranslator to a helper class. In this model, QWC acts as a proper window system / display server and can leverage multiple helper classes which are "owned" by the QWC. Here is a quick diagram illustrating the proposed general architecture around WASM window handling and its difference from typical OSes: https://i.imgur.com/vcBwUPf.png Change-Id: Idca617992b8e1b431e5c71d46b5db61597c99e75 Pick-to: 6.3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: ensure cursor reverts after window resizeLorn Potter2022-01-124-9/+46
| | | | | | | | | | | | | | 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: don’t exit on clean return from main()Morten Johan Sørvig2022-01-051-0/+6
| | | | | | | | | | | | | | | Qt 6 uses Emcripten’s default of not exiting the runtime when main() exits. Make qtloader not transition to the “Exited” state when main() exits with code 0, since this would hide the app canvas. (The app state tracking code in qtloader is by now outdated, and should be revisited.) Pick-to: 6.3 Change-Id: Ib47898f1dd93d87b2675f20cd39f96ac3cb681a7 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: always use requestAnimationFrame for updatesMorten Johan Sørvig2022-01-055-65/+116
| | | | | | | | | | | | | | | | | | | | | The compositor was posting update events and flushing/redrawing using a zero-timer. Change this to use the request_animation_frame API from Emscripten, which makes sure we flush window content at the next native paint event. This has the additional benefit that hidden canvases (e.g on hidden tabs) won’t get frame events, and then stop painting. We support both well-behaved QWindows, where the window calls requestUpate() and then paints/flushes on the following deliverUpdateRequest(), and also less well behaved windows which paints at any point during event processing. Pick-to: 6.3 Change-Id: I747d6f7ace86ceddaa18ab86b6a0ee833f98991b Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: Use new event dispatcher for QtGuiMorten Johan Sørvig2021-12-235-230/+18
| | | | | | | | | | | | | 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>
* Declare params in qwasmclipboard unusedDavid Skoland2021-12-151-0/+2
| | | | | | | | | | Without this, it won't compile with the -developer-build configure option (warnings are errors) Pick-to: 6.3 6.2 Change-Id: I114370e918d63bd6e8855b5f750999cf372e2f6d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: improve clipboard supportLorn Potter2021-12-083-77/+336
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for Clipboard API Add clipboard manual test Also includes these fixes: - improve clipboard use for chrome browser - make QClipboard::setText work - html copy and paste - image copy/paste Chrome browser supports text, html and png To use the Clipboard API, apps need to be served from a secure context (https). There is a fallback in the case of non secure context (http) - Firefox requires dom.events.asyncClipboard.read, dom.events.asyncClipboard.clipboardItem and dom.events.asyncClipboard.dataTransfer to be set from about:config, in order to support the Clipboard API. Change-Id: Ie4cb1bbb1dfc77e9655090a30967632780d15dd9 Fixes: QTBUG-74504 Fixes: QTBUG-93619 Fixes: QTBUG-79365 Fixes: QTBUG-86169 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: make the compositor draw the window iconMorten Johan Sørvig2021-12-062-2/+9
| | | | | | | | | | | | | | | | Currently the compositor draws the Qt logo by default; check if the window has an icon and draw that instead if set. Fixes: QTBUG-86052 Pick-to: 6.2 Change-Id: Ia4f9c03562c15993c86cb8717f27e47ab669353d Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: Fix assert/crash when tooltip window is closed and mouse movedLorn Potter2021-12-011-3/+3
| | | | | | | | Fixes: QTBUG-92521 Pick-to: 5.15 6.2 Change-Id: I627fdcf3064321a3c1cb1140473038571ec78b9e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix mouse move and right clickLorn Potter2021-11-271-4/+8
| | | | | | | | | | | | Emscripten has no concept of 'no mouse button', so when there is no button down, it was sending left mouse. Also we were hiding mousepress for only leftmouse downs. Fixes: QTBUG-97431 Pick-to: 6.2 Change-Id: Ibf078705c343944e45551830b7fee94ed5aa7333 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: remove unused variableMorten Johan Sørvig2021-11-191-4/+0
| | | | | | Change-Id: I442e3dc4534193709c3510c43a484e5d3c2eb4af Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Remove unreachable breaksDavid Skoland2021-11-101-5/+0
| | | | | Change-Id: I0e005964624125d3ab12f77c94fd393802547a13 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: fix size of QDialogsLorn Potter2021-11-061-1/+6
| | | | | | | | | We can simply propagate the minimum window size. Pick-to: 6.2 5.15 Fixes: QTBUG-83503 Change-Id: Ia9f67c92ca37fd0f4e89f08e5153e12c1385f6f8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix changing cursor shapeLorn Potter2021-10-292-9/+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>
* Revert "wasm: Hide popups when a window is left-clicked"David Skoland2021-10-291-3/+0
| | | | | | | | | This reverts commit 0921caf9769c84192c539db22085d343f1a4b5b1. Reason for revert: This change breaks mouse press handling in popups themselves. I'll make another solution. Change-Id: Ib9fd41f3f078e6abf22e5b0f75724d4acc737ead Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Adjust behavior of windowIsPopupType and hasTitleBarDavid Skoland2021-10-272-9/+8
| | | | | | | | | | | The previous implementation did not check for the popup flag, so it was added, and the tool window exception was preserved. hasTitleBar was also changed so it checks for popups and not tooltips specifically (tooltips are always popups). Change-Id: I3e2ba3be56e992b30ca2a07375092073572e7fcb Pick-to: 6.2 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: fix window activationLorn Potter2021-10-273-1/+9
| | | | | | | | | | | | | | This fixes window activation of dialogs and tooltips In the case of tooltips, We were activating the window being removed. In the case of dialogs, we need to raise the window before requesting the activation. Change-Id: Ie989e6d92afedf1895b5e188f0695f6254d70272 Fixes: QTBUG-94918 Pick-to: 5.15 6.2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: Hide popups when a window is left-clickedDavid Skoland2021-10-251-0/+3
| | | | | | | | | This logic is taken from the macOS platform implementation and seems reasonable to reuse in WASM. Fixes: QTBUG-90990 Change-Id: Id4a4dd8d9fdd9de3085bfcd9079793aad3dda363 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Make sure Qt::Popup is treated like a dialogDavid Skoland2021-10-182-3/+2
| | | | | | | | | | | According to the documentation, Qt::Popup should have a proper frame with a title bar. To honor this, two functions had to be slightly altered. Change-Id: I4bbc18e6b7fbec5702fad6e22ef2226c09dea15a Fixes: QTBUG-94768 Pick-to: 5.15 6.2 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Add comment about the meaning of magic number in QWasmEventTranslatorDavid Skoland2021-10-181-0/+5
| | | | | | | | Without this comment, the button == 0 code is very cryptic. This comment helps in deciphering what exactly is being checked. Change-Id: Ied96118362d097d7036bafcc491b8574e1225de1 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>