From e7ba33c0ec00b2534f15f9908e6016108da4a6dd Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Sun, 27 Mar 2016 12:10:19 +0200 Subject: [PATCH 1/2] Remove attached() definition from header. The implementation of attached() method was removed in commit 'Fix SHM drawing logic' (330e3a78695bbe7f439676831b2336f3e5e26521) but the definition in the header file was not. Change-Id: Ib850bc7101a661882078be95011d75660f621622 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 3f35a1eba3f..a905641f3d6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -120,7 +120,6 @@ public: using QtWayland::wl_surface::attach; void attach(QWaylandBuffer *buffer, int x, int y); void attachOffset(QWaylandBuffer *buffer); - QWaylandBuffer *attached() const; QPoint attachOffset() const; using QtWayland::wl_surface::damage; From d77d93487409cbfda35a29590adedfd91811dace Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 30 Mar 2016 15:13:44 +0200 Subject: [PATCH 2/2] Client: Don't create shell surfaces for QShapedPixmapWindow QShapedPixmapWindow is used as a drag-and-drop icon. This caused two roles (wl_data_device-icon and wl_shell_surface) to be assigned to the same surface, resulting in a protocol error. This bug hasn't been encountered before because QShapedPixmapWindow sets X11BypassWindowManagerHint, which was previously used to determine whether to create a shell surface or not. Task-number: QTBUG-52052 Change-Id: I1d79f3ec8ad08e0be1551c39df6232876dc2ac2e Reviewed-by: Giulio Camuffo Reviewed-by: Erik Larsson --- .../platforms/wayland/qwaylandwindow.cpp | 25 ++++++++++++++++--- .../platforms/wayland/qwaylandwindow_p.h | 2 ++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 68fea2fac88..2dd58e89cc5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -116,13 +116,13 @@ QWaylandWindow::~QWaylandWindow() void QWaylandWindow::initWindow() { init(mDisplay->createSurface(static_cast(this))); - if (QPlatformWindow::parent()) { + + if (shouldCreateSubSurface()) { QWaylandWindow *p = static_cast(QPlatformWindow::parent()); if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); } - } else if (!(qEnvironmentVariableIsSet("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT") && - window()->flags() & Qt::BypassWindowManagerHint)) { + } else if (shouldCreateShellSurface()) { mShellSurface = mDisplay->createShellSurface(this); } @@ -176,6 +176,25 @@ void QWaylandWindow::initWindow() handleContentOrientationChange(window()->contentOrientation()); } +bool QWaylandWindow::shouldCreateShellSurface() const +{ + if (shouldCreateSubSurface()) + return false; + + if (window()->inherits("QShapedPixmapWindow")) + return false; + + if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT")) + return window()->flags() & Qt::BypassWindowManagerHint; + + return true; +} + +bool QWaylandWindow::shouldCreateSubSurface() const +{ + return QPlatformWindow::parent() != Q_NULLPTR; +} + void QWaylandWindow::reset() { delete mShellSurface; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index a905641f3d6..6e271cc1066 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -234,6 +234,8 @@ private: bool setWindowStateInternal(Qt::WindowState flags); void setGeometry_helper(const QRect &rect); void initWindow(); + bool shouldCreateShellSurface() const; + bool shouldCreateSubSurface() const; void reset(); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e);