summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wayland/qwaylandwindow.cpp
Commit message (Collapse)AuthorAgeFilesLines
* wayland: Add xx-session-management-v1 supportDavid Edmundson14 days1-0/+11
| | | | | | | | | | | | | | | | | | This is powered by the xx-session-manager which is tagged as experiemntal. This is guarded by an env variable. Application level session IDs are exposed via QSessionManager. The public API for windows is exposed via the existing QSessionManager and QWidget::setWindowRole. As it's not widely supported the documentation in QWidget is left untouched for now. [ChangeLog][Third-Party Code] New protocol synced from wayland-protocols Change-Id: Ibfbef86c6e75f8b95433cbba69ca10a5abea9e21 Reviewed-by: Vlad Zahorodnii <[email protected]>
* wayland: Initialize surface format on constructionDavid Edmundson2025-06-181-0/+1
| | | | | | | | | | QPlatformWindow::surfaceFormat should return the requestedFormat until the surface is created. Fixes: QTBUG-137739 Pick-to: 6.10 Change-Id: I483cc47d96fc0edb110c1ad80d20eb4d96bc1202 Reviewed-by: David Edmundson <[email protected]>
* wayland: Drop unused member variableDavid Edmundson2025-06-031-11/+0
| | | | | | | | | The only mWaitingForUpdate is checked is to show a debug. The only public way to call requestUpdate is via QWindow::requestUpdate which has a guard already. Change-Id: I542e0f470ec2134f0a9fd415aab6ac7832e77263 Reviewed-by: David Redondo <[email protected]>
* wayland: Ack configure events when suspendedDavid Edmundson2025-06-021-2/+5
| | | | | | | | | | | | | All configure events should be acked, and that acknowledgement is double buffered with the surface commit. If a window is not exposed, for example being in a suspended state, us sending an expose event is semantically wrong. It also ends up not resulting in a commit as at some point it no-ops, we have to commit manually. Change-Id: I020b06f04030c1209f2fc768adc8bd66d57975b1 Reviewed-by: David Redondo <[email protected]>
* wayland: Use modern syntax for method invokationDavid Edmundson2025-06-021-1/+1
| | | | | Change-Id: I4b4d15fcb932460a1b6a132145451fa2990496ad Reviewed-by: David Redondo <[email protected]>
* wayland: Reset surface on QWindow type changeDavid Edmundson2025-05-301-5/+26
| | | | | | | | | | | | | | | Changing the role between toplevel and popups is illegal on wayland even if the window is not visible. We need to reset to the wl_surface. This meant we cannot call setWindowFlags in the constructor. QWindow::flags / QWindow::windowType changes after QPlatformWindow::setFlags has finished, so we need to use our own flags rather in XdgShell rather than pulling them from the QWindow. Task-number: QTBUG-136110 Change-Id: I8b54b7ea8a768a539178395e53cc63a64fd80232 Reviewed-by: David Edmundson <[email protected]>
* wayland: Drop ShellIntegration::handleExposeDavid Edmundson2025-05-291-5/+0
| | | | | | | | | | | | | | | This was effectively deprecated when the virtual isExposed was added and we moved towards a state based system. The region of the exposed geometry is something we want to phase out and is of no use to shells. The other usage in XdgShell was for updating contentGeometry on first show, but this is now an explicit call updated by QWaylandWindow directly. Change-Id: I09a083fcfcc69c444ca4270f425b591b046e0617 Reviewed-by: Vlad Zahorodnii <[email protected]>
* wayland: Make initial commit for surface state opt-inDavid Edmundson2025-05-291-1/+2
| | | | | | | | | | | | | | | After setting up the shell surface we setup the initial state and have to commit the surface to apply the surface role in order to get a configure event from the compositor. This is not a requirement for subsurfaces, and can be skipped. It is also problematic for some 3rd party shells, such as ext-session-lock-v1, which has a different setup behaviour. Task-number: QTBUG-136337 Change-Id: I9e7874ec2f4150e24eb4790384eacc4123f9552b Reviewed-by: Vlad Zahorodnii <[email protected]>
* wayland: Move to synchronous expose eventsDavid Edmundson2025-05-291-30/+27
| | | | | | | | | | | | | | | | | | | | | Move to synchronous delivery for expose events. One twist with this the expose event from geometry events. This event normally comes from the display server, but in our case is synthesised by the backend. This needs to be deferred, but we can do that internally. The move to synchronous events allows us to drop an old workaround for renders finishing after a window is hidden. The mInResizeFromApplyConfigure guard in geometry changes existed as all configure events trigger their own expose event and we didn't want two. Not the sending is deferred it's implicity handled by the mLastExposeGeometry check. Task-number: QTBUG-137021 Change-Id: I8758c083e4d44a04606ae72f1019f2bc577f51f6 Reviewed-by: Vlad Zahorodnii <[email protected]>
* Wayland Client: explicitly attach a buffer in sendExposeEvent()David Edmundson2025-05-271-4/+25
| | | | | | | | | | | if an expose is not handled by application code. This primarily is a workaround for Qt unit tests using QWindow directly and wanting focus. Done-with: Liang Qi <[email protected]> Fixes: QTBUG-137021 Change-Id: Ibcbd931af9a3558cf7244699216bc716eba4850c Reviewed-by: Liang Qi <[email protected]> Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* wayland: Deliver WindowScreenChangedEvent synchronouslyVlad Zahorodnii2025-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | The QWaylandWindow::handleScreensChanged() function checks window()->screen(), but QWindow's screen is updated asynchronously. It can lead to the following issue: - start on screen 1 - QWaylandWindow::handleWindowScreenChanged(screen 2): it'll update the window geometry so the window position is at the top left corner of screen 2 - QWaylandWindow::handleWindowScreenChanged(screen 1): it'll do nothing, despite the fact that the geometry has to be updated This change makes the delivery of WindowScreenChanged events sync, so the QPA updates the window geometry as expected if the window moves back and forth between two outputs. This fixes misplaced popup menus in Konsole. Change-Id: I5a200b33ef63c6082f54ee85667b7b1ab513335e Reviewed-by: David Edmundson <[email protected]>
* Client: add cursor state managementLu YaNing2025-05-271-5/+20
| | | | | | | | | | | When tooltip window is shown and dismissed under Wayland, the cursor state Add cursor state storage and application logic to ensure cursor state is properly updated when changing cursors on focused Fixes: QTBUG-135938 Change-Id: I8c3520bcb785cea03cddd1eb91e58b9d253b4fe0 Reviewed-by: David Edmundson <[email protected]>
* Set geometry before creating shell windowDavid Edmundson2025-04-301-2/+1
| | | | | | | | | Otherwise we risk creating the window with one geometry only to immediately change it. Fixes: QTBUG-136494 Change-Id: I140b51f895a12c448dee7859b8fb12bb5b60227b Reviewed-by: David Redondo <[email protected]>
* Don't call elapsed() on an invalid QElapsedTimerDavid Faure2025-04-051-3/+4
| | | | | | | | | | | | | | | | | It's UB, and it returns garbage. In QWaylandWindow::timerEvent the value was unused if the timer was invalid (but that was tested only later). In QWaylandInputDevice / QWaylandTabletToolV2 however the garbage value was passed on to wl_cursor_frame_and_duration. Testcase: running tests/auto/client/client/tst_client and tests/auto/client/tabletv2/tst_tabletv2 in a UBSAN build. Pick-to: 6.9 6.8 6.5 Change-Id: Ie0f8610bbca49913942b2247d3e968197e12f47e Reviewed-by: Konstantin Ritt <[email protected]>
* Client: Reset mFrameCallbackTimedOut when showing a windowVlad Zahorodnii2025-03-311-3/+10
| | | | | | | | | | | | | | | | | | | When a window is hidden, the corresponding expose event is sent asynchronously. So, a buffer (and a frame callback) can be attached after the window is hidden. QWaylandWindow::initWindow() handles that case by attaching a nil buffer to the surface, but it skips resetting the frame callback things. If mFrameCallbackTimedOut is not reset, then the window can get stuck in the unexposed state and not show up after the second setVisible(true). This change makes the initWindow() function also reset frame callback data. It fixes some windows not showing up after remapping them. Pick-to: 6.9 Change-Id: I8952ffed24844c73721c4f689786146c317e014d Reviewed-by: David Edmundson <[email protected]>
* client: Drop assert in frame size syncingDavid Edmundson2025-03-181-1/+0
| | | | | | | | | | | | | | | Whilst this assert is true for a normal application workflow such as QtQuick, it's not something we can guarantee with all applications. If the assert is not true, the absolutely worst case is the same glitchy resizing that we had in 6.8 and older. Fixes: QTBUG-134126 Pick-to: 6.9 Pick-to: 6.9.0 Change-Id: I43b660d771d628ceedce9407fd146b48074557f9 Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* client: implement support for the color management protocolXaver Hugl2025-02-021-0/+34
| | | | | | | | | This uses an "experimental" tag of the proposed protocol, which has been implemented by several compositors. Once the protocol gets merged upstream, this should be updated to use the final version from that as well. Change-Id: I8653489fea44f404b759b046cd3fa910dc92479b Reviewed-by: Tor Arne Vestbø <[email protected]>
* client: update mouse position on enterYifan Zhu2025-01-291-0/+7
| | | | | | | | | | Otherwise cursor position is not correctly set after a wl_pointer enter event. Fixes: QTBUG-133204 Pick-to: 6.9 6.8 Change-Id: I444fb63093ae08ae37f1e5b2863fb19fc7bb240a Reviewed-by: David Redondo <[email protected]>
* client: use QDesktopUnixServices instead of QGenericUnixServicesThiago Macieira2025-01-231-1/+1
| | | | | | | | Renamed in 3e29267df0e2f332290caad69e5bd5cfd61cf3da in qtbase. Pick-to: 6.9 Change-Id: If857e206071226c2d0f6f42ce1c9b4d091b0bc63 Reviewed-by: Liang Qi <[email protected]>
* QWaylandWindow: prevent a crash when calling requestXdgActivationTokenIlya Fedin2025-01-211-1/+9
| | | | | | | | It could crash if it's called when there's no mShellSurface Pick-to: 6.9 6.8 Change-Id: I9b279e915ea661b121da672ebd46be458a1a9218 Reviewed-by: David Edmundson <[email protected]>
* Client: Always trigger a commit in flushDavid Edmundson2024-12-061-1/+2
| | | | | | | | | | | | | | | | | | | | There are a few paths in wayland that require the client to always commit to apply changes or ack requests. We need this synchronized with any rendering so it is normally triggered with an expose or update event relying that this will always commit at the end. There is a path in QWidget code where if the window is not damaged we never call backingStore->beginPaint. If this doesn't happen we don't swap the front buffer, and the expose event will no-op. We want to avoid attaching in this case, but we should commit without attaching regardless to flush these events. This fixes an issue where Qt could fail to ack configure events which don't trigger updates. Pick-to: 6.8 Change-Id: Iaa606b0bf9fbbaefd3e67444cc768f95076967fe Reviewed-by: Vlad Zahorodnii <[email protected]>
* Client: Implement frame-perfect resizingDavid Edmundson2024-11-251-0/+14
| | | | | | | | | | | | | | | | | | | | | | With synchronous delivery we can be sure that any exposeEvent blocks until the frame is rendered and committed. This patch introduces a new override to make the render thread back off starting a new frame when a resize is pending. If a configure event is received we do not need the render thread to dispatch a new frame as the main thread will do so explicitly when the configure event has been processed. To handle the case of a frame already being in flight at the time of the main thread processing a configure event, this patch submits a new exposeEvent with the old geometry. This will block until any existing frames are fully submitted and the new exposeEvent is handled. Together with the allowsIndependentThreadedRendering hook we can ensure that no frame of the old size are going to be committed after we finish processing and acking the incoming configure request. Change-Id: Ic8ec9803800b17d2b8419da1a93e8dc388e702ab Reviewed-by: Vlad Zahorodnii <[email protected]>
* Adapt window recreation to wl_surface as winId and lifetime changesDavid Redondo2024-11-131-1/+0
| | | | | | | | | | | | | | | | | | | Returning wl_surface as winId broke widget windows after reconnect. When fetching globals from the new connection new screens are added, this results in QWidget being notified of a screen change. It then refreshes its cached winId which at this point in time will be 0 since the window does not have a new window yet. Then when a widget repainting the backing store will never be flushed because it doesnt find a native parent anymore by going up the parent chain and looking for a widget with non-null winId. Fix this by recreating the wl_surface after fetching the globals but before the initital roundtrip. While at it dont recreate role objects for windows that dont need them. With the changes that also now hidden windows have wl_surfaces we would recreate them along with closed popups. Change-Id: Ib7ed27d1f25df84c85cce4802726178586c19d55 Reviewed-by: David Edmundson <[email protected]>
* client: Fix changing to subsurface now that wl_surface is not destroyedDavid Redondo2024-11-061-7/+8
| | | | | | | | | | In the past isVisible() was equivalent to having a wl_surface - this does not hold anymore. The QWaylandWindow will have a wl_surface for all its life time. Changing parent while the window is hidden would run now into a protocol error. Change-Id: I2aec6217ad495daa9dbb2ee2fee1b73ba00e6937 Reviewed-by: David Edmundson <[email protected]>
* Client: implement toplevel icon protocolDavid Redondo2024-10-311-0/+5
| | | | | | | | | | | | | | This allows QWindow::setIcon to work on desktops that support the standards. If an icon name is set, we assume it's from an installed theme and provide the name, otherwise we provide buffers. For SVGs the size hint from the compositor is used, otherwise we supply pixmap data in all the sizes we have available. [ChangeLog][Third-Party Code] New protocol synced from wayland-protocols Change-Id: Iabbd928a3476aafa2d63a81e68299049e59991db Reviewed-by: David Redondo <[email protected]>
* client: Drop outdated QT_WAYLAND_RESIZE_AFTER_SWAPDavid Edmundson2024-10-251-5/+0
| | | | | | | | | | | | | QT_WAYLAND_RESIZE_AFTER_SWAP was added in15f82d0bc40eae635ed1377ae39253a8f515ea4a in 2014 to provide an opt-in-path to support drivers that did not apply an eglWindow resize until after the swap occurred. This is now the default in the EGL specification and fully supported in QtWayland. The environment variable does nothing. Change-Id: I8114d11801db5ba6863f48e2d44cca984bb58de7 Reviewed-by: Vlad Zahorodnii <[email protected]>
* Client: Use synchronous delivery for geometry eventsDavid Edmundson2024-10-251-57/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies the data flow and reduces the paths for some races with threaded rendering. Making all events synchronous does not work due to application logic having nested event loops. The design is all normal wayland events are flushed at the end of each dispatch so that everything remains ordered. When a configure event is received applying that state is queued. When it is applied, all events emitted from this are flushed. Application driven geometry changes are also synchronous. The old code to manage frame synchronization is removed, this attempted to not apply configure events whilst a frame is in flight. It doesn't work properly as the render thread could start on the next frame whilst the main thread processed the resize. It is problematic in this port as the mutexes will cause deadlocks with sync delivery. Task-number: QTBUG-121731 Fixes: QTBUG-117762 Fixes: QTBUG-119112 Change-Id: I5802b4006d307a45468767d68c3ad40078df5703 Reviewed-by: Vlad Zahorodnii <[email protected]>
* Client: Send mouse events with QPointingDevice instancesShawn Rutledge2024-10-011-4/+10
| | | | | | | | | | | | | | We can't distinguish devices so far on Wayland: primaryPointingDevice() is just an assumption. But at least we know which seat sends the event. After this change, for example, the mouse seat name is visible in qtdeclarative/examples/quick/pointerhandlers/singlePointHandlerProperties.qml Task-number: QTBUG-85272 Task-number: QTBUG-115207 Task-number: QTBUG-129087 Pick-to: 6.8 Change-Id: I3822075bf5680c40b55868f413c48adaea1d3fec Reviewed-by: David Edmundson <[email protected]>
* Return wl_surface* QWaylandWindow::winId()Xavier BESSON2024-09-271-3/+1
| | | | | | | | | | | Required when you want to use some of the wayland protocols (For example: Keyboard shortcuts inhibit) Fixes: QTBUG-67919 Fixes: QTBUG-93103 Fixes: QTBUG-94729 Change-Id: I112c4c3eac99187317dce8de59a77ba3b0e70d17 Reviewed-by: David Edmundson <[email protected]>
* client: Change default lifespan of wl_surface to match the windowDavid Redondo2024-09-241-44/+53
| | | | | | | | | | | | | | | | | | This brings it more in-line with other platforms where the underlying backing store has the lifespan of the window, implicitly fixing a teardown issue with Qt Vulkan. With this commit the wl_surface lifetime matches the QPlatformWindow, on show and hide the shell surface is still recreated, with a null buffer attached inbetween to get a blank slate as per the specification. There is still some paths where a wl_surface is reset during the platform window lifetime if the user ever converted a subsurface to a toplevel or vice-versa, also for handling compositing restarts. Task-number: QTBUG-125592 Change-Id: I449ec170a085c7c0fca504687556d702daddf79a Reviewed-by: David Edmundson <[email protected]>
* Client: Ceil cursor's fallback buffer scaleIlya Fedin2024-09-111-1/+1
| | | | | | | This should provide a crisper cursor Change-Id: Iaa3108cc2c6346e9db9755975ca2718875f470b7 Reviewed-by: David Edmundson <[email protected]>
* Client: Fix desktop environment check for decorationsIlya Fedin2024-09-071-2/+2
| | | | | | | | | XDG_CURRENT_DESKTOP is an array and the current check doesn't work on e.g. Ubuntu Pick-to: 6.8 Change-Id: Iff049ad8dd432191f815c6c079448af02dc7a09a Reviewed-by: David Edmundson <[email protected]>
* Client: Pass tablet input to decorationsNicolas Fella2024-09-031-0/+10
| | | | | | | | | | | | | Otherwise decoration cannot be interacted with using a stylus. Since there is no reason for the decoration to distinguish between stylus and mouse input reuse the existing mouse handling instead of adding a dedicated tablet input function to the decoration API. Fixes: QTBUG-117920 Pick-to: 6.8 Change-Id: I947e5b4f638fb3c2b15a1ca4ed01c02caf9d4812 Reviewed-by: Shawn Rutledge <[email protected]>
* Fix compilation with -qreal floatTim Blechmann2024-08-131-2/+2
| | | | | | | Task-number: QTBUG-118877 Pick-to: 6.8 Change-Id: Ie5d4f8b500276e0939da6899306fcd6c87b226df Reviewed-by: David Edmundson <[email protected]>
* client: Update internal geometry before notifying shell surfacesDavid Edmundson2024-08-121-7/+7
| | | | | | | | | Some shell surfaces will query sizes on the window directly. In particular Xdg Shell Popup repositioning. The update is still processed before the expose event, so we have a chance to pause rendering for async geometry changes. Change-Id: I3961b282dbb450c864e3543ef267ddcd7a9c36d7 Reviewed-by: David Edmundson <[email protected]>
* Client: Use std::unique_ptr to manage window decorationDavid Redondo2024-07-221-7/+5
| | | | | | | | | | | | There was a potential crash in the QWaylandWindow destructor. First it deletes the window decoration (but does not unset the pointer!) and then deletes the surface via reset(). This eventually triggers QWaylandDisplay::handleKeyboardFocusChanged which will call decoration->update(). Using std::unique_ptr makes it easier to manage and prevents such errors. Change-Id: I52edcdab0d25c35dc656581fbb5c1c9b5ca481c4 Reviewed-by: Vlad Zahorodnii <[email protected]>
* client: process exposure updates in the main threadDavid Edmundson2024-07-181-1/+1
| | | | | | | This is important for when synchronous delivery is enabled as that should only happen from the main thread. Change-Id: I524443c6d2dd8dee8d36834b6d3032eb8f8c1750 Reviewed-by: Vlad Zahorodnii <[email protected]>
* client: Guard against windows being on a null screenDavid Edmundson2024-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | calculateScreenFromSurfaceEvents uses the screen information from our surface enter events. If this is not set yet, or refers to outputs not yet complete we fall back to the QWindow::screen. This was introduced in 2f7a86fac338dc78259d93b675f1cd131c24c926. It was assumed that this would always be a valid value as QtBase keeps it updated, but there are apparently paths for it to still be null. It will be evaluated again when the surface receives a wl_enter event or the output that we have entered is finally initialised and we will then be marked as on the correct screen. Pick-to: 6.8 Pick-to: 6.7 Change-Id: I33b4a5112c3426a8ea523d39a0658ba7ffee5298 Reviewed-by: Aleix Pol Gonzalez <[email protected]> Reviewed-by: Vlad Zahorodnii <[email protected]>
* client: Cache exposed state and unify sending eventsDavid Edmundson2024-07-151-25/+38
| | | | | | | | | | | | | | | Right now we are sending an expose event on every configure event because exposure may have changed. This causes an overhead. The mechanism for sending expose events is also scattered, there are a lot of properties that affect exposure, having everyone track the full state gets messy. This is cleanup work to then be able to land viewport clipping and synchronous event delivery. Change-Id: I192b908cdb6f6adda7d0e33f83961861e09504e8 Reviewed-by: Vlad Zahorodnii <[email protected]>
* Client: Split requests to set window and content geometryVlad Zahorodnii2024-06-261-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, QWaylandShellSurface::setWindowGeometry() serves several purposes. It's used to specify the bounds of the content when using client side decorations (not preferred but the one that's painted) and it's used to tell the compositor the preferred window size. These two use cases are very different in nature. This change introduces QWaylandShellSurface::setContentGeometry() request, which can be used to communicate the bounds of the client side decorated content. The content geometry is specified in the surface-local coordinate system, i.e. 0,0 is the main surface's top left corner. QWaylandShellSurface::setWindowGeometry() takes window geometry in the global coordinate system, excluding the drop shadows. [ChangeLog][QtWaylandClient][Important Behavior Changes] The QWaylandShellSurface::setWindowGeometry() function is no longer suitable for communicating the bounds of client side decorated content. Custom shell implementations should use QWaylandShellSurface::setContentGeometry() instead. Change-Id: I134ce4f0866d3abbe7050ed6769dc586210eac27 Reviewed-by: David Edmundson <[email protected]> Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* client: Drop the concept of a queued buffer before the first exposeDavid Edmundson2024-06-261-12/+1
| | | | | | | | | | | | | | | Added in 46aece51330b6f9b5b4bfd68a5b3b183dc5b1c38 this was part of a guard to handle clients committing before the window was configured. Since then there has been work in ensuring expose events are delivered to the client correctly only when the window is configured. Including e6d55239c454d454978edb7d8b17f6c993e7ba07. Even if a client does manually explicitly flush a paint before the first expose, we should be able to simply discard the buffer. It's part of the contract that a client should redraw contents when it gets an expose event. This is better as any queued buffer cannot be of the right size and it simplifies the code. Pick-to: 6.8 Fixes: QTBUG-126262 Change-Id: Ia4829ca75a55819b5e8ab366baedcdf83dfc14ec Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* Client: Ensure that guessed popup parent has a shell surfaceVlad Zahorodnii2024-06-201-2/+4
| | | | | | | | | The last input window may not have a shell surface if it is a subsurface or that window has been just made invisible. Pick-to: 6.8 6.7 Change-Id: Iad11c68659579429ddc5d9ba0038975b25da8e0d Reviewed-by: David Edmundson <[email protected]>
* client: Support popup repositioningDavid Edmundson2024-05-281-1/+1
| | | | | | | | | | | | | | | | | | | Xdg popups can be repositioned at runtime. An important example is tooltips where the same instance gets re-used between multiple invocations. shellSurface->setWindowPosition is guarded to not run from configure events to avoid a feedback loop. Window exposure is changed in xdgshell to mark the window as exposed when applying the configure, not when it is received. This is needed to ensure geometry is up-to-date. This patch is orthogonal to providing proper semantic positioning. Change-Id: I673957832d34129e9b9fc8fba732ffb2083a4d0b Reviewed-by: Liang Qi <[email protected]> Reviewed-by: David Redondo <[email protected]>
* Client: Update size hints on custom margins changeIlya Fedin2024-05-251-0/+1
| | | | | | | | | As size hints get sent in window content geometry, they have to be updated once window content geometry changes Pick-to: 6.7 6.5 Change-Id: I7c17770d29be8381b0c43ab724202219a9cf7a5f Reviewed-by: David Edmundson <[email protected]>
* client: Avoid roundtrip to handle xdgoutput race conditionDavid Edmundson2024-05-251-3/+0
| | | | | | | | | | | | | | | | | The original bug was that we could get a surface enter event before the xdg output was fully ready, where we had a QPlatformScreen but no QScreen announced. A solution with a roundtrip was added, which works, but roundtrips cause other problems processing messages out of order and inhibts a move to synchronous delivery. As an alternative fix we move the problem from QWaylandWindow to QWaylandSurface and have that filter out not-ready QScreens. The best output is then re-evaluated whenever a screen is added. Change-Id: Iabc78917112aa8c58cad8e128c5bb3030f8c8f65 Reviewed-by: David Redondo <[email protected]>
* client: Always update the window's screen on changesDavid Edmundson2024-05-251-3/+2
| | | | | | | | | | | | | | | | | QWindow::screen can be set by an application programmatically or be updated from the platform. Currently when the QPA handles a screen change we compare against mLastReportedScreen to determine if we need to update anything. This results have a situation where sometimes we use the new value from the platform, sometimes not, depending on which screens happened to be used. To be consistent, always check against the window's current screen. Change-Id: I7ea15aa497a81d0cf46efe274f83f4667304623e Reviewed-by: Vlad Zahorodnii <[email protected]>
* Client: Fix initialization of QWaylandWindow::mScaleVlad Zahorodnii2024-05-241-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QWaylandWindow initializes mScale to the scale factor of the currently assigned screen when it's constructed. However, it doesn't keep track of subsequent screen changes that may occur afterwards before QWindow::setVisible(true). For example window.setScreen(foo); window.create(); window.setScreen(bar); window.show(); In that case, the value of mScale will correspond to the scale factor of output "foo" when show() is called. A better place to initialize mScale is when the show() function is called. Furthermore, since there's wl_surface.preferred_buffer_scale and fractional_scale_v1.preferred_scale events, QWaylandWindow could stop guessing the scale factor and rely on the compositor telling us that information. However, it's important that the compositor sends the preferred buffer scale before the first configure event arrives. Fixes: QTBUG-124839 Pick-to: 6.7 Change-Id: I842aaa352d9cb1e53158f64f2ec0cd3734f7ecf3 Reviewed-by: Liang Qi <[email protected]> Reviewed-by: David Edmundson <[email protected]>
* Client: Try harder to guess the transient parent windowVlad Zahorodnii2024-05-241-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xdg_popup requires a parent surface. On the other hand, Qt is quite permissive, it allows showing a popup window without specifying the transient parent window. Things have been slowly changing and more controls specify the transient parent, but there are still apps that don't do it. For that particular reason, QWaylandWindow has some heuristics to guess the transient parent. Currently, that heuristic works as follows: - If QWindow::transientParent() is set, use that - otherwise use the focus window However, this heuristic doesn't consider that a window can be inactive. For example, user hovers an element in the window while the window has no focus. This change proposes a heuristic that considers the last interacted input device, i.e. - if QWindow::transientParent() is specified, prefer that - if there's a "top" popup, use it - otherwise check the last interacted window With the proposed heuristic, tooltips are less likely to be backed by xdg-toplevel in inactive apps. Pick-to: 6.7 Change-Id: I7e6a607dc38f9e8adce316d3540a9bd9c37cfed4 Reviewed-by: David Edmundson <[email protected]>
* client: Disentangle platform services and windowmanagerintegrationDavid Redondo2024-05-101-1/+1
| | | | | | | | | The current state was a bit messy with the platform services being the potentially no initialised qt window manager extension wayland object. Change-Id: Id1f911b75d34fcf70594ca7257b79bf431f0643f Reviewed-by: David Edmundson <[email protected]>
* QWaylandWindow: requestActivate on showKai Uwe Broulik2024-04-261-0/+3
| | | | | | | | | | | | | | For simplicitly, a Wayland compositor typically activates a window when it is mapped. However, it does not necessarily have to and might not want to in order to prevent stealing focus. Inttroduce a requestActivateOnShow() on the shell which is called when showing a window and, in case of XDG Shell, will explicitly request activation (unless Qt::WA_ShowWithoutActivating is set) and make use of the existing XDG Activation infrastructure. Change-Id: I69ab5f2cee4540d5baefa5a266f22dbb165e4192 Reviewed-by: David Edmundson <[email protected]>