output: don't round geometry as often

CCBUG: 459373
This commit is contained in:
Xaver Hugl 2022-09-28 10:38:38 +02:00
parent 6b4df3f65a
commit ceae717500
4 changed files with 18 additions and 8 deletions

View file

@ -169,6 +169,11 @@ QRect Output::geometry() const
return QRect(m_state.position, pixelSize() / scale());
}
QRectF Output::fractionalGeometry() const
{
return QRectF(m_state.position, QSizeF(pixelSize()) / scale());
}
QSize Output::physicalSize() const
{
return orientateSize(m_information.physicalSize);

View file

@ -131,6 +131,11 @@ public:
*/
QRect geometry() const;
/**
* Returns geometry of this output in device independent pixels, without rounding
*/
QRectF fractionalGeometry() const;
/**
* Equivalent to `QRect(QPoint(0, 0), geometry().size())`
*/

View file

@ -44,8 +44,8 @@ public:
{
}
QPoint pos;
QSize size;
QPointF pos;
QSizeF size;
QString name;
QString description;
QPointer<OutputInterface> output;
@ -137,7 +137,7 @@ void XdgOutputV1Interface::update()
return;
}
const QRect geometry = d->output->handle()->geometry();
const QRectF geometry = d->output->handle()->fractionalGeometry();
const auto resources = d->resourceMap();
if (d->pos != geometry.topLeft()) {
@ -194,7 +194,7 @@ void XdgOutputV1InterfacePrivate::sendLogicalSize(Resource *resource)
ClientConnection *connection = output->display()->getConnection(resource->client());
qreal scaleOverride = connection->scaleOverride();
send_logical_size(resource->handle, size.width() * scaleOverride, size.height() * scaleOverride);
send_logical_size(resource->handle, std::round(size.width() * scaleOverride), std::round(size.height() * scaleOverride));
}
void XdgOutputV1InterfacePrivate::sendLogicalPosition(Resource *resource)

View file

@ -2394,7 +2394,7 @@ void Workspace::updateClientArea()
workAreas[desktop] = m_geometry;
for (const Output *output : std::as_const(m_outputs)) {
screenAreas[desktop][output] = output->geometry();
screenAreas[desktop][output] = output->fractionalGeometry();
}
}
@ -2439,7 +2439,7 @@ void Workspace::updateClientArea()
}
restrictedAreas[vd] += strutRegion;
for (Output *output : std::as_const(m_outputs)) {
const auto geo = screenAreas[vd][output].intersected(adjustClientArea(window, output->geometry()));
const auto geo = screenAreas[vd][output].intersected(adjustClientArea(window, output->fractionalGeometry()));
// ignore the geometry if it results in the screen getting removed completely
if (!geo.isEmpty()) {
screenAreas[vd][output] = geo;
@ -2488,12 +2488,12 @@ QRectF Workspace::clientArea(clientAreaOption opt, const Output *output, const V
return *outputIt;
}
}
return output->geometry();
return output->fractionalGeometry();
case MaximizeFullArea:
case FullScreenArea:
case MovementArea:
case ScreenArea:
return output->geometry();
return output->fractionalGeometry();
case WorkArea:
return m_workAreas.value(desktop, m_geometry);
case FullArea: