diff options
| author | David Edmundson <davidedmundson@kde.org> | 2025-06-03 12:52:20 +0300 |
|---|---|---|
| committer | David Edmundson <davidedmundson@kde.org> | 2025-06-27 14:49:22 +0100 |
| commit | 0094c73c3ce255f9c0b51f491caee518aef078df (patch) | |
| tree | 5a8e50b670dbf763afbef57166957dd8d4ee942f /src/widgets/kernel/qwidget.cpp | |
| parent | a5722944bea247159f1d105c0bf767b9bf19cf21 (diff) | |
wayland: Add xx-session-management-v1 support
This is powered by the xx-session-manager which is tagged as
experiemntal. This is guarded by an env variable.
Application level session IDs are exposed via QSessionManager.
The public API for windows is exposed via the existing QSessionManager
and QWidget::setWindowRole.
As it's not widely supported the documentation in QWidget is left
untouched for now.
[ChangeLog][Third-Party Code] New protocol synced from wayland-protocols
Change-Id: Ibfbef86c6e75f8b95433cbba69ca10a5abea9e21
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
| -rw-r--r-- | src/widgets/kernel/qwidget.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 1155172a0a8..22ca1d238fe 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1360,6 +1360,12 @@ void QWidgetPrivate::create() xcbWindow->setWindowRole(topData()->role); } #endif +#if QT_CONFIG(wayland) + if (!topData()->role.isNull()) { + if (auto *waylandWindow = dynamic_cast<QWaylandWindow*>(win->handle())) + waylandWindow->setSessionRestoreId(topData()->role); + } +#endif QBackingStore *store = q->backingStore(); usesRhiFlush = false; @@ -6359,17 +6365,24 @@ QString QWidget::windowRole() const */ void QWidget::setWindowRole(const QString &role) { -#if QT_CONFIG(xcb) +#if QT_CONFIG(xcb) || QT_CONFIG(wayland) Q_D(QWidget); d->createTLExtra(); d->topData()->role = role; +#else + Q_UNUSED(role); +#endif + if (windowHandle()) { +#if QT_CONFIG(xcb) if (auto *xcbWindow = dynamic_cast<QXcbWindow*>(windowHandle()->handle())) xcbWindow->setWindowRole(role); - } -#else - Q_UNUSED(role); #endif +#if QT_CONFIG(wayland) + if (auto *waylandWindow = dynamic_cast<QWaylandWindow*>(windowHandle()->handle())) + waylandWindow->setSessionRestoreId(role); +#endif + } } /*! |
