summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* client texture cleanup: fix crash in clean-up lambdaThomas Senyk2024-01-182-0/+4
| | | | | | | | | | | | | | | | | | | | | The dtor of WaylandEgl[Stream]ClientBuffer used to only clean-up the aboutToBeDestroyed-connection/lambda if it's integration is still present. This was a pointless condition as that clean-up is not depending on the integration and can lead to access of dead memory (when the Buffer is already deleted but the lambda is then later called due to QOpenGLContext::aboutToBeDestroyed) Fixed by moving the clean-up into it's own scope (needs a scope due to QMutexLocker) Pick-to: 6.5 Change-Id: Ib3b6e54365f66484f249ee449cb3b27029f5ce7c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit acce7bc40d287eff826cd97dbea595da3050669f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 01ef243b5478f249adf0532aa6639de462e9957d)
* client: Avoid creating decorations in the render threadDavid Edmundson2024-01-113-8/+3
| | | | | | | | | | | | | | | | | | createDecoration is called when on the main thread from when window flags change, implicitly from initWindow, and also every handleWindowStatesChanged which will be called when we get the first configure event in an xdg shell. There is no need to create the decoration in QWaylandGLContext::makeCurrent. Any current call to makeCurrent before the platform window is shown will not create a decoration as there's a check for a shell surface. Any call afterwards will have already been handled by initWindow. Similarly the SHM backend store does not need to handle decorations itself. Fixes: QTBUG-105703 Change-Id: I644cece28277131cf7a65eaa234ff08c8431d544 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit c5aed5ae22f00e4b6c3be7051560b297bc10d941) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit a3c66ed7a868e57f1f7f6a051b85e2fc4899e538)
* QWaylandEglWindow: Pass window surface format to q_glFormatFromConfigKai Uwe Broulik2024-01-101-1/+1
| | | | | | | | | | | | Otherwise it disregards the window's swap interval preference. Fixes: QTBUG-120477 Pick-to: 6.5 Change-Id: Icc6b192f9f317a80acdf4b588ee3f1c26f2ddf0a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 6d7bf2a494b0f12972cf313215a268fe9e54678b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 6a8284f36cfb508c713429d0f0edf2d950e6ca5b)
* bradient: Explicitly set Qt::PlainText textFormatKai Uwe Broulik2024-01-101-0/+1
| | | | | | | | | | | | Otherwise a window title containing HTML tags can mess up the layout. Pick-to: 6.5 Change-Id: I7bd4abd2e0caa92cbb08c0eb46acba737126c913 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 5b6a7eeb224f471fa534c23249dc881a77182103) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 2a1ec6fc5ed7fa820dbb5ca7095584c62c684ff9)
* Doc: Add documentation for QML WaylandQuickItem::output propertyAndreas Eliasson2024-01-091-0/+5
| | | | | | | | | | Fixes: QTBUG-120397 Pick-to: 6.5 6.2 Change-Id: I52dee0bf480dee26ca71f7a914150be9679f87f3 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> (cherry picked from commit bf3470703b437ce88903caeba02b9fdd8b9c99d4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 68b80faec6c08b5f1b6acee7ccaa5545e57344de)
* client: Fix window margin calculationRob Hall2024-01-061-2/+2
| | | | | | | | | | | | | | | Don't subtract the size of the window frame margin from the content area. Fixes an issue where an area of the window is unclickable when client-side decorations are in use. Fixes: QTBUG-120392 Pick-to: 6.5 Change-Id: I6a89b2d463be084233ea3448cacfbbd09d66b96e Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Kai Uwe Broulik <kde@privat.broulik.de> (cherry picked from commit c37824eeacda237dbc62f0951dfea1fd2eb5ddb2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 0618e1e7f73c6bef2e70a2ad51aa9b6f5959cec5)
* QWaylandWindow: Reset input region on window resetKai Uwe Broulik2024-01-061-0/+3
| | | | | | | | | | | Amends 604db6b5 and fixes the input region (and thus Qt::WindowTransparentForInput) not working on subsequent shows. Change-Id: Ie160aa0b2c13e6858b31ad98866a8689dfbad149 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit f308aa256e5328b53d6c41f995edf078bca87b98) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit cb09ffb0cb7619674bbbc31c2a130ceefe40fe28)
* bradient: Don't cache decoration colorsKai Uwe Broulik2024-01-061-12/+9
| | | | | | | | | | | | | Reading them from QPalette on the fly is pretty negligible. Easily ensures that the palette renders with correct colors when the color scheme changes. Pick-to: 6.5 Change-Id: I469fa2f32889a7841a3d4c4c8d11e1abf50ae66f Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit cd9f8f607c371f7b477143c79ef64a892e7df3c3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit cf21edf54d55fd2f43b6ac9330ce8faf93e5baba)
* QWaylandScreen: Implement subpixelAntialiasingTypeHintKai Uwe Broulik2024-01-062-2/+30
| | | | | | | | | | | | It isn't really used anywhere yet, since on Unix QFontconfigDatabase doesn't use the screen's information. Pick-to: 6.5 Change-Id: Icab81b2bf8df1a23223a74f2d4aee94601e0bea3 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 2d1eb5b8eec538458be09d38925fdd2b9d1101a3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 33c35df1bd6b496ce73ce13b2fb431e2cef1f6f5)
* bradient: Use "Size" instead of "Split" cursors for resizingKai Uwe Broulik2024-01-061-3/+3
| | | | | | | | | | | | | | | SizeVerCursor: "A cursor used for elements that are used to vertically resize top-level windows." SizeHorCursor: "A cursor used for elements that are used to horizontally resize top-level windows." Pick-to: 6.5 Change-Id: Ib780269120aa373cd9fcf84826683cccd1dc4f4d Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit d85ebd9fba97ea2dc89278e331bfdd904c09159d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 8acfeed01b7d29eb25be8a1dcf001471bbe9ad7d)
* client: Clean up text input proxy object in textinputv2David Edmundson2023-12-211-0/+1
| | | | | | | | | | | | | This not only cleans up a tiny amount of memory, but also fixes a potential crash if a wayland event were to arrive on the object after the Qt level wrapper is destroyed. Pick-to: 6.5 Change-Id: I6fafdd848d61da893304c4467a57b52d3771c508 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 18166784fda5b3afce55bf00227f77e08ff08ac2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit f5bcf869810fee9882cbd1d7208e625862724259)
* QWaylandMimeData: Skip "DELETE" formatKai Uwe Broulik2023-12-211-2/+5
| | | | | | | | | | | | | | | | | | This is presumably a left-over from XDND: https://freedesktop.org/wiki/Specifications/XDND/ > In general, XdndActionMove is implemented by first requesting the data > and then the special target DELETE defined in the X Selection > protocol. [...] DELETE should be sent before XdndFinished. Firefox sends this during dragging of files but trying to fetch it will fail, leading to a timeout and potential freeze. Pick-to: 6.5 Change-Id: Ic30f5cb23587c63d54859c5eaebb3a054a25ac69 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit c28b35521943646f5de5fbc44888f66a01e7a849) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit e5fe8e08ec8797295d970c1b1db2fa33f53d7aa2)
* QWaylandCursor: Set appropriate shape for drag cursorsKai Uwe Broulik2023-12-151-3/+3
| | | | | | | | | | | | | Even if the compositor is free to do whatever during a drag, the client can still set a proper cursor. The codepath without cursor-shape also doesn't special case them. Change-Id: Ib6b9864d8024ff2919471d6f2d12f9ba8e2e512d Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> (cherry picked from commit c9ade893aeacbe244300217aad51eee2a84940f7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit fa9dec205b29b169dfd6a2897ad3b7d3b26142be)
* Don't lock render thread when blocking swap is usedEskil Abrahamsen Blomfeldt2023-12-141-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, Qt will use a non-blocking eglSwapBuffers() and implement our own frame event mechanism with a time-out. When the blocking version of eglSwapBuffers() is in use (either because it's manually enabled or because the driver does not support the alternative), it depends on the main thread to poll events, as it will wait indefinitely for a frame callback. This is incompatible with our locking of the surface for the duration of the frame, since we may end up locking the main thread in QWaylandWindow::reset() during shutdown while the render thread is simultaneously locked in eglSwapBuffers(). The lock was implemented to work around a bug in one family of graphics drivers, so we simply disable it when blocking eglSwapBuffers() is used. If we need to put this back, we would need a more advanced approach and make sure we continue to poll events even while we're waiting for access to the surface. Pick-to: 6.5 Fixes: QTBUG-118890 Change-Id: I04f7d2b168726d82c38fe3fafd350dcab928b956 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 02263f21f5cdd61d71e5e8e08b2e73c05c6c1e76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit b0f96ca63ee89f06254d65a8aca780c0d61933b4)
* client: If the window minimized state is requested do not forward other statesDavid Edmundson2023-12-111-5/+10
| | | | | | | | | | | | | | In QWindowPrivate::effectiveState if the minimize flag is requested all other states are cleared. This makes sense for the internal representation, but we do not want to send the unset maximised state across the wire. Fixes: QTBUG-119136 Change-Id: I9b758c67ce11420b421a295fe3e65b68bf546027 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 0afaafef3916de86abaf5204c8b8350697ac15e8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 9eb71d709e045222c3270ea3e7f0c4134525322f)
* client: implement QWaylandCursor::size()Liang Qi2023-12-082-0/+12
| | | | | | | | | | | See also 78272c667f008f6afcf5f84e0add525b56c3a558 in qtbase. Fixes: QTBUG-118612 Pick-to: 6.5 Change-Id: I1cfd0c287b133c21a0ccdc5f283d9997f06fb2ed Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit a960d6e107a809c9f5ff9c71cceaa316bf1d428f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QWaylandMimeData: Check text/x-moz-urls for UTF-16Kai Uwe Broulik2023-12-041-10/+23
| | | | | | | | | | | | | | And fall back to UTF-8 if it's not. When dragging a picture out of Chrome, it sends a simple URL as UTF-8 under text/x-moz-urls. QXcbMime has this fall-back, too but I originally didn't consider it necessary. Pick-to: 6.5 Change-Id: I52378cfc354de342623e5dd3f7e1d028951e8dab Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 7de5d7c05276c179c9951c718c6fc5ccd18982aa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Client: Fix enter event cursor position with xdg-popup and QHighDpiScalingIlya Fedin2023-12-041-4/+9
| | | | | | | | | | | | | QWindowSystemInterface::handleEnterEvent accepts device-dependent position while QCursor::pos provides device-independent position. Use QWaylandCursor::pos instead. Pick-to: 6.5 6.2 5.15 Change-Id: I70d2997610f7a34c6763bd4f10f20a65c3debdbe Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 8e57e8b51b2b701c5520f37b7d78de5b3c488500) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Warn if eglSwapBuffers failDavid Redondo2023-11-241-1/+2
| | | | | | | | | | This failing was the cause of windows freezing on NVidia. If it happens for some other reason we can now see why. Change-Id: Iabd44b1b3f73a54adac3024436ffe116ca15d21a Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 5948151aaf6fb5d36d991dab71b2cc2c87e84572) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Client: Switch QWaylandXdgSurface::setSizeHints to the window content geometryIlya Fedin2023-11-231-4/+7
| | | | | | | | | | | | | | According to the protocol documentation, set_{min,max}_size work in window content geometry while it currently works in QWindow geometry. Practically this excludes shadows and includes the non-shadow part of client-side decoration. Pick-to: 6.5 Change-Id: Ib702e4c9036a07645ba254ac3cc0e5704a949fe4 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 426dab9209bb3509e715dd87a5614b7a17a254b6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Client: Move topmost grabbing popup tracking to QWaylandWindowVlad Zahorodnii2023-11-174-22/+23
| | | | | | | | | | | | | | | | | If the effective transient parent is different from QWaylandWindow::transientParent(), then the popups may be closed in wrong order and producing an xdg-shell protocol error. This change lifts topmost popup tracking from the xdg-shell plugin to QWaylandWindow so it can guess the correct transient parent and the xdg-shell plugin doesn't have to pick a different parent behind our back. Fixes: QTBUG-119110 Change-Id: I7c5f780b7bd4c3362aa7b22762ff336ae908ff70 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit cfaae5d910406ef38d124e8e2c9114e2bfe87cb3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* client: Always clear queued buffer busy flag when resetting the windowWeng Xuetian2023-11-131-0/+3
| | | | | | | | | | | | | | | In 39a003942ebab39a1d3b8bc64f41d0c68e92f4bf, the queued buffer is always set busy, but it may not be reset correctly if the queued buffer is not ever attached due to hiding the surface when window visibility is being updated at a very fast speed. Fixes: QTBUG-118650 Task-number: QTBUG-118650 Change-Id: Id0bdd3caa69c821bb84927f01b4839f46eee8a10 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: David Redondo <qt@david-redondo.de> (cherry picked from commit 6fe83f6076423068b652fa4fcb0b5adbd297f2a8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* client: Convert text/x-moz-urls to text/uri-listKai Uwe Broulik2023-11-091-0/+49
| | | | | | | | | | | | | Similar to how it's done in the XCB QPA. This format is used by both Firefox and Chrome for exchanging URLs. Pick-to: 6.5 Change-Id: Icd4406ff6297ea2800f4e1389ffc2878ee1ccb65 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 80a3359598553298b544feae0a7e7399d6cfd9a7) Reviewed-by: Liang Qi <liang.qi@qt.io>
* client: Implement QWheelEvent::invertedDavid Edmundson2023-11-063-10/+37
| | | | | | | | | | | | | | | | | | | | | | "Natural scrolling" is a setting that makes trackpads act in the inverse; moving up moves content down to mimic behavior of touchscreens. However not all scroll events are used for scrolling, so it can be useful to know the real direction. This was exposed in QWheelEvent it just needs plumbing. While this is technically an implementation of wl_pointer version 9, on the other hand, it fixes the value of QWheelEvent::inverted(), which makes scrolling with touchpad on wayland behave in a more expected fashion, so this can be viewed as a bugfix as well. The patch has been tested for almost a month, no regressions have been noticed. Change-Id: I050b8b3e55796beff33badb7c073c0b93589294e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> (cherry picked from commit 6b8a99afa3c6dff60bd4096c2273f8db0e4d1247)
* Add license headers to shader filesEskil Abrahamsen Blomfeldt2023-10-267-0/+21
| | | | | | | | | | These need the same licenses as the code. Pick-to: 6.5 6.2 5.15 Change-Id: Iad59ee3e3cb5f68de92cf6b3b5d8bd4840d4a2ad Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 702980b8d47e045b28d4e62842a25416f9138226) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Issue keyReleaseEvent regardless of focusInho Lee2023-10-241-1/+1
| | | | | | | | | | | | In some cases like using Key.forwardTo, keyReleaseEvent is ignored. It should be generated regardless of focus. Fixes: QTBUG-118042 Pick-to: 6.5 Change-Id: I154a27542c73264c3238d645e9b18e869c60b19e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 76d5c4992dff683fd6684864f620c593f5263f4b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Client: Always populate mimedata in dragsDavid Edmundson2023-10-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | It's possible for clients to perform a drag and drop operation within their own client without any mimeData. A user can directly access the original drag. On wayland without any mimedata it's impossible for a client to accept a drag as the mechansim involved is to either select a given mimedata entry or an empty string. Within Qt we always accept the first format if we accept a drag. When dragging within our own window we also start a wayland drag so will receive a cancel event from the compositor if the compositor doesn't believe the client has accepted the drag. This patch provides a dummy mimedata entry so that something can be accepted. Fixes: QTBUG-112161 Pick-to: 6.5 6.2 5.15 Change-Id: I6309d82e20545e10ebdb9dafde7e13a5e3be5ff2 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 32fedb6fa6579711b6cb192a2e3cfb7ad1264546) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix regression in orphaned texture clean-upThomas Senyk2023-10-102-6/+6
| | | | | | | | | | | | | | | | | | | The recently refactored QWaylandTextureOrphanage used sender() in a DirectionConnection, which doesn't work if sender and receiver live in different threads - which happens if multiple windows (and therefor multiple QSGRenderThread) exist This patch fixed that by replacing sender() with a lambda capture Also: fix a weirdly phrased comment Fixes: QTBUG-117932 Change-Id: I870e92b448dfd1f9864ff94743cf7accc50fc6ff Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit eb1a83ea9bb145d72a23f925002c9e9a745c110e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Highlight 2 examplesKai Köhne2023-09-291-0/+4
| | | | | | | | | Pick-to: 6.6.0 6.5 Task-number: QTBUG-117210 Change-Id: I808ae74c3b3c1ab8e4912344d804f1d3741b8dc6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 27026f5e992255165e208dbd1b49c91f904836ad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Client: Avoid locking resizing in QWaylandShmBackingStoreVlad Zahorodnii2023-09-251-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QWaylandWindow::setCanResize(false) will block applying configure events. QWaylandWindow::setCanResize(true) will unblock configure events and potentially apply a scheduled configure event if there's one. QWaylandWindow::setCanResize(true) has to be called **after** committing the surface to ensure that the xdg window geometry matches the buffer. We don't want the xdg window geometry change when painting. Unfortunately, setCanResize(true) can be called before the surface is committed when using a RasterSurface, for example - QWaylandShmBackingStore::beginPaint(): calls setCanResize(false) - QWaylandShmBackingStore::endPaint(): calls setCanResize(true) - QWaylandWindow::setCanResize(true): applies pending configure event - QWaylandShmBackingStore::flush(): commits the surface, but the xdg window geometry is wrong now As is, beginPaint() and endPaint() are not entirely correct functions where configure events can be blocked. We need functions that wrap both painting and flushing, which are not feasible with the current backing store design. On the other hand, it's worth noting that blocking configure events in the backing store is not necessary because painting happens on the main thread unlike OpenGL or Vulkan code paths. Given the lack of synchronization points and the fact that rendering happens on the main thread, this change removes blocking configure events in QWaylandShmBackingStore. It fixes dolphin and various other applications that use QtWidgets jumping while being interactively resized. Change-Id: I156e4fd5e04a6bba7e8d48171510d5ab0ec89713 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 8828452bcf2ecf4e02a64380a1697d148c4366b0)
* Client: Remove some surface commitsVlad Zahorodnii2023-09-252-7/+0
| | | | | | | | | | | | | | | | The buffer transform, input and opaque regions are double buffered state. They will be applied on the next surface commit. But the issue with them is that the relevant code makes surface commits too. It's undesired as it can lead to qtwayland committing partial state, for example it can break xdg surface window geometry. This change removes hidden surface commits. The relevant properties will be applied on the next frame. Change-Id: I1c40c9a5430fb6b91d7643b20d628f8a9a9d501a Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit e8cff6fb39c0fd01548bce18542820a6612dbe49)
* Client: Commit the initial surface state explicitlyVlad Zahorodnii2023-09-251-0/+2
| | | | | | | | | | | | | | | QWaylandWindow lacks an explicit step to finish initializing the shell surface by committing the surface. So far it used to work because of hidden surface commits in QWaylandWindow::handleContentOrientationChange(), QWaylandWindow::setMask() and so on. This change adds an explicit step to commit the initial surface state to make the shell surface initialization robust. Change-Id: Ibc38a4e0dbea689a727451c25a61af0270c7e548 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 225432c2294bdfbf24856b2f155cd274b24543b2)
* Fix use-after-free with animated cursorsPaul Olav Tvete2023-09-191-8/+1
| | | | | | | | | | | | | | | In WlCallback::callback_done(), m_fn() can cause the callback object to be deleted, so it should not be referenced after that. Since m_autoDelete is never set to true, the rest of callback_done() is dead code and can be removed. Fixes: QTBUG-117067 Pick-to: 6.5 Change-Id: I0b1a1fcb8204cba789272f3861be4c2e2d0789b4 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> (cherry picked from commit 6cc9cdbfddae3b801876273763804bd02b785a49) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Reimplement orphaned texture handlingThomas Senyk2023-09-188-225/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation was a bit error prone (there was a reproducable "dead pointer" issue) and had duplicated code (dma, egl and eglstream share the same code). The new implementation fixes both issues (and more): - no more 'this' capture on a lambda where the 'this' isn't an object and hence can go out of scope without the lambda knowing. - no more duplicated code as we now have a singleton as our orphanage: QWaylandTextureOrphanage 3 (dma, egl, eglstream) HW-integrations use this singleton - the class itself as well as it's container are thread-safe by the usage of QMutex/QMutexLocker. This also includes the deletion code within the orphanage. As the orphanes are 100% owned by the orphanage, they are protected from double deletion. - The cleanup due to QOpenGLContext::aboutToBeDestroyed is now ctx specific, no more lamdba-per-texture. Change-Id: I36e82fae796864319bed7ebdb5154e93dbe96394 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 2cea2d8520af4f3647f2e7aa7444b68c9c1e51cf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* client: make drag and drop in same control works againLiang Qi2023-09-101-0/+1
| | | | | | | | | | | | | This amends 40a27c26cee7ad4e5e32eb01568777cd4e9da25c. examples/widgets/draganddrop/draggabletext in qtbase now is fine. Fixes: QTBUG-116344 Change-Id: Ie930586fa7c6468c0e859786d968ad2343057e4d Reviewed-by: David Redondo <qt@david-redondo.de> Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 38f5679d57c7b05753ac1ab27d94b60dc10a340a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "Client: Send release button event on pointer leave"Liang Qi2023-09-062-8/+2
| | | | | | | | | | | | | This reverts commit 8235fa65fe033a94e7a44322d3502f25940092ec. It makes tests/manual/examples/widgets/draganddrop/puzzle not work, which does drag and drop in same app. Fixes: QTBUG-115757 Task-number: QTBUG-97037 Change-Id: I738769fde96f7da91f5bc4dc7a70ed49596dcd61 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 60647fa069ef4143642ae4c1b529ad2a7a7f2fd9)
* client: Add path to manipulate popup positioning via hidden properties APIDavid Edmundson2023-09-041-9/+90
| | | | | | | | | | | | Whilst long-term we want public API, we don't have anything available. This patch provides a non-official override using properties without us committing to any API promises moving forward. Change-Id: I46afbe9be7005d35305155643a1d158cf5bd509a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 6d24c829f173c95e9f5860a2233bc916c356be01) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Only remove initialized extensions in ExtContainerInho Lee2023-09-041-0/+2
| | | | | | | | | Only initialized extensions should be in the extension_vector. Change-Id: I174c4eedae472aa5412c3f2b8a102adbc812fe40 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 3da1356f306860084cf0f6c673c02150fadcfb7a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Client: Fix coding style in QWaylandWindow::setMask()Vlad Zahorodnii2023-08-281-1/+1
| | | | | | | | | | | | | | | | | | The relevant code can be reformatted as follows if (isOpaque()) { if (mMask.isEmpty()) setOpaqueArea(QRect(QPoint(0, 0), geometry().size())); } else { setOpaqueArea(mMask); } which doesn't fully make sense. Change-Id: If78270273bff4eec9ad58666b6f31c5f10139caf Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit d09c1e7b059d905dccfdb840ada570e074b28f89) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QWaylandInputDevice: Don't create cursor surface just for hiding itKai Uwe Broulik2023-08-281-9/+3
| | | | | | | | | | Just call set_cursor(null) directly. Change-Id: Id10b7d41775a41c805962d77fba2d7d2b19956d0 Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit ee8906f8960facec9ea029212553c5a06f84a2b8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* client: Wait for the compositor to send a fractional scaleKai Uwe Broulik2023-08-253-18/+7
| | | | | | | | | Don't assume it's 1.0 initially. Change-Id: I443cb40a0f3421e6d7bdeba550cc8fc94c646319 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 1452c8d6ee8fe59763d9d48549fe0fbd2466015c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QWaylandInputDevice: Reset cursor surface state when using shape cursorKai Uwe Broulik2023-08-251-1/+10
| | | | | | | | | | | | CursorSurface::update only calls set_cursor if the hotspot or serial has changed. Reset its state when using a shape cursor to ensure switching back to a cursor surface (e.g. when switching from a shape to a bitmap cursor) works as expected. Change-Id: Ia04dff468c251030a75e9f1eac642ed764879125 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 30216b545f3ef0a9bf465e57ba04b054d2a96728) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Client: Fix keyboard focus when closing a popupVlad Zahorodnii2023-08-172-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 325a2338976c3cca6278436af03e7bd4e4378d7c changed the order in which the shell surface and the QWaylandWindow::wlSurfaceDestroyed signal are ordered. Unfortunately, it broke popups with some compositors. When the wlSurfaceDestroyed signal is emitted, QWaylandInputDevice::Keyboard is going to reset its focused surface and call QWaylandDisplay::handleKeyboardFocusChanged(). QWaylandDisplay::handleKeyboardFocusChanged() is going to call QWaylandDisplay::handleWindowDeactivated(), it will make an async roundtrip to determine the current focused window. This is to batch leave and enter events. Since the wlSurfaceDestroyed signal is emitted before destroying the shell surface and the wl_surface, the compositor has no reason to change keyboard focus, so qtwayland will think that the app lost focus for good and close all popups. This change restores the old behavior by making QWaylandInputDevice::Keyboard connect to QWaylandSurface::destroyed signal, which is emitted after the window's wl_surface is gone. It also makes QWaylandInputDevice::Keyboard consistent with QWaylandInputDevice::Pointer. Fixes: QTBUG-116051 Change-Id: If866f94a0cec1659c27ffeb2d263a2480ca8fdf1 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 1da23c86d54cefa6f3bd4285658ed6dc7b3f5175) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QWaylandDrag: Call into super class QBasicDrag::dropKai Uwe Broulik2023-08-161-4/+1
| | | | | | | | | | | It's where, among other things, the override mouse cursor is reset. Otherwise the cursor stays a dragging hand indefinitely. Change-Id: I9e7a44e09d5806cd64e66ba7a7c96f2d24ec97fc Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit bdec910d775720dc2cd73833bfe9eefc73518dc8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QWaylandWindow: Support Qt::WindowTransparentForInputKai Uwe Broulik2023-08-072-9/+39
| | | | | | | | | | | | | | This is achieved by setting an explicitly empty input region (as opposed to a "null" region) on the window. Unlike set_opaque_region, where a null region means an empty region, in set_input_region it means an infinite region. Change-Id: I018d53196bc816b5eaea7dd3b24626a9738c9f47 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 604db6b5499f5de1d700f19c03bc43fe2f59380d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Client: Fix buffer damageVlad Zahorodnii2023-08-031-5/+15
| | | | | | | | | | | | | | | | | | | | | | | If the specified damage rectangle has fractional coordinates in the buffer local coordinate space, the buffer damage needs to be expanded, i.e. - bufferRect.left = floor(rect.left * scale) - bufferRect.right = ceil(rect.right * scale) = ceil((rect.x + rect.width) * scale) Flooring the coordinates and ceiling the size is not enough. It can produce incorrect results. For example, consider that a rectangle with logical coordinates of QRect(0, 23, 179, 46) has been damaged in a window with scale 1.5. When flooring the coordinates and ceiling the size, the following buffer damage rect will be produced: QRect(0, 34, 269, 69). Its height is off by 1, the expected height is 70 (ceil((23 + 46) * 1.5) - floor(23 * 1.5) = ceil(103.5) - floor(34.5) = 104 - 34 = 70). Change-Id: I927e75a2224bb58b4634125011d1305dbdfbb3aa Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit d79db699866b37bd3e3358ca18a210dfc5c0b4b9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* client: Set queued buffer busyDavid Redondo2023-08-032-2/+6
| | | | | | | | | | | | | | From the outside it doesn't matter if the buffer was really committed or queued, it still in use. If it is not marked busy QWaylandShmBackingStore will delete when it is resized which can happen when the surface changes screens or receives a new fractional scale resulting in a use after free producing a crash or protocol error. Change-Id: I8abc4edbd8990af5114aa0b36c8ecedb37a4f0f6 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Kai Uwe Broulik <kde@privat.broulik.de> (cherry picked from commit 39a003942ebab39a1d3b8bc64f41d0c68e92f4bf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QWaylandWindow: adapt to QPlatformWindow::setBackingStore() additionMarc Mutz2023-08-022-0/+11
| | | | | | | | | | | | | | | | | | When qtbase/a4ca9e80658bca7dad1529f03c1b59173a6ecf62 added a virtual QPlatformWindow::setBackingStore(), this was hidden by the existing QWaylandWindow::setBackingStore(), causing a FTBFS on -developer-builds. Fix by using the newly-added detection macro to turn the existing function into an overrider. Fixes: QTBUG-115691 Task-number: QTBUG-97482 Change-Id: If1d8c4443fe50030addb23331a50b7b9e1274626 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit fa2a7b256e2229d11b986007276b742d7be79e8f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* client: Make sure screens stay virtual siblings during reconnectDavid Redondo2023-07-281-3/+3
| | | | | | | | | | | | The virtual siblings of QWaylandScreen are constructed from the list of screens in QWaylandDisplay. It is important that when a window changes screens due to handleScreenRemoved that the screens are siblings otherwise the platformwindow is destroyed and window becomes hidden. Change-Id: I7ceeee4e18fbdfa936fe987441d35b8a5cb1eefd Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 475b8e8da52e0c42bcab7f3df21d9e4df4d50bc2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix injecting key events in QML testsBernd Weimer2023-07-121-0/+2
| | | | | | | | | | | | | | Since QTBUG-110268 was fixed, injected key events by the TestCase QML type take a different code path and don't go through sendFullKeyEvent() any more that would map the key to a proper scan code, if not provided. The mapping has been added to the new path, as well. Fixes: QTBUG-115112 Change-Id: I79c7e7813b380daf586916eeca68acc4ab392872 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit fee9011f88e385081a211505067e7d83d4b8d66c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>