Add support for ToolTip Role on PlasmaSurface

Summary:
It's mapped to be on all desktops in order to properly have tooltips
show for the panel (which is on all desktops) instead of just on the
desktop it's created.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2032
icc-effect-5.14.5
Martin Gräßlin 2016-06-28 13:25:15 +02:00
parent 3493e97655
commit c9984094de
2 changed files with 8 additions and 1 deletions

View File

@ -148,6 +148,7 @@ void PlasmaSurfaceTest::testRoleOnAllDesktops_data()
QTest::newRow("OSD") << PlasmaShellSurface::Role::OnScreenDisplay << true;
QTest::newRow("Normal") << PlasmaShellSurface::Role::Normal << false;
QTest::newRow("Notification") << PlasmaShellSurface::Role::Notification << true;
QTest::newRow("ToolTip") << PlasmaShellSurface::Role::ToolTip << true;
}
void PlasmaSurfaceTest::testRoleOnAllDesktops()
@ -206,6 +207,7 @@ void PlasmaSurfaceTest::testRoleOnAllDesktops()
QEXPECT_FAIL("Panel", "PS before WS not supported", Continue);
QEXPECT_FAIL("OSD", "PS before WS not supported", Continue);
QEXPECT_FAIL("Notification", "PS before WS not supported", Continue);
QEXPECT_FAIL("ToolTip", "PS before WS not supported", Continue);
QCOMPARE(c->isOnAllDesktops(), expectedOnAllDesktops);
}
@ -220,6 +222,7 @@ void PlasmaSurfaceTest::testAcceptsFocus_data()
QTest::newRow("OSD") << PlasmaShellSurface::Role::OnScreenDisplay << false << false;
QTest::newRow("Normal") << PlasmaShellSurface::Role::Normal << true << true;
QTest::newRow("Notification") << PlasmaShellSurface::Role::Notification << false << false;
QTest::newRow("ToolTip") << PlasmaShellSurface::Role::ToolTip << false << false;
}
void PlasmaSurfaceTest::testAcceptsFocus()

View File

@ -735,6 +735,7 @@ bool ShellClient::acceptsFocus() const
}
if (m_plasmaShellSurface) {
if (m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::OnScreenDisplay ||
m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::ToolTip ||
m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Notification) {
return false;
}
@ -897,6 +898,9 @@ void ShellClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *surface
case PlasmaShellSurfaceInterface::Role::Notification:
type = NET::Notification;
break;
case PlasmaShellSurfaceInterface::Role::ToolTip:
type = NET::Tooltip;
break;
case PlasmaShellSurfaceInterface::Role::Normal:
default:
type = NET::Normal;
@ -904,7 +908,7 @@ void ShellClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *surface
}
if (type != m_windowType) {
m_windowType = type;
if (m_windowType == NET::Desktop || type == NET::Dock || type == NET::OnScreenDisplay || type == NET::Notification) {
if (m_windowType == NET::Desktop || type == NET::Dock || type == NET::OnScreenDisplay || type == NET::Notification || type == NET::Tooltip) {
setOnAllDesktops(true);
}
workspace()->updateClientArea();