backends/virtual: Drop KWIN_WAYLAND_VIRTUAL_SCREENSHOTS

Virtual backend is used primarily by tests, there are plans to use it
for virtual outputs too. But in either case we don't need screenshots.

I also can't imagine how it can be useful as a debugging tool. It's more
convenient to spin a windowed kwin instance.

The main motivation behind this change is to get rid of custom code in
virtual output layers and simplify it a bit more.
This commit is contained in:
Vlad Zahorodnii 2023-01-10 14:46:22 +02:00
parent ae1ca8ec9d
commit ff53950a6d
6 changed files with 0 additions and 42 deletions

View file

@ -11,8 +11,6 @@
#include "virtual_egl_backend.h"
#include "virtual_output.h"
#include "virtual_qpainter_backend.h"
// Qt
#include <QTemporaryDir>
namespace KWin
{
@ -20,15 +18,6 @@ namespace KWin
VirtualBackend::VirtualBackend(QObject *parent)
: OutputBackend(parent)
{
if (qEnvironmentVariableIsSet("KWIN_WAYLAND_VIRTUAL_SCREENSHOTS")) {
m_screenshotDir.reset(new QTemporaryDir);
if (!m_screenshotDir->isValid()) {
m_screenshotDir.reset();
}
if (m_screenshotDir) {
qDebug() << "Screenshots saved to: " << m_screenshotDir->path();
}
}
}
VirtualBackend::~VirtualBackend()
@ -43,14 +32,6 @@ bool VirtualBackend::initialize()
return true;
}
QString VirtualBackend::screenshotDirPath() const
{
if (!m_screenshotDir) {
return QString();
}
return m_screenshotDir->path();
}
std::unique_ptr<QPainterBackend> VirtualBackend::createQPainterBackend()
{
return std::make_unique<VirtualQPainterBackend>(this);

View file

@ -15,8 +15,6 @@
#include <QObject>
#include <QRect>
class QTemporaryDir;
namespace KWin
{
class VirtualBackend;
@ -32,12 +30,6 @@ public:
bool initialize() override;
bool saveFrames() const
{
return m_screenshotDir != nullptr;
}
QString screenshotDirPath() const;
std::unique_ptr<QPainterBackend> createQPainterBackend() override;
std::unique_ptr<OpenGLBackend> createOpenGLBackend() override;
@ -59,7 +51,6 @@ private:
VirtualOutput *createOutput(const QPoint &position, const QSize &size, qreal scale);
QVector<VirtualOutput *> m_outputs;
std::unique_ptr<QTemporaryDir> m_screenshotDir;
};
} // namespace KWin

View file

@ -201,11 +201,6 @@ void VirtualEglBackend::present(Output *output)
glFlush();
static_cast<VirtualOutput *>(output)->vsyncMonitor()->arm();
if (m_backend->saveFrames()) {
const std::unique_ptr<VirtualEglLayer> &layer = m_outputs[output];
layer->texture()->toImage().save(QStringLiteral("%1/%2-%3.png").arg(m_backend->screenshotDirPath(), output->name(), QString::number(m_frameCounter++)));
}
}
} // namespace

View file

@ -61,7 +61,6 @@ private:
void removeOutput(Output *output);
VirtualBackend *m_backend;
int m_frameCounter = 0;
std::map<Output *, std::unique_ptr<VirtualEglLayer>> m_outputs;
};

View file

@ -42,8 +42,6 @@ QImage *VirtualQPainterLayer::image()
}
VirtualQPainterBackend::VirtualQPainterBackend(VirtualBackend *backend)
: QPainterBackend()
, m_backend(backend)
{
connect(backend, &VirtualBackend::outputAdded, this, &VirtualQPainterBackend::addOutput);
connect(backend, &VirtualBackend::outputRemoved, this, &VirtualQPainterBackend::removeOutput);
@ -69,10 +67,6 @@ void VirtualQPainterBackend::removeOutput(Output *output)
void VirtualQPainterBackend::present(Output *output)
{
static_cast<VirtualOutput *>(output)->vsyncMonitor()->arm();
if (m_backend->saveFrames()) {
m_outputs[output]->image()->save(QStringLiteral("%1/%2-%3.png").arg(m_backend->screenshotDirPath(), output->name(), QString::number(m_frameCounter++)));
}
}
VirtualQPainterLayer *VirtualQPainterBackend::primaryLayer(Output *output)

View file

@ -50,8 +50,6 @@ private:
void removeOutput(Output *output);
std::map<Output *, std::unique_ptr<VirtualQPainterLayer>> m_outputs;
VirtualBackend *m_backend;
int m_frameCounter = 0;
};
} // namespace KWin