diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a3dc1bf21..0b7da29723 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -150,7 +150,6 @@ target_sources(kwin PRIVATE virtualkeyboard_dbus.cpp was_user_interaction_x11_filter.cpp wayland_server.cpp - waylandoutput.cpp waylandshellintegration.cpp waylandwindow.cpp window.cpp diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index c1cb89792d..e741b0887f 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -64,7 +64,6 @@ #include "wayland/xdgoutput_v1_interface.h" #include "wayland/xdgshell_interface.h" #include "wayland/xwaylandkeyboardgrab_v1_interface.h" -#include "waylandoutput.h" #include "workspace.h" #include "x11window.h" #include "xdgactivationv1.h" @@ -297,14 +296,17 @@ void WaylandServer::handleOutputRemoved(Output *output) void WaylandServer::handleOutputEnabled(Output *output) { if (!output->isPlaceholder() && !output->isNonDesktop()) { - m_waylandOutputs.insert(output, new WaylandOutput(output)); + auto waylandOutput = new KWaylandServer::OutputInterface(waylandServer()->display(), output); + m_xdgOutputManagerV1->createXdgOutput(waylandOutput, waylandOutput); + + m_waylandOutputs.insert(output, waylandOutput); } } void WaylandServer::handleOutputDisabled(Output *output) { - if (!output->isPlaceholder() && !output->isNonDesktop()) { - delete m_waylandOutputs.take(output); + if (auto waylandOutput = m_waylandOutputs.take(output)) { + waylandOutput->remove(); } } diff --git a/src/wayland_server.h b/src/wayland_server.h index 6d007e575b..6bd3957e64 100644 --- a/src/wayland_server.h +++ b/src/wayland_server.h @@ -61,7 +61,6 @@ class XdgActivationV1Integration; class XdgPopupWindow; class XdgSurfaceWindow; class XdgToplevelWindow; -class WaylandOutput; class KWIN_EXPORT WaylandServer : public QObject { @@ -292,7 +291,7 @@ private: KWaylandServer::ContentTypeManagerV1Interface *m_contentTypeManager = nullptr; QList m_windows; InitializationFlags m_initFlags; - QHash m_waylandOutputs; + QHash m_waylandOutputs; QHash m_waylandOutputDevices; KWIN_SINGLETON(WaylandServer) }; diff --git a/src/waylandoutput.cpp b/src/waylandoutput.cpp deleted file mode 100644 index 74e0bf537a..0000000000 --- a/src/waylandoutput.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - SPDX-FileCopyrightText: 2021 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#include "waylandoutput.h" -#include "wayland_server.h" - -#include - -namespace KWin -{ - -WaylandOutput::WaylandOutput(Output *output, QObject *parent) - : QObject(parent) - , m_platformOutput(output) - , m_waylandOutput(new KWaylandServer::OutputInterface(waylandServer()->display(), output)) - , m_xdgOutputV1(waylandServer()->xdgOutputManagerV1()->createXdgOutput(m_waylandOutput.get(), m_waylandOutput.get())) -{ -} - -} // namespace KWin diff --git a/src/waylandoutput.h b/src/waylandoutput.h deleted file mode 100644 index e4edae313f..0000000000 --- a/src/waylandoutput.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - SPDX-FileCopyrightText: 2021 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#pragma once - -#include "core/output.h" -#include "wayland/output_interface.h" -#include "wayland/utils.h" -#include "wayland/xdgoutput_v1_interface.h" - -namespace KWin -{ - -class WaylandOutput : public QObject -{ - Q_OBJECT - -public: - explicit WaylandOutput(Output *output, QObject *parent = nullptr); - -private: - Output *m_platformOutput; - KWaylandServer::ScopedGlobalPointer m_waylandOutput; - KWaylandServer::XdgOutputV1Interface *m_xdgOutputV1; -}; - -} // namespace KWin