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:
parent
ae1ca8ec9d
commit
ff53950a6d
6 changed files with 0 additions and 42 deletions
|
@ -11,8 +11,6 @@
|
||||||
#include "virtual_egl_backend.h"
|
#include "virtual_egl_backend.h"
|
||||||
#include "virtual_output.h"
|
#include "virtual_output.h"
|
||||||
#include "virtual_qpainter_backend.h"
|
#include "virtual_qpainter_backend.h"
|
||||||
// Qt
|
|
||||||
#include <QTemporaryDir>
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -20,15 +18,6 @@ namespace KWin
|
||||||
VirtualBackend::VirtualBackend(QObject *parent)
|
VirtualBackend::VirtualBackend(QObject *parent)
|
||||||
: OutputBackend(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()
|
VirtualBackend::~VirtualBackend()
|
||||||
|
@ -43,14 +32,6 @@ bool VirtualBackend::initialize()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VirtualBackend::screenshotDirPath() const
|
|
||||||
{
|
|
||||||
if (!m_screenshotDir) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
return m_screenshotDir->path();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<QPainterBackend> VirtualBackend::createQPainterBackend()
|
std::unique_ptr<QPainterBackend> VirtualBackend::createQPainterBackend()
|
||||||
{
|
{
|
||||||
return std::make_unique<VirtualQPainterBackend>(this);
|
return std::make_unique<VirtualQPainterBackend>(this);
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
class QTemporaryDir;
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
class VirtualBackend;
|
class VirtualBackend;
|
||||||
|
@ -32,12 +30,6 @@ public:
|
||||||
|
|
||||||
bool initialize() override;
|
bool initialize() override;
|
||||||
|
|
||||||
bool saveFrames() const
|
|
||||||
{
|
|
||||||
return m_screenshotDir != nullptr;
|
|
||||||
}
|
|
||||||
QString screenshotDirPath() const;
|
|
||||||
|
|
||||||
std::unique_ptr<QPainterBackend> createQPainterBackend() override;
|
std::unique_ptr<QPainterBackend> createQPainterBackend() override;
|
||||||
std::unique_ptr<OpenGLBackend> createOpenGLBackend() override;
|
std::unique_ptr<OpenGLBackend> createOpenGLBackend() override;
|
||||||
|
|
||||||
|
@ -59,7 +51,6 @@ private:
|
||||||
VirtualOutput *createOutput(const QPoint &position, const QSize &size, qreal scale);
|
VirtualOutput *createOutput(const QPoint &position, const QSize &size, qreal scale);
|
||||||
|
|
||||||
QVector<VirtualOutput *> m_outputs;
|
QVector<VirtualOutput *> m_outputs;
|
||||||
std::unique_ptr<QTemporaryDir> m_screenshotDir;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
|
@ -201,11 +201,6 @@ void VirtualEglBackend::present(Output *output)
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
static_cast<VirtualOutput *>(output)->vsyncMonitor()->arm();
|
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
|
} // namespace
|
||||||
|
|
|
@ -61,7 +61,6 @@ private:
|
||||||
void removeOutput(Output *output);
|
void removeOutput(Output *output);
|
||||||
|
|
||||||
VirtualBackend *m_backend;
|
VirtualBackend *m_backend;
|
||||||
int m_frameCounter = 0;
|
|
||||||
std::map<Output *, std::unique_ptr<VirtualEglLayer>> m_outputs;
|
std::map<Output *, std::unique_ptr<VirtualEglLayer>> m_outputs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,6 @@ QImage *VirtualQPainterLayer::image()
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualQPainterBackend::VirtualQPainterBackend(VirtualBackend *backend)
|
VirtualQPainterBackend::VirtualQPainterBackend(VirtualBackend *backend)
|
||||||
: QPainterBackend()
|
|
||||||
, m_backend(backend)
|
|
||||||
{
|
{
|
||||||
connect(backend, &VirtualBackend::outputAdded, this, &VirtualQPainterBackend::addOutput);
|
connect(backend, &VirtualBackend::outputAdded, this, &VirtualQPainterBackend::addOutput);
|
||||||
connect(backend, &VirtualBackend::outputRemoved, this, &VirtualQPainterBackend::removeOutput);
|
connect(backend, &VirtualBackend::outputRemoved, this, &VirtualQPainterBackend::removeOutput);
|
||||||
|
@ -69,10 +67,6 @@ void VirtualQPainterBackend::removeOutput(Output *output)
|
||||||
void VirtualQPainterBackend::present(Output *output)
|
void VirtualQPainterBackend::present(Output *output)
|
||||||
{
|
{
|
||||||
static_cast<VirtualOutput *>(output)->vsyncMonitor()->arm();
|
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)
|
VirtualQPainterLayer *VirtualQPainterBackend::primaryLayer(Output *output)
|
||||||
|
|
|
@ -50,8 +50,6 @@ private:
|
||||||
void removeOutput(Output *output);
|
void removeOutput(Output *output);
|
||||||
|
|
||||||
std::map<Output *, std::unique_ptr<VirtualQPainterLayer>> m_outputs;
|
std::map<Output *, std::unique_ptr<VirtualQPainterLayer>> m_outputs;
|
||||||
VirtualBackend *m_backend;
|
|
||||||
int m_frameCounter = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
Loading…
Reference in a new issue