summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm
Commit message (Collapse)AuthorAgeFilesLines
* wasm: change input element type to password for password echo modeLorn Potter2025-06-261-0/+10
| | | | | | | Fixes: QTBUG-133631 Pick-to: 6.9 6.10 Change-Id: I930de385a24229a7e47f8f80eb607fc59be19d30 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: a11y - Implement support for disabled attributeEven Oscar Andersen2025-06-132-1/+15
| | | | | | Fixes: QTBUG-137449 Change-Id: I6aa07c7108b5ad14c12e6f24e71b8dda12fec483 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: don't recreate WebGL context on surface changeMorten Sørvig2025-06-123-79/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The native WebGL context is tied to a single canvas, and can only be used with that canvas. (Qt creates one canvas per QPlatformWindow). This means that we need new native contexts in cases where a QWindow is repeatedly created and destroyed. It can be tempting to just create a new WebGL context "behind the scenes" on the makeCurrent() call in this case, but this does not work since GL resources created by user code with the original WebGL context in place are now invalid. Inform user code that this has happened by signaling a context loss. This is done by returning false from makeCurrent(), and then making sure isValid() returns false as well. The context becomes invalid whenever the owning platform window is destroyed; add a call from ~QWasmWindow() which handles that bookkeeping. Pick-to: 6.10 Task-number: QTBUG-120138 Change-Id: I929b9bb51153007c16630b1a991399f01ebffa62 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Fix stacking order problem for transient parent windowsEven Oscar Andersen2025-05-2611-419/+733
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows with a transient parent does not reflect the relationship in the stacking order. Essentially AboveTransientParent is missing as a configuration choice. What makes this slightly convoluted is that the window stack does not depend on the window (for testability). We solve this problem by making the stack and treenode templates, and provide test class as arguments when testing. QWasmWindow and QWasmScreen are not templated as before. There is also a new order type StayAboveTransientParent. Which means that we can no longer use order type to get to the group location (Since StayAboveTransientParent can map to either of the three types). The window stack tests have been updated to handle the StayAboveTransientParent type. Finally, we do not do anything with a normal parent child relationship as this should already work correctly. Fixes: QTBUG-131699 Change-Id: Ie08e18f9e0a2339175c4a09da0a831f031df71e1 Reviewed-by: Lorn Potter <[email protected]>
* wasm: ignore keypresses if alt and numeric keyboardEven Oscar Andersen2025-05-191-0/+8
| | | | | | | | | | | | When left-alt + num lock activated + number pressed the number was inserted in the text. However in this input mode a 4 digit keycode is used to insert a special character, it is wrong to insert the individual digits in addition Fixes: QTBUG-136799 Pick-to: 6.9 6.8 Change-Id: Iebafd1dfe5df1701a87a824ed99a440b122f0c57 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: a11y - move to describedbycontainerEven Oscar Andersen2025-05-193-80/+143
| | | | | | | | | | | | aria-description is more rarely supported than aria-describedby. So switch to the latter. Create a new container inside the a11yContainer. Handle DescriptionChanged to update description in one place only Task-number: QTBUG-134657 Change-Id: I0d025e5739451e6fab133c2590fd20ea13e2d946 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: a11y - Use <div> for StaticTextEven Oscar Andersen2025-05-151-4/+6
| | | | | | | | | VoiceOver reads the readonly textarea as "Multiline text field, read-only, double tap to edit” Fixes: QTBUG-136665 Change-Id: I809a842795a18bcd0756d39b0f6240981b762ef9 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: set focus to m_canvas instead of m_windowEven Oscar Andersen2025-05-144-36/+17
| | | | | | | | | | | | | | | | | | | | | | Setting focus and contentEditable on m_window causes innerHTML to build up with characters. This does not happen when using the m_canvas The downside is that m_canvas is aria-hidden, but this should, in principle, not be a problem since m_canvas should not be focused when a11y is in effect. Later aria-hidden might be set only if a11y is in effect. This is a candidate for manual cherry-picking to 6.9 6.9.1 Task-number: QTBUG-136687 Change-Id: I08a9db2c39f9b0b0038c75fd06d3504b736ea031 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: handle changes in inputMethodAccepted()Even Oscar Andersen2025-05-132-10/+14
| | | | | | | | | | | | | The result of inputMethodAccepted() function might switch after setFocusObject()/showInputPanel() has been called. End result it was not picked up and not acted upon. It turns out update() is called after this flag is set, so check for changes in the update() function. Task-number: QTBUG-136687 Change-Id: I585cc82f2a177bb7708627102d3074a627d0f024 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Fix keyboard popping up on cell and tabletsEven Oscar Andersen2025-05-081-0/+2
| | | | | | | | | | | | The fix for text/button broke cellphones and tablets. (QTBUG-136562) The fix is reverted on 6.9, and fixed here on 6.10 The fix is to set inputMode so that it matches the focus. Change-Id: I88b0a32787ff97b6f5b057e4ebd240f565b5a284 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: a11y - refactor set/get attribute/propertyEven Oscar Andersen2025-05-072-90/+126
| | | | | | | | | Add setAttribute, setProperty, addEventHandler functions to reduce linelength and improve readability. Task-number: QTBUG-134657 Change-Id: I7deb1ac13872291b848c191198d741669d852e3a Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Update input field geometry on window geometry changeEven Oscar Andersen2025-05-023-22/+45
| | | | | | | | | | The location of the input field was wrong leading to empty space inserted in the user interface. Fixes: QTBUG-136233 Pick-to: 6.9 6.8 Change-Id: Ic8c9faf5c4dbb8cec43a43c25c1cce8d7809f140 Reviewed-by: Piotr Wierciński <[email protected]>
* wasm: call "focus" on window, not canvasEven Oscar Andersen2025-05-021-1/+2
| | | | | | | | | This is necessary to have correct focus handling on webassembly/ubuntu without this change tabbing from text input to f.ex a button would not work. Change-Id: I78eaa6202d8bdb87b1195d5c38a3f73570a49c90 Reviewed-by: Piotr Wierciński <[email protected]>
* wasm: a11y - add back incorrectly removed focus handlerEven Oscar Andersen2025-05-011-0/+4
| | | | | | Task-number: QTBUG-135024 Change-Id: Ia0b5dba60985e36899a5bee116ab2f6cb05c602c Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Make sure cellphone keyboard does not show needlesslyEven Oscar Andersen2025-05-011-0/+1
| | | | | | | | | | The last fix for QTBUG-136050 did not set inputMode "none" which causes the keyboard to be visible on cell phones and tablets. Fixes: QTBUG-136050 Change-Id: If8c97fb009c10ff5338ce7e6516ca2c5a992d0d0 Reviewed-by: Lorn Potter <[email protected]>
* wasm: Make sure typing with window focus does not produce charactersEven Oscar Andersen2025-04-294-9/+33
| | | | | | | | | | contenteditable on the window caused characters to be inserted. Instead create a div as a child element, and set contenteditable on that. Fixes: QTBUG-136050 Change-Id: I4ccf3589ea19876f68bb9c7077c3a13ae5f989e6 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Install cut/copy/paste handlers on window for not chromeEven Oscar Andersen2025-04-281-1/+1
| | | | | | | | This is how it used to be. More changes are needed to fix cut/copy/paste. Change-Id: Ib5073b82a568a391581f0b4d8369eaab57fd8f19 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: fix clipboard event handler leaksMorten Sørvig2025-04-254-28/+32
| | | | | | | | | | | | | Use QWasmEventHandler instead of calling addEventListener() directly (using QWasmEventHandler also allows supporting JSPI). The QWasmEventHandler destructor calls removeEventListener(), which should make sure everything gets cleaned up. Keep the Chrome-specific global (document) event handler code path, but register once at startup instead of once per window. Change-Id: If4314df738afc0dcfdb0f6f1ab9e1f176e1812ac Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: set aria-hidden for input context elementMorten Sørvig2025-04-231-0/+1
| | | | | | | | | This element is not a part of the accessibility implementation, and should not be visible to the screen reader. Change-Id: Ifb8c404f7dd5a916cd42856b1f6b4529f2fb3ae0 Reviewed-by: Piotr Wierciński <[email protected]> Reviewed-by: Even Oscar Andersen <[email protected]>
* wasm a11y: Fix typo in commentsMichael Weghorn2025-04-231-2/+2
| | | | | | | This amends 593c7b9be40f3fa876ffadd7518795a333dc5b74. Change-Id: Iae1e46cb9b85eb1c47e02b286aa832d2e3b92dac Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Reduce usage of the id attributeEven Oscar Andersen2025-04-222-10/+31
| | | | | | | | | It is not always required, limit it to the cases where it is explicitly given, or if it is necessary. Fixes: QTBUG-135024 Change-Id: I451379d86543e2297574d4cda09ef825736f9c5d Reviewed-by: Morten Johan Sørvig <[email protected]>
* Allow configuring WASM without draganddropJuha Vuolle2025-04-223-1/+15
| | | | | | | Pick-to: 6.9 6.8 Fixes: QTBUG-135874 Change-Id: I84459af06d34682ca3bed1e2e1dab773c77bbcae Reviewed-by: Morten Johan Sørvig <[email protected]>
* Allow configuring WASM without clipboardJuha Vuolle2025-04-225-2/+34
| | | | | | | Pick-to: 6.9 6.8 Fixes: QTBUG-135875 Change-Id: Ibf0a51ff0e1268f32d32511dff64003c28137795 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: a11y - Use aria-label for QAccessible::NameEven Oscar Andersen2025-04-171-2/+5
| | | | | | | | | innerHTML does not work too well with type input. Instead use attribute 'aria-label' Task-number: QTBUG-135590 Change-Id: Ibec36a133c650bb51b1f1a84580a5ce35531c137 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: port a11y event handling to suspendresumecontrolMorten Sørvig2025-04-152-22/+26
| | | | | | | | | | | The accessibility code uses a shared event handler installed on several elements. Register the event handler in the constructor and then add it to the a11y elements as needed. Change-Id: I9bfc49a3358f15cc62de9c8140cab96cf0b23161 Reviewed-by: Even Oscar Andersen <[email protected]> Reviewed-by: Lorn Potter <[email protected]>
* wasm: remove stray qDebug()Morten Sørvig2025-04-111-2/+0
| | | | | Change-Id: Ieddd4b6a0e948c65679cc66ba1f4ea22c9ec5fc5 Reviewed-by: Piotr Wierciński <[email protected]>
* wasm: port rest of input context event handlersMorten Sørvig2025-04-112-16/+7
| | | | | | | | | | | | Follow-up to 13e92283, change the clipboard event handlers to use QWasmEventHandler as well. The removed addEventListener calls set capturing to false, but this is already the default (also for QWasmEventHandler), Change-Id: Ibecaa22099fecd371a5d243cf391d3ce6f562400 Reviewed-by: Piotr Wierciński <[email protected]> Reviewed-by: Even Oscar Andersen <[email protected]>
* wasm: a11y - synchronize focus between Qt and a11yEven Oscar Andersen2025-04-112-2/+23
| | | | | | | | | | | | Listen for "focus" javascript events.. Listen for QAccessible::Focus a11y events. When receiving QAccessible::PopupMenuStart set focus to first item. Task-number: QTBUG-135096 Change-Id: I676e53e77169cc1643765210318b460193042c53 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Fix use after delete of QWasmSuspendResumeControlPiotr Wiercinski2025-04-092-3/+5
| | | | | | | | | | m_inputContext and other fields depends on the lifetime of m_suspendResume, but the latter gets destroyed first. Make sure that m_suspendResume is initialized first. Fixes: QTBUG-135378 Change-Id: Ifa2d58ec06a1f832549478bece3a8f651276ac8f Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Add support for contrastPreference detection to WASM themePiotr Wiercinski2025-04-042-42/+102
| | | | | | Task-number: QTBUG-133596 Change-Id: I4482fe5a3457579867bd870cb2c8d371dd08e1a0 Reviewed-by: Oliver Eftevaag <[email protected]>
* wasm: a11y - Add handling of LocationChangedEven Oscar Andersen2025-04-041-2/+4
| | | | | | Fixes: QTBUG-134585 Change-Id: Ib82ee6f59b7b2ca16ad4d84980cbd27ba13b6dd0 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: a11y - enable accessibility by environment variableEven Oscar Andersen2025-04-034-23/+49
| | | | | | | | If QT_WASM_ENABLE_ACCESSIBILITY is set to "1" when the application starts, accessibility is enabled right away. Change-Id: I5b0118dc8ae19f446c64be33fe3c03b45c5b4527 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: a11y - Add call to setActiveEven Oscar Andersen2025-04-021-0/+1
| | | | | | | | | There are various tests for this within the accessibility system. Without it, it is not consistent what works and what does not work. Task-number: QTBUG-134657 Change-Id: Idfa8905f377e2ef00a4d1af26cbf001064bc75dc Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: fix compositional input event handler leaksLorn Potter2025-03-202-24/+17
| | | | | | Change-Id: Ia6d7b9972c126b926e1d7d458ef4e034edbc924a Reviewed-by: Even Oscar Andersen <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: Use the new QWasmEventHandler classMorten Sørvig2025-03-172-35/+35
| | | | | | | Also saves one malloc call per event handler. Change-Id: I33a72916b101e27d2e4139ebb1dc5227b0793273 Reviewed-by: Lorn Potter <[email protected]>
* wasm: use QWasmWindow::fromWindow()Morten Sørvig2025-03-133-4/+6
| | | | | | | | | Make it test for null QWindow and handle(), use it instead of C-style casting handle(). Change-Id: I7ffb1ef5d3d3c09c8ae44ec0141e93530a04abe6 Reviewed-by: Even Oscar Andersen <[email protected]> Reviewed-by: Piotr Wierciński <[email protected]>
* wasm: Honor invisible and disabled when setting visibility for a11yEven Oscar Andersen2025-03-111-2/+2
| | | | | | Task-number: QTBUG-115926 Change-Id: I04ccf9371af4eb4890a9cfe21cc6d8f005a3cc44 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: improve asyncify supportMorten Sørvig2025-03-036-18/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite the event dispatcher to use QWasmSuspendResumeControl for asyncify suspend/resume. This includes using the following helper classes which provides additional functionality on top of QWasmSuspendResumeControl. - QWasmTimer: manages native timers on the main thread - QWasmEventHandler and qstdweb::EventCallback: input events - QWasmAnimationFrameHandler: animation frame events Initialization differs slightly, depending on if QtGui and the QPA machinery is in use, or of the app is a QtCore only application. In the former case, QWasmSuspendResumeControl is created early by QWasmIntegration in order to support registering event handlers at startup, before the event dispatcher has been created. processEvents() now actually processes native events. This is done by running a suspend-resume loop until the native event queue has been exhausted. If WaitForMoreEvents is specified then processEvents() will, in addition, also suspend and wait for additional native events. Timers on secondary threads are now managed by modifying the wait condition timeout, instead of proxying timers to the main thread. In effect secondary threads will now sleep until the next timer should fire, and then wake up and process that timer. Change-Id: I20e8afb6b67c64a7c52dbd89e9c50ffadba39594 Reviewed-by: Jøger Hansegård <[email protected]>
* wasm: call focus on window if not editableEven Oscar Andersen2025-02-204-15/+33
| | | | | | | | | | | | | We used to call focus on the input element even for things like pushbuttons. This will display a keyboard on android, instead call focus on the focus window. Fixes: QTBUG-133781 Pick-to: 6.9 6.8 Change-Id: Ide4d6ec21a14f17b40d3d3de077c0ab073682f19 Reviewed-by: Lorn Potter <[email protected]>
* wasm: Truncate input field length to 1px, fix object selectionEven Oscar Andersen2025-02-082-30/+43
| | | | | | | | | | | | | | | | | | | | | | | | Having the input field length too wide causes the view to scroll to contain it. Since it is not visible, setting it to 1px width and height should work. Further, input field contents where set on the showInputPanel call. At this point in time we do not necessarily have an updated focus object. Hence the input contents is now set on the setFocusObject call. Ignore input on showInputPanel/hideInputPanel. This reflects the current design where showInputPanel do not act unless inputMethodAccepted(), and hideInputPanel do not act if m_focusObject. Still hideInputPanel used to set m_usingTextInput to false, this behavior is not kept. Fixes: QTBUG-132057 Pick-to: 6.8 6.9 Change-Id: I2d7088def8060df267c5da9e045824decd913faa Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: don't give native focus to non-focus windowsMorten Sørvig2025-01-291-1/+1
| | | | | | | | | | | | | | isActive() may return true if a (transient) parent window is active (has focus). Compare against QGuiApplication::focusWindow() instead. Fixes: QTBUG-129233 Pick-to: 6.8 6.9 Change-Id: I834a5814a5db161bdea2ba3524d1010e0c0e3e6e Reviewed-by: Even Oscar Andersen <[email protected]> Reviewed-by: Piotr Wierciński <[email protected]> Reviewed-by: Lorn Potter <[email protected]>
* wasm: support foreign windowsMorten Sørvig2025-01-296-12/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for embedding native html elements using QWindow::fromWinId(). WId is an emscripten::val *, e.g. a pointer to val which holds a html element. The element can be created either from C++ using emscripten::val, or from JavaScript. User code owns the val * as usual for WId; ownership is not passed to the QWindow instance. Set QWasmWindow::m_window to be the native element when fromWinId() is used, and skip the rest of the QWasmWindow implementation in that case: We don't need to install event handlers or provide accessibility elements. Make key and pointer event handlers stop propagation only if the event was not accepted. This makes sure that input events reach the embedded native element. Limit setPointerCapture calls to when the event is targeted for Qt elements only. Determining the true target can be a bit tricky when shadow DOM is in use since the browsers may retarget the event. Use composedPath() to get the true event target. Task-number: QTBUG-128804 Task-number: QTBUG-128732 Change-Id: I5ce66e93bacb06abfd042916687cd45fc9588c51 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: move qwasmwindowclientarea content to qwasmwindowMorten Sørvig2025-01-295-271/+209
| | | | | | | | | | This allows us to keep all event handlers in one place. Move event handler registration to registerEventHandlers(), which is called from the QWasmWindow constructor. Change-Id: I31f22d6eb876b92bb15d4a140e0569f0288a5915 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: streamline key eventsMorten Sørvig2025-01-294-37/+15
| | | | | | | | | | | | | Set the event type from the event handler instead of determining the event type at run-time based on string comparison. QWasmDeadKeySupport adds a complication. This can't be easily simplified or removed since it maintains state. Change-Id: Iad6f02ee7e2dc22817d7ac606514a2b4022f8fb0 Reviewed-by: Morten Johan Sørvig <[email protected]> Reviewed-by: Even Oscar Andersen <[email protected]>
* Replace qdebug.h includes in public headers with forward-declarationsAhmad Samir2025-01-151-0/+1
| | | | | | | | | | | | | | | | | | | qdebug.h includes many Qt and STL headers, so if you include a Qt header you get all those transitive includes, which may affect build time. - Where appropriate use the printf-like syntax of qDebug() and co., these don't need the QDebug streaming operators - qfloat16 is used in an inline member function, so include it explicitly [ChangeLog][Potentially Source Incompatible Changes] Various Qt public headers don't include QDebug any more; if you need QDebug's streaming you'll have to include it in your code. Task-number: QTBUG-132439 Pick-to: 6.9 Change-Id: I750587e17a3b38fa226cd3af8eaccc8da580f436 Reviewed-by: Thiago Macieira <[email protected]>
* Make QWasmScreen::allWindows return all (wasm) windowsEven Oscar Andersen2025-01-082-13/+18
| | | | | | | | | | | | | | It seems that findChildren does not return every window if called at an inconvenient time. This causes not all windows to be returned, and later the QWasmCompositor will not detect a valid window to compose, and therefor goes to disabled. Fixes: QTBUG-132414 Pick-to: 6.9 Change-Id: I6c872071751d5a2fbdeea36fb8f4c7e9677fd7d0 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: streamline wheel eventsMorten Sørvig2024-12-043-17/+1
| | | | | | | | | Wheel events only have one type ("wheel"), which can be specified directly. Change-Id: Icd5adaf262bc4b5159fd1c38acd8041b7e4cda99 Reviewed-by: Even Oscar Andersen <[email protected]> Reviewed-by: Lorn Potter <[email protected]>
* wasm: streamline drag event handlingMorten Sørvig2024-12-044-57/+40
| | | | | | | | | | Set the event type from the event handler instead of determining the event type at run-time based on string comparison. Change-Id: I1df299bd0c8fd1c989e4e283aa1cb04cddafc1ce Reviewed-by: Even Oscar Andersen <[email protected]> Reviewed-by: Lorn Potter <[email protected]>
* wasm: remove template keyModifier machineryMorten Sørvig2024-12-042-83/+19
| | | | | | | | | | The EmscriptenKeyboardEvent case is not in use and can be removed and replaced with a normal function. Change-Id: Ie887a01947b94f004e960ddebc7597ac1445eddf Reviewed-by: Lorn Potter <[email protected]> Reviewed-by: Even Oscar Andersen <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]>
* wasm: remove default constructors and assignment opsMorten Sørvig2024-12-042-90/+0
| | | | | | | | | The compiler will generate them for us, even if we don't specify "= default". Change-Id: I3d19611fd2d44aed590337b851b26b89d39ea5bd Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Even Oscar Andersen <[email protected]>