Commit afe0a5c0 authored by Martin Flöser's avatar Martin Flöser

Fix placement of KSplash

Summary:
In a bug report there was a reference that on multi-screen KSplash is
not placed correctly. I investigated and noticed that it is an OSD which
sets an own position. In KWin the events were processed correctly but
the position was off.

The problem is that KWin has code to correct the position of an OSD when
it's size changes. This happens also on first damage and then the window
gets incorrectly placed when the position is set. So honor that the
position is set.

Test Plan: Restarted the session, ksplash positioned correctly now.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8268
parent 1e7b4fbc
......@@ -76,7 +76,7 @@ AbstractClient::AbstractClient()
connect(this, &AbstractClient::geometryShapeChanged, this,
[this] (Toplevel *c, const QRect &old) {
Q_UNUSED(c)
if (isOnScreenDisplay() && !geometry().isEmpty() && old.size() != geometry().size()) {
if (isOnScreenDisplay() && !geometry().isEmpty() && old.size() != geometry().size() && !isInitialPositionSet()) {
GeometryUpdatesBlocker blocker(this);
QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop());
Placement::self()->place(this, area);
......
......@@ -678,6 +678,10 @@ public:
bool unresponsive() const;
virtual bool isInitialPositionSet() const {
return false;
}
public Q_SLOTS:
virtual void closeWindow() = 0;
......
......@@ -57,6 +57,8 @@ private Q_SLOTS:
void testPanelWindowsCanCover_data();
void testPanelWindowsCanCover();
void testOSDPlacement();
void testOSDPlacementManualPosition_data();
void testOSDPlacementManualPosition();
void testPanelTypeHasStrut_data();
void testPanelTypeHasStrut();
void testPanelActivate_data();
......@@ -246,6 +248,40 @@ void PlasmaSurfaceTest::testOSDPlacement()
QCOMPARE(c->geometry(), QRect(540, 616, 200, 100));
}
void PlasmaSurfaceTest::testOSDPlacementManualPosition_data()
{
QTest::addColumn<Test::ShellSurfaceType>("type");
QTest::newRow("wl-shell") << Test::ShellSurfaceType::WlShell;
QTest::newRow("xdgv5") << Test::ShellSurfaceType::XdgShellV5;
QTest::newRow("xdgv6") << Test::ShellSurfaceType::XdgShellV6;
}
void PlasmaSurfaceTest::testOSDPlacementManualPosition()
{
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data()));
QVERIFY(!plasmaSurface.isNull());
plasmaSurface->setRole(PlasmaShellSurface::Role::OnScreenDisplay);
plasmaSurface->setPosition(QPoint(50, 70));
QFETCH(Test::ShellSurfaceType, type);
QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data()));
QVERIFY(!shellSurface.isNull());
// now render and map the window
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c);
QVERIFY(c->isInitialPositionSet());
QCOMPARE(c->windowType(), NET::OnScreenDisplay);
QVERIFY(c->isOnScreenDisplay());
QCOMPARE(c->geometry(), QRect(50, 70, 100, 50));
}
void PlasmaSurfaceTest::testPanelTypeHasStrut_data()
{
QTest::addColumn<Test::ShellSurfaceType>("type");
......
......@@ -137,7 +137,7 @@ public:
void installQtExtendedSurface(KWayland::Server::QtExtendedSurfaceInterface *surface);
void installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *decoration);
bool isInitialPositionSet() const;
bool isInitialPositionSet() const override;
bool isTransient() const override;
bool hasTransientPlacementHint() const override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment