Refactor geometry constraints code
ClosedPublic

Authored by zzag on Jan 22 2020, 9:42 AM.

Details

Summary

Currently, there are a couple of issues with sizeForClientSize(). First
of all, we have a method called clientSizeToFrameSize() which does similar
thing except applying geometry constraints and checking window rules. The
other issue is that sizeForClientSize() is doing a bit too much, it checks
window rules, it applies a bunch of geometry constrains. Sometimes it
does not perform conversion between client sizes and frame sizes!

This change attempts to address those issues by replacing sizeForClientSize
with two similar methods and changing semantics of some methods of the
X11Client class.

The most significant difference between sizeForClientSize() and the new
methods is that neither constrainClientSize() nor constrainFrameSize()
check window rules. This is up to users of those methods. In many places,
we don't have to check window rules because we check isResizable(),
which returns false if the frame size is enforced by a window rule.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Jan 22 2020, 9:42 AM
Restricted Application added a project: KWin. · View Herald TranscriptJan 22 2020, 9:42 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Jan 22 2020, 9:42 AM
zzag added a comment.Jan 30 2020, 12:16 PM

If there are no objections, I'm going to land this patch (and other patches that depend on it) in about a week.

zzag updated this revision to Diff 75659.Feb 14 2020, 8:02 AM

Rebase.

zzag updated this revision to Diff 75666.Feb 14 2020, 8:28 AM

Delete unrelated changes in X11Client::setFrameGeometry and X11Client::plainResize.

davidedmundson accepted this revision.Feb 28 2020, 11:37 AM
davidedmundson added inline comments.
abstract_client.cpp
3092

@p frame

expects a parameter called frame

This revision is now accepted and ready to land.Feb 28 2020, 11:37 AM
zzag added inline comments.Feb 28 2020, 11:56 AM
abstract_client.cpp
3092

Heh, that's a copy and paste error.

This revision was automatically updated to reflect the committed changes.