diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/qwaylandnativeinterface.cpp | 2 | ||||
-rw-r--r-- | src/client/qwaylandshellsurface_p.h | 4 | ||||
-rw-r--r-- | src/client/qwaylandvulkanwindow.cpp | 2 | ||||
-rw-r--r-- | src/client/qwaylandvulkanwindow_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandwindow.cpp | 14 | ||||
-rw-r--r-- | src/client/qwaylandwindow_p.h | 15 |
6 files changed, 32 insertions, 7 deletions
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index b76b1f08b..ea3da8b48 100644 --- a/src/client/qwaylandnativeinterface.cpp +++ b/src/client/qwaylandnativeinterface.cpp @@ -143,7 +143,7 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "vksurface") { if (window->surfaceType() == QSurface::VulkanSurface && window->handle()) { // return a pointer to the VkSurfaceKHR value, not the value itself - return static_cast<QWaylandVulkanWindow *>(window->handle())->surface(); + return static_cast<QWaylandVulkanWindow *>(window->handle())->vkSurface(); } } #endif diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h index 8f176e281..51116c52a 100644 --- a/src/client/qwaylandshellsurface_p.h +++ b/src/client/qwaylandshellsurface_p.h @@ -21,6 +21,8 @@ #include <QtWaylandClient/qtwaylandclientglobal.h> #include <QtCore/private/qglobal_p.h> +#include <any> + struct wl_surface; QT_BEGIN_NAMESPACE @@ -80,6 +82,8 @@ public: QPlatformWindow *platformWindow(); struct wl_surface *wlSurface(); + virtual std::any surfaceRole() const { return std::any(); }; + protected: void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); void repositionFromApplyConfigure(const QPoint &position); diff --git a/src/client/qwaylandvulkanwindow.cpp b/src/client/qwaylandvulkanwindow.cpp index 228bf5ced..db25a2715 100644 --- a/src/client/qwaylandvulkanwindow.cpp +++ b/src/client/qwaylandvulkanwindow.cpp @@ -26,7 +26,7 @@ QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const return QWaylandWindow::Vulkan; } -VkSurfaceKHR *QWaylandVulkanWindow::surface() +VkSurfaceKHR *QWaylandVulkanWindow::vkSurface() { if (m_surface) return &m_surface; diff --git a/src/client/qwaylandvulkanwindow_p.h b/src/client/qwaylandvulkanwindow_p.h index d71fb277c..df24e5dbd 100644 --- a/src/client/qwaylandvulkanwindow_p.h +++ b/src/client/qwaylandvulkanwindow_p.h @@ -30,7 +30,7 @@ public: WindowType windowType() const override; - VkSurfaceKHR *surface(); + VkSurfaceKHR *vkSurface(); private: VkSurfaceKHR m_surface = VK_NULL_HANDLE; diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 56b9af282..4e254dee9 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -59,6 +59,11 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) static WId id = 1; mWindowId = id++; initializeWlSurface(); + + connect(this, &QWaylandWindow::wlSurfaceCreated, this, + &QNativeInterface::Private::QWaylandWindow::surfaceCreated); + connect(this, &QWaylandWindow::wlSurfaceDestroyed, this, + &QNativeInterface::Private::QWaylandWindow::surfaceDestroyed); } QWaylandWindow::~QWaylandWindow() @@ -847,6 +852,15 @@ QWaylandShellSurface *QWaylandWindow::shellSurface() const return mShellSurface; } +std::any QWaylandWindow::_surfaceRole() const +{ + if (mSubSurfaceWindow) + return mSubSurfaceWindow->object(); + if (mShellSurface) + return mShellSurface->surfaceRole(); + return {}; +} + QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const { return mSubSurfaceWindow; diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index 6531606a7..2eb6b64ce 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -28,10 +28,12 @@ #include <QtCore/QMap> // for QVariantMap #include <qpa/qplatformwindow.h> +#include <qpa/qplatformwindow_p.h> #include <QtWaylandClient/private/qwayland-wayland.h> #include <QtWaylandClient/private/qwaylanddisplay_p.h> #include <QtWaylandClient/qtwaylandclientglobal.h> +#include <QtWaylandClient/private/qwaylandshellsurface_p.h> struct wl_egl_window; @@ -56,7 +58,8 @@ class QWaylandSurface; class QWaylandFractionalScale; class QWaylandViewport; -class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow +class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QNativeInterface::Private::QWaylandWindow, + public QPlatformWindow { Q_OBJECT public: @@ -115,17 +118,22 @@ public: QMargins frameMargins() const override; QMargins customMargins() const; - void setCustomMargins(const QMargins &margins); + void setCustomMargins(const QMargins &margins) override; QSize surfaceSize() const; QRect windowContentGeometry() const; QPointF mapFromWlSurface(const QPointF &surfacePosition) const; QWaylandSurface *waylandSurface() const { return mSurface.data(); } ::wl_surface *wlSurface(); + ::wl_surface *surface() const override + { + return const_cast<QWaylandWindow *>(this)->wlSurface(); + } static QWaylandWindow *fromWlSurface(::wl_surface *surface); QWaylandDisplay *display() const { return mDisplay; } QWaylandShellSurface *shellSurface() const; + std::any _surfaceRole() const override; QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *waylandScreen() const; @@ -207,7 +215,7 @@ public: void deliverUpdateRequest() override; void setXdgActivationToken(const QString &token); - void requestXdgActivationToken(uint serial); + void requestXdgActivationToken(uint serial) override; void beginFrame(); void endFrame(); @@ -222,7 +230,6 @@ public slots: signals: void wlSurfaceCreated(); void wlSurfaceDestroyed(); - void xdgActivationTokenCreated(const QString &token); protected: virtual void doHandleFrameCallback(); |