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

Set the restore geometry after placing a ShellClient for the first time

The restore geometry gets initially set to 0/0xsize before the placement
is done. When going into updateClientArea and then afterwards into
AbstractClient::checkWorkspacePosition the geometry restory is used for
calculating the new position. This results in windows getting moved to
0/0 when e.g. plugging in a new screen or a panel changes, etc.

This change ensures that the restore geometry is set correctly after the
first placement.

BUG: 366696

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision:
parent 997cf97c
......@@ -232,7 +232,6 @@ void PlasmaSurfaceTest::testOSDPlacement()
QEXPECT_FAIL("", "Geometry should not change due to a screen being added", Continue);
QCOMPARE(c->geometry(), QRect(590, 649, 100, 50));
......@@ -21,6 +21,7 @@ along with this program. If not, see <>.
#include "composite.h"
#include "cursor.h"
#include "deleted.h"
#include "placement.h"
#include "screens.h"
#include "wayland_server.h"
#include "workspace.h"
......@@ -478,7 +479,6 @@ void ShellClient::doSetGeometry(const QRect &rect)
if (m_unmapped && m_geomMaximizeRestore.isEmpty() && !geom.isEmpty()) {
// use first valid geometry as restore geometry
// TODO: needs to interact with placing. The first valid geometry should be the placed one
m_geomMaximizeRestore = geom;
......@@ -1223,4 +1223,10 @@ void ShellClient::finishCompositing(ReleaseReason releaseReason)
void ShellClient::placeIn(QRect &area)
Placement::self()->place(this, area);
......@@ -127,6 +127,9 @@ public:
bool setupCompositing() override;
void finishCompositing(ReleaseReason releaseReason = ReleaseReason::Release) override;
// TODO: const-ref
void placeIn(QRect &area);
void addDamage(const QRegion &damage) override;
bool belongsToSameApplication(const AbstractClient *other, bool active_hack) const override;
......@@ -381,7 +381,7 @@ void Workspace::init()
placementDone = true;
if (!placementDone) {
Placement::self()->place(c, area);
if (!unconstrained_stacking_order.contains(c))
......@@ -401,7 +401,7 @@ void Workspace::init()
// TODO: when else should we send the client through placement?
if (c->hasTransientPlacementHint()) {
QRect area = clientArea(PlacementArea, Screens::self()->current(), c->desktop());
Placement::self()->place(c, area);
x_stacking_dirty = true;
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