backends/x11: Remove initial position logic

Let kwin decide the output position. This makes the behavior of the
x11 backend consistent with the drm backend.
master
Vlad Zahorodnii 2 years ago
parent 97e196df54
commit 26752058d6

@ -281,12 +281,10 @@ void X11WindowedBackend::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) {
auto *output = new X11WindowedOutput(this);
output->init(QPoint(logicalWidthSum, 0), QSize(pixelWidth, pixelHeight));
output->init(QSize(pixelWidth, pixelHeight));
m_protocols = protocolsAtom;
m_deleteWindowProtocol = deleteWindowAtom;
@ -299,7 +297,6 @@ void X11WindowedBackend::createOutputs()
32, 1,
&m_deleteWindowProtocol);
logicalWidthSum += logicalWidth;
m_outputs << output;
Q_EMIT outputAdded(output);
output->setEnabled(true);
@ -500,13 +497,6 @@ void X11WindowedBackend::handleClientMessage(xcb_client_message_event_t *event)
auto removedOutput = *it;
it = m_outputs.erase(it);
// update the sizes
int x = removedOutput->internalPosition().x();
for (; it != m_outputs.end(); ++it) {
(*it)->setGeometry(QPoint(x, 0), (*it)->pixelSize());
x += (*it)->geometry().width();
}
removedOutput->setEnabled(false);
Q_EMIT outputRemoved(removedOutput);
delete removedOutput;
@ -590,7 +580,7 @@ void X11WindowedBackend::updateSize(xcb_configure_notify_event_t *event)
const QSize s = QSize(event->width, event->height);
if (s != output->pixelSize()) {
output->setGeometry(output->internalPosition(), s);
output->resize(s);
}
Q_EMIT sizeChanged();
}

@ -74,13 +74,13 @@ SoftwareVsyncMonitor *X11WindowedOutput::vsyncMonitor() const
return m_vsyncMonitor.get();
}
void X11WindowedOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
void X11WindowedOutput::init(const QSize &pixelSize)
{
const int refreshRate = 60000; // TODO: get refresh rate via randr
m_renderLoop->setRefreshRate(refreshRate);
m_vsyncMonitor->setRefreshRate(refreshRate);
setGeometry(logicalPosition, pixelSize);
resize(pixelSize);
setScale(m_backend->initialOutputScale());
const uint32_t eventMask = XCB_EVENT_MASK_KEY_PRESS
@ -157,12 +157,10 @@ void X11WindowedOutput::initXInputForWindow()
#endif
}
void X11WindowedOutput::setGeometry(const QPoint &logicalPosition, const QSize &pixelSize)
void X11WindowedOutput::resize(const QSize &pixelSize)
{
auto mode = std::make_shared<OutputMode>(pixelSize, m_renderLoop->refreshRate());
setModesInternal({mode}, mode);
moveTo(logicalPosition);
}
void X11WindowedOutput::setWindowTitle(const QString &title)

@ -38,7 +38,8 @@ public:
RenderLoop *renderLoop() const override;
SoftwareVsyncMonitor *vsyncMonitor() const;
void init(const QPoint &logicalPosition, const QSize &pixelSize);
void init(const QSize &pixelSize);
void resize(const QSize &pixelSize);
xcb_window_t window() const
{
@ -54,13 +55,6 @@ public:
void setWindowTitle(const QString &title);
/**
* @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);
/**
* Translates the global X11 screen coordinate @p pos to output coordinates.
*/

Loading…
Cancel
Save