From fb114dfba3717d63e65cf5c221f5457e64ea8efa Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 12 Feb 2020 12:44:21 +0200 Subject: [PATCH] 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 --- x11client.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/x11client.cpp b/x11client.cpp index 5121613b68..a553e133e3 100644 --- a/x11client.cpp +++ b/x11client.cpp @@ -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); }