Commit 97e196df authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

backends/wayland: Remove initial position logic

Let kwin decide the output position. This makes the behavior of the
wayland backend consistent with the drm backend.
parent b5a4c082
......@@ -772,18 +772,14 @@ void WaylandBackend::createOutputs()
// create an output window of this size in the end
const int pixelWidth = initialWindowSize().width() * initialOutputScale() + 0.5;
const int pixelHeight = initialWindowSize().height() * initialOutputScale() + 0.5;
const int logicalWidth = initialWindowSize().width();
int logicalWidthSum = 0;
for (int i = 0; i < initialOutputCount(); i++) {
const QString name = QStringLiteral("WL-%1").arg(i);
createOutput(name, QPoint(logicalWidthSum, 0), QSize(pixelWidth, pixelHeight));
logicalWidthSum += logicalWidth;
createOutput(name, QSize(pixelWidth, pixelHeight));
}
}
WaylandOutput *WaylandBackend::createOutput(const QString &name, const QPoint &position, const QSize &size)
WaylandOutput *WaylandBackend::createOutput(const QString &name, const QSize &size)
{
auto surface = m_compositor->createSurface(this);
if (!surface || !surface->isValid()) {
......@@ -811,7 +807,7 @@ WaylandOutput *WaylandBackend::createOutput(const QString &name, const QPoint &p
return nullptr;
}
waylandOutput->init(position, size);
waylandOutput->init(size);
connect(waylandOutput, &WaylandOutput::frameRendered, this, [waylandOutput]() {
// The current time of the monotonic clock is a pretty good estimate when the frame
// has been presented, however it will be much better if we check whether the host
......@@ -973,7 +969,7 @@ void WaylandBackend::clearDpmsFilter()
Output *WaylandBackend::createVirtualOutput(const QString &name, const QSize &size, double scale)
{
return createOutput(name, m_outputs.constLast()->geometry().topRight(), size * scale);
return createOutput(name, size * scale);
}
void WaylandBackend::removeVirtualOutput(Output *output)
......
......@@ -327,7 +327,7 @@ private:
void createOutputs();
void destroyOutputs();
WaylandOutput *createOutput(const QString &name, const QPoint &position, const QSize &size);
WaylandOutput *createOutput(const QString &name, const QSize &size);
wl_display *m_display;
KWayland::Client::EventQueue *m_eventQueue;
......
......@@ -55,23 +55,19 @@ RenderLoop *WaylandOutput::renderLoop() const
return m_renderLoop.get();
}
void WaylandOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
void WaylandOutput::init(const QSize &pixelSize)
{
m_renderLoop->setRefreshRate(s_refreshRate);
auto mode = std::make_shared<OutputMode>(pixelSize, s_refreshRate);
setModesInternal({mode}, mode);
moveTo(logicalPosition);
setScale(backend()->initialOutputScale());
}
void WaylandOutput::setGeometry(const QPoint &logicalPosition, const QSize &pixelSize)
void WaylandOutput::resize(const QSize &pixelSize)
{
auto mode = std::make_shared<OutputMode>(pixelSize, s_refreshRate);
setModesInternal({mode}, mode);
moveTo(logicalPosition);
Q_EMIT m_backend->screensQueried();
}
......@@ -146,7 +142,7 @@ void XdgShellOutput::handleConfigure(const QSize &size, XdgShellSurface::States
Q_UNUSED(states);
m_xdgShellSurface->ackConfigure(serial);
if (size.width() > 0 && size.height() > 0) {
setGeometry(geometry().topLeft(), size * scale());
resize(size * scale());
if (m_hasBeenConfigured) {
Q_EMIT sizeChanged(size);
}
......
......@@ -44,7 +44,7 @@ public:
RenderLoop *renderLoop() const override;
void init(const QPoint &logicalPosition, const QSize &pixelSize);
void init(const QSize &pixelSize);
virtual void lockPointer(KWayland::Client::Pointer *pointer, bool lock)
{
......@@ -57,12 +57,7 @@ public:
return false;
}
/**
* @brief defines the geometry of the output
* @param logicalPosition top left position of the output in compositor space
* @param pixelSize output size as seen from the outside
*/
void setGeometry(const QPoint &logicalPosition, const QSize &pixelSize);
void resize(const QSize &pixelSize);
KWayland::Client::Surface *surface() const
{
......
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