From 5a9df05460b383dcf03f39a6bcc152f1ef713fae Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 2 May 2019 10:11:40 +0200 Subject: [PATCH] Add CriticalNotification window type to PlasmaShellSurface protocol Differential Revision: https://phabricator.kde.org/D20628 --- src/wayland/autotests/client/test_plasmashell.cpp | 1 + src/wayland/plasmashell_interface.cpp | 5 ++++- src/wayland/plasmashell_interface.h | 3 ++- src/wayland/tests/plasmasurfacetest.cpp | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/wayland/autotests/client/test_plasmashell.cpp b/src/wayland/autotests/client/test_plasmashell.cpp index 38424f83ed..7c6082d04e 100644 --- a/src/wayland/autotests/client/test_plasmashell.cpp +++ b/src/wayland/autotests/client/test_plasmashell.cpp @@ -161,6 +161,7 @@ void TestPlasmaShell::testRole_data() QTest::newRow("panel") << PlasmaShellSurface::Role::Panel << PlasmaShellSurfaceInterface::Role::Panel; QTest::newRow("notification") << PlasmaShellSurface::Role::Notification << PlasmaShellSurfaceInterface::Role::Notification; QTest::newRow("tooltip") << PlasmaShellSurface::Role::ToolTip << PlasmaShellSurfaceInterface::Role::ToolTip; + QTest::newRow("criticalnotification") << PlasmaShellSurface::Role::CriticalNotification << PlasmaShellSurfaceInterface::Role::CriticalNotification; } void TestPlasmaShell::testRole() diff --git a/src/wayland/plasmashell_interface.cpp b/src/wayland/plasmashell_interface.cpp index 7540d1eb47..2a020bd327 100644 --- a/src/wayland/plasmashell_interface.cpp +++ b/src/wayland/plasmashell_interface.cpp @@ -50,7 +50,7 @@ private: static const quint32 s_version; }; -const quint32 PlasmaShellInterface::Private::s_version = 5; +const quint32 PlasmaShellInterface::Private::s_version = 6; PlasmaShellInterface::Private::Private(PlasmaShellInterface *q, Display *d) : Global::Private(d, &org_kde_plasma_shell_interface, s_version) @@ -252,6 +252,9 @@ void PlasmaShellSurfaceInterface::Private::setRole(uint32_t role) case ORG_KDE_PLASMA_SURFACE_ROLE_TOOLTIP: r = Role::ToolTip; break; + case ORG_KDE_PLASMA_SURFACE_ROLE_CRITICALNOTIFICATION: + r = Role::CriticalNotification; + break; case ORG_KDE_PLASMA_SURFACE_ROLE_NORMAL: default: r = Role::Normal; diff --git a/src/wayland/plasmashell_interface.h b/src/wayland/plasmashell_interface.h index 134178d66b..7e00611820 100644 --- a/src/wayland/plasmashell_interface.h +++ b/src/wayland/plasmashell_interface.h @@ -110,7 +110,8 @@ public: Panel, ///< The surface represents a panel (dock), normally stacked above normal surfaces OnScreenDisplay, ///< The surface represents an on screen display, like a volume changed notification Notification, ///< The surface represents a notification @since 5.24 - ToolTip ///< The surface represents a tooltip @since 5.24 + ToolTip, ///< The surface represents a tooltip @since 5.24 + CriticalNotification, ///< The surface represents a critical notification, like battery is running out @since 5.58 }; /** * @returns The requested role, default value is @c Role::Normal. diff --git a/src/wayland/tests/plasmasurfacetest.cpp b/src/wayland/tests/plasmasurfacetest.cpp index 17c74e5a78..e10ffba9b8 100644 --- a/src/wayland/tests/plasmasurfacetest.cpp +++ b/src/wayland/tests/plasmasurfacetest.cpp @@ -172,6 +172,8 @@ int main(int argc, char **argv) parser.addHelpOption(); QCommandLineOption notificationOption(QStringLiteral("notification")); parser.addOption(notificationOption); + QCommandLineOption criticalNotificationOption(QStringLiteral("criticalNotification")); + parser.addOption(criticalNotificationOption); QCommandLineOption panelOption(QStringLiteral("panel")); parser.addOption(panelOption); QCommandLineOption desktopOption(QStringLiteral("desktop")); @@ -191,6 +193,8 @@ int main(int argc, char **argv) if (parser.isSet(notificationOption)) { client.setRole(PlasmaShellSurface::Role::Notification); + } else if (parser.isSet(criticalNotificationOption)) { + client.setRole(PlasmaShellSurface::Role::CriticalNotification); } else if (parser.isSet(panelOption)) { client.setRole(PlasmaShellSurface::Role::Panel); } else if (parser.isSet(desktopOption)) {