From 99f491e79914da85213a899574ae36ad2e3c097c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 15 Sep 2016 13:59:25 +0200 Subject: [PATCH 1/3] parent qaction in test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: My compiler doesn't seem to like this constructor, it bails out with the following error: /home/sebas/kf5/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp: In member function ‘void GlobalShortcutsTest::testConsumedShift()’: /home/sebas/kf5/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp:79:40: error: no matching function for call to ‘QAction::QAction()’ QScopedPointer action(new QAction); ^~~~~~~ Using this as first argument fixes the build on my machine. Test Plan: screenedges test fails, others pass. (this screenedges test failure seems unrelated) Reviewers: graesslin Reviewed By: graesslin Subscribers: luebking, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D2782 --- autotests/integration/globalshortcuts_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp index 69dae8334e..ab46fbd520 100644 --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -76,7 +76,7 @@ void GlobalShortcutsTest::testConsumedShift() { // this test verifies that a shortcut with a consumed shift modifier triggers // create the action - QScopedPointer action(new QAction); + QScopedPointer action(new QAction(nullptr)); action->setProperty("componentName", QStringLiteral(KWIN_NAME)); action->setObjectName(QStringLiteral("globalshortcuts-test-consumed-shift")); QSignalSpy triggeredSpy(action.data(), &QAction::triggered); From 7b0676ebaf30f8eeb31bb82368071d9ca4df9439 Mon Sep 17 00:00:00 2001 From: "Tobias C. Berner" Date: Fri, 16 Sep 2016 10:04:43 +0200 Subject: [PATCH 2/3] Include in waylandclipboard.cpp Summary: `errno.h` needs to be includes, as `errno`, `EAGAIN` and `EWOULDBLOCK` are used. Without: > --- helpers/xclipboardsync/CMakeFiles/org_kde_kwin_xclipboard_syncer.dir/all --- > /wrkdirs/usr/ports/x11-wm/plasma5-kwin/work/kwin-5.7.95/helpers/xclipboardsync/waylandclipboard.cpp:110:25: error: use of undeclared identifier 'errno' > if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) { > ^ > /wrkdirs/usr/ports/x11-wm/plasma5-kwin/work/kwin-5.7.95/helpers/xclipboardsync/waylandclipboard.cpp:110:34: error: use of undeclared identifier 'EAGAIN' > if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) { > ^ > /wrkdirs/usr/ports/x11-wm/plasma5-kwin/work/kwin-5.7.95/helpers/xclipboardsync/waylandclipboard.cpp:110:44: error: use of undeclared identifier 'errno' > if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) { > ^ > /wrkdirs/usr/ports/x11-wm/plasma5-kwin/work/kwin-5.7.95/helpers/xclipboardsync/waylandclipboard.cpp:110:53: error: use of undeclared identifier 'EWOULDBLOCK' > if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) { > ^ > 4 errors generated. > *** [helpers/xclipboardsync/CMakeFiles/org_kde_kwin_xclipboard_syncer.dir/waylandclipboard.cpp.o] Error code 1 Reviewers: graesslin Reviewed By: graesslin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D2794 --- helpers/xclipboardsync/waylandclipboard.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/helpers/xclipboardsync/waylandclipboard.cpp b/helpers/xclipboardsync/waylandclipboard.cpp index 7702089087..2362304357 100644 --- a/helpers/xclipboardsync/waylandclipboard.cpp +++ b/helpers/xclipboardsync/waylandclipboard.cpp @@ -35,6 +35,7 @@ along with this program. If not, see . #include #include +#include #include using namespace KWayland::Client; From 7d93b585789f680e09f7d100a2b1ba1a2a182f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 15 Sep 2016 14:17:48 +0200 Subject: [PATCH 3/3] Fix whether a panel is supposed to have a strut in ShellClient Summary: The PanelBehavior was incorrectly mapped to hasStrut resulting in too many modes creating a strut for the panel. CCBUG: 368499 Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2788 --- autotests/integration/plasma_surface_test.cpp | 48 +++++++++++++++++++ shell_client.cpp | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp index 3ff802236d..07a3d10839 100644 --- a/autotests/integration/plasma_surface_test.cpp +++ b/autotests/integration/plasma_surface_test.cpp @@ -35,6 +35,8 @@ along with this program. If not, see . using namespace KWin; using namespace KWayland::Client; +Q_DECLARE_METATYPE(KWin::Layer) + static const QString s_socketName = QStringLiteral("wayland_test_kwin_plasma_surface-0"); class PlasmaSurfaceTest : public QObject @@ -52,6 +54,8 @@ private Q_SLOTS: void testDesktopIsOpaque(); void testOSDPlacement(); + void testPanelTypeHasStrut_data(); + void testPanelTypeHasStrut(); private: ConnectionThread *m_connection = nullptr; @@ -235,5 +239,49 @@ void PlasmaSurfaceTest::testOSDPlacement() QCOMPARE(c->geometry(), QRect(590, 649, 100, 50)); } +void PlasmaSurfaceTest::testPanelTypeHasStrut_data() +{ + QTest::addColumn("type"); + QTest::addColumn("panelBehavior"); + QTest::addColumn("expectedStrut"); + QTest::addColumn("expectedMaxArea"); + QTest::addColumn("expectedLayer"); + + QTest::newRow("always visible - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; + QTest::newRow("always visible - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; + QTest::newRow("autohide - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; + QTest::newRow("autohide - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; + QTest::newRow("windows can cover - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; + QTest::newRow("windows can cover - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; + QTest::newRow("windows go below - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; + QTest::newRow("windows go below - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; +} + +void PlasmaSurfaceTest::testPanelTypeHasStrut() +{ + QScopedPointer surface(Test::createSurface()); + QVERIFY(!surface.isNull()); + QFETCH(Test::ShellSurfaceType, type); + QScopedPointer shellSurface(Test::createShellSurface(type, surface.data())); + QVERIFY(!shellSurface.isNull()); + QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); + QVERIFY(!plasmaSurface.isNull()); + plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); + plasmaSurface->setPosition(QPoint(0, 0)); + QFETCH(PlasmaShellSurface::PanelBehavior, panelBehavior); + plasmaSurface->setPanelBehavior(panelBehavior); + + // now render and map the window + auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + + QVERIFY(c); + QCOMPARE(c->windowType(), NET::Dock); + QVERIFY(c->isDock()); + QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); + QTEST(c->hasStrut(), "expectedStrut"); + QTEST(workspace()->clientArea(MaximizeArea, 0, 0), "expectedMaxArea"); + QTEST(c->layer(), "expectedLayer"); +} + WAYLANDTEST_MAIN(PlasmaSurfaceTest) #include "plasma_surface_test.moc" diff --git a/shell_client.cpp b/shell_client.cpp index 3f8e6ec2b7..1b4fd849c6 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -1062,7 +1062,7 @@ bool ShellClient::hasStrut() const if (m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) { return false; } - return m_plasmaShellSurface->panelBehavior() != PlasmaShellSurfaceInterface::PanelBehavior::WindowsGoBelow; + return m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible; } void ShellClient::updateIcon()