qMax -> std::max
This commit is contained in:
parent
f1f58a186d
commit
b0b7c8b1d3
30 changed files with 97 additions and 97 deletions
|
@ -273,7 +273,7 @@ void BlurEffect::reconfigure(ReconfigureFlags flags)
|
|||
m_expandSize = blurOffsets[m_downSampleIterations - 1].expandSize;
|
||||
m_noiseStrength = BlurConfig::noiseStrength();
|
||||
|
||||
m_scalingFactor = qMax(1.0, QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96.0);
|
||||
m_scalingFactor = std::max(1.0, QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96.0);
|
||||
|
||||
updateTexture();
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ int DesktopGridEffect::gridColumns() const
|
|||
case DesktopLayoutMode::LayoutAutomatic:
|
||||
return ceil(sqrt(effects->numberOfDesktops()));
|
||||
case DesktopLayoutMode::LayoutCustom:
|
||||
return qMax(1.0, ceil(qreal(effects->numberOfDesktops()) / customLayoutRows()));
|
||||
return std::max(1.0, ceil(qreal(effects->numberOfDesktops()) / customLayoutRows()));
|
||||
case DesktopLayoutMode::LayoutPager:
|
||||
default:
|
||||
return effects->desktopGridSize().width();
|
||||
|
|
|
@ -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 * qMax(1 + diff, 1.2), m_targetZoom);
|
||||
m_zoom = qMin(m_zoom * std::max(1 + diff, 1.2), m_targetZoom);
|
||||
} else {
|
||||
m_zoom = qMax(m_zoom * qMin(1 - diff, 0.8), m_targetZoom);
|
||||
m_zoom = std::max(m_zoom * qMin(1 - diff, 0.8), m_targetZoom);
|
||||
if (m_zoom == 1.0) {
|
||||
// zoom ended - delete FBO and texture
|
||||
m_fbo.reset();
|
||||
|
|
|
@ -164,7 +164,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()),
|
||||
qMax(pos.x(), pos2.x()), qMax(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);
|
||||
} else if (!drawing.isEmpty()) {
|
||||
|
|
|
@ -291,7 +291,7 @@ void SlideBackEffect::slotTabBoxAdded()
|
|||
|
||||
void SlideBackEffect::slotTabBoxClosed()
|
||||
{
|
||||
m_tabboxActive = qMax(m_tabboxActive - 1, 0);
|
||||
m_tabboxActive = std::max(m_tabboxActive - 1, 0);
|
||||
}
|
||||
|
||||
bool SlideBackEffect::isWindowUsable(EffectWindow *w)
|
||||
|
|
|
@ -151,7 +151,7 @@ void ThumbnailAsideEffect::arrange()
|
|||
qreal mwidth = 0;
|
||||
for (const Data &d : std::as_const(windows)) {
|
||||
height += d.window->height();
|
||||
mwidth = qMax(mwidth, d.window->width());
|
||||
mwidth = std::max(mwidth, d.window->width());
|
||||
pos[d.index] = d.window->height();
|
||||
}
|
||||
EffectScreen *effectiveScreen = effects->findScreen(screen);
|
||||
|
|
|
@ -285,8 +285,8 @@ void WobblyWindowsEffect::apply(EffectWindow *w, int mask, WindowPaintData &data
|
|||
}
|
||||
left = qMin(left, quads[i].left());
|
||||
top = qMin(top, quads[i].top());
|
||||
right = qMax(right, quads[i].right());
|
||||
bottom = qMax(bottom, quads[i].bottom());
|
||||
right = std::max(right, quads[i].right());
|
||||
bottom = std::max(bottom, quads[i].bottom());
|
||||
}
|
||||
QRectF dirtyRect(
|
||||
left * data.xScale() + w->x() + data.xTranslation(),
|
||||
|
|
|
@ -199,7 +199,7 @@ void ZoomEffect::reconfigure(ReconfigureFlags)
|
|||
{
|
||||
ZoomConfig::self()->read();
|
||||
// On zoom-in and zoom-out change the zoom by the defined zoom-factor.
|
||||
zoomFactor = qMax(0.1, ZoomConfig::zoomFactor());
|
||||
zoomFactor = std::max(0.1, ZoomConfig::zoomFactor());
|
||||
// Visibility of the mouse-pointer.
|
||||
mousePointer = MousePointerType(ZoomConfig::mousePointer());
|
||||
// Track moving of the mouse.
|
||||
|
@ -211,9 +211,9 @@ void ZoomEffect::reconfigure(ReconfigureFlags)
|
|||
m_accessibilityIntegration->setTextCaretTrackingEnabled(ZoomConfig::enableTextCaretTracking());
|
||||
#endif
|
||||
// The time in milliseconds to wait before a focus-event takes away a mouse-move.
|
||||
focusDelay = qMax(uint(0), ZoomConfig::focusDelay());
|
||||
focusDelay = std::max(uint(0), ZoomConfig::focusDelay());
|
||||
// The factor the zoom-area will be moved on touching an edge on push-mode or using the navigation KAction's.
|
||||
moveFactor = qMax(0.1, ZoomConfig::moveFactor());
|
||||
moveFactor = std::max(0.1, ZoomConfig::moveFactor());
|
||||
if (source_zoom < 0) {
|
||||
// Load the saved zoom value.
|
||||
source_zoom = 1.0;
|
||||
|
@ -239,7 +239,7 @@ void ZoomEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseco
|
|||
if (target_zoom > zoom) {
|
||||
zoom = qMin(zoom + ((zoomDist * time) / animationTime(150 * zoomFactor)), target_zoom);
|
||||
} else {
|
||||
zoom = qMax(zoom - ((zoomDist * time) / animationTime(150 * zoomFactor)), target_zoom);
|
||||
zoom = std::max(zoom - ((zoomDist * time) / animationTime(150 * zoomFactor)), target_zoom);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,8 +319,8 @@ void ZoomEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData &d
|
|||
prevPoint = cursorPoint;
|
||||
// fall through
|
||||
case MouseTrackingDisabled:
|
||||
xTranslation = qMin(0, qMax(int(screenSize.width() - screenSize.width() * zoom), int(screenSize.width() / 2 - prevPoint.x() * zoom)));
|
||||
yTranslation = qMin(0, qMax(int(screenSize.height() - screenSize.height() * zoom), int(screenSize.height() / 2 - prevPoint.y() * zoom)));
|
||||
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)));
|
||||
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 ®ion, ScreenPaintData &d
|
|||
yMove = (y + threshold - screenSize.height()) / zoom;
|
||||
}
|
||||
if (xMove) {
|
||||
prevPoint.setX(qMax(0, qMin(screenSize.width(), prevPoint.x() + xMove)));
|
||||
prevPoint.setX(std::max(0, qMin(screenSize.width(), prevPoint.x() + xMove)));
|
||||
}
|
||||
if (yMove) {
|
||||
prevPoint.setY(qMax(0, qMin(screenSize.height(), prevPoint.y() + yMove)));
|
||||
prevPoint.setY(std::max(0, qMin(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(qMax(0, qMin(screenSize.width(), prevPoint.x() + xMove)));
|
||||
prevPoint.setY(qMax(0, qMin(screenSize.height(), prevPoint.y() + yMove)));
|
||||
prevPoint.setX(std::max(0, qMin(screenSize.width(), prevPoint.x() + xMove)));
|
||||
prevPoint.setY(std::max(0, qMin(screenSize.height(), prevPoint.y() + yMove)));
|
||||
cursorPoint = prevPoint;
|
||||
effects->addRepaintFull();
|
||||
}
|
||||
|
@ -492,17 +492,17 @@ void ZoomEffect::moveZoom(int x, int y)
|
|||
|
||||
const QSize screenSize = effects->virtualScreenSize();
|
||||
if (x < 0) {
|
||||
xMove = -qMax(1.0, screenSize.width() / zoom / moveFactor);
|
||||
xMove = -std::max(1.0, screenSize.width() / zoom / moveFactor);
|
||||
} else if (x > 0) {
|
||||
xMove = qMax(1.0, screenSize.width() / zoom / moveFactor);
|
||||
xMove = std::max(1.0, screenSize.width() / zoom / moveFactor);
|
||||
} else {
|
||||
xMove = 0;
|
||||
}
|
||||
|
||||
if (y < 0) {
|
||||
yMove = -qMax(1.0, screenSize.height() / zoom / moveFactor);
|
||||
yMove = -std::max(1.0, screenSize.height() / zoom / moveFactor);
|
||||
} else if (y > 0) {
|
||||
yMove = qMax(1.0, screenSize.height() / zoom / moveFactor);
|
||||
yMove = std::max(1.0, screenSize.height() / zoom / moveFactor);
|
||||
} else {
|
||||
yMove = 0;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ void ButtonsModel::add(int index, int type)
|
|||
|
||||
void ButtonsModel::move(int sourceIndex, int targetIndex)
|
||||
{
|
||||
if (sourceIndex == qMax(0, targetIndex)) {
|
||||
if (sourceIndex == std::max(0, targetIndex)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -153,10 +153,10 @@ void ButtonsModel::move(int sourceIndex, int targetIndex)
|
|||
// Row will be moved down
|
||||
beginMoveRows(QModelIndex(), sourceIndex, sourceIndex, QModelIndex(), targetIndex + 1);
|
||||
} else {
|
||||
beginMoveRows(QModelIndex(), sourceIndex, sourceIndex, QModelIndex(), qMax(0, targetIndex));
|
||||
beginMoveRows(QModelIndex(), sourceIndex, sourceIndex, QModelIndex(), std::max(0, targetIndex));
|
||||
}
|
||||
|
||||
m_buttons.move(sourceIndex, qMax(0, targetIndex));
|
||||
m_buttons.move(sourceIndex, std::max(0, targetIndex));
|
||||
endMoveRows();
|
||||
}
|
||||
|
||||
|
|
|
@ -921,8 +921,8 @@ void AnimationEffect::updateLayerRepaints()
|
|||
case Scale: {
|
||||
createRegion = true;
|
||||
const QSize sz = entry.key()->frameGeometry().size().toSize();
|
||||
float fx = qMax(fixOvershoot(anim->from[0], *anim, 1), fixOvershoot(anim->to[0], *anim, 2));
|
||||
// float fx = qMax(interpolated(*anim,0), anim->to[0]);
|
||||
float fx = std::max(fixOvershoot(anim->from[0], *anim, 1), fixOvershoot(anim->to[0], *anim, 2));
|
||||
// float fx = std::max(interpolated(*anim,0), anim->to[0]);
|
||||
if (fx >= 0.0) {
|
||||
if (anim->attribute == Size) {
|
||||
fx /= sz.width();
|
||||
|
@ -930,8 +930,8 @@ void AnimationEffect::updateLayerRepaints()
|
|||
f[0] *= fx;
|
||||
t[0] += geometryCompensation(anim->meta & AnimationEffect::Horizontal, fx) * sz.width();
|
||||
}
|
||||
// float fy = qMax(interpolated(*anim,1), anim->to[1]);
|
||||
float fy = qMax(fixOvershoot(anim->from[1], *anim, 1), fixOvershoot(anim->to[1], *anim, 2));
|
||||
// float fy = std::max(interpolated(*anim,1), anim->to[1]);
|
||||
float fy = std::max(fixOvershoot(anim->from[1], *anim, 1), fixOvershoot(anim->to[1], *anim, 2));
|
||||
if (fy >= 0.0) {
|
||||
if (anim->attribute == Size) {
|
||||
fy /= sz.height();
|
||||
|
|
|
@ -576,13 +576,13 @@ QPoint Effect::cursorPos()
|
|||
double Effect::animationTime(const KConfigGroup &cfg, const QString &key, int defaultTime)
|
||||
{
|
||||
int time = cfg.readEntry(key, 0);
|
||||
return time != 0 ? time : qMax(defaultTime * effects->animationTimeFactor(), 1.);
|
||||
return time != 0 ? time : std::max(defaultTime * effects->animationTimeFactor(), 1.);
|
||||
}
|
||||
|
||||
double Effect::animationTime(int defaultTime)
|
||||
{
|
||||
// at least 1ms, otherwise 0ms times can break some things
|
||||
return qMax(defaultTime * effects->animationTimeFactor(), 1.);
|
||||
return std::max(defaultTime * effects->animationTimeFactor(), 1.);
|
||||
}
|
||||
|
||||
int Effect::requestedEffectChainPosition() const
|
||||
|
@ -939,9 +939,9 @@ WindowQuadList WindowQuadList::makeGrid(int maxQuadSize) const
|
|||
|
||||
for (const WindowQuad &quad : std::as_const(*this)) {
|
||||
left = qMin(left, quad.left());
|
||||
right = qMax(right, quad.right());
|
||||
right = std::max(right, quad.right());
|
||||
top = qMin(top, quad.top());
|
||||
bottom = qMax(bottom, quad.bottom());
|
||||
bottom = std::max(bottom, quad.bottom());
|
||||
}
|
||||
|
||||
WindowQuadList ret;
|
||||
|
@ -964,11 +964,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 = qMax(y, quadTop);
|
||||
const double y0 = std::max(y, quadTop);
|
||||
const double y1 = qMin(quadBottom, y + maxQuadSize);
|
||||
|
||||
for (double x = xBegin; x < quadRight; x += maxQuadSize) {
|
||||
const double x0 = qMax(x, quadLeft);
|
||||
const double x0 = std::max(x, quadLeft);
|
||||
const double x1 = qMin(quadRight, x + maxQuadSize);
|
||||
|
||||
ret.append(quad.makeSubQuad(x0, y0, x1, y1));
|
||||
|
@ -993,9 +993,9 @@ WindowQuadList WindowQuadList::makeRegularGrid(int xSubdivisions, int ySubdivisi
|
|||
|
||||
for (const WindowQuad &quad : *this) {
|
||||
left = qMin(left, quad.left());
|
||||
right = qMax(right, quad.right());
|
||||
right = std::max(right, quad.right());
|
||||
top = qMin(top, quad.top());
|
||||
bottom = qMax(bottom, quad.bottom());
|
||||
bottom = std::max(bottom, quad.bottom());
|
||||
}
|
||||
|
||||
double xIncrement = (right - left) / xSubdivisions;
|
||||
|
@ -1021,11 +1021,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 = qMax(y, quadTop);
|
||||
const double y0 = std::max(y, quadTop);
|
||||
const double y1 = qMin(quadBottom, y + yIncrement);
|
||||
|
||||
for (double x = xBegin; x < quadRight; x += xIncrement) {
|
||||
const double x0 = qMax(x, quadLeft);
|
||||
const double x0 = std::max(x, quadLeft);
|
||||
const double x1 = qMin(quadRight, x + xIncrement);
|
||||
|
||||
ret.append(quad.makeSubQuad(x0, y0, x1, y1));
|
||||
|
|
|
@ -4146,7 +4146,7 @@ inline double WindowQuad::left() const
|
|||
|
||||
inline double WindowQuad::right() const
|
||||
{
|
||||
return qMax(verts[0].px, qMax(verts[1].px, qMax(verts[2].px, verts[3].px)));
|
||||
return std::max(verts[0].px, std::max(verts[1].px, std::max(verts[2].px, verts[3].px)));
|
||||
}
|
||||
|
||||
inline double WindowQuad::top() const
|
||||
|
@ -4156,7 +4156,7 @@ inline double WindowQuad::top() const
|
|||
|
||||
inline double WindowQuad::bottom() const
|
||||
{
|
||||
return qMax(verts[0].py, qMax(verts[1].py, qMax(verts[2].py, verts[3].py)));
|
||||
return std::max(verts[0].py, std::max(verts[1].py, std::max(verts[2].py, verts[3].py)));
|
||||
}
|
||||
|
||||
inline QRectF WindowQuad::bounds() const
|
||||
|
@ -4203,7 +4203,7 @@ void Motion<T>::calculate(const int msec)
|
|||
}
|
||||
|
||||
// Poor man's time independent calculation
|
||||
int steps = qMax(1, msec / 5);
|
||||
int steps = std::max(1, msec / 5);
|
||||
for (int i = 0; i < steps; i++) {
|
||||
T diff = m_target - m_value;
|
||||
T strength = diff * m_strength;
|
||||
|
|
|
@ -1740,8 +1740,8 @@ void GLVertexBufferPrivate::reallocatePersistentBuffer(size_t size)
|
|||
}
|
||||
|
||||
// Round the size up to 64 kb
|
||||
size_t minSize = qMax<size_t>(frameSizes.average() * 3, 128 * 1024);
|
||||
bufferSize = qMax(size, minSize);
|
||||
size_t minSize = std::max<size_t>(frameSizes.average() * 3, 128 * 1024);
|
||||
bufferSize = std::max(size, minSize);
|
||||
|
||||
const GLbitfield storage = GL_DYNAMIC_STORAGE_BIT;
|
||||
const GLbitfield access = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
|
||||
|
@ -1823,7 +1823,7 @@ void GLVertexBufferPrivate::reallocateBuffer(size_t size)
|
|||
{
|
||||
// Round the size up to 4 Kb for streaming/dynamic buffers.
|
||||
const size_t minSize = 32768; // Minimum size for streaming buffers
|
||||
const size_t alloc = usage != GL_STATIC_DRAW ? qMax(size, minSize) : size;
|
||||
const size_t alloc = usage != GL_STATIC_DRAW ? std::max(size, minSize) : size;
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, alloc, nullptr, usage);
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
const int count = parser.value(outputCountOption).toInt(&ok);
|
||||
if (ok) {
|
||||
outputCount = qMax(1, count);
|
||||
outputCount = std::max(1, count);
|
||||
}
|
||||
|
||||
// TODO: create backend without having the server running
|
||||
|
|
|
@ -306,7 +306,7 @@ void Options::setFocusStealingPreventionLevel(int focusStealingPreventionLevel)
|
|||
if (m_focusStealingPreventionLevel == focusStealingPreventionLevel) {
|
||||
return;
|
||||
}
|
||||
m_focusStealingPreventionLevel = qMax(0, qMin(4, focusStealingPreventionLevel));
|
||||
m_focusStealingPreventionLevel = std::max(0, qMin(4, focusStealingPreventionLevel));
|
||||
Q_EMIT focusStealingPreventionLevelChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -235,9 +235,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 = qMax(cxl, xl);
|
||||
xl = std::max(cxl, xl);
|
||||
xr = qMin(cxr, xr);
|
||||
yt = qMax(cyt, yt);
|
||||
yt = std::max(cyt, yt);
|
||||
yb = qMin(cyb, yb);
|
||||
if (client->keepAbove()) {
|
||||
overlap += 16 * (xr - xl) * (yb - yt);
|
||||
|
|
|
@ -556,16 +556,16 @@ void Decoration::updateExtendedBorders()
|
|||
|
||||
if (settings()->borderSize() == KDecoration2::BorderSize::None) {
|
||||
if (!clientPointer()->isMaximizedHorizontally()) {
|
||||
extLeft = qMax(m_extendedBorders->left(), extSize);
|
||||
extRight = qMax(m_extendedBorders->right(), extSize);
|
||||
extLeft = std::max(m_extendedBorders->left(), extSize);
|
||||
extRight = std::max(m_extendedBorders->right(), extSize);
|
||||
}
|
||||
if (!clientPointer()->isMaximizedVertically()) {
|
||||
extBottom = qMax(m_extendedBorders->bottom(), extSize);
|
||||
extBottom = std::max(m_extendedBorders->bottom(), extSize);
|
||||
}
|
||||
|
||||
} else if (settings()->borderSize() == KDecoration2::BorderSize::NoSides && !clientPointer()->isMaximizedHorizontally()) {
|
||||
extLeft = qMax(m_extendedBorders->left(), extSize);
|
||||
extRight = qMax(m_extendedBorders->right(), extSize);
|
||||
extLeft = std::max(m_extendedBorders->left(), extSize);
|
||||
extRight = std::max(m_extendedBorders->right(), extSize);
|
||||
}
|
||||
|
||||
setResizeOnlyBorders(QMargins(extLeft, 0, extRight, extBottom));
|
||||
|
|
|
@ -170,8 +170,8 @@ const QString &AuroraeTheme::themeName() const
|
|||
|
||||
void AuroraeTheme::borders(int &left, int &top, int &right, int &bottom, bool maximized) const
|
||||
{
|
||||
const qreal titleHeight = qMax((qreal)d->themeConfig.titleHeight(),
|
||||
d->themeConfig.buttonHeight() * buttonSizeFactor() + d->themeConfig.buttonMarginTop());
|
||||
const qreal titleHeight = std::max((qreal)d->themeConfig.titleHeight(),
|
||||
d->themeConfig.buttonHeight() * buttonSizeFactor() + d->themeConfig.buttonMarginTop());
|
||||
if (maximized) {
|
||||
const qreal title = titleHeight + d->themeConfig.titleEdgeTopMaximized() + d->themeConfig.titleEdgeBottomMaximized();
|
||||
switch ((DecorationPosition)d->themeConfig.decorationPosition()) {
|
||||
|
|
|
@ -348,7 +348,7 @@ QPixmap PlastikButtonProvider::icon(ButtonIcon icon, int size, bool active, bool
|
|||
lw2 = 1;
|
||||
}
|
||||
|
||||
int h = qMax((r.width() / 2), (lw1 + 2 * lw2));
|
||||
int h = std::max((r.width() / 2), (lw1 + 2 * lw2));
|
||||
|
||||
// horizontal bars
|
||||
drawObject(p, HorizontalLine, r.x(), r.y(), r.width(), lw1);
|
||||
|
|
|
@ -298,7 +298,7 @@ void NightColorManager::readConfig()
|
|||
}
|
||||
m_morning = mrB;
|
||||
m_evening = evB;
|
||||
m_trTime = qMax(trTime / 1000 / 60, 1);
|
||||
m_trTime = std::max(trTime / 1000 / 60, 1);
|
||||
}
|
||||
|
||||
void NightColorManager::resetAllTimers()
|
||||
|
@ -355,7 +355,7 @@ void NightColorManager::quickAdjust(int targetTemp)
|
|||
if (m_currentTemp < targetTemp) {
|
||||
nextTemp = qMin(m_currentTemp + TEMPERATURE_STEP, targetTemp);
|
||||
} else {
|
||||
nextTemp = qMax(m_currentTemp - TEMPERATURE_STEP, targetTemp);
|
||||
nextTemp = std::max(m_currentTemp - TEMPERATURE_STEP, targetTemp);
|
||||
}
|
||||
commitGammaRamps(nextTemp);
|
||||
|
||||
|
@ -449,7 +449,7 @@ void NightColorManager::slowUpdate(int targetTemp)
|
|||
if (m_currentTemp < targetTemp) {
|
||||
nextTemp = qMin(m_currentTemp + TEMPERATURE_STEP, targetTemp);
|
||||
} else {
|
||||
nextTemp = qMax(m_currentTemp - TEMPERATURE_STEP, targetTemp);
|
||||
nextTemp = std::max(m_currentTemp - TEMPERATURE_STEP, targetTemp);
|
||||
}
|
||||
commitGammaRamps(nextTemp);
|
||||
if (nextTemp == targetTemp) {
|
||||
|
|
|
@ -30,13 +30,13 @@ bool isOpenGLES()
|
|||
|
||||
EGLConfig configFromFormat(EGLDisplay display, const QSurfaceFormat &surfaceFormat, EGLint surfaceType)
|
||||
{
|
||||
// qMax as these values are initialized to -1 by default.
|
||||
const EGLint redSize = qMax(surfaceFormat.redBufferSize(), 0);
|
||||
const EGLint greenSize = qMax(surfaceFormat.greenBufferSize(), 0);
|
||||
const EGLint blueSize = qMax(surfaceFormat.blueBufferSize(), 0);
|
||||
const EGLint alphaSize = qMax(surfaceFormat.alphaBufferSize(), 0);
|
||||
const EGLint depthSize = qMax(surfaceFormat.depthBufferSize(), 0);
|
||||
const EGLint stencilSize = qMax(surfaceFormat.stencilBufferSize(), 0);
|
||||
// std::max as these values are initialized to -1 by default.
|
||||
const EGLint redSize = std::max(surfaceFormat.redBufferSize(), 0);
|
||||
const EGLint greenSize = std::max(surfaceFormat.greenBufferSize(), 0);
|
||||
const EGLint blueSize = std::max(surfaceFormat.blueBufferSize(), 0);
|
||||
const EGLint alphaSize = std::max(surfaceFormat.alphaBufferSize(), 0);
|
||||
const EGLint depthSize = std::max(surfaceFormat.depthBufferSize(), 0);
|
||||
const EGLint stencilSize = std::max(surfaceFormat.stencilBufferSize(), 0);
|
||||
|
||||
const EGLint renderableType = isOpenGLES() ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_BIT;
|
||||
|
||||
|
|
|
@ -921,8 +921,8 @@ void SceneOpenGLDecorationRenderer::resizeTexture()
|
|||
client()->window()->layoutDecorationRects(left, top, right, bottom);
|
||||
QSize size;
|
||||
|
||||
size.rwidth() = toNativeSize(qMax(qMax(top.width(), bottom.width()),
|
||||
qMax(left.height(), right.height())));
|
||||
size.rwidth() = toNativeSize(std::max(std::max(top.width(), bottom.width()),
|
||||
std::max(left.height(), right.height())));
|
||||
size.rheight() = toNativeSize(top.height()) + toNativeSize(bottom.height()) + toNativeSize(left.width()) + toNativeSize(right.width());
|
||||
|
||||
size.rheight() += 4 * (2 * TexturePad);
|
||||
|
|
|
@ -654,7 +654,7 @@ void Edge::updateApproaching(const QPoint &point)
|
|||
int factor = 0;
|
||||
const int edgeDistance = m_edges->cornerOffset();
|
||||
auto cornerDistance = [=](const QPoint &corner) {
|
||||
return qMax(qAbs(corner.x() - point.x()), qAbs(corner.y() - point.y()));
|
||||
return std::max(qAbs(corner.x() - point.x()), qAbs(corner.y() - point.y()));
|
||||
};
|
||||
switch (border()) {
|
||||
case ElectricTopLeft:
|
||||
|
@ -813,7 +813,7 @@ void ScreenEdges::reconfigure()
|
|||
// TODO: migrate settings to a group ScreenEdges
|
||||
KConfigGroup windowsConfig = m_config->group("Windows");
|
||||
setTimeThreshold(windowsConfig.readEntry("ElectricBorderDelay", 150));
|
||||
setReActivationThreshold(qMax(timeThreshold() + 50, windowsConfig.readEntry("ElectricBorderCooldown", 350)));
|
||||
setReActivationThreshold(std::max(timeThreshold() + 50, windowsConfig.readEntry("ElectricBorderCooldown", 350)));
|
||||
int desktopSwitching = windowsConfig.readEntry("ElectricBorders", static_cast<int>(ElectricDisabled));
|
||||
if (desktopSwitching == ElectricDisabled) {
|
||||
setDesktopSwitching(false);
|
||||
|
|
|
@ -940,7 +940,7 @@ void Workspace::slotLowerWindowOpacity()
|
|||
if (!m_activeWindow) {
|
||||
return;
|
||||
}
|
||||
m_activeWindow->setOpacity(qMax(m_activeWindow->opacity() - 0.05, 0.05));
|
||||
m_activeWindow->setOpacity(std::max(m_activeWindow->opacity() - 0.05, 0.05));
|
||||
}
|
||||
|
||||
void Workspace::closeActivePopup()
|
||||
|
|
|
@ -1002,7 +1002,7 @@ public:
|
|||
if (!hasMaxSize()) {
|
||||
return QSize(INT_MAX, INT_MAX);
|
||||
}
|
||||
const QSize size(qMax(m_sizeHints->maxWidth, 1), qMax(m_sizeHints->maxHeight, 1));
|
||||
const QSize size(std::max(m_sizeHints->maxWidth, 1), std::max(m_sizeHints->maxHeight, 1));
|
||||
return fromXNative(size);
|
||||
}
|
||||
QSizeF minSize() const
|
||||
|
@ -1043,7 +1043,7 @@ public:
|
|||
return QSize(1, INT_MAX);
|
||||
}
|
||||
// prevent division by zero
|
||||
return QSize(m_sizeHints->minAspect[0], qMax(m_sizeHints->minAspect[1], 1));
|
||||
return QSize(m_sizeHints->minAspect[0], std::max(m_sizeHints->minAspect[1], 1));
|
||||
}
|
||||
QSize maxAspect() const
|
||||
{
|
||||
|
@ -1051,7 +1051,7 @@ public:
|
|||
return QSize(INT_MAX, 1);
|
||||
}
|
||||
// prevent division by zero
|
||||
return QSize(m_sizeHints->maxAspect[0], qMax(m_sizeHints->maxAspect[1], 1));
|
||||
return QSize(m_sizeHints->maxAspect[0], std::max(m_sizeHints->maxAspect[1], 1));
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -652,7 +652,7 @@ void VirtualDesktopManager::updateLayout()
|
|||
if (m_rootInfo) {
|
||||
// TODO: Is there a sane way to avoid overriding the existing grid?
|
||||
columns = m_rootInfo->desktopLayoutColumnsRows().width();
|
||||
m_rows = qMax(1, m_rootInfo->desktopLayoutColumnsRows().height());
|
||||
m_rows = std::max(1, m_rootInfo->desktopLayoutColumnsRows().height());
|
||||
orientation = m_rootInfo->desktopLayoutOrientation() == NET::OrientationHorizontal ? Qt::Horizontal : Qt::Vertical;
|
||||
}
|
||||
|
||||
|
@ -780,7 +780,7 @@ void VirtualDesktopManager::setNETDesktopLayout(Qt::Orientation orientation, uin
|
|||
}
|
||||
}
|
||||
|
||||
m_rows = qMax(1u, height);
|
||||
m_rows = std::max(1u, height);
|
||||
|
||||
m_grid.update(QSize(width, height), orientation, m_desktops);
|
||||
// TODO: why is there no call to m_rootInfo->setDesktopLayout?
|
||||
|
|
|
@ -212,8 +212,8 @@ void KeyboardInterface::sendModifiers(quint32 depressed, quint32 latched, quint3
|
|||
|
||||
void KeyboardInterface::setRepeatInfo(qint32 charactersPerSecond, qint32 delay)
|
||||
{
|
||||
d->keyRepeat.charactersPerSecond = qMax(charactersPerSecond, 0);
|
||||
d->keyRepeat.delay = qMax(delay, 0);
|
||||
d->keyRepeat.charactersPerSecond = std::max(charactersPerSecond, 0);
|
||||
d->keyRepeat.delay = std::max(delay, 0);
|
||||
const QList<KeyboardInterfacePrivate::Resource *> keyboards = d->resourceMap().values();
|
||||
for (KeyboardInterfacePrivate::Resource *keyboardResource : keyboards) {
|
||||
if (keyboardResource->version() >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) {
|
||||
|
|
|
@ -1075,7 +1075,7 @@ void Window::setDesktop(int desktop)
|
|||
{
|
||||
const int numberOfDesktops = VirtualDesktopManager::self()->count();
|
||||
if (desktop != NET::OnAllDesktops) { // Do range check
|
||||
desktop = qMax(1, qMin(numberOfDesktops, desktop));
|
||||
desktop = std::max(1, qMin(numberOfDesktops, desktop));
|
||||
}
|
||||
|
||||
QVector<VirtualDesktop *> desktops;
|
||||
|
@ -2503,7 +2503,7 @@ bool Window::performMouseCommand(Options::MouseCommand cmd, const QPointF &globa
|
|||
break;
|
||||
case Options::MouseOpacityLess:
|
||||
if (!isDesktop()) { // No point in changing the opacity of the desktop
|
||||
setOpacity(qMax(opacity() - 0.1, 0.1));
|
||||
setOpacity(std::max(opacity() - 0.1, 0.1));
|
||||
}
|
||||
break;
|
||||
case Options::MouseClose:
|
||||
|
@ -4046,7 +4046,7 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
|
|||
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaTop)) {
|
||||
QRect rect = r & oldGeomTall;
|
||||
if (!rect.isEmpty()) {
|
||||
oldTopMax = qMax(oldTopMax, rect.y() + rect.height());
|
||||
oldTopMax = std::max(oldTopMax, rect.y() + rect.height());
|
||||
}
|
||||
}
|
||||
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaRight)) {
|
||||
|
@ -4064,7 +4064,7 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
|
|||
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaLeft)) {
|
||||
QRect rect = r & oldGeomWide;
|
||||
if (!rect.isEmpty()) {
|
||||
oldLeftMax = qMax(oldLeftMax, rect.x() + rect.width());
|
||||
oldLeftMax = std::max(oldLeftMax, rect.x() + rect.width());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4072,7 +4072,7 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
|
|||
for (const QRect &r : workspace()->restrictedMoveArea(desktop, StrutAreaTop)) {
|
||||
QRect rect = r & newGeomTall;
|
||||
if (!rect.isEmpty()) {
|
||||
topMax = qMax(topMax, rect.y() + rect.height());
|
||||
topMax = std::max(topMax, rect.y() + rect.height());
|
||||
}
|
||||
}
|
||||
for (const QRect &r : workspace()->restrictedMoveArea(desktop, StrutAreaRight)) {
|
||||
|
@ -4090,7 +4090,7 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
|
|||
for (const QRect &r : workspace()->restrictedMoveArea(desktop, StrutAreaLeft)) {
|
||||
QRect rect = r & newGeomWide;
|
||||
if (!rect.isEmpty()) {
|
||||
leftMax = qMax(leftMax, rect.x() + rect.width());
|
||||
leftMax = std::max(leftMax, rect.x() + rect.width());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4140,10 +4140,10 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
|
|||
}
|
||||
|
||||
if (save[Left] || keep[Left]) {
|
||||
newGeom.moveLeft(qMax(leftMax, screenArea.x()));
|
||||
newGeom.moveLeft(std::max(leftMax, screenArea.x()));
|
||||
}
|
||||
if (save[Top] || keep[Top]) {
|
||||
newGeom.moveTop(qMax(topMax, screenArea.y()));
|
||||
newGeom.moveTop(std::max(topMax, screenArea.y()));
|
||||
}
|
||||
if (save[Right] || keep[Right]) {
|
||||
newGeom.moveRight(qMin(rightMax, screenArea.right()) + 1);
|
||||
|
@ -4153,10 +4153,10 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol
|
|||
}
|
||||
|
||||
if (oldGeometry.x() >= oldLeftMax && newGeom.x() < leftMax) {
|
||||
newGeom.setLeft(qMax(leftMax, screenArea.x()));
|
||||
newGeom.setLeft(std::max(leftMax, screenArea.x()));
|
||||
}
|
||||
if (oldGeometry.y() >= oldTopMax && newGeom.y() < topMax) {
|
||||
newGeom.setTop(qMax(topMax, screenArea.y()));
|
||||
newGeom.setTop(std::max(topMax, screenArea.y()));
|
||||
}
|
||||
|
||||
checkOffscreenPosition(&newGeom, screenArea);
|
||||
|
|
|
@ -2350,9 +2350,9 @@ QRectF Workspace::adjustClientArea(Window *window, const QRectF &area) const
|
|||
// Handle struts at xinerama edges that are inside the virtual screen.
|
||||
// They're given in virtual screen coordinates, make them affect only
|
||||
// their xinerama screen.
|
||||
strutLeft.setLeft(qMax(strutLeft.left(), screenArea.left()));
|
||||
strutLeft.setLeft(std::max(strutLeft.left(), screenArea.left()));
|
||||
strutRight.setRight(qMin(strutRight.right(), screenArea.right()));
|
||||
strutTop.setTop(qMax(strutTop.top(), screenArea.top()));
|
||||
strutTop.setTop(std::max(strutTop.top(), screenArea.top()));
|
||||
strutBottom.setBottom(qMin(strutBottom.bottom(), screenArea.bottom()));
|
||||
|
||||
if (strutLeft.intersects(area)) {
|
||||
|
@ -2676,11 +2676,11 @@ QPointF Workspace::adjustWindowPosition(Window *window, QPointF pos, bool unrest
|
|||
QRectF geo = window->frameGeometry();
|
||||
if (window->maximizeMode() & MaximizeHorizontal && (geo.x() == maxRect.left() || geo.right() == maxRect.right())) {
|
||||
guideMaximized |= MaximizeHorizontal;
|
||||
borderSnapZone.setWidth(qMax(borderSnapZone.width() + 2, maxRect.width() / 16));
|
||||
borderSnapZone.setWidth(std::max(borderSnapZone.width() + 2, maxRect.width() / 16));
|
||||
}
|
||||
if (window->maximizeMode() & MaximizeVertical && (geo.y() == maxRect.top() || geo.bottom() == maxRect.bottom())) {
|
||||
guideMaximized |= MaximizeVertical;
|
||||
borderSnapZone.setHeight(qMax(borderSnapZone.height() + 2, maxRect.height() / 16));
|
||||
borderSnapZone.setHeight(std::max(borderSnapZone.height() + 2, maxRect.height() / 16));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3583,8 +3583,8 @@ QSizeF X11Window::constrainClientSize(const QSizeF &size, SizeMode mode) const
|
|||
}
|
||||
w = qMin(max_size.width(), w);
|
||||
h = qMin(max_size.height(), h);
|
||||
w = qMax(min_size.width(), w);
|
||||
h = qMax(min_size.height(), h);
|
||||
w = std::max(min_size.width(), w);
|
||||
h = std::max(min_size.height(), h);
|
||||
|
||||
if (!rules()->checkStrictGeometry(!isFullScreen())) {
|
||||
// Disobey increments and aspect by explicit rule.
|
||||
|
@ -4496,7 +4496,7 @@ void X11Window::maximize(MaximizeMode mode)
|
|||
r.setSize(constrainFrameSize(r.size(), SizeModeMax));
|
||||
if (r.size() != clientArea.size()) { // to avoid off-by-one errors...
|
||||
if (isElectricBorderMaximizing() && r.width() < clientArea.width()) {
|
||||
r.moveLeft(qMax(clientArea.left(), Cursors::self()->mouse()->pos().x() - r.width() / 2));
|
||||
r.moveLeft(std::max(clientArea.left(), Cursors::self()->mouse()->pos().x() - r.width() / 2));
|
||||
r.moveRight(qMin(clientArea.right(), r.right()));
|
||||
} else {
|
||||
r.moveCenter(clientArea.center());
|
||||
|
|
Loading…
Reference in a new issue