core: Rename Output::fractionalGeometry()

In Qt, if an overloaded function returns QRectF/QSizeF/QPointF, it
usually has F suffix. Do the same in kwin for the consistency sake.
This commit is contained in:
Vlad Zahorodnii 2024-01-11 09:42:30 +02:00
parent bc58d13ee8
commit c314705d53
9 changed files with 19 additions and 19 deletions

View file

@ -462,7 +462,7 @@ QRect Output::geometry() const
return QRect(m_state.position, pixelSize() / scale());
}
QRectF Output::fractionalGeometry() const
QRectF Output::geometryF() const
{
return QRectF(m_state.position, QSizeF(pixelSize()) / scale());
}

View file

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

View file

@ -778,7 +778,7 @@ QPointF WindowRules::checkPositionSafe(QPointF pos, bool init) const
}
const auto outputs = workspace()->outputs();
const bool inAnyOutput = std::any_of(outputs.begin(), outputs.end(), [ret](const auto output) {
return output->fractionalGeometry().contains(ret);
return output->geometryF().contains(ret);
});
if (inAnyOutput) {
return ret;

View file

@ -372,7 +372,7 @@ void WorkspaceScene::postPaint()
void WorkspaceScene::paint(const RenderTarget &renderTarget, const QRegion &region)
{
Output *output = kwinApp()->operationMode() == Application::OperationMode::OperationModeX11 ? nullptr : painted_screen;
RenderViewport viewport(output ? output->fractionalGeometry() : workspace()->geometry(), output ? output->scale() : 1, renderTarget);
RenderViewport viewport(output ? output->geometryF() : workspace()->geometry(), output ? output->scale() : 1, renderTarget);
m_renderer->beginFrame(renderTarget, viewport);

View file

@ -83,7 +83,7 @@ void Tile::setGeometryFromWindow(const QRectF &geom)
void Tile::setGeometryFromAbsolute(const QRectF &geom)
{
const QRectF outGeom = m_tiling->output()->fractionalGeometry();
const QRectF outGeom = m_tiling->output()->geometryF();
const QRectF relGeom((geom.x() - outGeom.x()) / outGeom.width(),
(geom.y() - outGeom.y()) / outGeom.height(),
geom.width() / outGeom.width(),
@ -120,7 +120,7 @@ QRectF Tile::relativeGeometry() const
QRectF Tile::absoluteGeometry() const
{
const QRectF geom = m_tiling->output()->fractionalGeometry();
const QRectF geom = m_tiling->output()->geometryF();
return QRectF(std::round(geom.x() + m_relativeGeometry.x() * geom.width()),
std::round(geom.y() + m_relativeGeometry.y() * geom.height()),
std::round(m_relativeGeometry.width() * geom.width()),
@ -129,7 +129,7 @@ QRectF Tile::absoluteGeometry() const
QRectF Tile::absoluteGeometryInScreen() const
{
const QRectF geom = m_tiling->output()->fractionalGeometry();
const QRectF geom = m_tiling->output()->geometryF();
return QRectF(std::round(m_relativeGeometry.x() * geom.width()),
std::round(m_relativeGeometry.y() * geom.height()),
std::round(m_relativeGeometry.width() * geom.width()),
@ -208,7 +208,7 @@ void Tile::resizeFromGravity(Gravity gravity, int x_root, int y_root)
return;
}
const QRectF outGeom = m_tiling->output()->fractionalGeometry();
const QRectF outGeom = m_tiling->output()->geometryF();
const QPointF relativePos = QPointF((x_root - outGeom.x()) / outGeom.width(), (y_root - outGeom.y()) / outGeom.height());
QRectF newGeom = m_relativeGeometry;
@ -251,7 +251,7 @@ void Tile::resizeByPixels(qreal delta, Qt::Edge edge)
return;
}
const auto outGeom = m_tiling->output()->fractionalGeometry();
const auto outGeom = m_tiling->output()->geometryF();
auto newGeom = m_relativeGeometry;
switch (edge) {

View file

@ -96,7 +96,7 @@ Tile *TileManager::bestTileForPosition(const QPointF &pos)
if (!exclusiveContains(r, pos)) {
// This gives a strong preference for tiles that contain the point
// still base on distance though as floating tiles can overlap
distance += m_output->fractionalGeometry().width();
distance += m_output->geometryF().width();
}
if (distance < minimumDistance) {
minimumDistance = distance;

View file

@ -108,8 +108,8 @@ XdgOutputV1Interface::XdgOutputV1Interface(OutputInterface *output)
name = handle->name();
description = handle->description();
pos = handle->fractionalGeometry().topLeft();
size = handle->fractionalGeometry().size();
pos = handle->geometryF().topLeft();
size = handle->geometryF().size();
connect(handle, &Output::geometryChanged, this, &XdgOutputV1Interface::update);
}
@ -120,7 +120,7 @@ void XdgOutputV1Interface::update()
return;
}
const QRectF geometry = output->handle()->fractionalGeometry();
const QRectF geometry = output->handle()->geometryF();
const auto resources = resourceMap();
if (pos != geometry.topLeft()) {

View file

@ -2306,7 +2306,7 @@ void Workspace::updateClientArea()
workAreas[desktop] = m_geometry;
for (const Output *output : std::as_const(m_outputs)) {
screenAreas[desktop][output] = output->fractionalGeometry();
screenAreas[desktop][output] = output->geometryF();
}
}
@ -2356,7 +2356,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->fractionalGeometry()));
const auto geo = screenAreas[vd][output].intersected(adjustClientArea(window, output->geometryF()));
// ignore the geometry if it results in the screen getting removed completely
if (!geo.isEmpty()) {
screenAreas[vd][output] = geo;
@ -2407,12 +2407,12 @@ QRectF Workspace::clientArea(clientAreaOption opt, const Output *output, const V
return *outputIt;
}
}
return output->fractionalGeometry();
return output->geometryF();
case MaximizeFullArea:
case FullScreenArea:
case MovementArea:
case ScreenArea:
return output->fractionalGeometry();
return output->geometryF();
case WorkArea:
return m_workAreas.value(desktop, m_geometry);
case FullArea:
@ -2518,7 +2518,7 @@ Output *Workspace::xineramaIndexToOutput(int index) const
const QRect needle(infos[index].x_org, infos[index].y_org, infos[index].width, infos[index].height);
for (Output *output : std::as_const(m_outputs)) {
if (Xcb::toXNative(output->fractionalGeometry()) == needle) {
if (Xcb::toXNative(output->geometryF()) == needle) {
return output;
}
}

View file

@ -593,7 +593,7 @@ void Xwayland::updatePrimary()
}
Output *const primaryOutput = workspace()->outputOrder().front();
const QRect primaryOutputGeometry = Xcb::toXNative(primaryOutput->fractionalGeometry());
const QRect primaryOutputGeometry = Xcb::toXNative(primaryOutput->geometryF());
for (int i = 0; i < resources->num_crtcs; ++i) {
Xcb::RandR::CrtcInfo crtcInfo(crtcs[i], resources->config_timestamp);
const QRect geometry = crtcInfo.rect();