Return early if we ignore resize increments and aspect ratio constraints

Summary:
If we know that we are going to disobey resize increment and aspect ratio
geometry hints, then there is no point for trying to constrain the client
size according to those hints. Just return early.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27031
This commit is contained in:
Vlad Zahorodnii 2020-02-12 12:44:21 +02:00
parent b8f1c09cfd
commit fb114dfba3

View file

@ -3625,8 +3625,11 @@ QSize X11Client::constrainClientSize(const QSize &size, SizeMode mode) const
w = qMax(min_size.width(), w);
h = qMax(min_size.height(), h);
int w1 = w;
int h1 = h;
if (!rules()->checkStrictGeometry(!isFullScreen())) {
// Disobey increments and aspect by explicit rule.
return QSize(w, h);
}
int width_inc = m_geometryHints.resizeIncrements().width();
int height_inc = m_geometryHints.resizeIncrements().height();
int basew_inc = m_geometryHints.baseSize().width();
@ -3750,11 +3753,6 @@ QSize X11Client::constrainClientSize(const QSize &size, SizeMode mode) const
w += baseSize.width();
h += baseSize.height();
}
if (!rules()->checkStrictGeometry(!isFullScreen())) {
// disobey increments and aspect by explicit rule
w = w1;
h = h1;
}
return QSize(w, h);
}