Paste P281

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Dec 10 2018, 6:24 PM.
diff --git a/shell_client.cpp b/shell_client.cpp
index b7291791d..042ff06cb 100644
--- a/shell_client.cpp
+++ b/shell_client.cpp
@@ -48,6 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KWayland/Server/plasmawindowmanagement_interface.h>
#include <KWayland/Server/appmenu_interface.h>
#include <KWayland/Server/server_decoration_palette_interface.h>
+#include <KWayland/Server/xdg_decoration_interface.h>
#include <KDesktopFile>
@@ -1806,6 +1807,12 @@ void ShellClient::installServerSideDecoration(KWayland::Server::ServerSideDecora
);
}
+void ShellClient::installXdgDecoration(XdgDecorationInterface *deco)
+{
+ deco->configure(XdgDecorationInterface::Mode::ServerSide);
+ updateDecoration(true);
+}
+
bool ShellClient::shouldExposeToWindowManagement()
{
if (isInternal()) {
diff --git a/shell_client.h b/shell_client.h
index 60754ac93..a345b3fd3 100644
--- a/shell_client.h
+++ b/shell_client.h
@@ -34,6 +34,7 @@ class ServerSideDecorationPaletteInterface;
class AppMenuInterface;
class PlasmaShellSurfaceInterface;
class QtExtendedSurfaceInterface;
+class XdgDecorationInterface;
}
}
@@ -142,6 +143,7 @@ public:
void installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *decoration);
void installAppMenu(KWayland::Server::AppMenuInterface *appmenu);
void installPalette(KWayland::Server::ServerSideDecorationPaletteInterface *palette);
+ void installXdgDecoration(KWayland::Server::XdgDecorationInterface *decoration);
bool isInitialPositionSet() const override;
diff --git a/wayland_server.cpp b/wayland_server.cpp
index bd4962480..d681bd384 100644
--- a/wayland_server.cpp
+++ b/wayland_server.cpp
@@ -57,6 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KWayland/Server/shell_interface.h>
#include <KWayland/Server/outputmanagement_interface.h>
#include <KWayland/Server/outputconfiguration_interface.h>
+#include <KWayland/Server/xdg_decoration_interface.h>
#include <KWayland/Server/xdgshell_interface.h>
#include <KWayland/Server/xdgforeign_interface.h>
#include <KWayland/Server/xdgoutput_interface.h>
@@ -235,6 +236,14 @@ bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
connect(m_xdgShell, &XdgShellInterface::surfaceCreated, this, &WaylandServer::createSurface<XdgShellSurfaceInterface>);
connect(m_xdgShell, &XdgShellInterface::xdgPopupCreated, this, &WaylandServer::createSurface<XdgShellPopupInterface>);
+ m_xdgDecorationManager = m_display->createXdgDecorationManager(m_xdgShell, m_display);
+ m_xdgDecorationManager->create();
+ connect(m_xdgDecorationManager, &XdgDecorationManagerInterface::xdgDecorationInterfaceCreated, this, [this] (XdgDecorationInterface *deco) {
+ if (ShellClient *client = findClient(deco->surface()->surface())) {
+ client->installXdgDecoration(deco);
+ }
+ });
+
m_display->createShm();
m_seat = m_display->createSeat(m_display);
m_seat->create();
diff --git a/wayland_server.h b/wayland_server.h
index bc0a58998..7b3081550 100644
--- a/wayland_server.h
+++ b/wayland_server.h
@@ -59,6 +59,7 @@ class PlasmaWindowManagementInterface;
class QtSurfaceExtensionInterface;
class OutputManagementInterface;
class OutputConfigurationInterface;
+class XdgDecorationManagerInterface;
class XdgShellInterface;
class XdgForeignInterface;
class XdgOutputManagerInterface;
@@ -240,6 +241,7 @@ private:
KWayland::Server::ServerSideDecorationPaletteManagerInterface *m_paletteManager = nullptr;
KWayland::Server::IdleInterface *m_idle = nullptr;
KWayland::Server::XdgOutputManagerInterface *m_xdgOutputManager = nullptr;
+ KWayland::Server::XdgDecorationManagerInterface *m_xdgDecorationManager = nullptr;
struct {
KWayland::Server::ClientConnection *client = nullptr;
QMetaObject::Connection destroyConnection;
davidedmundson edited the content of this paste. (Show Details)Dec 10 2018, 6:24 PM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.