Add CriticalNotification window type to PlasmaShellSurface protocol

Differential Revision: https://phabricator.kde.org/D20628
This commit is contained in:
Kai Uwe Broulik 2019-05-02 10:11:40 +02:00
parent 840268aa7e
commit 5a9df05460
4 changed files with 11 additions and 2 deletions

View file

@ -161,6 +161,7 @@ void TestPlasmaShell::testRole_data()
QTest::newRow("panel") << PlasmaShellSurface::Role::Panel << PlasmaShellSurfaceInterface::Role::Panel; QTest::newRow("panel") << PlasmaShellSurface::Role::Panel << PlasmaShellSurfaceInterface::Role::Panel;
QTest::newRow("notification") << PlasmaShellSurface::Role::Notification << PlasmaShellSurfaceInterface::Role::Notification; QTest::newRow("notification") << PlasmaShellSurface::Role::Notification << PlasmaShellSurfaceInterface::Role::Notification;
QTest::newRow("tooltip") << PlasmaShellSurface::Role::ToolTip << PlasmaShellSurfaceInterface::Role::ToolTip; QTest::newRow("tooltip") << PlasmaShellSurface::Role::ToolTip << PlasmaShellSurfaceInterface::Role::ToolTip;
QTest::newRow("criticalnotification") << PlasmaShellSurface::Role::CriticalNotification << PlasmaShellSurfaceInterface::Role::CriticalNotification;
} }
void TestPlasmaShell::testRole() void TestPlasmaShell::testRole()

View file

@ -50,7 +50,7 @@ private:
static const quint32 s_version; 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) PlasmaShellInterface::Private::Private(PlasmaShellInterface *q, Display *d)
: Global::Private(d, &org_kde_plasma_shell_interface, s_version) : 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: case ORG_KDE_PLASMA_SURFACE_ROLE_TOOLTIP:
r = Role::ToolTip; r = Role::ToolTip;
break; break;
case ORG_KDE_PLASMA_SURFACE_ROLE_CRITICALNOTIFICATION:
r = Role::CriticalNotification;
break;
case ORG_KDE_PLASMA_SURFACE_ROLE_NORMAL: case ORG_KDE_PLASMA_SURFACE_ROLE_NORMAL:
default: default:
r = Role::Normal; r = Role::Normal;

View file

@ -110,7 +110,8 @@ public:
Panel, ///< The surface represents a panel (dock), normally stacked above normal surfaces 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 OnScreenDisplay, ///< The surface represents an on screen display, like a volume changed notification
Notification, ///< The surface represents a notification @since 5.24 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. * @returns The requested role, default value is @c Role::Normal.

View file

@ -172,6 +172,8 @@ int main(int argc, char **argv)
parser.addHelpOption(); parser.addHelpOption();
QCommandLineOption notificationOption(QStringLiteral("notification")); QCommandLineOption notificationOption(QStringLiteral("notification"));
parser.addOption(notificationOption); parser.addOption(notificationOption);
QCommandLineOption criticalNotificationOption(QStringLiteral("criticalNotification"));
parser.addOption(criticalNotificationOption);
QCommandLineOption panelOption(QStringLiteral("panel")); QCommandLineOption panelOption(QStringLiteral("panel"));
parser.addOption(panelOption); parser.addOption(panelOption);
QCommandLineOption desktopOption(QStringLiteral("desktop")); QCommandLineOption desktopOption(QStringLiteral("desktop"));
@ -191,6 +193,8 @@ int main(int argc, char **argv)
if (parser.isSet(notificationOption)) { if (parser.isSet(notificationOption)) {
client.setRole(PlasmaShellSurface::Role::Notification); client.setRole(PlasmaShellSurface::Role::Notification);
} else if (parser.isSet(criticalNotificationOption)) {
client.setRole(PlasmaShellSurface::Role::CriticalNotification);
} else if (parser.isSet(panelOption)) { } else if (parser.isSet(panelOption)) {
client.setRole(PlasmaShellSurface::Role::Panel); client.setRole(PlasmaShellSurface::Role::Panel);
} else if (parser.isSet(desktopOption)) { } else if (parser.isSet(desktopOption)) {