diff options
Diffstat (limited to 'src')
12 files changed, 50 insertions, 7 deletions
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index b76b1f08..ea3da8b4 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 8f176e28..51116c52 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 228bf5ce..db25a271 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 d71fb277..df24e5db 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 56b9af28..4e254dee 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 6531606a..2eb6b64c 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(); diff --git a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h index 8affdfd6..0a82e5ee 100644 --- a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h +++ b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h @@ -18,6 +18,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Surface : public QWaylandS { public: QWaylandFullScreenShellV1Surface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window); + std::any surfaceRole() const override { return m_shell->object(); } private: QtWayland::zwp_fullscreen_shell_v1 *m_shell = nullptr; diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h index 7e6811fd..853897cd 100644 --- a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h +++ b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h @@ -28,6 +28,8 @@ public: void applyConfigure() override; + std::any surfaceRole() const override { return ivi_surface::object(); }; + private: void createExtendedSurface(QWaylandWindow *window); void ivi_surface_configure(int32_t width, int32_t height) override; diff --git a/src/plugins/shellintegration/qt-shell/qwaylandqtsurface_p.h b/src/plugins/shellintegration/qt-shell/qwaylandqtsurface_p.h index 2f95dd71..53c37f79 100644 --- a/src/plugins/shellintegration/qt-shell/qwaylandqtsurface_p.h +++ b/src/plugins/shellintegration/qt-shell/qwaylandqtsurface_p.h @@ -42,6 +42,8 @@ public: void raise() override; void lower() override; + std::any surfaceRole() const override { return object(); }; + private: void resetConfiguration(); void sendSizeHints(); diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index d3996f43..24600302 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -57,6 +57,8 @@ public: void applyConfigure() override; bool wantsDecorations() const override; + std::any surfaceRole() const override { return object(); }; + protected: void requestWindowStates(Qt::WindowStates states) override; diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 9bd5209f..c1462e07 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -417,6 +417,15 @@ void *QWaylandXdgSurface::nativeResource(const QByteArray &resource) return nullptr; } +std::any QWaylandXdgSurface::surfaceRole() const +{ + if (m_toplevel) + return m_toplevel->object(); + if (m_popup) + return m_popup->object(); + return {}; +} + void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) { if (m_toplevel) diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index abfd0db3..58860269 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -72,6 +72,8 @@ public: void *nativeResource(const QByteArray &resource); + std::any surfaceRole() const override; + protected: void requestWindowStates(Qt::WindowStates states) override; void xdg_surface_configure(uint32_t serial) override; |