qMin -> std::min

This commit is contained in:
Xaver Hugl 2022-11-12 15:33:44 +01:00
parent b0b7c8b1d3
commit d265535f9b
22 changed files with 69 additions and 69 deletions

View file

@ -222,8 +222,8 @@ void MagicLampEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, Wi
offset[0] = (icon.y() + quad[0].y() - geo.y()) * progress * ((quadFactor * quadFactor * quadFactor) / height_cube);
quadFactor = quad[2].y() + (geo.height() - quad[2].y()) * progress;
offset[1] = (icon.y() + quad[2].y() - geo.y()) * progress * ((quadFactor * quadFactor * quadFactor) / height_cube);
p_progress[1] = qMin(offset[1] / (icon.y() + icon.height() - geo.y() - float(quad[2].y())), 1.0f);
p_progress[0] = qMin(offset[0] / (icon.y() + icon.height() - geo.y() - float(quad[0].y())), 1.0f);
p_progress[1] = std::min(offset[1] / (icon.y() + icon.height() - geo.y() - float(quad[2].y())), 1.0f);
p_progress[0] = std::min(offset[0] / (icon.y() + icon.height() - geo.y() - float(quad[0].y())), 1.0f);
} else {
lastQuad = quad;
}
@ -241,8 +241,8 @@ void MagicLampEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, Wi
offset[0] = (geo.y() - icon.height() + geo.height() + quad[0].y() - icon.y()) * progress * ((quadFactor * quadFactor * quadFactor) / height_cube);
quadFactor = geo.height() - quad[2].y() + (quad[2].y()) * progress;
offset[1] = (geo.y() - icon.height() + geo.height() + quad[2].y() - icon.y()) * progress * ((quadFactor * quadFactor * quadFactor) / height_cube);
p_progress[0] = qMin(offset[0] / (geo.y() - icon.height() + geo.height() - icon.y() - float(geo.height() - quad[0].y())), 1.0f);
p_progress[1] = qMin(offset[1] / (geo.y() - icon.height() + geo.height() - icon.y() - float(geo.height() - quad[2].y())), 1.0f);
p_progress[0] = std::min(offset[0] / (geo.y() - icon.height() + geo.height() - icon.y() - float(geo.height() - quad[0].y())), 1.0f);
p_progress[1] = std::min(offset[1] / (geo.y() - icon.height() + geo.height() - icon.y() - float(geo.height() - quad[2].y())), 1.0f);
} else {
lastQuad = quad;
}
@ -263,8 +263,8 @@ void MagicLampEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, Wi
offset[0] = (geo.x() - icon.width() + geo.width() + quad[0].x() - icon.x()) * progress * ((quadFactor * quadFactor * quadFactor) / width_cube);
quadFactor = geo.width() - quad[1].x() + (quad[1].x()) * progress;
offset[1] = (geo.x() - icon.width() + geo.width() + quad[1].x() - icon.x()) * progress * ((quadFactor * quadFactor * quadFactor) / width_cube);
p_progress[0] = qMin(offset[0] / (geo.x() - icon.width() + geo.width() - icon.x() - float(geo.width() - quad[0].x())), 1.0f);
p_progress[1] = qMin(offset[1] / (geo.x() - icon.width() + geo.width() - icon.x() - float(geo.width() - quad[1].x())), 1.0f);
p_progress[0] = std::min(offset[0] / (geo.x() - icon.width() + geo.width() - icon.x() - float(geo.width() - quad[0].x())), 1.0f);
p_progress[1] = std::min(offset[1] / (geo.x() - icon.width() + geo.width() - icon.x() - float(geo.width() - quad[1].x())), 1.0f);
} else {
lastQuad = quad;
}
@ -285,8 +285,8 @@ void MagicLampEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, Wi
offset[0] = (icon.x() + quad[0].x() - geo.x()) * progress * ((quadFactor * quadFactor * quadFactor) / width_cube);
quadFactor = quad[1].x() + (geo.width() - quad[1].x()) * progress;
offset[1] = (icon.x() + quad[1].x() - geo.x()) * progress * ((quadFactor * quadFactor * quadFactor) / width_cube);
p_progress[0] = qMin(offset[0] / (icon.x() + icon.width() - geo.x() - float(quad[0].x())), 1.0f);
p_progress[1] = qMin(offset[1] / (icon.x() + icon.width() - geo.x() - float(quad[1].x())), 1.0f);
p_progress[0] = std::min(offset[0] / (icon.x() + icon.width() - geo.x() - float(quad[0].x())), 1.0f);
p_progress[1] = std::min(offset[1] / (icon.x() + icon.width() - geo.x() - float(quad[1].x())), 1.0f);
} else {
lastQuad = quad;
}

View file

@ -86,9 +86,9 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mill
if (m_zoom != m_targetZoom) {
double diff = time / animationTime(500.0);
if (m_targetZoom > m_zoom) {
m_zoom = qMin(m_zoom * std::max(1 + diff, 1.2), m_targetZoom);
m_zoom = std::min(m_zoom * std::max(1 + diff, 1.2), m_targetZoom);
} else {
m_zoom = std::max(m_zoom * qMin(1 - diff, 0.8), m_targetZoom);
m_zoom = std::max(m_zoom * std::min(1 - diff, 0.8), m_targetZoom);
if (m_zoom == 1.0) {
// zoom ended - delete FBO and texture
m_fbo.reset();

View file

@ -163,7 +163,7 @@ void MouseMarkEffect::slotMouseChanged(const QPoint &pos, const QPoint &,
}
QPoint pos2 = drawing.last();
drawing.append(pos);
QRect repaint = QRect(qMin(pos.x(), pos2.x()), qMin(pos.y(), pos2.y()),
QRect repaint = QRect(std::min(pos.x(), pos2.x()), std::min(pos.y(), pos2.y()),
std::max(pos.x(), pos2.x()), std::max(pos.y(), pos2.y()));
repaint.adjust(-width, -width, width, width);
effects->addRepaint(repaint);

View file

@ -428,11 +428,11 @@ static xcb_pixmap_t xpixmapFromImage(const QImage &image)
const QSize window = pickWindowSize(image);
for (int i = 0; i < image.height(); i += window.height()) {
const int targetHeight = qMin(image.height() - i, window.height());
const int targetHeight = std::min(image.height() - i, window.height());
const uint8_t *line = image.scanLine(i);
for (int j = 0; j < image.width(); j += window.width()) {
const int targetWidth = qMin(image.width() - j, window.width());
const int targetWidth = std::min(image.width() - j, window.width());
const uint8_t *bytes = line + j * bytesPerPixel;
const uint32_t byteCount = targetWidth * targetHeight * bytesPerPixel;

View file

@ -149,7 +149,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
if (slideLength < geo.width()) {
data.multiplyOpacity(t);
}
data.translate(-interpolate(qMin(geo.width(), slideLength), 0.0, t));
data.translate(-interpolate(std::min(geo.width(), slideLength), 0.0, t));
splitPoint = geo.width() - (geo.x() + geo.width() - screenRect.x() - animData.offset);
region &= QRegion(geo.x() + splitPoint, geo.y(), geo.width() - splitPoint, geo.height());
break;
@ -157,7 +157,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
if (slideLength < geo.height()) {
data.multiplyOpacity(t);
}
data.translate(0.0, -interpolate(qMin(geo.height(), slideLength), 0.0, t));
data.translate(0.0, -interpolate(std::min(geo.height(), slideLength), 0.0, t));
splitPoint = geo.height() - (geo.y() + geo.height() - screenRect.y() - animData.offset);
region &= QRegion(geo.x(), geo.y() + splitPoint, geo.width(), geo.height() - splitPoint);
break;
@ -165,7 +165,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
if (slideLength < geo.width()) {
data.multiplyOpacity(t);
}
data.translate(interpolate(qMin(geo.width(), slideLength), 0.0, t));
data.translate(interpolate(std::min(geo.width(), slideLength), 0.0, t));
splitPoint = screenRect.x() + screenRect.width() - geo.x() - animData.offset;
region &= QRegion(geo.x(), geo.y(), splitPoint, geo.height());
break;
@ -174,7 +174,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
if (slideLength < geo.height()) {
data.multiplyOpacity(t);
}
data.translate(0.0, interpolate(qMin(geo.height(), slideLength), 0.0, t));
data.translate(0.0, interpolate(std::min(geo.height(), slideLength), 0.0, t));
splitPoint = screenRect.y() + screenRect.height() - geo.y() - animData.offset;
region &= QRegion(geo.x(), geo.y(), geo.width(), splitPoint);
}

View file

@ -160,7 +160,7 @@ void ThumbnailAsideEffect::arrange()
}
QRectF area = effects->clientArea(MaximizeArea, effectiveScreen, effects->currentDesktop());
double scale = area.height() / double(height);
scale = qMin(scale, maxwidth / double(mwidth)); // don't be wider than maxwidth pixels
scale = std::min(scale, maxwidth / double(mwidth)); // don't be wider than maxwidth pixels
int add = 0;
for (int i = 0;
i < windows.size();

View file

@ -283,8 +283,8 @@ void WobblyWindowsEffect::apply(EffectWindow *w, int mask, WindowPaintData &data
Pair newPos = computeBezierPoint(wwi, uv);
v.move(newPos.x - tx, newPos.y - ty);
}
left = qMin(left, quads[i].left());
top = qMin(top, quads[i].top());
left = std::min(left, quads[i].left());
top = std::min(top, quads[i].top());
right = std::max(right, quads[i].right());
bottom = std::max(bottom, quads[i].bottom());
}

View file

@ -237,7 +237,7 @@ void ZoomEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseco
const float zoomDist = qAbs(target_zoom - source_zoom);
if (target_zoom > zoom) {
zoom = qMin(zoom + ((zoomDist * time) / animationTime(150 * zoomFactor)), target_zoom);
zoom = std::min(zoom + ((zoomDist * time) / animationTime(150 * zoomFactor)), target_zoom);
} else {
zoom = std::max(zoom - ((zoomDist * time) / animationTime(150 * zoomFactor)), target_zoom);
}
@ -319,8 +319,8 @@ void ZoomEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &d
prevPoint = cursorPoint;
// fall through
case MouseTrackingDisabled:
xTranslation = qMin(0, std::max(int(screenSize.width() - screenSize.width() * zoom), int(screenSize.width() / 2 - prevPoint.x() * zoom)));
yTranslation = qMin(0, std::max(int(screenSize.height() - screenSize.height() * zoom), int(screenSize.height() / 2 - prevPoint.y() * zoom)));
xTranslation = std::min(0, std::max(int(screenSize.width() - screenSize.width() * zoom), int(screenSize.width() / 2 - prevPoint.x() * zoom)));
yTranslation = std::min(0, std::max(int(screenSize.height() - screenSize.height() * zoom), int(screenSize.height() / 2 - prevPoint.y() * zoom)));
break;
case MouseTrackingPush: {
// touching an edge of the screen moves the zoom-area in that direction.
@ -339,10 +339,10 @@ void ZoomEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &d
yMove = (y + threshold - screenSize.height()) / zoom;
}
if (xMove) {
prevPoint.setX(std::max(0, qMin(screenSize.width(), prevPoint.x() + xMove)));
prevPoint.setX(std::max(0, std::min(screenSize.width(), prevPoint.x() + xMove)));
}
if (yMove) {
prevPoint.setY(std::max(0, qMin(screenSize.height(), prevPoint.y() + yMove)));
prevPoint.setY(std::max(0, std::min(screenSize.height(), prevPoint.y() + yMove)));
}
xTranslation = -int(prevPoint.x() * (zoom - 1.0));
yTranslation = -int(prevPoint.y() * (zoom - 1.0));
@ -478,8 +478,8 @@ void ZoomEffect::actualSize()
void ZoomEffect::timelineFrameChanged(int /* frame */)
{
const QSize screenSize = effects->virtualScreenSize();
prevPoint.setX(std::max(0, qMin(screenSize.width(), prevPoint.x() + xMove)));
prevPoint.setY(std::max(0, qMin(screenSize.height(), prevPoint.y() + yMove)));
prevPoint.setX(std::max(0, std::min(screenSize.width(), prevPoint.x() + xMove)));
prevPoint.setY(std::max(0, std::min(screenSize.height(), prevPoint.y() + yMove)));
cursorPoint = prevPoint;
effects->addRepaintFull();
}

View file

@ -938,9 +938,9 @@ WindowQuadList WindowQuadList::makeGrid(int maxQuadSize) const
double bottom = first().bottom();
for (const WindowQuad &quad : std::as_const(*this)) {
left = qMin(left, quad.left());
left = std::min(left, quad.left());
right = std::max(right, quad.right());
top = qMin(top, quad.top());
top = std::min(top, quad.top());
bottom = std::max(bottom, quad.bottom());
}
@ -965,11 +965,11 @@ WindowQuadList WindowQuadList::makeGrid(int maxQuadSize) const
// Loop over all intersecting cells and add sub-quads
for (double y = yBegin; y < quadBottom; y += maxQuadSize) {
const double y0 = std::max(y, quadTop);
const double y1 = qMin(quadBottom, y + maxQuadSize);
const double y1 = std::min(quadBottom, y + maxQuadSize);
for (double x = xBegin; x < quadRight; x += maxQuadSize) {
const double x0 = std::max(x, quadLeft);
const double x1 = qMin(quadRight, x + maxQuadSize);
const double x1 = std::min(quadRight, x + maxQuadSize);
ret.append(quad.makeSubQuad(x0, y0, x1, y1));
}
@ -992,9 +992,9 @@ WindowQuadList WindowQuadList::makeRegularGrid(int xSubdivisions, int ySubdivisi
double bottom = first().bottom();
for (const WindowQuad &quad : *this) {
left = qMin(left, quad.left());
left = std::min(left, quad.left());
right = std::max(right, quad.right());
top = qMin(top, quad.top());
top = std::min(top, quad.top());
bottom = std::max(bottom, quad.bottom());
}
@ -1022,11 +1022,11 @@ WindowQuadList WindowQuadList::makeRegularGrid(int xSubdivisions, int ySubdivisi
// Loop over all intersecting cells and add sub-quads
for (double y = yBegin; y < quadBottom; y += yIncrement) {
const double y0 = std::max(y, quadTop);
const double y1 = qMin(quadBottom, y + yIncrement);
const double y1 = std::min(quadBottom, y + yIncrement);
for (double x = xBegin; x < quadRight; x += xIncrement) {
const double x0 = std::max(x, quadLeft);
const double x1 = qMin(quadRight, x + xIncrement);
const double x1 = std::min(quadRight, x + xIncrement);
ret.append(quad.makeSubQuad(x0, y0, x1, y1));
}

View file

@ -4141,7 +4141,7 @@ inline const WindowVertex &WindowQuad::operator[](int index) const
inline double WindowQuad::left() const
{
return qMin(verts[0].px, qMin(verts[1].px, qMin(verts[2].px, verts[3].px)));
return std::min(verts[0].px, std::min(verts[1].px, std::min(verts[2].px, verts[3].px)));
}
inline double WindowQuad::right() const
@ -4151,7 +4151,7 @@ inline double WindowQuad::right() const
inline double WindowQuad::top() const
{
return qMin(verts[0].py, qMin(verts[1].py, qMin(verts[2].py, verts[3].py)));
return std::min(verts[0].py, std::min(verts[1].py, std::min(verts[2].py, verts[3].py)));
}
inline double WindowQuad::bottom() const

View file

@ -306,7 +306,7 @@ void Options::setFocusStealingPreventionLevel(int focusStealingPreventionLevel)
if (m_focusStealingPreventionLevel == focusStealingPreventionLevel) {
return;
}
m_focusStealingPreventionLevel = std::max(0, qMin(4, focusStealingPreventionLevel));
m_focusStealingPreventionLevel = std::max(0, std::min(4, focusStealingPreventionLevel));
Q_EMIT focusStealingPreventionLevelChanged();
}

View file

@ -236,9 +236,9 @@ void Placement::placeSmart(Window *c, const QRectF &area, PlacementPolicy /*next
// if windows overlap, calc the overall overlapping
if ((cxl < xr) && (cxr > xl) && (cyt < yb) && (cyb > yt)) {
xl = std::max(cxl, xl);
xr = qMin(cxr, xr);
xr = std::min(cxr, xr);
yt = std::max(cyt, yt);
yb = qMin(cyb, yb);
yb = std::min(cyb, yb);
if (client->keepAbove()) {
overlap += 16 * (xr - xl) * (yb - yt);
} else if (client->keepBelow() && !client->isDock()) { // ignore KeepBelow windows

View file

@ -23,7 +23,7 @@ PlastikButtonProvider::PlastikButtonProvider()
QPixmap PlastikButtonProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{
int origSize = requestedSize.isValid() ? qMin(requestedSize.width(), requestedSize.height()) : 10;
int origSize = requestedSize.isValid() ? std::min(requestedSize.width(), requestedSize.height()) : 10;
if (size) {
*size = QSize(origSize, origSize);
}

View file

@ -287,7 +287,7 @@ void NightColorManager::readConfig()
QTime evB = QTime::fromString(s->eveningBeginFixed(), "hhmm");
int diffME = evB > mrB ? mrB.msecsTo(evB) : evB.msecsTo(mrB);
int diffMin = qMin(diffME, MSC_DAY - diffME);
int diffMin = std::min(diffME, MSC_DAY - diffME);
int trTime = s->transitionTime() * 1000 * 60;
if (trTime < 0 || diffMin <= trTime) {
@ -353,7 +353,7 @@ void NightColorManager::quickAdjust(int targetTemp)
int nextTemp;
if (m_currentTemp < targetTemp) {
nextTemp = qMin(m_currentTemp + TEMPERATURE_STEP, targetTemp);
nextTemp = std::min(m_currentTemp + TEMPERATURE_STEP, targetTemp);
} else {
nextTemp = std::max(m_currentTemp - TEMPERATURE_STEP, targetTemp);
}
@ -447,7 +447,7 @@ void NightColorManager::slowUpdate(int targetTemp)
}
int nextTemp;
if (m_currentTemp < targetTemp) {
nextTemp = qMin(m_currentTemp + TEMPERATURE_STEP, targetTemp);
nextTemp = std::min(m_currentTemp + TEMPERATURE_STEP, targetTemp);
} else {
nextTemp = std::max(m_currentTemp - TEMPERATURE_STEP, targetTemp);
}

View file

@ -52,7 +52,7 @@ void DesktopChain::resize(uint previousSize, uint newSize)
// But when desktops are removed, we may have to modify the chain a bit,
// otherwise invalid desktops may show up.
for (int i = 0; i < m_chain.size(); ++i) {
m_chain[i] = qMin(m_chain[i], newSize);
m_chain[i] = std::min(m_chain[i], newSize);
}
}
}

View file

@ -932,7 +932,7 @@ void Workspace::slotIncreaseWindowOpacity()
if (!m_activeWindow) {
return;
}
m_activeWindow->setOpacity(qMin(m_activeWindow->opacity() + 0.05, 1.0));
m_activeWindow->setOpacity(std::min(m_activeWindow->opacity() + 0.05, 1.0));
}
void Workspace::slotLowerWindowOpacity()

View file

@ -496,7 +496,7 @@ void VirtualDesktopManager::removeVirtualDesktop(VirtualDesktop *desktop)
}
}
const uint newCurrent = qMin(oldCurrent, (uint)m_desktops.count());
const uint newCurrent = std::min(oldCurrent, (uint)m_desktops.count());
m_current = m_desktops.at(newCurrent - 1);
if (oldCurrent != newCurrent) {
Q_EMIT currentChanged(oldCurrent, newCurrent);
@ -558,7 +558,7 @@ void VirtualDesktopManager::setCount(uint count)
m_desktops.resize(count);
if (m_current) {
uint oldCurrent = current();
uint newCurrent = qMin(oldCurrent, count);
uint newCurrent = std::min(oldCurrent, count);
m_current = m_desktops.at(newCurrent - 1);
if (oldCurrent != newCurrent) {
Q_EMIT currentChanged(oldCurrent, newCurrent);
@ -646,7 +646,7 @@ void VirtualDesktopManager::updateRootInfo()
void VirtualDesktopManager::updateLayout()
{
m_rows = qMin(m_rows, count());
m_rows = std::min(m_rows, count());
int columns = count() / m_rows;
Qt::Orientation orientation = Qt::Horizontal;
if (m_rootInfo) {

View file

@ -157,7 +157,7 @@ PlasmaVirtualDesktopInterface *PlasmaVirtualDesktopManagementInterface::createDe
return *i;
}
const quint32 actualPosition = qMin(position, (quint32)d->desktops.count());
const quint32 actualPosition = std::min(position, (quint32)d->desktops.count());
auto desktop = new PlasmaVirtualDesktopInterface(this);
desktop->d->id = id;

View file

@ -1075,7 +1075,7 @@ void Window::setDesktop(int desktop)
{
const int numberOfDesktops = VirtualDesktopManager::self()->count();
if (desktop != NET::OnAllDesktops) { // Do range check
desktop = std::max(1, qMin(numberOfDesktops, desktop));
desktop = std::max(1, std::min(numberOfDesktops, desktop));
}
QVector<VirtualDesktop *> desktops;
@ -1714,8 +1714,8 @@ void Window::checkUnrestrictedInteractiveMoveResize()
int left_marge, right_marge, top_marge, bottom_marge, titlebar_marge;
// restricted move/resize - keep at least part of the titlebar always visible
// how much must remain visible when moved away in that direction
left_marge = qMin(100. + borderRight(), moveResizeGeom.width());
right_marge = qMin(100. + borderLeft(), moveResizeGeom.width());
left_marge = std::min(100. + borderRight(), moveResizeGeom.width());
right_marge = std::min(100. + borderLeft(), moveResizeGeom.width());
// width/height change with opaque resizing, use the initial ones
titlebar_marge = initialInteractiveMoveResizeGeometry().height();
top_marge = borderBottom();
@ -1868,7 +1868,7 @@ void Window::handleInteractiveMoveResize(int x, int y, int x_root, int y_root)
}
// When doing a restricted move we must always keep 100px of the titlebar
// visible to allow the user to be able to move it again.
requiredPixels = qMin(100 * (transposed ? titleRect.width() : titleRect.height()),
requiredPixels = std::min(100 * (transposed ? titleRect.width() : titleRect.height()),
rect.width() * rect.height());
return titleRect;
};
@ -2498,7 +2498,7 @@ bool Window::performMouseCommand(Options::MouseCommand cmd, const QPointF &globa
break;
case Options::MouseOpacityMore:
if (!isDesktop()) { // No point in changing the opacity of the desktop
setOpacity(qMin(opacity() + 0.1, 1.0));
setOpacity(std::min(opacity() + 0.1, 1.0));
}
break;
case Options::MouseOpacityLess:
@ -4052,13 +4052,13 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaRight)) {
QRect rect = r & oldGeomWide;
if (!rect.isEmpty()) {
oldRightMax = qMin(oldRightMax, rect.x());
oldRightMax = std::min(oldRightMax, rect.x());
}
}
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaBottom)) {
QRect rect = r & oldGeomTall;
if (!rect.isEmpty()) {
oldBottomMax = qMin(oldBottomMax, rect.y());
oldBottomMax = std::min(oldBottomMax, rect.y());
}
}
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaLeft)) {
@ -4078,13 +4078,13 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
for (const QRect &r : workspace()->restrictedMoveArea(desktop, StrutAreaRight)) {
QRect rect = r & newGeomWide;
if (!rect.isEmpty()) {
rightMax = qMin(rightMax, rect.x());
rightMax = std::min(rightMax, rect.x());
}
}
for (const QRect &r : workspace()->restrictedMoveArea(desktop, StrutAreaBottom)) {
QRect rect = r & newGeomTall;
if (!rect.isEmpty()) {
bottomMax = qMin(bottomMax, rect.y());
bottomMax = std::min(bottomMax, rect.y());
}
}
for (const QRect &r : workspace()->restrictedMoveArea(desktop, StrutAreaLeft)) {
@ -4146,10 +4146,10 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
newGeom.moveTop(std::max(topMax, screenArea.y()));
}
if (save[Right] || keep[Right]) {
newGeom.moveRight(qMin(rightMax, screenArea.right()) + 1);
newGeom.moveRight(std::min(rightMax, screenArea.right()) + 1);
}
if (save[Bottom] || keep[Bottom]) {
newGeom.moveBottom(qMin(bottomMax, screenArea.bottom()) + 1);
newGeom.moveBottom(std::min(bottomMax, screenArea.bottom()) + 1);
}
if (oldGeometry.x() >= oldLeftMax && newGeom.x() < leftMax) {

View file

@ -1482,7 +1482,7 @@ void Workspace::slotDesktopRemoved(VirtualDesktop *desktop)
if ((*it)->desktops().count() > 1) {
(*it)->leaveDesktop(desktop);
} else {
sendWindowToDesktop(*it, qMin(desktop->x11DesktopNumber(), VirtualDesktopManager::self()->count()), true);
sendWindowToDesktop(*it, std::min(desktop->x11DesktopNumber(), VirtualDesktopManager::self()->count()), true);
}
}
@ -2351,9 +2351,9 @@ QRectF Workspace::adjustClientArea(Window *window, const QRectF &area) const
// They're given in virtual screen coordinates, make them affect only
// their xinerama screen.
strutLeft.setLeft(std::max(strutLeft.left(), screenArea.left()));
strutRight.setRight(qMin(strutRight.right(), screenArea.right()));
strutRight.setRight(std::min(strutRight.right(), screenArea.right()));
strutTop.setTop(std::max(strutTop.top(), screenArea.top()));
strutBottom.setBottom(qMin(strutBottom.bottom(), screenArea.bottom()));
strutBottom.setBottom(std::min(strutBottom.bottom(), screenArea.bottom()));
if (strutLeft.intersects(area)) {
adjustedArea.setLeft(strutLeft.right());

View file

@ -3581,8 +3581,8 @@ QSizeF X11Window::constrainClientSize(const QSizeF &size, SizeMode mode) const
min_size.setHeight(decominsize.height());
}
}
w = qMin(max_size.width(), w);
h = qMin(max_size.height(), h);
w = std::min(max_size.width(), w);
h = std::min(max_size.height(), h);
w = std::max(min_size.width(), w);
h = std::max(min_size.height(), h);
@ -4497,7 +4497,7 @@ void X11Window::maximize(MaximizeMode mode)
if (r.size() != clientArea.size()) { // to avoid off-by-one errors...
if (isElectricBorderMaximizing() && r.width() < clientArea.width()) {
r.moveLeft(std::max(clientArea.left(), Cursors::self()->mouse()->pos().x() - r.width() / 2));
r.moveRight(qMin(clientArea.right(), r.right()));
r.moveRight(std::min(clientArea.right(), r.right()));
} else {
r.moveCenter(clientArea.center());
const bool closeHeight = r.height() > 97 * clientArea.height() / 100;

View file

@ -75,7 +75,7 @@ Xvisit::Xvisit(Window *target, KWaylandServer::AbstractDataSource *dataSource, D
return;
}
xcb_atom_t *value = static_cast<xcb_atom_t *>(xcb_get_property_value(reply));
m_version = qMin(*value, Dnd::version());
m_version = std::min(*value, Dnd::version());
if (m_version < 1) {
// minimal version we accept is 1
doFinish();