From c9984094dec243941a4c51fb10b087061d1ff660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 28 Jun 2016 13:25:15 +0200 Subject: [PATCH] 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 --- autotests/wayland/plasma_surface_test.cpp | 3 +++ shell_client.cpp | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/autotests/wayland/plasma_surface_test.cpp b/autotests/wayland/plasma_surface_test.cpp index e522692df8..d14fb425e3 100644 --- a/autotests/wayland/plasma_surface_test.cpp +++ b/autotests/wayland/plasma_surface_test.cpp @@ -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() diff --git a/shell_client.cpp b/shell_client.cpp index d211b7ea44..08176e877f 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -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();