Commit f696b578 authored by Martin Flöser's avatar Martin Flöser

[wayland] Add support for QtSurfaceExtension for closing ShellClients

If the ShellClient has a QtExtendedSurface it's closeable.
parent 6bdf120b
......@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KWayland/Server/surface_interface.h>
#include <KWayland/Server/buffer_interface.h>
#include <KWayland/Server/plasmashell_interface.h>
#include <KWayland/Server/qtsurfaceextension_interface.h>
#include <QWindow>
......@@ -238,6 +239,9 @@ void ShellClient::checkWorkspacePosition(QRect oldGeometry, int oldDesktop)
void ShellClient::closeWindow()
{
if (m_qtExtendedSurface) {
m_qtExtendedSurface->close();
}
}
AbstractClient *ShellClient::findModal(bool allow_itself)
......@@ -248,7 +252,7 @@ AbstractClient *ShellClient::findModal(bool allow_itself)
bool ShellClient::isCloseable() const
{
return false;
return m_qtExtendedSurface ? true : false;
}
bool ShellClient::isFullScreenable() const
......@@ -571,4 +575,9 @@ bool ShellClient::isInitialPositionSet() const
return false;
}
void ShellClient::installQtExtendedSurface(QtExtendedSurfaceInterface *surface)
{
m_qtExtendedSurface = surface;
}
}
......@@ -28,6 +28,7 @@ namespace Server
{
class ShellSurfaceInterface;
class PlasmaShellSurfaceInterface;
class QtExtendedSurfaceInterface;
}
}
......@@ -103,6 +104,7 @@ public:
}
void installPlasmaShellSurface(KWayland::Server::PlasmaShellSurfaceInterface *surface);
void installQtExtendedSurface(KWayland::Server::QtExtendedSurfaceInterface *surface);
bool isInitialPositionSet() const;
......@@ -136,6 +138,7 @@ private:
QRect m_geomMaximizeRestore; // size and position of the window before it was set to maximize
NET::WindowType m_windowType = NET::Normal;
QPointer<KWayland::Server::PlasmaShellSurfaceInterface> m_plasmaShellSurface;
QPointer<KWayland::Server::QtExtendedSurfaceInterface> m_qtExtendedSurface;
};
}
......
......@@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KWayland/Server/display.h>
#include <KWayland/Server/output_interface.h>
#include <KWayland/Server/plasmashell_interface.h>
#include <KWayland/Server/qtsurfaceextension_interface.h>
#include <KWayland/Server/seat_interface.h>
#include <KWayland/Server/shell_interface.h>
......@@ -146,6 +147,15 @@ void WaylandServer::init(const QByteArray &socketName)
}
}
);
m_qtExtendedSurface = m_display->createQtSurfaceExtension(m_display);
m_qtExtendedSurface->create();
connect(m_qtExtendedSurface, &QtSurfaceExtensionInterface::surfaceCreated,
[this] (QtExtendedSurfaceInterface *surface) {
if (ShellClient *client = findClient(surface->surface())) {
client->installQtExtendedSurface(surface);
}
}
);
}
void WaylandServer::initOutputs()
......
......@@ -44,6 +44,7 @@ class SeatInterface;
class SurfaceInterface;
class OutputInterface;
class PlasmaShellInterface;
class QtSurfaceExtensionInterface;
}
}
......@@ -131,6 +132,7 @@ private:
KWayland::Server::SeatInterface *m_seat = nullptr;
KWayland::Server::ShellInterface *m_shell = nullptr;
KWayland::Server::PlasmaShellInterface *m_plasmaShell = nullptr;
KWayland::Server::QtSurfaceExtensionInterface *m_qtExtendedSurface = nullptr;
KWayland::Server::ClientConnection *m_xwaylandConnection = nullptr;
KWayland::Server::ClientConnection *m_qtConnection = nullptr;
KWayland::Client::ConnectionThread *m_qtClientConnection = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment