diff --git a/tests/waylandclienttest.cpp b/tests/waylandclienttest.cpp index 28d9d61f11..7d5f0fb53f 100644 --- a/tests/waylandclienttest.cpp +++ b/tests/waylandclienttest.cpp @@ -61,6 +61,7 @@ WaylandClientTest::WaylandClientTest(QObject *parent) , m_output(nullptr) , m_surface(nullptr) , m_shm(nullptr) + , m_shellSurface(nullptr) , m_timer(new QTimer(this)) { init(); @@ -112,9 +113,9 @@ void WaylandClientTest::setupRegistry(Registry *registry) connect(registry, &Registry::shellAnnounced, this, [this, registry](quint32 name) { Shell *shell = registry->createShell(name, 1, this); - ShellSurface *shellSurface = shell->createSurface(m_surface, m_surface); - shellSurface->setFullscreen(m_output); - connect(shellSurface, &ShellSurface::sizeChanged, this, static_cast(&WaylandClientTest::render)); + m_shellSurface = shell->createSurface(m_surface, m_surface); + connect(m_shellSurface, &ShellSurface::sizeChanged, this, static_cast(&WaylandClientTest::render)); + render(QSize(200, 200)); } ); connect(registry, &Registry::outputAnnounced, this, @@ -169,6 +170,17 @@ void WaylandClientTest::setupRegistry(Registry *registry) if (button == BTN_RIGHT) { QCoreApplication::instance()->quit(); } + if (button == BTN_MIDDLE) { + if (m_shellSurface) { + static bool s_maximized = false; + s_maximized = !s_maximized; + if (s_maximized) { + m_shellSurface->setMaximized(); + } else { + m_shellSurface->setToplevel(); + } + } + } } } ); diff --git a/tests/waylandclienttest.h b/tests/waylandclienttest.h index b1ae7d8575..a3455b13f1 100644 --- a/tests/waylandclienttest.h +++ b/tests/waylandclienttest.h @@ -32,6 +32,7 @@ class ConnectionThread; class EventQueue; class Output; class Registry; +class ShellSurface; class ShmPool; class Surface; } @@ -60,6 +61,7 @@ private: KWayland::Client::Output *m_output; KWayland::Client::Surface *m_surface; KWayland::Client::ShmPool *m_shm; + KWayland::Client::ShellSurface *m_shellSurface; QSize m_currentSize; QTimer *m_timer; };