From bd6dbf01f13007c20f93080d59b26d3635a81a9d Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 10 Nov 2020 19:06:48 +0100 Subject: Implement xdg_activation_v1 protocol Change-Id: Ib5c8d0c6a209308c2c1a7f5e45d8866ba0127d81 Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/client/qwaylandshellsurface.cpp | 11 +++++++++++ src/client/qwaylandshellsurface_p.h | 2 ++ src/client/qwaylandwindow.cpp | 13 +++++++++++-- src/client/qwaylandwindow_p.h | 4 ++++ 4 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src/client') diff --git a/src/client/qwaylandshellsurface.cpp b/src/client/qwaylandshellsurface.cpp index 81e05a44..f87e5962 100644 --- a/src/client/qwaylandshellsurface.cpp +++ b/src/client/qwaylandshellsurface.cpp @@ -105,6 +105,17 @@ uint32_t QWaylandShellSurface::getSerial(QWaylandInputDevice *inputDevice) return inputDevice->serial(); } +void QWaylandShellSurface::setXdgActivationToken(const QString &token) +{ + Q_UNUSED(token); + qCWarning(lcQpaWayland) << "setXdgActivationToken not implemented" << token; +} + +void QWaylandShellSurface::requestXdgActivationToken(quint32 serial) +{ + Q_UNUSED(serial); + Q_EMIT m_window->xdgActivationTokenCreated({}); +} } QT_END_NAMESPACE diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h index cdf1abdb..4779eebb 100644 --- a/src/client/qwaylandshellsurface_p.h +++ b/src/client/qwaylandshellsurface_p.h @@ -103,6 +103,8 @@ public: virtual void setWindowPosition(const QPoint &position) { Q_UNUSED(position); } virtual bool requestActivate() { return false; } + virtual void setXdgActivationToken(const QString &token); + virtual void requestXdgActivationToken(quint32 serial); inline QWaylandWindow *window() { return m_window; } QPlatformWindow *platformWindow(); diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index b0d1c0d1..3481a8fa 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -1249,8 +1249,8 @@ void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) void QWaylandWindow::requestActivateWindow() { - if (mShellSurface == nullptr || !mShellSurface->requestActivate()) - qCWarning(lcQpaWayland) << "Wayland does not support QWindow::requestActivate()"; + if (mShellSurface) + mShellSurface->requestActivate(); } bool QWaylandWindow::isExposed() const @@ -1497,6 +1497,15 @@ void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea) wl_region_destroy(region); } +void QWaylandWindow::requestXdgActivationToken(uint serial) +{ + mShellSurface->requestXdgActivationToken(serial); +} + +void QWaylandWindow::setXdgActivationToken(const QString &token) +{ + mShellSurface->setXdgActivationToken(token); +} } QT_END_NAMESPACE diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index f2dbe337..4eecdd86 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -230,12 +230,16 @@ public: void handleUpdate(); void deliverUpdateRequest() override; + void setXdgActivationToken(const QString &token); + void requestXdgActivationToken(uint serial); + public slots: void applyConfigure(); signals: void wlSurfaceCreated(); void wlSurfaceDestroyed(); + void xdgActivationTokenCreated(const QString &token); protected: virtual void doHandleFrameCallback(); -- cgit v1.2.1