Commit 5490b001 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

backends/wayland: Allow outputs to have a name

As expected in many parts of our codebase
parent d40aec08
......@@ -799,13 +799,14 @@ void WaylandBackend::createOutputs()
int logicalWidthSum = 0;
for (int i = 0; i < initialOutputCount(); i++) {
createOutput(QPoint(logicalWidthSum, 0), QSize(pixelWidth, pixelHeight));
const QString name = QStringLiteral("WL-%1").arg(i);
createOutput(name, QPoint(logicalWidthSum, 0), QSize(pixelWidth, pixelHeight));
logicalWidthSum += logicalWidth;
}
}
WaylandOutput *WaylandBackend::createOutput(const QPoint &position, const QSize &size)
WaylandOutput *WaylandBackend::createOutput(const QString &name, const QPoint &position, const QSize &size)
{
auto surface = m_compositor->createSurface(this);
if (!surface || !surface->isValid()) {
......@@ -825,7 +826,7 @@ WaylandOutput *WaylandBackend::createOutput(const QPoint &position, const QSize
WaylandOutput *waylandOutput = nullptr;
if (m_xdgShell && m_xdgShell->isValid()) {
waylandOutput = new XdgShellOutput(surface, m_xdgShell, this, m_nextId++);
waylandOutput = new XdgShellOutput(name, surface, m_xdgShell, this, m_nextId++);
}
if (!waylandOutput) {
......@@ -1014,8 +1015,7 @@ void WaylandBackend::clearDpmsFilter()
Output *WaylandBackend::createVirtualOutput(const QString &name, const QSize &size, double scale)
{
Q_UNUSED(name);
return createOutput(m_outputs.constLast()->geometry().topRight(), size * scale);
return createOutput(name, m_outputs.constLast()->geometry().topRight(), size * scale);
}
void WaylandBackend::removeVirtualOutput(Output *output)
......
......@@ -330,7 +330,7 @@ private:
void destroyOutputs();
void updateScreenSize(WaylandOutput *output);
WaylandOutput *createOutput(const QPoint &position, const QSize &size);
WaylandOutput *createOutput(const QString &name, const QPoint &position, const QSize &size);
Session *m_session;
wl_display *m_display;
......
......@@ -24,16 +24,14 @@ namespace Wayland
using namespace KWayland::Client;
static const int s_refreshRate = 60000; // TODO: can we get refresh rate data from Wayland host?
WaylandOutput::WaylandOutput(Surface *surface, WaylandBackend *backend)
WaylandOutput::WaylandOutput(const QString &name, Surface *surface, WaylandBackend *backend)
: Output(backend)
, m_renderLoop(new RenderLoop(this))
, m_surface(surface)
, m_backend(backend)
{
static int identifier = -1;
identifier++;
setInformation(Information{
.name = QStringLiteral("WL-%1").arg(identifier),
.name = name,
.capabilities = Capability::Dpms,
});
......@@ -107,8 +105,8 @@ void WaylandOutput::setDpmsMode(DpmsMode mode)
}
}
XdgShellOutput::XdgShellOutput(Surface *surface, XdgShell *xdgShell, WaylandBackend *backend, int number)
: WaylandOutput(surface, backend)
XdgShellOutput::XdgShellOutput(const QString &name, Surface *surface, XdgShell *xdgShell, WaylandBackend *backend, int number)
: WaylandOutput(name, surface, backend)
, m_number(number)
{
m_xdgShellSurface = xdgShell->createSurface(surface, this);
......
......@@ -40,7 +40,7 @@ class WaylandOutput : public Output
{
Q_OBJECT
public:
WaylandOutput(KWayland::Client::Surface *surface, WaylandBackend *backend);
WaylandOutput(const QString &name, KWayland::Client::Surface *surface, WaylandBackend *backend);
~WaylandOutput() override;
RenderLoop *renderLoop() const override;
......@@ -104,7 +104,8 @@ private:
class XdgShellOutput : public WaylandOutput
{
public:
XdgShellOutput(KWayland::Client::Surface *surface,
XdgShellOutput(const QString &name,
KWayland::Client::Surface *surface,
KWayland::Client::XdgShell *xdgShell,
WaylandBackend *backend, int number);
~XdgShellOutput() override;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment