From 5a73f4a3506d2ac5138721071f1dbdd173d7b4d5 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 27 Jul 2020 14:05:52 +0300 Subject: [PATCH] screencast: Move creation of the global to manager We want to turn screencasting into a plugin eventually. --- screencast/screencastmanager.cpp | 8 ++++++-- screencast/screencastmanager.h | 2 ++ wayland_server.cpp | 4 ---- wayland_server.h | 5 ----- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/screencast/screencastmanager.cpp b/screencast/screencastmanager.cpp index cd820ace85..d5dc42a995 100644 --- a/screencast/screencastmanager.cpp +++ b/screencast/screencastmanager.cpp @@ -27,6 +27,7 @@ #include "plugins/scenes/opengl/scene_opengl.h" #include "pipewirestream.h" +#include #include #include #include @@ -37,9 +38,12 @@ using namespace KWin; ScreencastManager::ScreencastManager(QObject *parent) : QObject(parent) + , m_screencast(waylandServer()->display()->createScreencastInterface(this)) { - connect(waylandServer()->screencast(), &KWaylandServer::ScreencastInterface::windowScreencastRequested, this, &ScreencastManager::streamWindow); - connect(waylandServer()->screencast(), &KWaylandServer::ScreencastInterface::outputScreencastRequested, this, &ScreencastManager::streamOutput); + connect(m_screencast, &KWaylandServer::ScreencastInterface::windowScreencastRequested, + this, &ScreencastManager::streamWindow); + connect(m_screencast, &KWaylandServer::ScreencastInterface::outputScreencastRequested, + this, &ScreencastManager::streamOutput); } class EGLFence : public QObject { diff --git a/screencast/screencastmanager.h b/screencast/screencastmanager.h index 084b06ab9e..35ddb0407f 100644 --- a/screencast/screencastmanager.h +++ b/screencast/screencastmanager.h @@ -45,5 +45,7 @@ public: private: void integrateStreams(KWaylandServer::ScreencastStreamInterface *waylandStream, PipeWireStream *pipewireStream); + + KWaylandServer::ScreencastInterface *m_screencast; }; diff --git a/wayland_server.cpp b/wayland_server.cpp index 887adb53ba..91cc6e6df9 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -458,10 +458,6 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags m_keyState = m_display->createKeyStateInterface(m_display); m_keyState->create(); -#ifdef PipeWire_FOUND - m_screencast = m_display->createScreencastInterface(m_display); -#endif - return true; } diff --git a/wayland_server.h b/wayland_server.h index 95cee5ff1b..f1bdbc3025 100644 --- a/wayland_server.h +++ b/wayland_server.h @@ -69,7 +69,6 @@ class LinuxDmabufUnstableV1Buffer; class TabletManagerInterface; class KeyboardShortcutsInhibitManagerV1Interface; class XdgDecorationManagerV1Interface; -class ScreencastInterface; } @@ -128,9 +127,6 @@ public: { return m_windowManagement; } - KWaylandServer::ScreencastInterface *screencast() { - return m_screencast; - } KWaylandServer::ServerSideDecorationManagerInterface *decorationManager() const { return m_decorationManager; } @@ -285,7 +281,6 @@ private: KWaylandServer::LinuxDmabufUnstableV1Interface *m_linuxDmabuf = nullptr; KWaylandServer::KeyboardShortcutsInhibitManagerV1Interface *m_keyboardShortcutsInhibitManager = nullptr; QSet m_linuxDmabufBuffers; - KWaylandServer::ScreencastInterface *m_screencast = nullptr; struct { KWaylandServer::ClientConnection *client = nullptr; QMetaObject::Connection destroyConnection;