diff --git a/abstract_client.h b/abstract_client.h --- a/abstract_client.h +++ b/abstract_client.h @@ -635,25 +635,25 @@ virtual void setFrameGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) = 0; void setFrameGeometry(const QRect &rect, ForceGeometry_t force = NormalGeometrySet); /// How to resize the window in order to obey constains (mainly aspect ratios) - enum Sizemode { - SizemodeAny, - SizemodeFixedW, ///< Try not to affect width - SizemodeFixedH, ///< Try not to affect height - SizemodeMax ///< Try not to make it larger in either direction + enum SizeMode { + SizeModeAny, + SizeModeFixedW, ///< Try not to affect width + SizeModeFixedH, ///< Try not to affect height + SizeModeMax ///< Try not to make it larger in either direction }; /** * Calculates the appropriate frame size for the given client size @p wsize. * * @p wsize is adapted according to the window's size hints (minimum, maximum and incremental size changes). * * Default implementation returns the passed in @p wsize. */ - virtual QSize sizeForClientSize(const QSize &wsize, Sizemode mode = SizemodeAny, bool noframe = false) const; + virtual QSize sizeForClientSize(const QSize &wsize, SizeMode mode = SizeModeAny, bool noframe = false) const; /** * Adjust the frame size @p frame according to the window's size hints. */ - QSize adjustedSize(const QSize&, Sizemode mode = SizemodeAny) const; + QSize adjustedSize(const QSize&, SizeMode mode = SizeModeAny) const; QSize adjustedSize() const; /** diff --git a/abstract_client.cpp b/abstract_client.cpp --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -1080,8 +1080,8 @@ bool update = false; if (isResize()) { QRect orig = initialMoveResizeGeometry(); - Sizemode sizemode = SizemodeAny; - auto calculateMoveResizeGeom = [this, &topleft, &bottomright, &orig, &sizemode, &mode]() { + SizeMode sizeMode = SizeModeAny; + auto calculateMoveResizeGeom = [this, &topleft, &bottomright, &orig, &sizeMode, &mode]() { switch(mode) { case PositionTopLeft: setMoveResizeGeometry(QRect(topleft, orig.bottomRight())); @@ -1097,19 +1097,19 @@ break; case PositionTop: setMoveResizeGeometry(QRect(QPoint(orig.left(), topleft.y()), orig.bottomRight())); - sizemode = SizemodeFixedH; // try not to affect height + sizeMode = SizeModeFixedH; // try not to affect height break; case PositionBottom: setMoveResizeGeometry(QRect(orig.topLeft(), QPoint(orig.right(), bottomright.y()))); - sizemode = SizemodeFixedH; + sizeMode = SizeModeFixedH; break; case PositionLeft: setMoveResizeGeometry(QRect(QPoint(topleft.x(), orig.top()), orig.bottomRight())); - sizemode = SizemodeFixedW; + sizeMode = SizeModeFixedW; break; case PositionRight: setMoveResizeGeometry(QRect(orig.topLeft(), QPoint(bottomright.x(), orig.bottom()))); - sizemode = SizemodeFixedW; + sizeMode = SizeModeFixedW; break; case PositionCenter: default: @@ -1210,18 +1210,18 @@ } // Always obey size hints, even when in "unrestricted" mode - QSize size = adjustedSize(moveResizeGeometry().size(), sizemode); + QSize size = adjustedSize(moveResizeGeometry().size(), sizeMode); // the new topleft and bottomright corners (after checking size constrains), if they'll be needed topleft = QPoint(moveResizeGeometry().right() - size.width() + 1, moveResizeGeometry().bottom() - size.height() + 1); bottomright = QPoint(moveResizeGeometry().left() + size.width() - 1, moveResizeGeometry().top() + size.height() - 1); orig = moveResizeGeometry(); // if aspect ratios are specified, both dimensions may change. // Therefore grow to the right/bottom if needed. // TODO it should probably obey gravity rather than always using right/bottom ? - if (sizemode == SizemodeFixedH) + if (sizeMode == SizeModeFixedH) orig.setRight(bottomright.x()); - else if (sizemode == SizemodeFixedW) + else if (sizeMode == SizeModeFixedW) orig.setBottom(bottomright.y()); calculateMoveResizeGeom(); @@ -1237,7 +1237,7 @@ setMoveResizeGeometry(workspace()->clientArea(FullScreenArea, screen, 0)); else { QRect moveResizeGeom = workspace()->clientArea(MaximizeArea, screen, 0); - QSize adjSize = adjustedSize(moveResizeGeom.size(), SizemodeMax); + QSize adjSize = adjustedSize(moveResizeGeom.size(), SizeModeMax); if (adjSize != moveResizeGeom.size()) { QRect r(moveResizeGeom); moveResizeGeom.setSize(adjSize); @@ -1881,7 +1881,7 @@ BORDER(Top) #undef BORDER -QSize AbstractClient::sizeForClientSize(const QSize &wsize, Sizemode mode, bool noframe) const +QSize AbstractClient::sizeForClientSize(const QSize &wsize, SizeMode mode, bool noframe) const { Q_UNUSED(mode) Q_UNUSED(noframe) @@ -3125,7 +3125,7 @@ } } -QSize AbstractClient::adjustedSize(const QSize& frame, Sizemode mode) const +QSize AbstractClient::adjustedSize(const QSize& frame, SizeMode mode) const { // first, get the window size for the given frame size s QSize wsize = frameSizeToClientSize(frame); diff --git a/placement.cpp b/placement.cpp --- a/placement.cpp +++ b/placement.cpp @@ -748,17 +748,17 @@ return; QRect geom = frameGeometry(); geom.setRight(workspace()->packPositionRight(this, geom.right(), true)); - QSize adjsize = adjustedSize(geom.size(), SizemodeFixedW); + QSize adjsize = adjustedSize(geom.size(), SizeModeFixedW); if (frameGeometry().size() == adjsize && geom.size() != adjsize && resizeIncrements().width() > 1) { // take care of size increments int newright = workspace()->packPositionRight(this, geom.right() + resizeIncrements().width() - 1, true); // check that it hasn't grown outside of the area, due to size increments // TODO this may be wrong? if (workspace()->clientArea(MovementArea, QPoint((x() + newright) / 2, frameGeometry().center().y()), desktop()).right() >= newright) geom.setRight(newright); } - geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); - geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedW)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setFrameGeometry(geom); } @@ -777,7 +777,7 @@ geom.setRight(workspace()->packPositionLeft(this, geom.right(), false)); if (geom.width() <= 1) return; - geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedW)); if (geom.width() > 20) { workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setFrameGeometry(geom); @@ -796,15 +796,15 @@ return; QRect geom = frameGeometry(); geom.setBottom(workspace()->packPositionDown(this, geom.bottom(), true)); - QSize adjsize = adjustedSize(geom.size(), SizemodeFixedH); + QSize adjsize = adjustedSize(geom.size(), SizeModeFixedH); if (frameGeometry().size() == adjsize && geom.size() != adjsize && resizeIncrements().height() > 1) { // take care of size increments int newbottom = workspace()->packPositionDown(this, geom.bottom() + resizeIncrements().height() - 1, true); // check that it hasn't grown outside of the area, due to size increments if (workspace()->clientArea(MovementArea, QPoint(frameGeometry().center().x(), (y() + newbottom) / 2), desktop()).bottom() >= newbottom) geom.setBottom(newbottom); } - geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setFrameGeometry(geom); } @@ -824,7 +824,7 @@ geom.setBottom(workspace()->packPositionUp(this, geom.bottom(), false)); if (geom.height() <= 1) return; - geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); if (geom.height() > 20) { workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setFrameGeometry(geom); diff --git a/x11client.h b/x11client.h --- a/x11client.h +++ b/x11client.h @@ -194,7 +194,7 @@ void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override; void resizeWithChecks(int w, int h, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet); void resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet); - QSize sizeForClientSize(const QSize&, Sizemode mode = SizemodeAny, bool noframe = false) const override; + QSize sizeForClientSize(const QSize&, SizeMode mode = SizeModeAny, bool noframe = false) const override; bool providesContextHelp() const override; diff --git a/x11client.cpp b/x11client.cpp --- a/x11client.cpp +++ b/x11client.cpp @@ -1249,7 +1249,7 @@ if (rules()->checkStrictGeometry(true)) { // check geometry constraints (rule to obey is set) const QRect fsarea = workspace()->clientArea(FullScreenArea, this); - if (sizeForClientSize(fsarea.size(), SizemodeAny, true) != fsarea.size()) { + if (sizeForClientSize(fsarea.size(), SizeModeAny, true) != fsarea.size()) { return false; // the app wouldn't fit exactly fullscreen geometry due to its strict geometry requirements } } @@ -3551,7 +3551,7 @@ * \a wsize is adapted according to the window's size hints (minimum, * maximum and incremental size changes). */ -QSize X11Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool noframe) const +QSize X11Client::sizeForClientSize(const QSize& wsize, SizeMode mode, bool noframe) const { int w = wsize.width(); int h = wsize.height(); @@ -3665,8 +3665,8 @@ } \ } switch(mode) { - case SizemodeAny: -#if 0 // make SizemodeAny equal to SizemodeFixedW - prefer keeping fixed width, + case SizeModeAny: +#if 0 // make SizeModeAny equal to SizeModeFixedW - prefer keeping fixed width, // so that changing aspect ratio to a different value and back keeps the same size (#87298) { ASPECT_CHECK_SHRINK_H_GROW_W @@ -3676,22 +3676,22 @@ break; } #endif - case SizemodeFixedW: { + case SizeModeFixedW: { // the checks are order so that attempts to modify height are first ASPECT_CHECK_GROW_H ASPECT_CHECK_SHRINK_H_GROW_W ASPECT_CHECK_SHRINK_W_GROW_H ASPECT_CHECK_GROW_W break; } - case SizemodeFixedH: { + case SizeModeFixedH: { ASPECT_CHECK_GROW_W ASPECT_CHECK_SHRINK_W_GROW_H ASPECT_CHECK_SHRINK_H_GROW_W ASPECT_CHECK_GROW_H break; } - case SizemodeMax: { + case SizeModeMax: { // first checks that try to shrink ASPECT_CHECK_SHRINK_H_GROW_W ASPECT_CHECK_SHRINK_W_GROW_H @@ -4417,16 +4417,16 @@ if (old_mode & MaximizeHorizontal) { // actually restoring from MaximizeFull if (geom_restore.width() == 0 || !clientArea.contains(geom_restore.center())) { // needs placement - plainResize(adjustedSize(QSize(width() * 2 / 3, clientArea.height()), SizemodeFixedH), geom_mode); + plainResize(adjustedSize(QSize(width() * 2 / 3, clientArea.height()), SizeModeFixedH), geom_mode); Placement::self()->placeSmart(this, clientArea); } else { setFrameGeometry(QRect(QPoint(geom_restore.x(), clientArea.top()), - adjustedSize(QSize(geom_restore.width(), clientArea.height()), SizemodeFixedH)), geom_mode); + adjustedSize(QSize(geom_restore.width(), clientArea.height()), SizeModeFixedH)), geom_mode); } } else { QRect r(x(), clientArea.top(), width(), clientArea.height()); r.setTopLeft(rules()->checkPosition(r.topLeft())); - r.setSize(adjustedSize(r.size(), SizemodeFixedH)); + r.setSize(adjustedSize(r.size(), SizeModeFixedH)); setFrameGeometry(r, geom_mode); } info->setState(NET::MaxVert, NET::Max); @@ -4437,16 +4437,16 @@ if (old_mode & MaximizeVertical) { // actually restoring from MaximizeFull if (geom_restore.height() == 0 || !clientArea.contains(geom_restore.center())) { // needs placement - plainResize(adjustedSize(QSize(clientArea.width(), height() * 2 / 3), SizemodeFixedW), geom_mode); + plainResize(adjustedSize(QSize(clientArea.width(), height() * 2 / 3), SizeModeFixedW), geom_mode); Placement::self()->placeSmart(this, clientArea); } else { setFrameGeometry(QRect(QPoint(clientArea.left(), geom_restore.y()), - adjustedSize(QSize(clientArea.width(), geom_restore.height()), SizemodeFixedW)), geom_mode); + adjustedSize(QSize(clientArea.width(), geom_restore.height()), SizeModeFixedW)), geom_mode); } } else { QRect r(clientArea.left(), y(), clientArea.width(), height()); r.setTopLeft(rules()->checkPosition(r.topLeft())); - r.setSize(adjustedSize(r.size(), SizemodeFixedW)); + r.setSize(adjustedSize(r.size(), SizeModeFixedW)); setFrameGeometry(r, geom_mode); } info->setState(NET::MaxHoriz, NET::Max); @@ -4480,7 +4480,7 @@ geom_restore = restore; // relevant for mouse pos calculation, bug #298646 } if (m_geometryHints.hasAspect()) { - restore.setSize(adjustedSize(restore.size(), SizemodeAny)); + restore.setSize(adjustedSize(restore.size(), SizeModeAny)); } setFrameGeometry(restore, geom_mode); if (!clientArea.contains(geom_restore.center())) // Not restoring to the same screen @@ -4493,7 +4493,7 @@ case MaximizeFull: { QRect r(clientArea); r.setTopLeft(rules()->checkPosition(r.topLeft())); - r.setSize(adjustedSize(r.size(), SizemodeMax)); + r.setSize(adjustedSize(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(), Cursor::pos().x() - r.width()/2));