From 211f08446cf8c3713fd521b8157ee8bcb2658896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 22 Aug 2014 13:48:50 +0200 Subject: [PATCH] [kwin_wayland] Keep the size in Surface Technically the Surface itself does not have a size, it's the ShellSurface or the size of the FullScreenShell's Output. But it simplifies a lot if we keep track of the size in the Surface as that way we can hide the fact which kind of Shell is used. The user of the Surface must connect either the FullscreenShell's Output or the ShellSurface to set the size on the Surface. --- src/wayland/test_wayland_surface.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/wayland/test_wayland_surface.cpp b/src/wayland/test_wayland_surface.cpp index a2936feb3c..0c59895641 100644 --- a/src/wayland/test_wayland_surface.cpp +++ b/src/wayland/test_wayland_surface.cpp @@ -118,6 +118,15 @@ void TestWaylandSurface::testStaticAccessor() QCOMPARE(KWin::Wayland::Surface::all().first(), s1); QCOMPARE(KWin::Wayland::Surface::get(*s1), s1); + QVERIFY(!s1->size().isValid()); + QSignalSpy sizeChangedSpy(s1, SIGNAL(sizeChanged(QSize))); + QVERIFY(sizeChangedSpy.isValid()); + const QSize testSize(200, 300); + s1->setSize(testSize); + QCOMPARE(s1->size(), testSize); + QCOMPARE(sizeChangedSpy.count(), 1); + QCOMPARE(sizeChangedSpy.first().first().toSize(), testSize); + // add another surface KWin::Wayland::Surface *s2 = compositor.createSurface(); QCOMPARE(KWin::Wayland::Surface::all().count(), 2);