summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/xdgshell/tst_xdgshell.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Correct license for test filesLucie Gérard2024-04-041-1/+1
| | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Task-number: QTBUG-121787 Change-Id: I35b93ca5f2fd27685eda4aafda48c24925c0c56f Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* client: Implement dialog-v1 protocolDavid Redondo2024-03-271-0/+36
| | | | | | | | Allows to mark windows as modal dialogs. Change-Id: Ie4999552933e02fc473e621e7cc5e3f2928c0adb Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* client: Fix xdg shell setting only a minimum size hintDavid Edmundson2024-02-201-9/+50
| | | | | | | | | | | | | | | An unbound maximum size is sent across the protocol as 0. We need to make this change before the check that the minimum size is less than the maximum size. This fixes having only a minimum size set. This bug is currently masked by the platform forcefully applying the minimum size. Pick-to: 6.6 Pick-to: 6.7 Change-Id: Ifca4fa01e4c2ac1c34aeb72db1584e4a868d50bc Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
* client: support Xdg Shell not_shown stateDavid Edmundson2023-09-251-0/+33
| | | | | | | | | | | | | This state is to indicate that a toplevel is not visible, either minimised on another desktop. This maps to QWindow::isExposed. In addition to XdgShell changes. QWaylandWindow is adjusted to check exposure state before sendingExposureEvents. Subsurfaces are un-exposed and re-exposed when the toplevel changes. Change-Id: I76932c2c58681f832c1c2efde3cfde1c32cd3e05 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* tests: Fix tst_xdgshell::minMaxSize()Vlad Zahorodnii2023-09-151-0/+2
| | | | | | | | | Amends e8cff6fb39c0fd01548bce18542820a6612dbe49. The new size hints will be committed when the surface is committed. Change-Id: I94e944fee7dac63d5e9ac86fb348b5d24d54abfc Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Client: Remove some surface commitsVlad Zahorodnii2023-08-291-0/+2
| | | | | | | | | | | | | | | 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>
* Fix C++20 deprecated capture of *this in [=]Marc Mutz2023-08-021-45/+45
| | | | | | | | | | The exec() function is synchronous, so we can just replace [=] with [&]. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I1b672b0ef456977fa0b898dff9c88f48765a3e41 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* client: Add support for xdg_popup_configureLiang Qi2023-03-101-2/+20
| | | | | | | | | | | | | | | | | This amends 59a5fe99e1569421b920d99c5b20cdafcdcf43a9. Since set_constraint_adjustment() was supported, popup should reposition itself from configure. Need to find a way to test clientSideMargins() and etc in the future. Fixes: QTBUG-110623 Task-number: QTBUG-87303 Pick-to: 5.15 6.2 6.4 6.5 Done-with: Ilya Fedin <fedin-ilja2010@ya.ru> Change-Id: I734acfcde3ba5a35b6f4222358bc93e49fa43f7c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Compile with -no-openglEskil Abrahamsen Blomfeldt2023-03-061-1/+0
| | | | | | | | | | | A few of the tests were including Qt OpenGL for no good reason, and the link step should be optional. Pick-to: 6.2 6.5 6.5.0 Fixes: QTBUG-110420 Change-Id: Icb78c15e49070c6938bf9bb75abfed677af6785b Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Client: Improve handling of 0xH and Wx0 xdg_toplevel configure eventsVlad Zahorodnii2022-12-051-0/+25
| | | | | | | | | The compositor can send a configure event with 0xH and Wx0 when it wants the window to have some concrete size along one dimension but wants the client to pick the size along the other dimension. Change-Id: I2e72017d4a71b19a930da24fa5c58b6ce672fb94 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Port from container::count() and length() to size()Marc Mutz2022-10-101-6/+6
| | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: I574208abc90a8042b500b3f96e3862b0ff339eb6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Only close popup in the the hiercharyWeng Xuetian2022-07-241-0/+87
| | | | | | | | | | | | | | | | | Imagine following event sequences: 1. a tooltip is shown. activePopups = {tooltip} 2. user click menu bar to show the menu, QMenu::setVisible is called. now activePopups(tooltip, menu} 3. tooltip visibility changed to false. 4. closePopups() close both tooltip and menu. This is a common pattern under wayland that menu is shown as a invisible state. This patch tries to memorize the surface hierchary used to create the popup role. And only close those popups whose ancesotor is hidden. Pick-to: 6.4 Change-Id: I78aa0b4e32a5812603e003e756d8bcd202e94af4 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Use SPDX license identifiersLucie Gérard2022-06-101-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I106d3a5d1a7b96250380b6f51a48f3b19d10e4d9 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Wayland client: use wl_keyboard to determine active stateMéven Car2021-10-041-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit f497a5bb87270174b8e0106b7eca1992d44ff15d made QWaylandDisplay use the xdgshell's active state for QWindow::isActive(), instead of using wl_keyboard activate/deactivate events. That seems to have been a misunderstanding, since xdgshell activation is only supposed to be used to determine visual appearance, and there is an explicit warning not to assume it means focus. This commit reverts this logic back to listening to wl_keyboard. It adds a fallback when there is no wl_keyboard available to handle activated/deactivated events through xdg-shell, in order to fix QTBUG-53702. windowStates is handled so that we're not using the Xdg hint for anything with QWindowSystemInterface::handleWindowStateChanged or anything where we need to track only having one active. We are still exposing it for decorations, which is the only reason to use the Xdghint over keyboard focus - so you can keep the toplevel active whilst you show a popup. Change-Id: I4343d2ed9fb5b066cde95628ed0b4ccc84a424db Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Client: Don't always recreate frame callbacksGeorges Basile Stavracas Neto2021-09-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main QWaylandWindow method that is executed when handling updates is QWaylandWindow::handleUpdate(). This method always, unconditionally queues a frame callback, regardless of whether any other one is already queued. On some circumstances, e.g. when a window is hidden or completely obscured by other windows, it stops receiving frame callbacks from the compositor. However, QWaylandWindow would continue to request for them, which eventually fills up the Wayland socket, and causes the application to crash. This can be avoided by checking if the platform window is already waiting for a frame callback, before queueing another one. In QWaylandWindow::handleUpdate(), check if mWaitingForFrameCallback is true before queueing frame callbacks, and early return if that's the case. The XDG-shell test needed to be updated for this: The mock compositor is not responding to any frame callbacks, so the window will be unexposed, no longer get paint events and therefore not trigger any commit. This worked by accident before because we were issuing updates quickly enough to reset the timer before it had a chance to unexpose the window. The easiest fix is just to disable the dependency on frame callbacks in this test, since that is clearly not what it's testing. Task-number: QTBUG-81504 Change-Id: Ieacb05c7d5a5fcf662243d9177ebcc308cb9ca84 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Georges Basile Stavracas Neto <gbsneto@gnome.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Unskip tst_xdgshell::showMinimized()Eskil Abrahamsen Blomfeldt2021-09-221-1/+0
| | | | | | | | This passes now, so re-enable it. Change-Id: I2e0c40d5d2f3b6bb84f71f4ad192384f88e8e34e Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Client: Set XdgShell size hints before the first commitDavid Edmundson2021-05-101-1/+1
| | | | | | | | | | | | | propagateSizeHints is only called in QWindow we have platform window and minimumSizeHint is then sent. We also need to send existing hints when we create the shell window. Sending them when we apply configure is too late, we need these hints available for the compositor to correctly configure the window. Change-Id: I6cbb294b11db06ecd87535fa4816bb8ad34a29c6 Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
* Client: Expose XdgShell native resourcesDavid Edmundson2020-08-261-0/+19
| | | | | | | | | | | | Many new specifications now rely on passing xdg_surface/xdg_toplevel as arguments to other protocols. wl_shell is currently exposed through native resources but xdg-shell related classes were not. Fixes: QTBUG-81479 Change-Id: I2023f39ad6813ff58e8a86d739f307d791794b16 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-081-1/+1
| | | | | | Task-number: QTBUG-84469 Change-Id: I4bc7b2eb2913fc828f09f96e21480b76cabf8656 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build: Add dependency on OpenGL moduleJohan Klokkhammer Helsing2020-01-301-1/+1
| | | | | | | | | | Several of the QOpenGL* classes we depend on has moved to QtOpenGL, add the dependency and fix the include paths. Task-number: QTBUG-74409 Change-Id: Iab7949dd67befaa71cf2cfa041771e93f4e47160 Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add client test for hiding the toplevel parent of a popupJohan Klokkhammer Helsing2019-12-061-0/+45
| | | | | | | | This used to cause undefined behavior. Task-number: QTBUG-80562 Change-Id: I0397b7b304f316616d2a713063bc5a634dc081bc Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Client tests: Fix missing frame eventJohan Klokkhammer Helsing2019-12-051-1/+1
| | | | | Change-Id: I8bda37560ff8b3c97699831427b0a148f8a5970c Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Client tests: Upgrade tests to wl_seat v5Johan Klokkhammer Helsing2019-08-261-17/+22
| | | | | | | | | This means that pointer events need to be followed by frame events. wl_seat version 4 is tested by the "tst_seatv4" autotest. Change-Id: Ifa8e6d6edc998853be7cd901003e619029fc6f68 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Test the exact window sizePier Luigi Fiorini2019-08-151-2/+6
| | | | | | | | | | Make sure we test exactly the size we expect. We used frameGeometry() to take client-side decoration margins into account, but actually frameMargins() returns exactly that, this means we can compute the actual size that we want to test. Change-Id: I2f41ffdb2aa2e3a4253a1ff7038c4bc2e43cdf98 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devJohan Klokkhammer Helsing2019-05-071-2/+9
|\ | | | | | | | | | | | | | | Conflicts: src/client/qwaylanddisplay_p.h src/client/qwaylandwindow.cpp Change-Id: I50eb5c83a8b81e4bdb032b68d41f429b17d0a74d
| * Client tests: Fix tst_xdgShell::pongs when run as the only testJohan Klokkhammer Helsing2019-04-111-1/+8
| | | | | | | | | | | | | | | | | | | | The shell integration is initialized lazily, so it's not possible to send ping events to the client before the first window has been initialized. This adds a simple window to the pong test. Change-Id: I13b4a9cb802b7abe18bfc23cf8c75eb873ded3ca Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| * tst_xdgshell::showMinimized: Really make sure the window was createdJohan Klokkhammer Helsing2019-04-111-1/+1
| | | | | | | | | | | | | | | | The surface(), may be a leftover cursor surface from earlier tests. Check for an xdgSurface instead, as those are verified to be cleaned up between tests. Change-Id: I6a2b402130814e896d335787fcb90fd8d57cafb7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Client: Add test for surfaces created by application codeJohan Klokkhammer Helsing2019-05-011-0/+30
|/ | | | | | | | This used to crash the client. Task-number: QTBUG-73801 Change-Id: I04d1c6fcc45b6d90f2ac28844e753da2cdf3ab08 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Client xdg-shell: Add test for switching popupsJohan Klokkhammer Helsing2019-03-051-0/+89
| | | | | | Task-number: QTBUG-73524 Change-Id: Ie9a13aeae52a7576699147e5515e2ed32a3a4d1c Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Client xdg-shell: Add test for tooltips on popupsv5.13.0-alpha1Johan Klokkhammer Helsing2019-02-061-0/+80
| | | | | | | | This used to cause protocol errors. Task-number: QTBUG-71734 Change-Id: Ic937210fc42c93f1d411fb0fb4f269de01f07b5b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Client: Test for xdg surface window geometryPier Luigi Fiorini2019-01-151-0/+16
| | | | | Change-Id: I2f336a81682317b1f7dc939d911906b4db60a386 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Client: Test for xdg toplevel min and max sizeJohan Klokkhammer Helsing2019-01-151-0/+22
| | | | | Change-Id: I60605f494eebfde9a7737911eefe69a93041ced5 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Create a new type of mock compositor for client testsJohan Klokkhammer Helsing2018-12-111-0/+269
There are a number of issues with the current client testing: - Adding new compositor functionality is cumbersome (need to add compositor send method, command, implementation, not to mention creating new wrapper objects. - Customizing available globals and their versions is not possible and would be hard to implement. I.e. how to test that functionality works with old and new versions of an interface? Handle globals being destroyed. We did this with wl_output, but it was painfully cumbersome. - Hard to verify that the compositor state is clean between tests. It is currently done in some tests, but requires boiler plate code which needs to be added and maintained for each test. - In general lots of boiler-plate for new tests. (We have to have separate tests as long as Qt has global/static state. I.e. if one shell extension has been initialized, we can't deinitialize and initialize another one, so tests have to be separate.) - Dispatching server events tied to the client event loop sometimes makes it hard to write tests without deadlocks. - Abstraction, encapsulation and automatic behavior that can't be disabled makes it hard to test low-level functionality like surface exposure. So, in an attempt to mitigate these issues, I wrote a new testing framework. - Compositor dispatch is running continuously in it's own thread, access to compositor state is guarded by a mutex on the compositor, locking this will make dispatching stop, so the test can safely access internals. Although a bit cumbersome at first this makes it much easier to directly use server protocol commands from the test itself, i.e. no need to create commands for every single thing we want to test. - The CoreCompositor::exec template method can accept a lambda that will be run with dispatching stopped. It can also return a value, conveniently letting us safely extract or modify compositor state from tests. - This framework also takes full advantage of the qtwaylandscanner, using wrapper classes for everything, reducing boiler plate considerably. - The compositor parts are designed to do as little as possible automatically, but still provide easy ways to enable common functionality, like releasing buffers automatically, configuring shell surfaces etc. - Compositor globals are pluggable, use add<GlobalClass>() and remove<GlobalClass>() to add new global interfaces. I.e. easy to create a compositor with or without data_device_manager for instance. - DefaultCompositor provides a sensible default set of functionality and convenience methods for most test-cases. Custom ones can still be made by inheriting from CoreCompositor directly instead or by removing or adding globals to DefaultCompositor. - Globals have an isClean() method. Implement it to verify that the client didn't leave any objects lying around from the previous test. CoreCompositor::isClean calls isClean on the globals so a single call is all that's needed. In short, we've traded mock compositor encapsulation and thread safety guarantees for less boiler-plate, easier and more convenient access to internals. Anything accessing compositor state should go into a exec() call, or through the wrapper macros QCOMPOSITOR_VERIFY and QCOMPOSITOR_COMPARE (or the TRY versions). I've also tried to make the compositor print warnings if compositor state is accessed in an unsafe way. The mock compositor is currently built once per test due to CI limitations (same thing as with the old tests). Change-Id: Ia3feb80ce175d3814292b7f4768a0cc719f8b0e8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>