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
This commit is contained in:
parent
7b0676ebaf
commit
7d93b58578
2 changed files with 49 additions and 1 deletions
|
@ -35,6 +35,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
using namespace KWin;
|
using namespace KWin;
|
||||||
using namespace KWayland::Client;
|
using namespace KWayland::Client;
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(KWin::Layer)
|
||||||
|
|
||||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_plasma_surface-0");
|
static const QString s_socketName = QStringLiteral("wayland_test_kwin_plasma_surface-0");
|
||||||
|
|
||||||
class PlasmaSurfaceTest : public QObject
|
class PlasmaSurfaceTest : public QObject
|
||||||
|
@ -52,6 +54,8 @@ private Q_SLOTS:
|
||||||
|
|
||||||
void testDesktopIsOpaque();
|
void testDesktopIsOpaque();
|
||||||
void testOSDPlacement();
|
void testOSDPlacement();
|
||||||
|
void testPanelTypeHasStrut_data();
|
||||||
|
void testPanelTypeHasStrut();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConnectionThread *m_connection = nullptr;
|
ConnectionThread *m_connection = nullptr;
|
||||||
|
@ -235,5 +239,49 @@ void PlasmaSurfaceTest::testOSDPlacement()
|
||||||
QCOMPARE(c->geometry(), QRect(590, 649, 100, 50));
|
QCOMPARE(c->geometry(), QRect(590, 649, 100, 50));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlasmaSurfaceTest::testPanelTypeHasStrut_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||||
|
QTest::addColumn<PlasmaShellSurface::PanelBehavior>("panelBehavior");
|
||||||
|
QTest::addColumn<bool>("expectedStrut");
|
||||||
|
QTest::addColumn<QRect>("expectedMaxArea");
|
||||||
|
QTest::addColumn<KWin::Layer>("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> surface(Test::createSurface());
|
||||||
|
QVERIFY(!surface.isNull());
|
||||||
|
QFETCH(Test::ShellSurfaceType, type);
|
||||||
|
QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data()));
|
||||||
|
QVERIFY(!shellSurface.isNull());
|
||||||
|
QScopedPointer<PlasmaShellSurface> 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)
|
WAYLANDTEST_MAIN(PlasmaSurfaceTest)
|
||||||
#include "plasma_surface_test.moc"
|
#include "plasma_surface_test.moc"
|
||||||
|
|
|
@ -1062,7 +1062,7 @@ bool ShellClient::hasStrut() const
|
||||||
if (m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) {
|
if (m_plasmaShellSurface->role() != PlasmaShellSurfaceInterface::Role::Panel) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_plasmaShellSurface->panelBehavior() != PlasmaShellSurfaceInterface::PanelBehavior::WindowsGoBelow;
|
return m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellClient::updateIcon()
|
void ShellClient::updateIcon()
|
||||||
|
|
Loading…
Reference in a new issue