summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm
Commit message (Collapse)AuthorAgeFilesLines
* wasm: futureproof EmscriptenMouseEventLorn Potter2020-01-091-2/+2
| | | | | | | | | | Future versions of emscripten will remove the timestamp, so we need to replace this with the current timestamp See https://github.com/emscripten-core/emscripten/commit/a7f058a1e6e4b72b4446a3b36f8e96f9f8f41f2d#diff-9a5d68085dc7db2938b37a2b7b05c1f5 Change-Id: Ieba323ad54933626d90ac7cbae5a2c471c52628e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-022-8/+15
|\ | | | | | | Change-Id: I7b6e6c687d8d60b4a54e6b9dada025ef66c53d96
| * wasm: fix setting translucent backgroundLorn Potter2020-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | We need to set the requested SurfaceFormat which may contain the alphaBufferSize in order for the GL context to have the alpha attribute Fixes: QTBUG-77303 Change-Id: I39860e24de49a255ab7e73bca78af92e6c074d0d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * 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: set focus on canvas on new screenLorn Potter2019-12-101-0/+2
|/ | | | | | | | This allows user to utilize the application without having to click on it first to cause the focus-in event. Change-Id: Ibc9582254dda91eb14ebcdf4b8ea4a4f862aa88d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Prevent emscripten_webgl_destroy_context from removing event handlersMorten Johan Sørvig2019-12-031-0/+7
| | | | | | | | | | | | | | | | | | | | The JavaScript implementation of that function has the following code: if (typeof JSEvents === 'object') JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas); // Release all // JS event handlers on the DOM element that the GL context is associated with since the context // is now deleted. This breaks mouse/keyboard events, etc. Disable this logic by temporarily setting the JSEvents object to undefined, for the duration of the emscripten_webgl_destroy_context call. Fixes: QTBUG-74850 Change-Id: Ied3177b0ca6e63e8ea07143bf7d6a850b0bce35a Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-11-061-1/+5
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/features/mac/default_post.prf src/corelib/tools/qsimd_p.h src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm util/qfloat16-tables/gen_qfloat16_tables.cpp Change-Id: If48fa8a3bc3c983706b609a6d3822cb67c1352a4
| * wasm: take canvas offset into accountLorn Potter2019-11-011-1/+5
| | | | | | | | | | | | | | | | | | This fixes issue with dialogs when the canvas is not at 0,0 in the browser window Change-Id: I14f6754746e064921635d6b3af3353bf3620ac44 Fixes: QTBUG-79160 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Wasm: Fix the markup in wasm_shell.htmlAlessandro Portale2019-10-291-1/+1
| | | | | | | | | | | | | | | | Img width and height are separate tags. Alternatively, they could be defined in the style tag. Change-Id: I0a4a93b63a99a7b644e9096bb9238739f408c0df Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Joerg Bornemann2019-09-201-0/+2
|\| | | | | | | | | | | | | | | Conflicts: qmake/generators/makefile.cpp qmake/generators/makefile.h Change-Id: I4c2deac4f6376c85f5e4fe7fb0ccc9ab9a013cd7
| * Prevent crash in QWasmScreen::resizeMaximizedWindows()Morten Johan Sørvig2019-09-181-0/+2
| | | | | | | | | | | | | | | | | | screen() may return a null QScreen pointer during screen initialization. Fixes: QTBUG-78118 Change-Id: Ide26eb3f06861c38cd7ae56789dd010d4cd7e572 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | wasm: recreate backing store texture with valid gl contextMorten Johan Sørvig2019-09-182-3/+7
| | | | | | | | | | | | | | | | The compositor context is not current during the resize() call, but will be during updateTexture(). Change-Id: I29c2e06aa251b564b5d622dc9380ec994e15aab0 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-08-131-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/corelib/tools/qlist.h src/gui/painting/qcompositionfunctions.cpp src/gui/painting/qtriangulator_p.h src/gui/text/qfontengine_p.h src/network/kernel/qhostinfo_p.h src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: Ib8a0308cf77224c4fbdcf56778fdac4a43e37798
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-081-0/+1
| |\ | | | | | | | | | Change-Id: I4c0fd501db974fb8339944b8df845336776d80a9
| | * eglfs: Fix raster windowsLaszlo Agocs2019-08-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also sanitize the initial WebAssembly hack. Both eglfs and wasm lack the concept of true raster windows. A QWindow with RasterSurface is rendered with OpenGL no matter what. The two platforms took two different approaches to work around the rest of the machinery: - wasm disabled the QOpenGLContext warning for non-OpenGL QWindows, - eglfs forced the QWindow surfaceType to OpenGLSurface whenever it was originally set to RasterSurface. Now, the latter breaks since c4e9eabc309a275efc222f4127f31ba4677259b7, leaving all raster window applications failing on eglfs, because flush in the backingstore is now checking the surface type and disallows OpenGLSurface windows. (just like how QOpenGLContext disallows RasterSurface windows) To solve all this correctly, introduce a new platform capability, OpenGLOnRasterSurface, and remove the special handling in the platform plugins. Change-Id: I7785dfb1c955577bbdccdc14ebaaac5babdec57c Fixes: QTBUG-77100 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-271-13/+13
|\| | | | | | | | | | | Change-Id: Ic6cfe08dbda1dc92b969e67063f805df63ba0fcf
| * | wasm: fix international dead keysLorn Potter2019-07-231-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Emscripten has changed the key code to include the string 'Digit' on numerals. We use this to detect and translate any Dead keys that may be pressed. Fixes: QTBUG-77041 Change-Id: I054e98a6cf66390b1154f25fe385e5b12840851f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QWasmEventTranslator: return Key_unknown, not 0x00, when a key isn't foundMarc Mutz2019-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This matches what translateDeadKey() returns for unhandled keys, and processKeyboard() checks for when replacing qtKey with the result of translateDeadKey(). Change-Id: I1500576b7b31047a7a35633a15cd6975b77d842d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QWasmEventTranslator: replace five QHash with constexpr C arraysMarc Mutz2019-07-162-41/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mapping is static, but a dynamic (even mutable) container was used. Fix by using C tables and liner scan, which will be just as fast or faster than a hash lookup, for the maximum of six entries of each table. Change-Id: I899d5b1428dc82cf58862f238595a266aef8279f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | Eradicate Q_FOREACH in the WASM plugin and mark the plugin free of themMarc Mutz2019-07-152-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first one is trivially correct: it clearly doesn't modify the container under iteration. The second is a bit more subtle, because drawWindow() could be expected to call a paintEvent and this could theoretically lead to lowering, closing, or opening of a window. But this function just ends up blit()ting, so it doesn't call into user code. Change-Id: Id15e0102e9c8aa12516af27d771104e9993c48a1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | QWasmFontDatabase: replace QStringList with a C array of stringsMarc Mutz2019-07-151-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The content is static, so a dynamic container is overkill. Use a C array. Don't make it static, as that creates more problems than is solves (static initialization). Change-Id: I07534c3336efbb6bbc19bfa1b8dad0c578d4e274 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-06-1417-68/+217
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/generators/makefile.cpp qmake/generators/unix/unixmake2.cpp src/corelib/thread/qthread_unix.cpp tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp Change-Id: I1df0d4ba20685de7f9300bf07458c13376493408
| * | wasm: handle mouse events even when not over a windowLorn Potter2019-05-301-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the mouse button is held and mouse moves from over the window, that window would never register the button up event, and cause issue like being able to move a dialog around by simply moving the mouse around. Change-Id: I1363ac9c9f4113a79bf6863668ba74b90b1cea4a Fixes: QTBUG-75951 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * | Merge remote-tracking branch 'origin/5.13.0' into 5.13Liang Qi2019-06-1117-64/+210
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/wasm/qwasmintegration.cpp src/plugins/platforms/wasm/qwasmintegration.h Change-Id: Idf4c7936513fb1f21daa8f6105b8545f13447bb8
| | * | wasm: rewrite/simplify OpenglContextMorten Johan Sørvig2019-05-142-35/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don’t need the contextLost callback since we can poll for the “lost” status in isValid() Recreating the native context is not very helpful, since it destroys all current context state. Remove this logic. Support makeCurrent() on different surfaces, as long as they refer to the same screen. Create the native context (and record which screen) on the first call to makeCurrent() Task-number: QTBUG-75463 Change-Id: I6eb830df14578ffdbed5b0505fe860ce433e4f9b Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
| | * | wasm: controlled screen destructionMorten Johan Sørvig2019-05-149-3/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Freeing OpenGL resources requires a current context, which (on wasm) requires a screen. Add a destroy() functions to QWasmScreen, QWasmCompositor, QWasmWindow, and QWasmBackingStore which facilitates OpenGL cleanup before we start deleting screen objects. Task-number: QTBUG-75463 Change-Id: I9954b536416b9147965c74459ccad838d1578778 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
| | * | wasm: add QWasmOffscreenSurfaceMorten Johan Sørvig2019-05-145-2/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This no-op implementation is sufficient to support OpenGL cleanup use cases, where the OpenGL context needs to be made current at times where we don't have a window available. A specific requirement on WebAssembly is that the context is tied to one specific screen; which is an extra requirement on QWasmOffscreenSurface, compared to the other platforms. Task-number: QTBUG-75463 Change-Id: Ie3658cb235bf342be66f19dfe981e3a56a90e1b6 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
| | * | wasm: use correct coordinates when blittingMorten Johan Sørvig2019-05-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The target position is the position on the canvas, not the global position on the page. Task-number: QTBUG-75463 Change-Id: I4ea2c9afacd2065fa975f6fa2e6a93d98f637854 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
| | * | wasm: prevent crash on null backingstore pointerMorten Johan Sørvig2019-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can get draw calls in between creating the platform window and the platform backing store. Task-number: QTBUG-75463 Change-Id: If0b67d40fac84e466f204ec23a267aa4c6121cbd Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
| | * | wasm: install one browser window resize handlerMorten Johan Sørvig2019-05-144-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Install one browser window resize handler instead of per-canvas resize handlers, which avoids having to uninstall on QScreen destruction. Task-number: QTBUG-75463 Change-Id: I8345262a906ed735f8e9e146f1e963f515cf0d25 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
| | * | wasm: remove qDebugMorten Johan Sørvig2019-05-071-2/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: Ic9812421b2a79a33bb138f448fe132dab141b724 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | | Merge remote-tracking branch 'origin/5.13' into devFriedemann Kleint2019-05-274-5/+35
|\| | | | | | | | | | | | | | | Change-Id: Ia279fc4a8226626041c772902a07b2f90f37b53b
| * | | wasm: fix QSGContext warning messageLorn Potter2019-05-211-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When runing the scenegraph example sgengine, gets rid if this error: QSGContext::initialize: stencil buffer support missing, expect rendering errors Change-Id: I7f3a82409bc2cf81cf8217876e527f9c45be3bf4 Fixes: QTBUG-74694 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * | | wasm: add Qt Virtual Keyboard supportDongmei Wang2019-05-162-0/+18
| | | | | | | | | | | | | | | | | | | | Change-Id: I454ab677cad25b50ba7b03ef2c4b6046e1227ce8 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
| * | | WASM: Make wasm_shell.html compatible with CMake configure_fileFredrik Orderud2019-05-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CMake configure_file command is commonly used copy & modify template files during the build process. One limitation, thought, is that configure_file expect the variables to be replaced to be encoded using either a @APPNAME@ or ${APPNAME} convention. This commit therefore changes "APPNAME" to "@APPNAME@" in wasm_shell.html to make the HTML template file compatible with CMake configure_file. With this commit, it becomes possible to write the following CMake function that mimics what QMake is already doing: function(copy_html_js_launch_files target) set(APPNAME ${target}) configure_file("${_qt5Core_install_prefix}/plugins/platforms/wasm_shell.html" "${target}.html") configure_file("${_qt5Core_install_prefix}/plugins/platforms/qtloader.js" qtloader.js COPYONLY) endfunction() Change-Id: Ic38abdc498ba03b8d21f1b9b70aa1d480ae7f362 Reference: https://cmake.org/cmake/help/latest/command/configure_file.html Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-05-155-0/+46
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qfloat16.cpp src/corelib/global/qfloat16.h src/plugins/platforms/windows/qwindowswindow.cpp Change-Id: I0938aaa6a9771f55e48c95ed29f6f5291431b947
| * | | wasm: support setting the font DPI from JSMorten Johan Sørvig2019-05-135-0/+46
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have not really been able to determine what the default DPI should be, so make it configurable with API on qtloader.js: qtLoader.setFontDpi(72); Also lowers the default DPI to the standard value of 96 (down from Qt default 100). Task-number: QTBUG-75510 Change-Id: Ica1164c8d80bb06519233adebf2c9e400c0991ce Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-05-135-3/+27
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I81dbf90fc936c9bf08197baefa071117bddb1c63
| * | wasm: add fixedPitch fontLorn Potter2019-05-075-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | Also define our default font so as to return something we actually have Task-number: QTBUG-75587 Change-Id: I26e3c62921d369c3017af9796c0a20f7ac06d07c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-05-072-6/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp src/corelib/kernel/qvariant.h src/corelib/tools/qlist.h Done-With: Milian Wolff <milian.wolff@kdab.com> Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: I6803f7239aa137a51a7467fab7cc7a01302a848d
| * | wasm: fix passing environmental variablesLorn Potter2019-05-061-1/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-75530 Change-Id: Ic0f0bd8ce863f55d737d96bbf9e5473466381c9b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * | wasm: use requestActive instead of activateLorn Potter2019-05-021-5/+2
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-74868 Change-Id: Ibbbac1ece66c8978440a282bf6949a82fb64d216 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | Remove extraneous sodipodi/inkskape cruft from Qt SVGEdward Welbourne2019-04-301-28/+1
|/ / | | | | | | | | Change-Id: Ib2d77331b33cac97e819e8273362703fcd80886c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | wasm: don't propagate touchLorn Potter2019-04-241-1/+1
| | | | | | | | | | | | Task-number: QTBUG-75263 Change-Id: I099f76114f876b3d6d81df3efb94db126db6a806 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | wasm: improve event coordinate handlingMorten Johan Sørvig2019-04-043-29/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | targetX and targetY are canvas-local coordinates, while Qt generally works with window-local and global coordinates. Add coordinate mapping calls where needed and make sure we pass correct coordinate types to Qt. This starts mattering when we have canvases which are not located at (0, 0). Change-Id: I28563310ca17d0cc5535317cff99fcd82d3723db Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | wasm: hide canvas text caretMorten Johan Sørvig2019-04-042-1/+2
| | | | | | | | | | | | | | | | Another side effect of setting contenteditable on the canvas. Seen on Firefox. Change-Id: I789ba4d7e6fbbdbf14b66fe1ae57183ec04e04bb Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | wasm: implement QDesktopServices::openUrl()Morten Johan Sørvig2019-04-025-4/+107
| | | | | | | | | | | | | | Call window.open(url, ”_blank”) for a new tab. Change-Id: I227904f905262c7aedd086203ed816b53f66359c Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | wasm: make windows fullscreen by defaultMorten Johan Sørvig2019-04-012-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | (fullscreen as in use the entire canvas area, without showing window decorations) This is a better default for Qt on the web where window decorations are not common. We also avoid the “window close” trap, where there is no way to re-open a closed main window. Change-Id: Ie0fbf6ada3f49244bee765ea882acb473809e715 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | wasm: add resizeCanvasElement() API to qtloader.jsMorten Johan Sørvig2019-04-013-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HTMl does not have per-element resize events, which means Qt has not way of knowing that a canvas has been resized and that the canvas buffer size should be updated. Depending on the use case, the hosting JavaScript code that caused the canvas resize could also inform Qt that the canvas has been resized. Add API to do this, which calls the existing canvas/screen resize implementation. Other solutions taken/not taken: - browser window resize events: these are available, and we install an event handler in qwasmeventtranslator.cpp. - DOM mutation events: would detect changes to the the size attributes themselves, but not if the size indirectly changed, e.g. “width: 100%” depends on the parent width. Not implemented. Change-Id: Ib324bb30f523e9fceea68000b95bf857a1d36b6c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | wasm: support adding and removing canvases at runtimeMorten Johan Sørvig2019-04-013-12/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | Add qtloader API: addCanvasElement() removeCanvasElement() These functions call the corresponding add/remove screen functions on QWasmIntegration. Task-number: QTBUG-64079 Change-Id: I537c11f3b5fb9240cca9b6313dd45f803d865ac6 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>