[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.
This commit is contained in:
Martin Gräßlin 2014-08-22 13:48:50 +02:00
parent b892ae3973
commit 211f08446c

View file

@ -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);