[tests] WaylandClientTest can maximize/restore on middle click
parent
7cded49145
commit
199cd70416
|
@ -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<void(WaylandClientTest::*)(const QSize&)>(&WaylandClientTest::render));
|
||||
m_shellSurface = shell->createSurface(m_surface, m_surface);
|
||||
connect(m_shellSurface, &ShellSurface::sizeChanged, this, static_cast<void(WaylandClientTest::*)(const QSize&)>(&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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue