diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 68fea2fac881480cc99d12b027be74c14721807b..2dd58e89cc534ec089cd841488476c83de9b450e 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -116,13 +116,13 @@ QWaylandWindow::~QWaylandWindow()
 void QWaylandWindow::initWindow()
 {
     init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
-    if (QPlatformWindow::parent()) {
+
+    if (shouldCreateSubSurface()) {
         QWaylandWindow *p = static_cast<QWaylandWindow *>(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/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index a905641f3d6c060371350faf02ef47f7add96923..6e271cc106603f4d8f1793fa0dde2692efe38084 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/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);