From 5405de120bba480f780e37e90fbd7c2ff1308b01 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 1 Nov 2018 13:48:52 +0100 Subject: Client: Don't be exposed if we want to create a sub or shell surface Because some shells don't allow attaching buffers before configure, we need to not be exposed until we know that we don't want a shell surface. Change-Id: Ida7101a99f953d02cf6401e4ea8d28cfabd6e102 Reviewed-by: Giulio Camuffo Reviewed-by: David Edmundson --- src/client/qwaylanddisplay.cpp | 13 ++++++------- src/client/qwaylanddisplay_p.h | 6 +++--- src/client/qwaylandwindow.cpp | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index a2957e0d..f2bd3160 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -88,13 +88,6 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) return surface; } -QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window) -{ - if (!mWaylandIntegration->shellIntegration()) - return nullptr; - return mWaylandIntegration->shellIntegration()->createShellSurface(window); -} - struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) { struct ::wl_region *region = mCompositor.create_region(); @@ -108,12 +101,18 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) ::wl_subsurface *QWaylandDisplay::createSubSurface(QWaylandWindow *window, QWaylandWindow *parent) { if (!mSubCompositor) { + qCWarning(lcQpaWayland) << "Can't create subsurface, not supported by the compositor."; return nullptr; } return mSubCompositor->get_subsurface(window->object(), parent->object()); } +QWaylandShellIntegration *QWaylandDisplay::shellIntegration() const +{ + return mWaylandIntegration->shellIntegration(); +} + QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() const { return mWaylandIntegration->clientBufferIntegration(); diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 43ccc0a9..fe1d7874 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -94,7 +94,7 @@ class QWaylandQtKeyExtension; class QWaylandWindow; class QWaylandIntegration; class QWaylandHardwareIntegration; -class QWaylandShellSurface; +class QWaylandShellIntegration; class QWaylandCursorTheme; typedef void (*RegistryListener)(void *data, @@ -115,13 +115,13 @@ public: QWaylandScreen *screenForOutput(struct wl_output *output) const; struct wl_surface *createSurface(void *handle); - QWaylandShellSurface *createShellSurface(QWaylandWindow *window); struct ::wl_region *createRegion(const QRegion &qregion); struct ::wl_subsurface *createSubSurface(QWaylandWindow *window, QWaylandWindow *parent); + QWaylandShellIntegration *shellIntegration() const; QWaylandClientBufferIntegration *clientBufferIntegration() const; - QWaylandWindowManagerIntegration *windowManagerIntegration() const; + #if QT_CONFIG(cursor) void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr); void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, qreal dpr); diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index c46c4981..79639cba 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -50,6 +50,7 @@ #include "qwaylandnativeinterface_p.h" #include "qwaylanddecorationfactory_p.h" #include "qwaylandshmbackingstore_p.h" +#include "qwaylandshellintegration_p.h" #if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevice_p.h" @@ -138,8 +139,9 @@ void QWaylandWindow::initWindow() } } else if (shouldCreateShellSurface()) { Q_ASSERT(!mShellSurface); + Q_ASSERT(mDisplay->shellIntegration()); - mShellSurface = mDisplay->createShellSurface(this); + mShellSurface = mDisplay->shellIntegration()->createShellSurface(this); if (mShellSurface) { // Set initial surface title setWindowTitle(window()->title()); @@ -211,6 +213,9 @@ void QWaylandWindow::initializeWlSurface() bool QWaylandWindow::shouldCreateShellSurface() const { + if (!mDisplay->shellIntegration()) + return false; + if (shouldCreateSubSurface()) return false; @@ -958,9 +963,16 @@ void QWaylandWindow::unfocus() bool QWaylandWindow::isExposed() const { + if (!window()->isVisible()) + return false; + if (mShellSurface) - return window()->isVisible() && mShellSurface->isExposed(); - return QPlatformWindow::isExposed(); + return mShellSurface->isExposed(); + + if (mSubSurfaceWindow) + return mSubSurfaceWindow->parent()->isExposed(); + + return !(shouldCreateShellSurface() || shouldCreateSubSurface()); } bool QWaylandWindow::isActive() const -- cgit v1.2.1 From 0b51286635ca3f724df94dd4d5268c950505f6ec Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 11 Apr 2019 13:43:07 +0200 Subject: Fix incorrect path to wl-eglstream-controller.xml Change-Id: I1d4bceeb87b7e95b7b4b9c9885e06052bd7536e9 Reviewed-by: Paul Olav Tvete --- src/3rdparty/protocol/qt_attribution.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/protocol/qt_attribution.json b/src/3rdparty/protocol/qt_attribution.json index 7881e6b0..051bd3f9 100644 --- a/src/3rdparty/protocol/qt_attribution.json +++ b/src/3rdparty/protocol/qt_attribution.json @@ -110,7 +110,7 @@ Copyright © 2015, 2016 Jan Arne Petersen" "Name": "Wayland EGLStream Controller Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor", - "Files": "wayland-eglstream-controller.xml", + "Files": "wl-eglstream-controller.xml", "Description": "Allows clients to request that the compositor creates its EGLStream.", "Homepage": "https://github.com/NVIDIA/egl-wayland", -- cgit v1.2.1