Remove globalPos() in AbstractWaylandOutput
It's confusing to have globalPos() and geometry() as both can return the same information. This change drops globalPos() function as it's not used outside the AbstractWaylandOutput class and renames setGlobalPos() to moveTo() to avoid having a setter without matching getter.
This commit is contained in:
parent
d841733ed8
commit
8d422f3005
6 changed files with 9 additions and 16 deletions
|
@ -55,7 +55,7 @@ QUuid AbstractWaylandOutput::uuid() const
|
||||||
|
|
||||||
QRect AbstractWaylandOutput::geometry() const
|
QRect AbstractWaylandOutput::geometry() const
|
||||||
{
|
{
|
||||||
return QRect(globalPos(), pixelSize() / scale());
|
return QRect(m_position, pixelSize() / scale());
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize AbstractWaylandOutput::physicalSize() const
|
QSize AbstractWaylandOutput::physicalSize() const
|
||||||
|
@ -68,12 +68,7 @@ int AbstractWaylandOutput::refreshRate() const
|
||||||
return m_refreshRate;
|
return m_refreshRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint AbstractWaylandOutput::globalPos() const
|
void AbstractWaylandOutput::moveTo(const QPoint &pos)
|
||||||
{
|
|
||||||
return m_position;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractWaylandOutput::setGlobalPos(const QPoint &pos)
|
|
||||||
{
|
{
|
||||||
if (m_position != pos) {
|
if (m_position != pos) {
|
||||||
m_position = pos;
|
m_position = pos;
|
||||||
|
@ -168,7 +163,7 @@ void AbstractWaylandOutput::applyChanges(const KWaylandServer::OutputChangeSet *
|
||||||
}
|
}
|
||||||
if (changeSet->positionChanged()) {
|
if (changeSet->positionChanged()) {
|
||||||
qCDebug(KWIN_CORE) << "Server setting position: " << changeSet->position();
|
qCDebug(KWIN_CORE) << "Server setting position: " << changeSet->position();
|
||||||
setGlobalPos(changeSet->position());
|
moveTo(changeSet->position());
|
||||||
// may just work already!
|
// may just work already!
|
||||||
overallSizeCheckNeeded = true;
|
overallSizeCheckNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
QString model() const override;
|
QString model() const override;
|
||||||
QString serialNumber() const override;
|
QString serialNumber() const override;
|
||||||
|
|
||||||
void setGlobalPos(const QPoint &pos);
|
void moveTo(const QPoint &pos);
|
||||||
void setScale(qreal scale);
|
void setScale(qreal scale);
|
||||||
|
|
||||||
void applyChanges(const KWaylandServer::OutputChangeSet *changeSet) override;
|
void applyChanges(const KWaylandServer::OutputChangeSet *changeSet) override;
|
||||||
|
@ -156,8 +156,6 @@ protected:
|
||||||
const QSize &physicalSize,
|
const QSize &physicalSize,
|
||||||
const QVector<Mode> &modes, const QByteArray &edid);
|
const QVector<Mode> &modes, const QByteArray &edid);
|
||||||
|
|
||||||
QPoint globalPos() const;
|
|
||||||
|
|
||||||
bool internal() const {
|
bool internal() const {
|
||||||
return m_internal;
|
return m_internal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,7 +490,7 @@ void DrmBackend::readOutputsConfiguration()
|
||||||
qCDebug(KWIN_DRM) << "Reading output configuration for " << *it;
|
qCDebug(KWIN_DRM) << "Reading output configuration for " << *it;
|
||||||
if (!outputInfo.isEmpty()) {
|
if (!outputInfo.isEmpty()) {
|
||||||
const QJsonObject pos = outputInfo["pos"].toObject();
|
const QJsonObject pos = outputInfo["pos"].toObject();
|
||||||
(*it)->setGlobalPos({pos["x"].toInt(), pos["y"].toInt()});
|
(*it)->moveTo({pos["x"].toInt(), pos["y"].toInt()});
|
||||||
if (const QJsonValue scale = outputInfo["scale"]; !scale.isUndefined()) {
|
if (const QJsonValue scale = outputInfo["scale"]; !scale.isUndefined()) {
|
||||||
(*it)->setScale(scale.toDouble(1.));
|
(*it)->setScale(scale.toDouble(1.));
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ void DrmBackend::readOutputsConfiguration()
|
||||||
(*it)->updateMode(size["width"].toInt(), size["height"].toInt(), mode["refresh"].toDouble() * 1000);
|
(*it)->updateMode(size["width"].toInt(), size["height"].toInt(), mode["refresh"].toDouble() * 1000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(*it)->setGlobalPos(pos);
|
(*it)->moveTo(pos);
|
||||||
(*it)->setTransformInternal(DrmOutput::Transform::Normal);
|
(*it)->setTransformInternal(DrmOutput::Transform::Normal);
|
||||||
}
|
}
|
||||||
pos.setX(pos.x() + (*it)->geometry().width());
|
pos.setX(pos.x() + (*it)->geometry().width());
|
||||||
|
|
|
@ -64,7 +64,7 @@ void VirtualOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
|
||||||
void VirtualOutput::setGeometry(const QRect &geo)
|
void VirtualOutput::setGeometry(const QRect &geo)
|
||||||
{
|
{
|
||||||
// TODO: set mode to have updated pixelSize
|
// TODO: set mode to have updated pixelSize
|
||||||
setGlobalPos(geo.topLeft());
|
moveTo(geo.topLeft());
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualOutput::vblank(std::chrono::nanoseconds timestamp)
|
void VirtualOutput::vblank(std::chrono::nanoseconds timestamp)
|
||||||
|
|
|
@ -79,7 +79,7 @@ void WaylandOutput::setGeometry(const QPoint &logicalPosition, const QSize &pixe
|
||||||
// TODO: set mode to have updated pixelSize
|
// TODO: set mode to have updated pixelSize
|
||||||
Q_UNUSED(pixelSize)
|
Q_UNUSED(pixelSize)
|
||||||
|
|
||||||
setGlobalPos(logicalPosition);
|
moveTo(logicalPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandOutput::updateEnablement(bool enable)
|
void WaylandOutput::updateEnablement(bool enable)
|
||||||
|
|
|
@ -151,7 +151,7 @@ void X11WindowedOutput::setGeometry(const QPoint &logicalPosition, const QSize &
|
||||||
{
|
{
|
||||||
// TODO: set mode to have updated pixelSize
|
// TODO: set mode to have updated pixelSize
|
||||||
Q_UNUSED(pixelSize);
|
Q_UNUSED(pixelSize);
|
||||||
setGlobalPos(logicalPosition);
|
moveTo(logicalPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11WindowedOutput::setWindowTitle(const QString &title)
|
void X11WindowedOutput::setWindowTitle(const QString &title)
|
||||||
|
|
Loading…
Reference in a new issue