From 2b903baaf07b14bc58263e1968c5e4adf7580e3e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jan 2020 10:08:23 +0100 Subject: Update protocol for xdg-output-unstable-v1 Change-Id: I7d7a2fdbd1f44469b90c467c9490448c13025fa5 Reviewed-by: Pier Luigi Fiorini --- src/3rdparty/protocol/qt_attribution.json | 4 ++-- src/3rdparty/protocol/xdg-output-unstable-v1.xml | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/protocol/qt_attribution.json b/src/3rdparty/protocol/qt_attribution.json index afbcbc27d..ddda0e971 100644 --- a/src/3rdparty/protocol/qt_attribution.json +++ b/src/3rdparty/protocol/qt_attribution.json @@ -150,8 +150,8 @@ Copyright 2015-2016 © Red Hat, Inc." "Description": "The XDG Output protocol is an extended way to describe output regions under Wayland", "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1, version 2", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.17/unstable/xdg-output/xdg-output-unstable-v1.xml", + "Version": "unstable v1, version 3", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-output/xdg-output-unstable-v1.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", diff --git a/src/3rdparty/protocol/xdg-output-unstable-v1.xml b/src/3rdparty/protocol/xdg-output-unstable-v1.xml index ccbfe1c9a..fe3a70aab 100644 --- a/src/3rdparty/protocol/xdg-output-unstable-v1.xml +++ b/src/3rdparty/protocol/xdg-output-unstable-v1.xml @@ -54,7 +54,7 @@ reset. - + A global factory interface for xdg_output objects. @@ -77,12 +77,17 @@ - + An xdg_output describes part of the compositor geometry. This typically corresponds to a monitor that displays part of the compositor space. + + For objects version 3 onwards, after all xdg_output properties have been + sent (when the object is created and when properties are updated), a + wl_output.done event is sent. This allows changes to the output + properties to be seen as atomic, even if they happen via multiple events. @@ -157,6 +162,10 @@ This allows changes to the xdg_output properties to be seen as atomic, even if they happen via multiple events. + + For objects version 3 onwards, this event is deprecated. Compositors + are not required to send it anymore and must send wl_output.done + instead. @@ -197,10 +206,12 @@ output via :1'. The description event is sent after creating an xdg_output (see - xdg_output_manager.get_xdg_output). This event is only sent once per + xdg_output_manager.get_xdg_output) and whenever the description + changes. The description is optional, and may not be sent at all. + + For objects of version 2 and lower, this event is only sent once per xdg_output, and the description does not change over the lifetime of - the wl_output global. The description is optional, and may not be sent - at all. + the wl_output global. -- cgit v1.2.3 From 9e637d9718d52075a74eeb6b7d9ae21fa9105a52 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 23 Oct 2019 23:52:34 +0200 Subject: Implement missing changed signals to properties QML cannot do property binding with properties without CONSTANT or NOTIFY. Also emit changed signal where it's not. Change-Id: I5117383e22085af08589f6aa05892676c24f3846 Reviewed-by: Shawn Rutledge Reviewed-by: Johan Helsing --- src/compositor/compositor_api/qwaylandquickitem.cpp | 10 +++++++++- src/compositor/compositor_api/qwaylandquickitem.h | 3 ++- src/compositor/extensions/qwaylandxdgshell.h | 4 ++-- src/compositor/extensions/qwaylandxdgshellv6.h | 4 ++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 357805393..c9a2e9fc2 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -413,11 +413,14 @@ QWaylandSurface *QWaylandQuickItem::surface() const void QWaylandQuickItem::setSurface(QWaylandSurface *surface) { Q_D(QWaylandQuickItem); + QWaylandSurface *oldSurf = d->view->surface(); QWaylandCompositor *oldComp = d->view->surface() ? d->view->surface()->compositor() : nullptr; d->view->setSurface(surface); QWaylandCompositor *newComp = d->view->surface() ? d->view->surface()->compositor() : nullptr; if (oldComp != newComp) emit compositorChanged(); + if (oldSurf != surface) + emit surfaceChanged(); update(); } @@ -1200,7 +1203,12 @@ bool QWaylandQuickItem::paintEnabled() const void QWaylandQuickItem::setPaintEnabled(bool enabled) { Q_D(QWaylandQuickItem); - d->paintEnabled = enabled; + + if (enabled != d->paintEnabled) { + d->paintEnabled = enabled; + emit paintEnabledChanged(); + } + update(); } diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h index 7731933e7..cc1704f63 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.h +++ b/src/compositor/compositor_api/qwaylandquickitem.h @@ -53,7 +53,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem Q_DECLARE_PRIVATE(QWaylandQuickItem) Q_PROPERTY(QWaylandCompositor *compositor READ compositor NOTIFY compositorChanged) Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged) - Q_PROPERTY(bool paintEnabled READ paintEnabled WRITE setPaintEnabled) + Q_PROPERTY(bool paintEnabled READ paintEnabled WRITE setPaintEnabled NOTIFY paintEnabledChanged) Q_PROPERTY(bool touchEventsEnabled READ touchEventsEnabled WRITE setTouchEventsEnabled NOTIFY touchEventsEnabledChanged) Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged) Q_PROPERTY(bool inputEventsEnabled READ inputEventsEnabled WRITE setInputEventsEnabled NOTIFY inputEventsEnabledChanged) @@ -168,6 +168,7 @@ private Q_SLOTS: Q_SIGNALS: void surfaceChanged(); void compositorChanged(); + void paintEnabledChanged(); void touchEventsEnabledChanged(); void originChanged(); void surfaceDestroyed(); diff --git a/src/compositor/extensions/qwaylandxdgshell.h b/src/compositor/extensions/qwaylandxdgshell.h index c79b22350..0535f8e4d 100644 --- a/src/compositor/extensions/qwaylandxdgshell.h +++ b/src/compositor/extensions/qwaylandxdgshell.h @@ -234,8 +234,8 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopup : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandXdgPopup) - Q_PROPERTY(QWaylandXdgSurface *xdgSurface READ xdgSurface) - Q_PROPERTY(QWaylandXdgSurface *parentXdgSurface READ parentXdgSurface) + Q_PROPERTY(QWaylandXdgSurface *xdgSurface READ xdgSurface CONSTANT) + Q_PROPERTY(QWaylandXdgSurface *parentXdgSurface READ parentXdgSurface CONSTANT) Q_PROPERTY(QRect configuredGeometry READ configuredGeometry NOTIFY configuredGeometryChanged) // Positioner properties diff --git a/src/compositor/extensions/qwaylandxdgshellv6.h b/src/compositor/extensions/qwaylandxdgshellv6.h index 71f82521a..f280880bc 100644 --- a/src/compositor/extensions/qwaylandxdgshellv6.h +++ b/src/compositor/extensions/qwaylandxdgshellv6.h @@ -215,8 +215,8 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV6 : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandXdgPopupV6) - Q_PROPERTY(QWaylandXdgSurfaceV6 *xdgSurface READ xdgSurface) - Q_PROPERTY(QWaylandXdgSurfaceV6 *parentXdgSurface READ parentXdgSurface) + Q_PROPERTY(QWaylandXdgSurfaceV6 *xdgSurface READ xdgSurface CONSTANT) + Q_PROPERTY(QWaylandXdgSurfaceV6 *parentXdgSurface READ parentXdgSurface CONSTANT) Q_PROPERTY(QRect configuredGeometry READ configuredGeometry NOTIFY configuredGeometryChanged) // Positioner properties -- cgit v1.2.3 From e57fb37c66d0efa3eb1b9367d284dc5643406cda Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 10 Jan 2020 13:02:17 +0100 Subject: Don't use deprecated QMatrix class anymore Task-number: QTBUG-46653 Change-Id: I038a370ca8af642605709fa5ffdb1c619c60433b Reviewed-by: Johan Helsing --- src/client/qwaylandshmbackingstore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp index 8d5b977d5..dc7ff6708 100644 --- a/src/client/qwaylandshmbackingstore.cpp +++ b/src/client/qwaylandshmbackingstore.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -328,7 +329,7 @@ void QWaylandShmBackingStore::updateDecorations() qreal dp = sourceImage.devicePixelRatio(); int dpWidth = int(sourceImage.width() / dp); int dpHeight = int(sourceImage.height() / dp); - QMatrix sourceMatrix; + QTransform sourceMatrix; sourceMatrix.scale(dp, dp); QRect target; // needs to be in device independent pixels -- cgit v1.2.3 From da13b1b130f520ee0bd9df0e9190db64a2ea4a93 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jan 2020 12:26:21 +0100 Subject: Client: Upgrade to xdg-output-unstable-v1 version 3 [ChangeLog][QPA plugin] xdg-output-unstable-v1 version 3 is now supported. Change-Id: I054b2946e86175eabe76731bac94e5f287c4ee58 Reviewed-by: Paul Olav Tvete --- src/client/qwaylanddisplay.cpp | 2 +- src/client/qwaylanddisplay_p.h | 6 +++--- src/client/qwaylandscreen.cpp | 20 +++++++++++++++++--- src/client/qwaylandscreen_p.h | 10 +++++++++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index ffcc72ff9..37cb0e9bc 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -351,7 +351,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin forceRoundTrip(); } } else if (interface == QLatin1String("zxdg_output_manager_v1")) { - mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, qMin(2, int(version)))); + mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); for (auto *screen : qAsConst(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); forceRoundTrip(); diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index e99ec1983..a52c89fe9 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -81,7 +81,6 @@ class QPlatformPlaceholderScreen; namespace QtWayland { class qt_surface_extension; class zwp_text_input_manager_v2; - class zxdg_output_manager_v1; } namespace QtWaylandClient { @@ -91,6 +90,7 @@ Q_WAYLAND_CLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland); class QWaylandInputDevice; class QWaylandBuffer; class QWaylandScreen; +class QWaylandXdgOutputManagerV1; class QWaylandClientBufferIntegration; class QWaylandWindowManagerIntegration; class QWaylandDataDeviceManager; @@ -165,7 +165,7 @@ public: QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } - QtWayland::zxdg_output_manager_v1 *xdgOutputManager() const { return mXdgOutputManager.data(); } + QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); } bool usingInputContextFromCompositor() const { return mUsingInputContextFromCompositor; } @@ -255,7 +255,7 @@ private: #endif QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; - QScopedPointer mXdgOutputManager; + QScopedPointer mXdgOutputManager; QSocketNotifier *mReadNotifier = nullptr; int mFd = -1; int mWritableNotificationFd = -1; diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp index 4f0cd9b0a..6cb337de3 100644 --- a/src/client/qwaylandscreen.cpp +++ b/src/client/qwaylandscreen.cpp @@ -53,6 +53,12 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, uint id, uint version) + : QtWayland::zxdg_output_manager_v1(display->wl_registry(), id, qMin(3u, version)) + , m_version(qMin(3u, version)) +{ +} + QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) , m_outputId(id) @@ -95,7 +101,7 @@ void QWaylandScreen::maybeInitialize() updateXdgOutputProperties(); } -void QWaylandScreen::initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager) +void QWaylandScreen::initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager) { Q_ASSERT(xdgOutputManager); if (zxdg_output_v1::isInitialized()) @@ -271,10 +277,15 @@ void QWaylandScreen::output_scale(int32_t factor) void QWaylandScreen::output_done() { mOutputDone = true; - if (mInitialized) + if (zxdg_output_v1::isInitialized() && mWaylandDisplay->xdgOutputManager()->version() >= 3) + mXdgOutputDone = true; + if (mInitialized) { updateOutputProperties(); - else + if (zxdg_output_v1::isInitialized()) + updateXdgOutputProperties(); + } else { maybeInitialize(); + } } void QWaylandScreen::updateOutputProperties() @@ -325,6 +336,9 @@ void QWaylandScreen::zxdg_output_v1_logical_size(int32_t width, int32_t height) void QWaylandScreen::zxdg_output_v1_done() { + if (Q_UNLIKELY(mWaylandDisplay->xdgOutputManager()->version() >= 3)) + qWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor"; + mXdgOutputDone = true; if (mInitialized) updateXdgOutputProperties(); diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h index ae91c6211..df1c94f24 100644 --- a/src/client/qwaylandscreen_p.h +++ b/src/client/qwaylandscreen_p.h @@ -64,6 +64,14 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandCursor; +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 { +public: + QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version); + uint version() const { return m_version; } +private: + uint m_version = 1; // TODO: remove when we upgrade minimum libwayland requriement to 1.10 +}; + class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 { public: @@ -72,7 +80,7 @@ public: void maybeInitialize(); - void initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager); + void initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager); QWaylandDisplay *display() const; -- cgit v1.2.3 From 5a66bc64b0b157929c9fc76f0f4ae046393be600 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Thu, 5 Dec 2019 12:12:37 -0500 Subject: Enable QtWayland for QNX Make EGL 1.5 with EGL_PLATFORM_WAYLAND_EXT a requirement for QNX and add some EGL 1.5 code alternatives. Avoids the need to deal with incompatibility problems between the QNX native display/window type and Wayland display/window type. Change-Id: Ib26a020e1f8c7f570c6af08697d8c8153c887294 Reviewed-by: Paul Olav Tvete Reviewed-by: Johan Helsing Reviewed-by: Dan Cape --- qtwayland.pro | 2 +- src/client/configure.json | 19 +++++++++++++++++-- .../drm-egl-server/drmeglserverbufferintegration.cpp | 4 ++++ .../qwaylandeglclientbufferintegration.cpp | 4 ++++ .../client/wayland-egl/qwaylandglcontext.cpp | 6 +++++- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/qtwayland.pro b/qtwayland.pro index fdcc3e24f..1dfa06aee 100644 --- a/qtwayland.pro +++ b/qtwayland.pro @@ -1,3 +1,3 @@ -requires(linux:!android|macos) +requires(linux:!android|macos|qnx) requires(qtHaveModule(gui)) load(qt_parts) diff --git a/src/client/configure.json b/src/client/configure.json index 7d4468240..9b8b43457 100644 --- a/src/client/configure.json +++ b/src/client/configure.json @@ -168,6 +168,21 @@ "return 0;" ] } + }, + "egl_1_5-wayland": { + "label": "EGL 1.5 with Wayland Platform", + "type": "compile", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "wayland-client.h" + ], + "main": [ + "eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr);" + ] + }, + "use": "egl" } }, @@ -218,7 +233,7 @@ }, "wayland-egl": { "label": "EGL", - "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl", + "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || tests.egl_1_5-wayland)", "output": [ "privateFeature" ] }, "wayland-brcm": { @@ -238,7 +253,7 @@ }, "wayland-drm-egl-server-buffer": { "label": "DRM EGL", - "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server", + "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || tests.egl_1_5-wayland)", "output": [ "privateFeature" ] }, "wayland-libhybris-egl-server-buffer": { diff --git a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp index 754196468..42c85f7db 100644 --- a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp +++ b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp @@ -125,7 +125,11 @@ void DrmEglServerBufferIntegration::initializeEgl() return; m_egl_initialized = true; +#if defined(EGL_VERSION_1_5) && defined(EGL_PLATFORM_WAYLAND_EXT) + m_egl_display = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, m_display->wl_display(), nullptr); +#else m_egl_display = eglGetDisplay((EGLNativeDisplayType) m_display->wl_display()); +#endif if (m_egl_display == EGL_NO_DISPLAY) { qWarning("Failed to initialize drm egl server buffer integration. Could not get egl display from wl_display."); return; diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp index 0dc389bb8..6f0b57fcd 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp @@ -76,6 +76,9 @@ QWaylandEglClientBufferIntegration::~QWaylandEglClientBufferIntegration() void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display) { +#if defined(EGL_VERSION_1_5) && defined(EGL_PLATFORM_WAYLAND_EXT) + m_eglDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, display->wl_display(), nullptr); +#else if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) { if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") || q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") || @@ -98,6 +101,7 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display) m_eglDisplay = eglGetDisplay((EGLNativeDisplayType) display->wl_display()); } +#endif m_display = display; diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp index 7679a5fb3..8ea8e1092 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp @@ -346,7 +346,11 @@ void QWaylandGLContext::updateGLFormat() wl_surface *wlSurface = m_display->createSurface(nullptr); wl_egl_window *eglWindow = wl_egl_window_create(wlSurface, 1, 1); - EGLSurface eglSurface = eglCreateWindowSurface(m_eglDisplay, m_config, eglWindow, 0); +#if defined(EGL_VERSION_1_5) + EGLSurface eglSurface = eglCreatePlatformWindowSurface(m_eglDisplay, m_config, eglWindow, nullptr); +#else + EGLSurface eglSurface = eglCreateWindowSurface(m_eglDisplay, m_config, eglWindow, nullptr); +#endif if (eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) { if (m_format.renderableType() == QSurfaceFormat::OpenGL -- cgit v1.2.3