[plasma/kwin] /: Revert "wayland: Make window geometry handling spec compliant"
Vlad Zahorodnii <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit b392271a180850774a5c881ef446affa834cc423 by Vlad Zahorodnii.
Committed on 04/08/2026 at 10:19.
Pushed by vladz into branch 'master'.
Revert "wayland: Make window geometry handling spec compliant"
This reverts 6f25aac2720cd933fe76646cbc3c2efe54f6d015.
While GTK and Qt adhere to the spec, there are also applications that
don't, for example chromium-based apps.
It'll be nice to adhere to the spec, but breaking the placement of some
(pretty important) apps is not worth it.
M +7 -3 autotests/integration/xdgshellwindow_test.cpp
M +12 -13 src/wayland/xdgshell.cpp
M +1 -1 src/wayland/xdgshell_p.h
https://invent.kde.org/plasma/kwin/-/commit/b392271a180850774a5c881ef446affa834cc423
diff --git a/autotests/integration/xdgshellwindow_test.cpp b/autotests/integration/xdgshellwindow_test.cpp
index d97c51e9503..2af28961f18 100644
--- a/autotests/integration/xdgshellwindow_test.cpp
+++ b/autotests/integration/xdgshellwindow_test.cpp
@@ -1227,13 +1227,17 @@ void TestXdgShellWindow::testXdgWindowGeometryAttachBuffer()
QCOMPARE(window->bufferGeometry().size(), QSize(200, 100));
Test::render(surface.get(), QSize(100, 50), Qt::blue);
- QVERIFY(Test::waylandSync());
- QCOMPARE(frameGeometryChangedSpy.count(), 1);
+ QVERIFY(frameGeometryChangedSpy.wait());
+ QCOMPARE(frameGeometryChangedSpy.count(), 2);
+ QCOMPARE(window->frameGeometry().topLeft(), oldPosition);
+ QCOMPARE(window->frameGeometry().size(), QSize(90, 40));
+ QCOMPARE(window->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10));
+ QCOMPARE(window->bufferGeometry().size(), QSize(100, 50));
shellSurface->xdgSurface()->set_window_geometry(0, 0, 100, 50);
surface->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(frameGeometryChangedSpy.wait());
- QCOMPARE(frameGeometryChangedSpy.count(), 2);
+ QCOMPARE(frameGeometryChangedSpy.count(), 3);
QCOMPARE(window->frameGeometry().topLeft(), oldPosition);
QCOMPARE(window->frameGeometry().size(), QSize(100, 50));
QCOMPARE(window->bufferGeometry().topLeft(), oldPosition);
diff --git a/src/wayland/xdgshell.cpp b/src/wayland/xdgshell.cpp
index 21785a63616..3aea39bb74e 100644
--- a/src/wayland/xdgshell.cpp
+++ b/src/wayland/xdgshell.cpp
@@ -158,25 +158,24 @@ void XdgSurfaceInterfacePrivate::apply(XdgSurfaceCommit *commit)
}
if (commit->windowGeometry.has_value()) {
- explicitWindowGeometry = true;
- const RectF geometry = commit->windowGeometry.value() & surface->boundingRect();
- if (effectiveWindowGeometry != geometry) {
- effectiveWindowGeometry = geometry;
- Q_EMIT q->windowGeometryChanged();
- }
- } else if (!explicitWindowGeometry) {
- const RectF geometry = surface->boundingRect();
- if (effectiveWindowGeometry != geometry) {
- effectiveWindowGeometry = geometry;
- Q_EMIT q->windowGeometryChanged();
- }
+ explicitWindowGeometry = commit->windowGeometry;
+ }
+
+ RectF geometry = surface->boundingRect();
+ if (explicitWindowGeometry) {
+ geometry &= *explicitWindowGeometry;
+ }
+
+ if (effectiveWindowGeometry != geometry) {
+ effectiveWindowGeometry = geometry;
+ Q_EMIT q->windowGeometryChanged();
}
}
void XdgSurfaceInterfacePrivate::reset()
{
effectiveWindowGeometry = RectF();
- explicitWindowGeometry = false;
+ explicitWindowGeometry = std::nullopt;
firstBufferAttached = false;
isConfigured = false;
isInitialized = false;
diff --git a/src/wayland/xdgshell_p.h b/src/wayland/xdgshell_p.h
index a1e5877134c..0fdd5041cdd 100644
--- a/src/wayland/xdgshell_p.h
+++ b/src/wayland/xdgshell_p.h
@@ -123,7 +123,7 @@ public:
QPointer<XXPipV1Interface> pip;
QPointer<SurfaceInterface> surface;
RectF effectiveWindowGeometry;
- bool explicitWindowGeometry = false;
+ std::optional<RectF> explicitWindowGeometry;
bool firstBufferAttached = false;
bool isConfigured = false;
bool isInitialized = false;