summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/qwaylandshellsurface_p.h3
-rw-r--r--src/client/qwaylandwindow.cpp14
-rw-r--r--src/client/qwaylandwindow_p.h3
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp7
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h3
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp23
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h3
7 files changed, 52 insertions, 4 deletions
diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h
index 5e2695109..8f176e281 100644
--- a/src/client/qwaylandshellsurface_p.h
+++ b/src/client/qwaylandshellsurface_p.h
@@ -71,6 +71,9 @@ public:
virtual void setXdgActivationToken(const QString &token);
virtual void requestXdgActivationToken(quint32 serial);
+ virtual void setAlertState(bool enabled) { Q_UNUSED(enabled); }
+ virtual bool isAlertState() const { return false; }
+
virtual QString externWindowHandle() { return QString(); }
inline QWaylandWindow *window() { return m_window; }
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 4fd012de2..c8d5121f6 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -502,6 +502,20 @@ void QWaylandWindow::setMask(const QRegion &mask)
mSurface->commit();
}
+void QWaylandWindow::setAlertState(bool enabled)
+{
+ if (mShellSurface)
+ mShellSurface->setAlertState(enabled);
+}
+
+bool QWaylandWindow::isAlertState() const
+{
+ if (mShellSurface)
+ return mShellSurface->isAlertState();
+
+ return false;
+}
+
void QWaylandWindow::applyConfigureWhenPossible()
{
QMutexLocker resizeLocker(&mResizeLock);
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index 298f3f2df..2e68cc2e4 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -143,6 +143,9 @@ public:
void setMask(const QRegion &region) override;
+ void setAlertState(bool enabled) override;
+ bool isAlertState() const override;
+
qreal scale() const;
qreal devicePixelRatio() const override;
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp
index e921ca461..8efc04086 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp
@@ -23,7 +23,8 @@ QWaylandXdgActivationV1::~QWaylandXdgActivationV1()
QWaylandXdgActivationTokenV1 *
QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display,
- struct ::wl_surface *surface, uint32_t serial,
+ struct ::wl_surface *surface,
+ std::optional<uint32_t> serial,
const QString &app_id)
{
auto wl = get_activation_token();
@@ -36,8 +37,8 @@ QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display,
if (!app_id.isEmpty())
provider->set_app_id(app_id);
- if (display->lastInputDevice())
- provider->set_serial(serial, display->lastInputDevice()->wl_seat());
+ if (serial && display->lastInputDevice())
+ provider->set_serial(*serial, display->lastInputDevice()->wl_seat());
provider->commit();
return provider;
}
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h
index d5d18459c..2f42d9258 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h
@@ -47,7 +47,8 @@ public:
QWaylandXdgActivationTokenV1 *requestXdgActivationToken(QWaylandDisplay *display,
struct ::wl_surface *surface,
- uint32_t serial, const QString &app_id);
+ std::optional<uint32_t> serial,
+ const QString &app_id);
};
QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index bd5e3fe50..fad8b5817 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -541,6 +541,29 @@ void QWaylandXdgSurface::setXdgActivationToken(const QString &token)
}
}
+void QWaylandXdgSurface::setAlertState(bool enabled)
+{
+ if (m_alertState == enabled)
+ return;
+
+ m_alertState = enabled;
+
+ if (!m_alertState)
+ return;
+
+ auto *activation = m_shell->activation();
+ if (!activation)
+ return;
+
+ const auto tokenProvider = activation->requestXdgActivationToken(
+ m_shell->m_display, m_window->wlSurface(), std::nullopt, m_appId);
+ connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this,
+ [this, tokenProvider](const QString &token) {
+ m_shell->activation()->activate(token, m_window->wlSurface());
+ tokenProvider->deleteLater();
+ });
+}
+
QString QWaylandXdgSurface::externWindowHandle()
{
if (!m_toplevel || !m_shell->exporter()) {
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
index d3cdb9d4e..dfd61105a 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
@@ -64,6 +64,8 @@ public:
bool requestActivate() override;
void setXdgActivationToken(const QString &token) override;
void requestXdgActivationToken(quint32 serial) override;
+ void setAlertState(bool enabled) override;
+ bool isAlertState() const override { return m_alertState; }
QString externWindowHandle() override;
void setSizeHints();
@@ -132,6 +134,7 @@ private:
uint m_appliedConfigureSerial = 0;
QString m_activationToken;
QString m_appId;
+ bool m_alertState = false;
friend class QWaylandXdgShell;
};