Add a ToolTip role to PlasmaShellSurface

Summary:
As Wayland doesn't have a proper ToolTip window type yet, we add it
to PlasmaShellSurface, so that we can use it for Plasma's tooltips.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D2030
This commit is contained in:
Martin Gräßlin 2016-06-28 12:59:57 +02:00
parent 89a4c2f0e1
commit 5ae8ac4327
4 changed files with 10 additions and 1 deletions

View file

@ -157,6 +157,7 @@ void TestPlasmaShell::testRole_data()
QTest::newRow("osd") << PlasmaShellSurface::Role::OnScreenDisplay << PlasmaShellSurfaceInterface::Role::OnScreenDisplay; QTest::newRow("osd") << PlasmaShellSurface::Role::OnScreenDisplay << PlasmaShellSurfaceInterface::Role::OnScreenDisplay;
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;
} }
void TestPlasmaShell::testRole() void TestPlasmaShell::testRole()

View file

@ -239,6 +239,9 @@ void PlasmaShellSurfaceInterface::Private::setRole(uint32_t role)
case ORG_KDE_PLASMA_SURFACE_ROLE_NOTIFICATION: case ORG_KDE_PLASMA_SURFACE_ROLE_NOTIFICATION:
r = Role::Notification; r = Role::Notification;
break; break;
case ORG_KDE_PLASMA_SURFACE_ROLE_TOOLTIP:
r = Role::ToolTip;
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

@ -109,7 +109,8 @@ public:
Desktop, ///< The surface represents a desktop, normally stacked below all other surfaces Desktop, ///< The surface represents a desktop, normally stacked below all other surfaces
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
}; };
/** /**
* @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.addOption(desktopOption); parser.addOption(desktopOption);
QCommandLineOption osdOption(QStringLiteral("osd")); QCommandLineOption osdOption(QStringLiteral("osd"));
parser.addOption(osdOption); parser.addOption(osdOption);
QCommandLineOption tooltipOption(QStringLiteral("tooltip"));
parser.addOption(tooltipOption);
QCommandLineOption skipTaskbarOption(QStringLiteral("skipTaskbar")); QCommandLineOption skipTaskbarOption(QStringLiteral("skipTaskbar"));
parser.addOption(skipTaskbarOption); parser.addOption(skipTaskbarOption);
parser.process(app); parser.process(app);
@ -186,6 +188,8 @@ int main(int argc, char **argv)
client.setRole(PlasmaShellSurface::Role::Desktop); client.setRole(PlasmaShellSurface::Role::Desktop);
} else if (parser.isSet(osdOption)) { } else if (parser.isSet(osdOption)) {
client.setRole(PlasmaShellSurface::Role::OnScreenDisplay); client.setRole(PlasmaShellSurface::Role::OnScreenDisplay);
} else if (parser.isSet(tooltipOption)) {
client.setRole(PlasmaShellSurface::Role::ToolTip);
} }
client.setSkipTaskbar(parser.isSet(skipTaskbarOption)); client.setSkipTaskbar(parser.isSet(skipTaskbarOption));