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
This commit is contained in:
commit
a9430f98b3
@ -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."
|
||||
},
|
||||
|
||||
|
@ -76,6 +76,7 @@ qt_config_compile_test(dmabuf_server_buffer
|
||||
LABEL "Linux dma-buf Buffer Sharing"
|
||||
LIBRARIES
|
||||
EGL::EGL
|
||||
Libdrm::Libdrm
|
||||
CODE
|
||||
"
|
||||
#include <EGL/egl.h>
|
||||
@ -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 <vulkan/vulkan.h>
|
||||
|
||||
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 <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <wayland-client.h>
|
||||
|
||||
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
|
||||
)
|
||||
|
@ -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": {
|
||||
|
@ -4,7 +4,7 @@
|
||||
## QWaylandBradientDecorationPlugin Plugin:
|
||||
#####################################################################
|
||||
|
||||
qt_add_plugin(QWaylandBradientDecorationPlugin
|
||||
qt_internal_add_plugin(QWaylandBradientDecorationPlugin
|
||||
OUTPUT_NAME bradient
|
||||
TYPE wayland-decoration-client
|
||||
SOURCES
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPainterPath>
|
||||
#include <QtGui/QPalette>
|
||||
#include <QtGui/QLinearGradient>
|
||||
#include <QtGui/QPainterPath>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,7 @@
|
||||
## QWaylandWlShellIntegrationPlugin Plugin:
|
||||
#####################################################################
|
||||
|
||||
qt_add_plugin(QWaylandWlShellIntegrationPlugin
|
||||
qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin
|
||||
OUTPUT_NAME wl-shell
|
||||
TYPE wayland-shell-integration
|
||||
SOURCES
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -4,7 +4,7 @@
|
||||
## QWaylandXdgShellIntegrationPlugin Plugin:
|
||||
#####################################################################
|
||||
|
||||
qt_add_plugin(QWaylandXdgShellIntegrationPlugin
|
||||
qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin
|
||||
OUTPUT_NAME xdg-shell
|
||||
TYPE wayland-shell-integration
|
||||
SOURCES
|
||||
|
@ -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,11 +156,13 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states)
|
||||
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -251,7 +251,7 @@ QSharedPointer<QWaylandBuffer> QWaylandCursor::cursorBitmapBuffer(QWaylandDispla
|
||||
const QImage &img = cursor->pixmap().toImage();
|
||||
QSharedPointer<QWaylandShmBuffer> 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)
|
||||
|
@ -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();
|
||||
|
@ -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*/) {}
|
||||
|
@ -157,7 +157,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());
|
||||
@ -414,6 +414,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;
|
||||
@ -1185,9 +1190,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;
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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);
|
||||
|
@ -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; }
|
||||
|
@ -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
|
||||
|
59
tests/auto/wayland/shared/xdgoutputv1.cpp
Normal file
59
tests/auto/wayland/shared/xdgoutputv1.cpp
Normal file
@ -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
|
88
tests/auto/wayland/shared/xdgoutputv1.h
Normal file
88
tests/auto/wayland/shared/xdgoutputv1.h
Normal file
@ -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
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user