diff options
author | Liang Qi <liang.qi@qt.io> | 2020-04-27 08:51:53 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-04-29 13:51:58 +0200 |
commit | 6319bc72e2dc63175ca797ee3042955f852e008f (patch) | |
tree | c9c1c71c43394a4cd2f0f6a75df8ba6f3a2550f3 /tests/auto | |
parent | 00c8a79da0c80616f18329cdfc61338a2c1af7df (diff) | |
parent | 28e7d940c42c47cf039522709883ae3de9f4fb88 (diff) | |
download | qtwayland-6319bc72e2dc63175ca797ee3042955f852e008f.tar.gz |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
tests/auto/client/xdgoutput/tst_xdgoutput.cpp
Regenerated CMake projects.
Removed duplicate wayland source in
tests/auto/client/xdgoutput/xdgoutput.pro. It's still
referenced via the included shared.pri file. Regenerated
the CMake project to adapt to that. Otherwise the CMake
project fails to configure due to duplicate rules with
a error like the one below
CMake Error at src/compositor/Qt6WaylandCompositorMacros.cmake:13 (add_custom_command):
Attempt to add a custom rule to output
tests/auto/client/xdgoutput/wayland-xdg-output-unstable-v1-server-protocol.h.rule
Also use a workaround fix for configuring CMake standalone tests
due to regression introduced by
dd7e40b1086020f6a054957f4972720cd684 in qtbase.
Change-Id: Ib364b851a1fa828c153efbf8653c9e4ef5e618cd
Diffstat (limited to 'tests/auto')
34 files changed, 292 insertions, 67 deletions
diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index 499a93a1..42e23b54 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/client/tst_client.cpp @@ -149,7 +149,7 @@ public: : compositor(c) { QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), this, SLOT(processWaylandEvents())); + connect(notifier, SIGNAL(activated(QSocketDescriptor)), this, SLOT(processWaylandEvents())); // connect to the event dispatcher to make sure to flush out the outgoing message queue connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClient::processWaylandEvents); connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClient::processWaylandEvents); diff --git a/tests/auto/client/datadevicev1/.prev_CMakeLists.txt b/tests/auto/client/datadevicev1/.prev_CMakeLists.txt index 97dedb85..e835f09d 100644 --- a/tests/auto/client/datadevicev1/.prev_CMakeLists.txt +++ b/tests/auto/client/datadevicev1/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_datadevicev1 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_datadevicev1.cpp INCLUDE_DIRECTORIES @@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_datadevicev1 FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/datadevicev1/CMakeLists.txt b/tests/auto/client/datadevicev1/CMakeLists.txt index e635e33c..06a56ccf 100644 --- a/tests/auto/client/datadevicev1/CMakeLists.txt +++ b/tests/auto/client/datadevicev1/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_datadevicev1 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_datadevicev1.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_datadevicev1 FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/inputcontext/.prev_CMakeLists.txt b/tests/auto/client/inputcontext/.prev_CMakeLists.txt index cf2301e7..c32f2e93 100644 --- a/tests/auto/client/inputcontext/.prev_CMakeLists.txt +++ b/tests/auto/client/inputcontext/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_inputcontext ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_inputcontext.cpp INCLUDE_DIRECTORIES @@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_inputcontext FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/inputcontext/CMakeLists.txt b/tests/auto/client/inputcontext/CMakeLists.txt index f061a7ea..5eb73b11 100644 --- a/tests/auto/client/inputcontext/CMakeLists.txt +++ b/tests/auto/client/inputcontext/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_inputcontext ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_inputcontext.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_inputcontext FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/nooutput/.prev_CMakeLists.txt b/tests/auto/client/nooutput/.prev_CMakeLists.txt index 3f09f584..61b43b0f 100644 --- a/tests/auto/client/nooutput/.prev_CMakeLists.txt +++ b/tests/auto/client/nooutput/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_nooutput ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_nooutput.cpp INCLUDE_DIRECTORIES @@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_nooutput FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/nooutput/CMakeLists.txt b/tests/auto/client/nooutput/CMakeLists.txt index e5110c0c..f7e9dfec 100644 --- a/tests/auto/client/nooutput/CMakeLists.txt +++ b/tests/auto/client/nooutput/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_nooutput ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_nooutput.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_nooutput FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/output/.prev_CMakeLists.txt b/tests/auto/client/output/.prev_CMakeLists.txt index 09ca5d6d..7e8e882c 100644 --- a/tests/auto/client/output/.prev_CMakeLists.txt +++ b/tests/auto/client/output/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_output ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_output.cpp INCLUDE_DIRECTORIES @@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_output FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/output/CMakeLists.txt b/tests/auto/client/output/CMakeLists.txt index 5d2dfbf9..e4267fad 100644 --- a/tests/auto/client/output/CMakeLists.txt +++ b/tests/auto/client/output/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_output ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_output.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_output FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt b/tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt index f86e81e1..3d23b446 100644 --- a/tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt +++ b/tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_primaryselectionv1 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_primaryselectionv1.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_primaryselectionv1 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/primaryselectionv1/CMakeLists.txt b/tests/auto/client/primaryselectionv1/CMakeLists.txt index d101c8b3..a8f9ae13 100644 --- a/tests/auto/client/primaryselectionv1/CMakeLists.txt +++ b/tests/auto/client/primaryselectionv1/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_primaryselectionv1 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_primaryselectionv1.cpp INCLUDE_DIRECTORIES @@ -28,5 +29,6 @@ qt6_generate_wayland_protocol_server_sources(tst_primaryselectionv1 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/seatv4/.prev_CMakeLists.txt b/tests/auto/client/seatv4/.prev_CMakeLists.txt index 9e0e4c37..d37de1da 100644 --- a/tests/auto/client/seatv4/.prev_CMakeLists.txt +++ b/tests/auto/client/seatv4/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_seatv4 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_seatv4.cpp INCLUDE_DIRECTORIES @@ -26,6 +27,7 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv4 FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/seatv4/CMakeLists.txt b/tests/auto/client/seatv4/CMakeLists.txt index 36b0c847..5496bd59 100644 --- a/tests/auto/client/seatv4/CMakeLists.txt +++ b/tests/auto/client/seatv4/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_seatv4 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_seatv4.cpp INCLUDE_DIRECTORIES @@ -27,6 +28,7 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv4 FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/seatv5/.prev_CMakeLists.txt b/tests/auto/client/seatv5/.prev_CMakeLists.txt index 11d615fb..fa9e5a4e 100644 --- a/tests/auto/client/seatv5/.prev_CMakeLists.txt +++ b/tests/auto/client/seatv5/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_seatv5 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_seatv5.cpp INCLUDE_DIRECTORIES @@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv5 FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/seatv5/CMakeLists.txt b/tests/auto/client/seatv5/CMakeLists.txt index fefdcf8d..67bfc653 100644 --- a/tests/auto/client/seatv5/CMakeLists.txt +++ b/tests/auto/client/seatv5/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_seatv5 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_seatv5.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv5 FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/shared/coreprotocol.cpp b/tests/auto/client/shared/coreprotocol.cpp index b0be2cb4..0d988521 100644 --- a/tests/auto/client/shared/coreprotocol.cpp +++ b/tests/auto/client/shared/coreprotocol.cpp @@ -158,6 +158,14 @@ void Output::sendScale(Resource *resource) wl_output::send_scale(resource->handle, m_data.scale); } +void Output::sendDone(wl_client *client) +{ + Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION); + auto resources = resourceMap().values(client); + for (auto *r : resources) + wl_output::send_done(r->handle); +} + void Output::sendDone() { Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION); diff --git a/tests/auto/client/shared/coreprotocol.h b/tests/auto/client/shared/coreprotocol.h index a12d22d3..8d5e2d66 100644 --- a/tests/auto/client/shared/coreprotocol.h +++ b/tests/auto/client/shared/coreprotocol.h @@ -245,6 +245,7 @@ public: void sendScale(int factor); void sendScale(Resource *resource); // Sends current scale to only one client + void sendDone(wl_client *client); void sendDone(); int scale() const { return m_data.scale; } diff --git a/tests/auto/client/shared/shared.pri b/tests/auto/client/shared/shared.pri index b59cdc48..97202e78 100644 --- a/tests/auto/client/shared/shared.pri +++ b/tests/auto/client/shared/shared.pri @@ -4,6 +4,7 @@ QMAKE_USE += wayland-server WAYLANDSERVERSOURCES += \ $$PWD/../../../../src/3rdparty/protocol/wayland.xml \ + $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml \ $$PWD/../../../../src/3rdparty/protocol/xdg-shell.xml \ $$PWD/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml @@ -14,6 +15,7 @@ HEADERS += \ $$PWD/coreprotocol.h \ $$PWD/datadevice.h \ $$PWD/mockcompositor.h \ + $$PWD/xdgoutputv1.h \ $$PWD/xdgshell.h \ $$PWD/textinput.h @@ -22,5 +24,6 @@ SOURCES += \ $$PWD/coreprotocol.cpp \ $$PWD/datadevice.cpp \ $$PWD/mockcompositor.cpp \ + $$PWD/xdgoutputv1.cpp \ $$PWD/xdgshell.cpp \ $$PWD/textinput.cpp diff --git a/tests/auto/client/shared/xdgoutputv1.cpp b/tests/auto/client/shared/xdgoutputv1.cpp new file mode 100644 index 00000000..2b491d2e --- /dev/null +++ b/tests/auto/client/shared/xdgoutputv1.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "xdgoutputv1.h" + +namespace MockCompositor { + +int XdgOutputV1::s_nextId = 1; + +void XdgOutputV1::sendLogicalSize(const QSize &size) +{ + m_logicalGeometry.setSize(size); + for (auto *resource : resourceMap()) + zxdg_output_v1::send_logical_size(resource->handle, size.width(), size.height()); +} + +void XdgOutputV1::addResource(wl_client *client, int id, int version) +{ + auto *resource = add(client, id, version)->handle; + zxdg_output_v1::send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height()); + send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y()); + if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) + send_name(resource, m_name); + if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION) + send_description(resource, m_description); + + if (version < 3) // zxdg_output_v1.done has been deprecated + zxdg_output_v1::send_done(resource); + else { + m_output->sendDone(client); + } +} + +} // namespace MockCompositor diff --git a/tests/auto/client/shared/xdgoutputv1.h b/tests/auto/client/shared/xdgoutputv1.h new file mode 100644 index 00000000..85b13450 --- /dev/null +++ b/tests/auto/client/shared/xdgoutputv1.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_XDGOUTPUTV1_H +#define MOCKCOMPOSITOR_XDGOUTPUTV1_H + +#include "coreprotocol.h" + +#include <qwayland-server-xdg-output-unstable-v1.h> + +namespace MockCompositor { + +class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1 +{ +public: + explicit XdgOutputV1(Output *output) + : m_output(output) + , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale)) + , m_name(QString("WL-%1").arg(s_nextId++)) + {} + + void send_logical_size(int32_t width, int32_t height) = delete; + void sendLogicalSize(const QSize &size); + + void send_done() = delete; // zxdg_output_v1.done has been deprecated (in protocol version 3) + + void addResource(wl_client *client, int id, int version); + Output *m_output = nullptr; + QRect m_logicalGeometry; + QString m_name; + QString m_description = "This is an Xdg Output description"; + static int s_nextId; +}; + +class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1 +{ + Q_OBJECT +public: + explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 3) + : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version) + , m_version(version) + {} + int m_version = 1; // TODO: remove on libwayland upgrade + QMap<Output *, XdgOutputV1 *> m_xdgOutputs; + XdgOutputV1 *getXdgOutput(Output *output) + { + if (auto *xdgOutput = m_xdgOutputs.value(output)) + return xdgOutput; + return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory + } + +protected: + void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override + { + auto *output = fromResource<Output>(outputResource); + auto *xdgOutput = getXdgOutput(output); + xdgOutput->addResource(resource->client(), id, resource->version()); + } +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_XDGOUTPUTV1_H diff --git a/tests/auto/client/surface/.prev_CMakeLists.txt b/tests/auto/client/surface/.prev_CMakeLists.txt index 43d6ec34..a8eb58da 100644 --- a/tests/auto/client/surface/.prev_CMakeLists.txt +++ b/tests/auto/client/surface/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_surface ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_surface.cpp INCLUDE_DIRECTORIES @@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_surface FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/surface/CMakeLists.txt b/tests/auto/client/surface/CMakeLists.txt index a1545115..a3962dda 100644 --- a/tests/auto/client/surface/CMakeLists.txt +++ b/tests/auto/client/surface/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_surface ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_surface.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_surface FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/tabletv2/.prev_CMakeLists.txt b/tests/auto/client/tabletv2/.prev_CMakeLists.txt index e7fc3f60..5fecee50 100644 --- a/tests/auto/client/tabletv2/.prev_CMakeLists.txt +++ b/tests/auto/client/tabletv2/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_tabletv2 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_tabletv2.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_tabletv2 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/tabletv2/CMakeLists.txt b/tests/auto/client/tabletv2/CMakeLists.txt index f5a12c55..d039e30d 100644 --- a/tests/auto/client/tabletv2/CMakeLists.txt +++ b/tests/auto/client/tabletv2/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_tabletv2 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_tabletv2.cpp INCLUDE_DIRECTORIES @@ -28,5 +29,6 @@ qt6_generate_wayland_protocol_server_sources(tst_tabletv2 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt b/tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt index 9311070a..228ad83e 100644 --- a/tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt +++ b/tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_xdgdecorationv1 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgdecorationv1.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_xdgdecorationv1 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/xdgdecorationv1/CMakeLists.txt b/tests/auto/client/xdgdecorationv1/CMakeLists.txt index de067a13..fb0fd06a 100644 --- a/tests/auto/client/xdgdecorationv1/CMakeLists.txt +++ b/tests/auto/client/xdgdecorationv1/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_xdgdecorationv1 ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgdecorationv1.cpp INCLUDE_DIRECTORIES @@ -28,5 +29,6 @@ qt6_generate_wayland_protocol_server_sources(tst_xdgdecorationv1 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp index cf20a137..98c0e044 100644 --- a/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -153,6 +153,8 @@ private slots: void initTestCase(); void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void clientSidePreferredByCompositor(); + void initialFramelessWindowHint(); + void delayedFramelessWindowHint(); }; void tst_xdgdecorationv1::initTestCase() @@ -182,5 +184,41 @@ void tst_xdgdecorationv1::clientSidePreferredByCompositor() QTRY_VERIFY(!window.frameMargins().isNull()); } +void tst_xdgdecorationv1::initialFramelessWindowHint() +{ + QRasterWindow window; + window.setFlag(Qt::FramelessWindowHint, true); + window.show(); + QCOMPOSITOR_TRY_COMPARE(get<XdgDecorationManagerV1>()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=]{ + xdgToplevel()->sendCompleteConfigure(); + }); + QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); + + // The client should not have create a decoration object, because that allows the compositor + // to override our decision and add server side decorations to our window. + QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration()); +} + +void tst_xdgdecorationv1::delayedFramelessWindowHint() +{ + QRasterWindow window; + window.show(); + QCOMPOSITOR_TRY_COMPARE(get<XdgDecorationManagerV1>()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=]{ + xdgToplevel()->sendCompleteConfigure(); + }); + QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(toplevelDecoration()); + + window.setFlag(Qt::FramelessWindowHint, true); + + // The client should now destroy the decoration object, so the compositor is no longer + // able to force window decorations + QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration()); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgdecorationv1) #include "tst_xdgdecorationv1.moc" diff --git a/tests/auto/client/xdgoutput/.prev_CMakeLists.txt b/tests/auto/client/xdgoutput/.prev_CMakeLists.txt index 505c7c05..3fc5aa77 100644 --- a/tests/auto/client/xdgoutput/.prev_CMakeLists.txt +++ b/tests/auto/client/xdgoutput/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_xdgoutput ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgoutput.cpp INCLUDE_DIRECTORIES @@ -24,8 +25,8 @@ qt_add_test(tst_xdgoutput qt6_generate_wayland_protocol_server_sources(tst_xdgoutput FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/xdgoutput/CMakeLists.txt b/tests/auto/client/xdgoutput/CMakeLists.txt index e0a4b756..341624e4 100644 --- a/tests/auto/client/xdgoutput/CMakeLists.txt +++ b/tests/auto/client/xdgoutput/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_xdgoutput ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgoutput.cpp INCLUDE_DIRECTORIES @@ -25,8 +26,8 @@ qt_add_test(tst_xdgoutput qt6_generate_wayland_protocol_server_sources(tst_xdgoutput FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/xdgoutput/tst_xdgoutput.cpp b/tests/auto/client/xdgoutput/tst_xdgoutput.cpp index 16e29a3c..0e5b2c87 100644 --- a/tests/auto/client/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/client/xdgoutput/tst_xdgoutput.cpp @@ -26,77 +26,21 @@ ** ****************************************************************************/ +#include "xdgoutputv1.h" #include "mockcompositor.h" + #include <QtOpenGL/QOpenGLWindow> #include <QtGui/QRasterWindow> #include <QtGui/QScreen> -#include <qwayland-server-xdg-output-unstable-v1.h> - using namespace MockCompositor; -// TODO: move to shared folder? -class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1 -{ -public: - explicit XdgOutputV1(Output *output) - : m_output(output) - , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale)) - , m_name(QString("WL-%1").arg(s_nextId++)) - {} - - void addResource(wl_client *client, int id, int version) - { - auto *resource = add(client, id, version)->handle; - send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height()); - send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y()); - if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) - send_name(resource, m_name); - if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION) - send_description(resource, m_description); - send_done(resource); - } - Output *m_output = nullptr; - QRect m_logicalGeometry; - QString m_name; - QString m_description = "This is an Xdg Output description"; - static int s_nextId; -}; - -int XdgOutputV1::s_nextId = 1; - -class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1 -{ - Q_OBJECT -public: - explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 2) - : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version) - , m_version(version) - {} - int m_version = 1; // TODO: remove on libwayland upgrade - QMap<Output *, XdgOutputV1 *> m_xdgOutputs; - XdgOutputV1 *getXdgOutput(Output *output) - { - if (auto *xdgOutput = m_xdgOutputs.value(output)) - return xdgOutput; - return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory - } - -protected: - void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override - { - auto *output = fromResource<Output>(outputResource); - auto *xdgOutput = getXdgOutput(output); - xdgOutput->addResource(resource->client(), id, resource->version()); - } -}; - class XdgOutputV1Compositor : public DefaultCompositor { public: explicit XdgOutputV1Compositor() { exec([this] { - int version = 2; // version 2 of of unstable-v1 + int version = 3; // version 3 of of unstable-v1 add<XdgOutputManagerV1>(version); }); } @@ -110,11 +54,13 @@ private slots: void cleanup(); void primaryScreen(); void overrideGeometry(); + void changeGeometry(); }; void tst_xdgoutput::cleanup() { QCOMPOSITOR_COMPARE(getAll<Output>().size(), 1); // Only the default output should be left + QTRY_COMPARE(QGuiApplication::screens().size(), 1); QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } @@ -124,7 +70,8 @@ void tst_xdgoutput::primaryScreen() QCOMPOSITOR_TRY_COMPARE(get<XdgOutputManagerV1>()->resourceMap().size(), 1); exec([=] { auto *resource = xdgOutput()->resourceMap().value(client()); - QCOMPARE(resource->version(), 2); + QCOMPARE(resource->version(), 3); + QCOMPARE(xdgOutput()->m_logicalGeometry.size(), QSize(1920, 1080)); }); auto *s = QGuiApplication::primaryScreen(); QTRY_COMPARE(s->size(), QSize(1920, 1080)); @@ -149,5 +96,43 @@ void tst_xdgoutput::overrideGeometry() exec([=] { remove(output(1)); }); } +void tst_xdgoutput::changeGeometry() +{ + auto *xdgOutput = exec([=] { + auto *output = add<Output>(); + auto *xdgOutput = get<XdgOutputManagerV1>()->getXdgOutput(output); + xdgOutput->m_logicalGeometry = QRect(10, 20, 800, 1200); + return xdgOutput; + }); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + auto *screen = QGuiApplication::screens()[1]; + QTRY_COMPARE(screen->size(), QSize(800, 1200)); + + exec([=] { + xdgOutput->sendLogicalSize(QSize(1024, 768)); + }); + + // Now we want to check that the client doesn't apply the size immediately, but waits for the + // done event. If we TRY_COMPARE immediately, we risk that the client just hasn't handled the + // logical_size request yet, so we add a screen and verify it on the client side just to give + // the client a chance to mess up. + exec([=] { add<Output>(); }); + QTRY_COMPARE(QGuiApplication::screens().size(), 3); + exec([=] { remove(output(2)); }); + + // The logical_size event should have been handled by now, but state should not have been applied yet. + QTRY_COMPARE(screen->size(), QSize(800, 1200)); + + exec([=] { + xdgOutput->m_output->sendDone(); + }); + + // Finally, the size should change + QTRY_COMPARE(screen->size(), QSize(1024, 768)); + + exec([=] { remove(output(1)); }); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgoutput) #include "tst_xdgoutput.moc" diff --git a/tests/auto/client/xdgoutput/xdgoutput.pro b/tests/auto/client/xdgoutput/xdgoutput.pro index 3cfbb6a7..f6532754 100644 --- a/tests/auto/client/xdgoutput/xdgoutput.pro +++ b/tests/auto/client/xdgoutput/xdgoutput.pro @@ -1,8 +1,5 @@ include (../shared/shared.pri) -WAYLANDSERVERSOURCES += \ - $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - TARGET = tst_xdgoutput SOURCES += tst_xdgoutput.cpp diff --git a/tests/auto/client/xdgshell/.prev_CMakeLists.txt b/tests/auto/client/xdgshell/.prev_CMakeLists.txt index 65f76210..4faa14f3 100644 --- a/tests/auto/client/xdgshell/.prev_CMakeLists.txt +++ b/tests/auto/client/xdgshell/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_xdgshell ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgshell.cpp INCLUDE_DIRECTORIES @@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_xdgshell FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/xdgshell/CMakeLists.txt b/tests/auto/client/xdgshell/CMakeLists.txt index cab6c882..a680575c 100644 --- a/tests/auto/client/xdgshell/CMakeLists.txt +++ b/tests/auto/client/xdgshell/CMakeLists.txt @@ -11,6 +11,7 @@ qt_add_test(tst_xdgshell ../shared/datadevice.cpp ../shared/datadevice.h ../shared/mockcompositor.cpp ../shared/mockcompositor.h ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgshell.cpp INCLUDE_DIRECTORIES @@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_xdgshell FILES ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/compositor/compositor/mockclient.cpp b/tests/auto/compositor/compositor/mockclient.cpp index 27d1eed8..76ccd0c5 100644 --- a/tests/auto/compositor/compositor/mockclient.cpp +++ b/tests/auto/compositor/compositor/mockclient.cpp @@ -57,7 +57,7 @@ MockClient::MockClient() fd = wl_display_get_fd(display); QSocketNotifier *readNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); - connect(readNotifier, SIGNAL(activated(int)), this, SLOT(readEvents())); + connect(readNotifier, SIGNAL(activated(QSocketDescriptor)), this, SLOT(readEvents())); QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; connect(dispatcher, SIGNAL(awake()), this, SLOT(flushDisplay())); |