[wayland] Add support for ServerSideDecorationManager
We announce support for it and depending on whether we have a plugin or not set the default mode to Server or None. When a decoration interface is created it gets installed on the ShellClient. But there it isn't properly used yet as we don't have support for decorations in ShellClient yet.
This commit is contained in:
parent
3de3a959c6
commit
5cef26d275
5 changed files with 60 additions and 0 deletions
|
@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "client.h"
|
||||
#include "composite.h"
|
||||
#include "scene.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
// KDecoration
|
||||
|
@ -33,6 +34,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KDecoration2/DecoratedClient>
|
||||
#include <KDecoration2/DecorationSettings>
|
||||
|
||||
// KWayland
|
||||
#include <KWayland/Server/server_decoration_interface.h>
|
||||
|
||||
// Frameworks
|
||||
#include <KPluginMetaData>
|
||||
#include <KPluginLoader>
|
||||
|
@ -82,8 +86,12 @@ QString DecorationBridge::readTheme() const
|
|||
|
||||
void DecorationBridge::init()
|
||||
{
|
||||
using namespace KWayland::Server;
|
||||
m_noPlugin = readNoPlugin();
|
||||
if (m_noPlugin) {
|
||||
if (waylandServer()) {
|
||||
waylandServer()->decorationManager()->setDefaultMode(ServerSideDecorationManagerInterface::Mode::None);
|
||||
}
|
||||
return;
|
||||
}
|
||||
m_plugin = readPlugin();
|
||||
|
@ -101,6 +109,9 @@ void DecorationBridge::init()
|
|||
initPlugin();
|
||||
}
|
||||
}
|
||||
if (waylandServer()) {
|
||||
waylandServer()->decorationManager()->setDefaultMode(m_factory ? ServerSideDecorationManagerInterface::Mode::Server : ServerSideDecorationManagerInterface::Mode::None);
|
||||
}
|
||||
}
|
||||
|
||||
void DecorationBridge::initPlugin()
|
||||
|
|
|
@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KWayland/Server/buffer_interface.h>
|
||||
#include <KWayland/Server/plasmashell_interface.h>
|
||||
#include <KWayland/Server/shadow_interface.h>
|
||||
#include <KWayland/Server/server_decoration_interface.h>
|
||||
#include <KWayland/Server/qtsurfaceextension_interface.h>
|
||||
#include <KWayland/Server/plasmawindowmanagement_interface.h>
|
||||
|
||||
|
@ -148,6 +149,10 @@ ShellClient::ShellClient(ShellSurfaceInterface *surface)
|
|||
updateCursor();
|
||||
}
|
||||
);
|
||||
// check whether we have a ServerSideDecoration
|
||||
if (ServerSideDecorationInterface *deco = ServerSideDecorationInterface::get(surface->surface())) {
|
||||
installServerSideDecoration(deco);
|
||||
}
|
||||
}
|
||||
|
||||
ShellClient::~ShellClient() = default;
|
||||
|
@ -847,4 +852,29 @@ QMatrix4x4 ShellClient::inputTransformation() const
|
|||
return m;
|
||||
}
|
||||
|
||||
void ShellClient::installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *deco)
|
||||
{
|
||||
if (m_serverDecoration == deco) {
|
||||
return;
|
||||
}
|
||||
m_serverDecoration = deco;
|
||||
connect(m_serverDecoration, &ServerSideDecorationInterface::destroyed, this,
|
||||
[this] {
|
||||
// TODO: update decoration
|
||||
m_serverDecoration = nullptr;
|
||||
}
|
||||
);
|
||||
// TODO: update decoration
|
||||
connect(m_serverDecoration, &ServerSideDecorationInterface::modeRequested, this,
|
||||
[this] (ServerSideDecorationManagerInterface::Mode mode) {
|
||||
const bool changed = mode != m_serverDecoration->mode();
|
||||
// always acknowledge the requested mode
|
||||
m_serverDecoration->setMode(mode);
|
||||
if (changed) {
|
||||
// TODO: update decoration
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace KWayland
|
|||
namespace Server
|
||||
{
|
||||
class ShellSurfaceInterface;
|
||||
class ServerSideDecorationInterface;
|
||||
class PlasmaShellSurfaceInterface;
|
||||
class QtExtendedSurfaceInterface;
|
||||
}
|
||||
|
@ -109,6 +110,7 @@ public:
|
|||
|
||||
void installPlasmaShellSurface(KWayland::Server::PlasmaShellSurfaceInterface *surface);
|
||||
void installQtExtendedSurface(KWayland::Server::QtExtendedSurfaceInterface *surface);
|
||||
void installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *decoration);
|
||||
|
||||
bool isInitialPositionSet() const;
|
||||
|
||||
|
@ -161,6 +163,7 @@ private:
|
|||
NET::WindowType m_windowType = NET::Normal;
|
||||
QPointer<KWayland::Server::PlasmaShellSurfaceInterface> m_plasmaShellSurface;
|
||||
QPointer<KWayland::Server::QtExtendedSurfaceInterface> m_qtExtendedSurface;
|
||||
KWayland::Server::ServerSideDecorationInterface *m_serverDecoration = nullptr;
|
||||
bool m_fullScreen = false;
|
||||
bool m_transient = false;
|
||||
};
|
||||
|
|
|
@ -42,6 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KWayland/Server/plasmawindowmanagement_interface.h>
|
||||
#include <KWayland/Server/qtsurfaceextension_interface.h>
|
||||
#include <KWayland/Server/seat_interface.h>
|
||||
#include <KWayland/Server/server_decoration_interface.h>
|
||||
#include <KWayland/Server/shadow_interface.h>
|
||||
#include <KWayland/Server/blur_interface.h>
|
||||
#include <KWayland/Server/shell_interface.h>
|
||||
|
@ -219,6 +220,16 @@ void WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
|
|||
shadowManager->create();
|
||||
|
||||
m_display->createDpmsManager(m_display)->create();
|
||||
|
||||
m_decorationManager = m_display->createServerSideDecorationManager(m_display);
|
||||
connect(m_decorationManager, &ServerSideDecorationManagerInterface::decorationCreated, this,
|
||||
[this] (ServerSideDecorationInterface *deco) {
|
||||
if (ShellClient *c = findClient(deco->surface())) {
|
||||
c->installServerSideDecoration(deco);
|
||||
}
|
||||
}
|
||||
);
|
||||
m_decorationManager->create();
|
||||
}
|
||||
|
||||
void WaylandServer::initWorkspace()
|
||||
|
|
|
@ -43,6 +43,7 @@ class CompositorInterface;
|
|||
class Display;
|
||||
class ShellInterface;
|
||||
class SeatInterface;
|
||||
class ServerSideDecorationManagerInterface;
|
||||
class SurfaceInterface;
|
||||
class OutputInterface;
|
||||
class PlasmaShellInterface;
|
||||
|
@ -89,6 +90,9 @@ public:
|
|||
KWayland::Server::PlasmaWindowManagementInterface *windowManagement() {
|
||||
return m_windowManagement;
|
||||
}
|
||||
KWayland::Server::ServerSideDecorationManagerInterface *decorationManager() const {
|
||||
return m_decorationManager;
|
||||
}
|
||||
QList<ShellClient*> clients() const {
|
||||
return m_clients;
|
||||
}
|
||||
|
@ -164,6 +168,7 @@ private:
|
|||
KWayland::Server::PlasmaShellInterface *m_plasmaShell = nullptr;
|
||||
KWayland::Server::PlasmaWindowManagementInterface *m_windowManagement = nullptr;
|
||||
KWayland::Server::QtSurfaceExtensionInterface *m_qtExtendedSurface = nullptr;
|
||||
KWayland::Server::ServerSideDecorationManagerInterface *m_decorationManager = nullptr;
|
||||
struct {
|
||||
KWayland::Server::ClientConnection *client = nullptr;
|
||||
QMetaObject::Connection destroyConnection;
|
||||
|
|
Loading…
Reference in a new issue