diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index ddda0e9716c..87f2422761d 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -103,7 +103,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright 2014 © Stephen "Lyude" Chandler Paul + "Copyright": "Copyright 2014 © Stephen \"Lyude\" Chandler Paul Copyright 2015-2016 © Red Hat, Inc." }, diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index 99aed833e5a..29252417163 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -76,6 +76,7 @@ qt_config_compile_test(dmabuf_server_buffer LABEL "Linux dma-buf Buffer Sharing" LIBRARIES EGL::EGL + Libdrm::Libdrm CODE " #include @@ -101,7 +102,7 @@ return 1; qt_config_compile_test(vulkan_server_buffer LABEL "Vulkan Buffer Sharing" CODE -" +"#define VK_USE_PLATFORM_WAYLAND_KHR 1 #include int main(int argc, char **argv) @@ -117,78 +118,127 @@ return 0; } ") +# egl_1_5-wayland +qt_config_compile_test(egl_1_5_wayland + LABEL "EGL 1.5 with Wayland Platform" + LIBRARIES + EGL::EGL + CODE +" +#include +#include +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr); + /* END TEST: */ + return 0; +} +") + #### Features -qt_feature("wayland_client" PRIVATE +qt_feature("wayland-client" PRIVATE LABEL "Qt Wayland Client" CONDITION NOT WIN32 AND Wayland_FOUND AND Wayland_FOUND AND WaylandScanner_FOUND ) -qt_feature("wayland_datadevice" PRIVATE +qt_feature("wayland-datadevice" PRIVATE CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard ) -qt_feature("wayland_client_primary_selection" PRIVATE +qt_feature("wayland-client-primary-selection" PRIVATE LABEL "primary-selection clipboard" CONDITION QT_FEATURE_clipboard ) -qt_feature("wayland_client_fullscreen_shell_v1" PRIVATE +qt_feature("wayland-client-fullscreen-shell-v1" PRIVATE LABEL "fullscreen-shell-v1" CONDITION QT_FEATURE_wayland_client ) -qt_feature("wayland_client_ivi_shell" PRIVATE +qt_feature("wayland-client-ivi-shell" PRIVATE LABEL "ivi-shell" CONDITION QT_FEATURE_wayland_client ) -qt_feature("wayland_client_wl_shell" PRIVATE +qt_feature("wayland-client-wl-shell" PRIVATE LABEL "wl-shell (deprecated)" CONDITION QT_FEATURE_wayland_client ) -qt_feature("wayland_client_xdg_shell" PRIVATE +qt_feature("wayland-client-xdg-shell" PRIVATE LABEL "xdg-shell" CONDITION QT_FEATURE_wayland_client ) -qt_feature("wayland_client_xdg_shell_v5" PRIVATE +qt_feature("wayland-client-xdg-shell-v5" PRIVATE LABEL "xdg-shell unstable v5 (deprecated)" CONDITION QT_FEATURE_wayland_client ) -qt_feature("wayland_client_xdg_shell_v6" PRIVATE +qt_feature("wayland-client-xdg-shell-v6" PRIVATE LABEL "xdg-shell unstable v6" CONDITION QT_FEATURE_wayland_client ) -qt_feature("wayland_egl" PRIVATE - LABEL "EGL" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND Wayland_FOUND +qt_feature("egl-extension-platform-wayland" PRIVATE + LABEL "EGL wayland platform extension" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_egl_1_5_wayland ) -qt_feature("wayland_brcm" PRIVATE +qt_feature("wayland-egl" PRIVATE + LABEL "EGL" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND Wayland_FOUND AND ( NOT QNX OR QT_FEATURE_egl_extension_platform_wayland ) +) +qt_feature("wayland-brcm" PRIVATE LABEL "Raspberry Pi" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_eglfs_brcm ) -qt_feature("xcomposite_egl" PRIVATE +qt_feature("xcomposite-egl" PRIVATE LABEL "XComposite EGL" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND QT_FEATURE_xlib AND XComposite_FOUND AND QT_FEATURE_egl_x11 ) -qt_feature("xcomposite_glx" PRIVATE +qt_feature("xcomposite-glx" PRIVATE LABEL "XComposite GLX" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 AND QT_FEATURE_xlib AND XComposite_FOUND ) -qt_feature("wayland_drm_egl_server_buffer" PRIVATE +qt_feature("wayland-drm-egl-server-buffer" PRIVATE LABEL "DRM EGL" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_drm_egl_server + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_drm_egl_server AND ( NOT QNX OR QT_FEATURE_egl_extension_platform_wayland ) ) -qt_feature("wayland_libhybris_egl_server_buffer" PRIVATE +qt_feature("wayland-libhybris-egl-server-buffer" PRIVATE LABEL "libhybris EGL" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_libhybris_egl_server ) -qt_feature("wayland_dmabuf_server_buffer" PRIVATE +qt_feature("wayland-dmabuf-server-buffer" PRIVATE LABEL "Linux dma-buf server buffer integration" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_dmabuf_server_buffer ) -qt_feature("wayland_vulkan_server_buffer" PRIVATE +qt_feature("wayland-vulkan-server-buffer" PRIVATE LABEL "Vulkan-based server buffer integration" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_vulkan_server_buffer + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_vulkan AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_vulkan_server_buffer ) -qt_feature("wayland_shm_emulation_server_buffer" PRIVATE +qt_feature("wayland-shm-emulation-server-buffer" PRIVATE LABEL "Shm emulation server buffer integration" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl ) +qt_configure_add_summary_section(NAME "Qt Wayland Drivers") +qt_configure_add_summary_entry(ARGS "wayland-egl") +qt_configure_add_summary_entry(ARGS "wayland-brcm") +qt_configure_add_summary_entry(ARGS "xcomposite-egl") +qt_configure_add_summary_entry(ARGS "xcomposite-glx") +qt_configure_add_summary_entry(ARGS "wayland-drm-egl-server-buffer") +qt_configure_add_summary_entry(ARGS "wayland-libhybris-egl-server-buffer") +qt_configure_add_summary_entry(ARGS "wayland-dmabuf-server-buffer") +qt_configure_add_summary_entry(ARGS "wayland-vulkan-server-buffer") +qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer") +qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section +qt_configure_add_summary_section(NAME "Qt Wayland Client Shell Integrations") +qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell") +qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell-v5") +qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell-v6") +qt_configure_add_summary_entry(ARGS "wayland-client-ivi-shell") +qt_configure_add_summary_entry(ARGS "wayland-client-wl-shell") +qt_configure_end_summary_section() # end of "Qt Wayland Client Shell Integrations" section +qt_configure_add_summary_entry(ARGS "wayland-client") +qt_configure_add_report_entry( + TYPE NOTE + MESSAGE "No wayland-egl support detected. Cross-toolkit compatibility disabled." + CONDITION NOT Wayland_FOUND +) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 5f19cefc5fc..e054f144911 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -216,9 +216,14 @@ "condition": "features.wayland-client", "output": [ "privateFeature" ] }, + "egl-extension-platform-wayland": { + "label": "EGL wayland platform extension", + "condition": "features.wayland-client && features.opengl && features.egl && tests.egl_1_5-wayland", + "output": [ "privateFeature" ] + }, "wayland-egl": { "label": "EGL", - "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || tests.egl_1_5-wayland)", + "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || features.egl-extension-platform-wayland)", "output": [ "privateFeature" ] }, "wayland-brcm": { @@ -238,7 +243,7 @@ }, "wayland-drm-egl-server-buffer": { "label": "DRM EGL", - "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || tests.egl_1_5-wayland)", + "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || features.egl-extension-platform-wayland)", "output": [ "privateFeature" ] }, "wayland-libhybris-egl-server-buffer": { diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt index 9bd875a40c9..0384eefcd8b 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandBradientDecorationPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandBradientDecorationPlugin +qt_internal_add_plugin(QWaylandBradientDecorationPlugin OUTPUT_NAME bradient TYPE wayland-decoration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 666dd39d147..daae9fcb3b5 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -40,6 +40,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index 038a8843c0f..f264dfbe937 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandBrcmEglClientBufferPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandBrcmEglClientBufferPlugin +qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin OUTPUT_NAME brcm-egl TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index f31e868ac8c..bda31db01b0 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -4,7 +4,7 @@ ## DmaBufServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(DmaBufServerBufferPlugin +qt_internal_add_plugin(DmaBufServerBufferPlugin OUTPUT_NAME dmabuf-server TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index ce3f9425408..b2eabcf447f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -4,7 +4,7 @@ ## DrmEglServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(DrmEglServerBufferPlugin +qt_internal_add_plugin(DrmEglServerBufferPlugin OUTPUT_NAME drm-egl-server TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt index 24cc9219e04..ed3c4c98fbe 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -4,7 +4,7 @@ ## LibHybrisEglServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(LibHybrisEglServerBufferPlugin +qt_internal_add_plugin(LibHybrisEglServerBufferPlugin OUTPUT_NAME libhybris-egl-server TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index aa6e443311c..6b68ab8eb74 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -4,7 +4,7 @@ ## ShmServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(ShmServerBufferPlugin +qt_internal_add_plugin(ShmServerBufferPlugin OUTPUT_NAME shm-emulation-server TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index 64ea378faad..3cfde46805d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -4,7 +4,7 @@ ## VulkanServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(VulkanServerBufferPlugin +qt_internal_add_plugin(VulkanServerBufferPlugin OUTPUT_NAME vulkan-server TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index 2eaf092ccf5..b7e274170fd 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandEglClientBufferPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandEglClientBufferPlugin +qt_internal_add_plugin(QWaylandEglClientBufferPlugin OUTPUT_NAME qt-plugin-wayland-egl TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt index 972cb1ace27..6ed42e74fa0 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandXCompositeEglClientBufferPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandXCompositeEglClientBufferPlugin +qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin OUTPUT_NAME xcomposite-egl TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt index d074fe4ee3d..54c18d0ed9a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandXCompositeGlxClientBufferPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandXCompositeGlxClientBufferPlugin +qt_internal_add_plugin(QWaylandXCompositeGlxClientBufferPlugin OUTPUT_NAME xcomposite-glx TYPE wayland-graphics-integration-client SOURCES diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index 9e068dfe280..686cfbcb6b9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandFullScreenShellV1IntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin +qt_internal_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin OUTPUT_NAME fullscreen-shell-v1 TYPE wayland-shell-integration SOURCES diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 496bbe68c09..3e630c7c832 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandWlShellIntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandWlShellIntegrationPlugin +qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin OUTPUT_NAME wl-shell TYPE wayland-shell-integration SOURCES diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 48e14c753fe..245fec19670 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -76,10 +76,11 @@ QWaylandWlShellSurface::~QWaylandWlShellSurface() delete m_extendedWindow; } -void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { enum resize resizeEdges = convertToResizeEdges(edges); resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index 324c10aacae..ca7ba602c73 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -76,7 +76,7 @@ public: ~QWaylandWlShellSurface() override; using QtWayland::wl_shell_surface::resize; - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; using QtWayland::wl_shell_surface::move; bool move(QWaylandInputDevice *inputDevice) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt index fec8b2c89a2..231bac0877a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandXdgShellV5IntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandXdgShellV5IntegrationPlugin +qt_internal_add_plugin(QWaylandXdgShellV5IntegrationPlugin OUTPUT_NAME xdg-shell-v5 TYPE wayland-shell-integration SOURCES diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index e8bff91935e..770fad7e853 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -82,10 +82,11 @@ QtWayland::xdg_surface_v5::resize_edge QWaylandXdgSurfaceV5::convertToResizeEdge | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); } -void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { resize_edge resizeEdges = convertToResizeEdges(edges); resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandXdgSurfaceV5::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index feebee7f431..bf221079e99 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -80,7 +80,7 @@ public: using QtWayland::xdg_surface_v5::resize; static resize_edge convertToResizeEdges(Qt::Edges edges); - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; using QtWayland::xdg_surface_v5::move; bool move(QWaylandInputDevice *inputDevice) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt index 094610155fa..190c6698f15 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandXdgShellV6IntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandXdgShellV6IntegrationPlugin +qt_internal_add_plugin(QWaylandXdgShellV6IntegrationPlugin OUTPUT_NAME xdg-shell-v6 TYPE wayland-shell-integration SOURCES diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index dc3cfdbfa11..c137b308bc0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -237,11 +237,14 @@ QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() destroy(); } -void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { - Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + if (!m_toplevel || !m_toplevel->isInitialized()) + return false; + auto resizeEdges = Toplevel::convertToResizeEdges(edges); m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index f77a4d4baeb..757b982b9db 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -77,7 +77,7 @@ public: QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window); ~QWaylandXdgSurfaceV6() override; - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; bool showWindowMenu(QWaylandInputDevice *seat) override; void setTitle(const QString &title) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 848a0ec603b..1b55b8eb7c6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -4,7 +4,7 @@ ## QWaylandXdgShellIntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(QWaylandXdgShellIntegrationPlugin +qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin OUTPUT_NAME xdg-shell TYPE wayland-shell-integration SOURCES diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index bd1f5a210e5..b6d23ac10a6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -56,10 +56,11 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) : QtWayland::xdg_toplevel(xdgSurface->get_toplevel()) , m_xdgSurface(xdgSurface) { - if (auto *decorationManager = m_xdgSurface->m_shell->decorationManager()) - m_decoration = decorationManager->createToplevelDecoration(object()); - QWindow *window = xdgSurface->window()->window(); + if (auto *decorationManager = m_xdgSurface->m_shell->decorationManager()) { + if (!(window->flags() & Qt::FramelessWindowHint)) + m_decoration = decorationManager->createToplevelDecoration(object()); + } requestWindowStates(window->windowStates()); requestWindowFlags(window->flags()); } @@ -155,10 +156,12 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_close() void QWaylandXdgSurface::Toplevel::requestWindowFlags(Qt::WindowFlags flags) { if (m_decoration) { - if (flags & Qt::FramelessWindowHint) - m_decoration->requestMode(QWaylandXdgToplevelDecorationV1::mode_client_side); - else + if (flags & Qt::FramelessWindowHint) { + delete m_decoration; + m_decoration = nullptr; + } else { m_decoration->unsetMode(); + } } } @@ -266,11 +269,14 @@ QWaylandXdgSurface::~QWaylandXdgSurface() destroy(); } -void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { - Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + if (!m_toplevel || !m_toplevel->isInitialized()) + return false; + auto resizeEdges = Toplevel::convertToResizeEdges(edges); m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 8f8682a4792..0c98be35cdc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -80,7 +80,7 @@ public: QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window); ~QWaylandXdgSurface() override; - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; bool showWindowMenu(QWaylandInputDevice *seat) override; void setTitle(const QString &title) override; diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 4d540c5db76..c9e3eb9ca88 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -251,7 +251,7 @@ QSharedPointer QWaylandCursor::cursorBitmapBuffer(QWaylandDispla const QImage &img = cursor->pixmap().toImage(); QSharedPointer buffer(new QWaylandShmBuffer(display, img.size(), img.format())); memcpy(buffer->image()->bits(), img.bits(), size_t(img.sizeInBytes())); - return std::move(buffer); + return buffer; } void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 82ffc503a9b..311084b1257 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -205,7 +205,7 @@ void QWaylandIntegration::initialize() int fd = wl_display_get_fd(mDisplay->wl_display()); QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data()); - QObject::connect(sn, SIGNAL(activated(int)), mDisplay.data(), SLOT(flushRequests())); + QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests())); // Qt does not support running with no screens mDisplay->ensureScreen(); diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index f5f202d0817..989cdb81b1c 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -73,8 +73,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject public: explicit QWaylandShellSurface(QWaylandWindow *window); ~QWaylandShellSurface() override {} - virtual void resize(QWaylandInputDevice * /*inputDevice*/, Qt::Edges /*edges*/) {} - + virtual bool resize(QWaylandInputDevice *, Qt::Edges) { return false; } virtual bool move(QWaylandInputDevice *) { return false; } virtual bool showWindowMenu(QWaylandInputDevice *seat) { Q_UNUSED(seat); return false; } virtual void setTitle(const QString & /*title*/) {} diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 523bdc73294..70ba132e83d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -155,7 +155,7 @@ void QWaylandWindow::initWindow() QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); QStringList domainName = QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), - QString::SkipEmptyParts); + Qt::SkipEmptyParts); if (domainName.isEmpty()) { mShellSurface->setAppId(fi.baseName()); @@ -408,6 +408,11 @@ QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const void QWaylandWindow::setVisible(bool visible) { + // Workaround for issue where setVisible may be called with the same value twice + if (lastVisible == visible) + return; + lastVisible = visible; + if (visible) { if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) activePopups << this; @@ -1179,9 +1184,15 @@ void QWaylandWindow::propagateSizeHints() mShellSurface->propagateSizeHints(); } -bool QtWaylandClient::QWaylandWindow::startSystemMove(const QPoint &pos) +bool QWaylandWindow::startSystemResize(Qt::Edges edges) +{ + if (auto *seat = display()->lastInputDevice()) + return mShellSurface && mShellSurface->resize(seat, edges); + return false; +} + +bool QtWaylandClient::QWaylandWindow::startSystemMove() { - Q_UNUSED(pos); if (auto seat = display()->lastInputDevice()) return mShellSurface && mShellSurface->move(seat); return false; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6ad63d354a8..a72e5fd9a65 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -196,7 +196,8 @@ public: void propagateSizeHints() override; void addAttachOffset(const QPoint point); - bool startSystemMove(const QPoint &pos); + bool startSystemResize(Qt::Edges edges) override; + bool startSystemMove() override; void timerEvent(QTimerEvent *event) override; void requestUpdate() override; @@ -269,6 +270,7 @@ private: void handleScreensChanged(); bool mInResizeFromApplyConfigure = false; + bool lastVisible = false; QRect mLastExposeGeometry; static const wl_callback_listener callbackListener; diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 05f00beee7b..3cecb5bcfbe 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -906,6 +906,11 @@ bool Scanner::process() printEvent(e); printf("\n"); printf(" {\n"); + printf(" Q_ASSERT_X(m_resource, \"%s::%s\", \"Uninitialised resource\");\n", interfaceName, e.name.constData()); + printf(" if (Q_UNLIKELY(!m_resource)) {\n"); + printf(" qWarning(\"could not call %s::%s as it's not initialised\");\n", interfaceName, e.name.constData()); + printf(" return;\n"); + printf(" }\n"); printf(" send_%s(\n", e.name.constData()); printf(" m_resource->handle"); for (const WaylandArgument &a : e.arguments) { diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 499a93a1dde..42e23b54ce9 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/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/wayland/datadevicev1/.prev_CMakeLists.txt b/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt index 97dedb85579..e835f09d9f1 100644 --- a/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/datadevicev1/CMakeLists.txt b/tests/auto/wayland/datadevicev1/CMakeLists.txt index e635e33ce4a..06a56ccfdad 100644 --- a/tests/auto/wayland/datadevicev1/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/inputcontext/.prev_CMakeLists.txt b/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt index cf2301e770d..c32f2e93094 100644 --- a/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/inputcontext/CMakeLists.txt b/tests/auto/wayland/inputcontext/CMakeLists.txt index f061a7ea239..5eb73b11c20 100644 --- a/tests/auto/wayland/inputcontext/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/nooutput/.prev_CMakeLists.txt b/tests/auto/wayland/nooutput/.prev_CMakeLists.txt index 3f09f584c21..61b43b0f669 100644 --- a/tests/auto/wayland/nooutput/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/nooutput/CMakeLists.txt b/tests/auto/wayland/nooutput/CMakeLists.txt index e5110c0c903..f7e9dfec1f5 100644 --- a/tests/auto/wayland/nooutput/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/output/.prev_CMakeLists.txt b/tests/auto/wayland/output/.prev_CMakeLists.txt index 09ca5d6d491..7e8e882c575 100644 --- a/tests/auto/wayland/output/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/output/CMakeLists.txt b/tests/auto/wayland/output/CMakeLists.txt index 5d2dfbf9d54..e4267fadb21 100644 --- a/tests/auto/wayland/output/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/primaryselectionv1/.prev_CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt index f86e81e12ed..3d23b446a90 100644 --- a/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/primaryselectionv1/CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt index d101c8b3d97..a8f9ae1315d 100644 --- a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/seatv4/.prev_CMakeLists.txt b/tests/auto/wayland/seatv4/.prev_CMakeLists.txt index 9e0e4c37ebe..d37de1da8ae 100644 --- a/tests/auto/wayland/seatv4/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/seatv4/CMakeLists.txt b/tests/auto/wayland/seatv4/CMakeLists.txt index 36b0c847183..5496bd59f27 100644 --- a/tests/auto/wayland/seatv4/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/seatv5/.prev_CMakeLists.txt b/tests/auto/wayland/seatv5/.prev_CMakeLists.txt index 11d615fb2f7..fa9e5a4eb48 100644 --- a/tests/auto/wayland/seatv5/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/seatv5/CMakeLists.txt b/tests/auto/wayland/seatv5/CMakeLists.txt index fefdcf8dbe2..67bfc65354a 100644 --- a/tests/auto/wayland/seatv5/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index b0be2cb4e5b..0d98852160d 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/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/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index a12d22d3658..8d5e2d66d31 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/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/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index b59cdc481da..97202e78792 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/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/wayland/shared/xdgoutputv1.cpp b/tests/auto/wayland/shared/xdgoutputv1.cpp new file mode 100644 index 00000000000..2b491d2ee76 --- /dev/null +++ b/tests/auto/wayland/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/wayland/shared/xdgoutputv1.h b/tests/auto/wayland/shared/xdgoutputv1.h new file mode 100644 index 00000000000..85b134500a0 --- /dev/null +++ b/tests/auto/wayland/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 + +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 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(outputResource); + auto *xdgOutput = getXdgOutput(output); + xdgOutput->addResource(resource->client(), id, resource->version()); + } +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_XDGOUTPUTV1_H diff --git a/tests/auto/wayland/surface/.prev_CMakeLists.txt b/tests/auto/wayland/surface/.prev_CMakeLists.txt index 43d6ec34e5a..a8eb58dac27 100644 --- a/tests/auto/wayland/surface/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/surface/CMakeLists.txt b/tests/auto/wayland/surface/CMakeLists.txt index a1545115e43..a3962ddaf3a 100644 --- a/tests/auto/wayland/surface/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/tabletv2/.prev_CMakeLists.txt b/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt index e7fc3f60f3a..5fecee50ac2 100644 --- a/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/tabletv2/CMakeLists.txt b/tests/auto/wayland/tabletv2/CMakeLists.txt index f5a12c55441..d039e30dde3 100644 --- a/tests/auto/wayland/tabletv2/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/xdgdecorationv1/.prev_CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt index 9311070a818..228ad83e00c 100644 --- a/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/xdgdecorationv1/CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt index de067a135c9..fb0fd06addf 100644 --- a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index cf20a137392..98c0e044668 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/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()->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()->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/wayland/xdgoutput/.prev_CMakeLists.txt b/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt index 505c7c0502f..3fc5aa77250 100644 --- a/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/xdgoutput/CMakeLists.txt b/tests/auto/wayland/xdgoutput/CMakeLists.txt index e0a4b756eca..341624e4aee 100644 --- a/tests/auto/wayland/xdgoutput/CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index 16e29a3c6d9..0e5b2c878cb 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -26,77 +26,21 @@ ** ****************************************************************************/ +#include "xdgoutputv1.h" #include "mockcompositor.h" + #include #include #include -#include - 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 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(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(version); }); } @@ -110,11 +54,13 @@ private slots: void cleanup(); void primaryScreen(); void overrideGeometry(); + void changeGeometry(); }; void tst_xdgoutput::cleanup() { QCOMPOSITOR_COMPARE(getAll().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()->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(); + auto *xdgOutput = get()->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(); }); + 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/wayland/xdgoutput/xdgoutput.pro b/tests/auto/wayland/xdgoutput/xdgoutput.pro index 3cfbb6a7602..f65327546c2 100644 --- a/tests/auto/wayland/xdgoutput/xdgoutput.pro +++ b/tests/auto/wayland/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/wayland/xdgshell/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt index 65f76210771..4faa14f3db4 100644 --- a/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt +++ b/tests/auto/wayland/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/wayland/xdgshell/CMakeLists.txt b/tests/auto/wayland/xdgshell/CMakeLists.txt index cab6c882550..a680575caac 100644 --- a/tests/auto/wayland/xdgshell/CMakeLists.txt +++ b/tests/auto/wayland/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 )