summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/qwaylandnativeinterface.cpp5
-rw-r--r--src/client/qwaylandwindow.cpp17
-rw-r--r--src/client/qwaylandwindow_p.h5
3 files changed, 22 insertions, 5 deletions
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp
index ea3da8b48..2c1cdb98b 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -148,8 +148,9 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
}
#endif
- if (auto shellIntegration = m_integration->shellIntegration())
- return shellIntegration->nativeResourceForWindow(resourceString, window);
+ QWaylandWindow *platformWindow = static_cast<QWaylandWindow *>(window->handle());
+ if (platformWindow && platformWindow->shellIntegration())
+ return platformWindow->shellIntegration()->nativeResourceForWindow(resourceString, window);
return nullptr;
}
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 4e254dee9..f5327c05c 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -45,6 +45,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display)
: QPlatformWindow(window)
, mDisplay(display)
, mSurfaceLock(QReadWriteLock::Recursive)
+ , mShellIntegration(display->shellIntegration())
, mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP"))
{
{
@@ -130,9 +131,9 @@ void QWaylandWindow::initWindow()
}
} else if (shouldCreateShellSurface()) {
Q_ASSERT(!mShellSurface);
- Q_ASSERT(mDisplay->shellIntegration());
+ Q_ASSERT(mShellIntegration);
- mShellSurface = mDisplay->shellIntegration()->createShellSurface(this);
+ mShellSurface = mShellIntegration->createShellSurface(this);
if (mShellSurface) {
// Set initial surface title
setWindowTitle(window()->title());
@@ -216,9 +217,19 @@ void QWaylandWindow::initializeWlSurface()
emit wlSurfaceCreated();
}
+void QWaylandWindow::setShellIntegration(QWaylandShellIntegration *shellIntegration)
+{
+ Q_ASSERT(shellIntegration);
+ if (mShellSurface) {
+ qCWarning(lcQpaWayland) << "Cannot set shell integration while there's already a shell surface created";
+ return;
+ }
+ mShellIntegration = shellIntegration;
+}
+
bool QWaylandWindow::shouldCreateShellSurface() const
{
- if (!mDisplay->shellIntegration())
+ if (!shellIntegration())
return false;
if (shouldCreateSubSurface())
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index 2eb6b64ce..185de69a9 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -50,6 +50,7 @@ class QWaylandSubSurface;
class QWaylandAbstractDecoration;
class QWaylandInputDevice;
class QWaylandScreen;
+class QWaylandShellIntegration;
class QWaylandShmBackingStore;
class QWaylandPointerEvent;
class QWaylandPointerGestureSwipeEvent;
@@ -202,6 +203,9 @@ public:
void setBackingStore(QWaylandShmBackingStore *backingStore) { mBackingStore = backingStore; }
QWaylandShmBackingStore *backingStore() const { return mBackingStore; }
+ void setShellIntegration(QWaylandShellIntegration *shellIntegration);
+ QWaylandShellIntegration *shellIntegration() const { return mShellIntegration; }
+
bool setKeyboardGrabEnabled(bool) override { return false; }
void propagateSizeHints() override;
void addAttachOffset(const QPoint point);
@@ -245,6 +249,7 @@ protected:
QScopedPointer<QWaylandFractionalScale> mFractionalScale;
QScopedPointer<QWaylandViewport> mViewport;
+ QWaylandShellIntegration *mShellIntegration = nullptr;
QWaylandShellSurface *mShellSurface = nullptr;
QWaylandSubSurface *mSubSurfaceWindow = nullptr;
QList<QWaylandSubSurface *> mChildren;