x11window: don't change size for centering windows with maximization

This commit is contained in:
Xaver Hugl 2022-09-28 13:55:32 +02:00
parent ceae717500
commit 3a28c02f28
2 changed files with 10 additions and 9 deletions

View file

@ -1025,9 +1025,9 @@ public:
QSizeF resizeIncrements() const
{
if (!hasResizeIncrements()) {
return QSize(1, 1);
return fromXNative(QSize(1, 1));
}
return QSizeF(qMax(fromXNative(m_sizeHints->widthInc), 1.), qMax(fromXNative(m_sizeHints->heightInc), 1.));
return Xcb::fromXNative(QSize(std::max(m_sizeHints->widthInc, 1), std::max(m_sizeHints->heightInc, 1)));
}
xcb_gravity_t windowGravity() const
{

View file

@ -4487,32 +4487,33 @@ void X11Window::maximize(MaximizeMode mode)
if (closeHeight) {
bool tryBottom = titlePos == Qt::BottomEdge;
if ((overHeight && titlePos == Qt::TopEdge) || screenArea.top() == clientArea.top()) {
r.setTop(clientArea.top());
r.moveTop(clientArea.top());
} else {
tryBottom = true;
}
if (tryBottom && (overHeight || screenArea.bottom() == clientArea.bottom())) {
r.setBottom(clientArea.bottom());
r.moveBottom(clientArea.bottom());
}
}
if (closeWidth) {
bool tryLeft = titlePos == Qt::LeftEdge;
if ((overWidth && titlePos == Qt::RightEdge) || screenArea.right() == clientArea.right()) {
r.setRight(clientArea.right());
r.moveRight(clientArea.right());
} else {
tryLeft = true;
}
if (tryLeft && (overWidth || screenArea.left() == clientArea.left())) {
r.setLeft(clientArea.left());
r.moveLeft(clientArea.left());
}
}
}
}
r.moveTopLeft(rules()->checkPosition(r.topLeft()));
// The above code tries to center align the window followed by setting top and bottom
// it's possible that we're in between two pixels
r.setX(Xcb::nativeFloor(r.x()));
r.setY(Xcb::nativeFloor(r.y()));
}
// The above code tries to center align the window followed by setting top and bottom
// it's possible that we no longer have a valid size
r = Xcb::nativeFloor(r);
moveResize(r);
if (options->electricBorderMaximize() && r.top() == clientArea.top()) {