diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 230a00998e..dd634ffde3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -83,6 +83,7 @@ target_sources(kwin PRIVATE options.cpp osd.cpp outline.cpp + outputlayer.cpp overlaywindow.cpp placement.cpp platform.cpp diff --git a/src/abstract_output.cpp b/src/abstract_output.cpp index 985edaed78..f74adfcf9f 100644 --- a/src/abstract_output.cpp +++ b/src/abstract_output.cpp @@ -8,6 +8,7 @@ */ #include "abstract_output.h" +#include "outputlayer.h" #include #include @@ -78,6 +79,7 @@ QDebug operator<<(QDebug debug, const AbstractOutput *output) AbstractOutput::AbstractOutput(QObject *parent) : QObject(parent) + , m_layer(new OutputLayer(this)) { } @@ -85,6 +87,11 @@ AbstractOutput::~AbstractOutput() { } +OutputLayer *AbstractOutput::layer() const +{ + return m_layer; +} + QUuid AbstractOutput::uuid() const { return QUuid(); diff --git a/src/abstract_output.h b/src/abstract_output.h index 07a6d979f4..c9e32e86b7 100644 --- a/src/abstract_output.h +++ b/src/abstract_output.h @@ -26,6 +26,7 @@ class OutputChangeSetV2; namespace KWin { class EffectScreenImpl; +class OutputLayer; class RenderLoop; class KWIN_EXPORT GammaRamp @@ -93,6 +94,11 @@ public: explicit AbstractOutput(QObject *parent = nullptr); ~AbstractOutput() override; + /** + * Returns the primary layer. TODO: remove it + */ + OutputLayer *layer() const; + /** * Returns a short identifiable name of this output. */ @@ -262,6 +268,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(AbstractOutput) EffectScreenImpl *m_effectScreen = nullptr; + OutputLayer *m_layer; int m_directScanoutCount = 0; friend class EffectScreenImpl; // to access m_effectScreen }; diff --git a/src/outputlayer.cpp b/src/outputlayer.cpp new file mode 100644 index 0000000000..4123c4fc79 --- /dev/null +++ b/src/outputlayer.cpp @@ -0,0 +1,32 @@ +/* + SPDX-FileCopyrightText: 2022 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "outputlayer.h" + +namespace KWin +{ + +OutputLayer::OutputLayer(QObject *parent) + : QObject(parent) +{ +} + +QRegion OutputLayer::repaints() const +{ + return m_repaints; +} + +void OutputLayer::addRepaint(const QRegion ®ion) +{ + m_repaints += region; +} + +void OutputLayer::resetRepaints() +{ + m_repaints = QRegion(); +} + +} // namespace KWin diff --git a/src/outputlayer.h b/src/outputlayer.h new file mode 100644 index 0000000000..8259f2e810 --- /dev/null +++ b/src/outputlayer.h @@ -0,0 +1,32 @@ +/* + SPDX-FileCopyrightText: 2022 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#pragma once + +#include "kwin_export.h" + +#include +#include + +namespace KWin +{ + +class KWIN_EXPORT OutputLayer : public QObject +{ + Q_OBJECT + +public: + explicit OutputLayer(QObject *parent = nullptr); + + QRegion repaints() const; + void resetRepaints(); + void addRepaint(const QRegion ®ion); + +private: + QRegion m_repaints; +}; + +} // namespace KWin