Use QRect::moveRight() and QRect::moveBottom() in XdgShellClient::transientPlacement()
ClosedPublic

Authored by zzag on Jan 31 2020, 3:36 AM.

Details

Summary

It's more intuitive.

Test Plan

Relevant tests pass.

Diff Detail

Repository
R108 KWin
Branch
split-out-xdg-shell-popup
Lint
Lint ErrorsExcuse: asdf
SeverityLocationCodeMessage
Errorinput.h:310CppcheckunknownMacro
Unit
No Unit Test Coverage
Build Status
Buildable 21881
Build 21899: arc lint + arc unit
zzag created this revision.Jan 31 2020, 3:36 AM
Restricted Application added a project: KWin. · View Herald TranscriptJan 31 2020, 3:36 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Jan 31 2020, 3:36 AM
broulik added inline comments.
xdgshellclient.cpp
1710

So what is this comment about then?

zzag added inline comments.Jan 31 2020, 9:19 AM
xdgshellclient.cpp
1710

It says that you can't do

popupPosition.moveRight(bounds.x() + bounds.width());

or to rephrase zzag:

.right() is off by one
.setRight is off by one

so it cancels out.

Personally I find it so difficult to parse that it's easier to just boycott the method.
Everyone who comes across it and is aware of QRect's ridiculousness ends up having to do a load of additional checking in their heads anyway.

Though we don't have a kwin policy on that and we use QRect::right/bottom in other places, so I can't have a formal objection here.

zzag abandoned this revision.Jan 31 2020, 10:25 AM

I just approved another patch that used setRight setBottom in the same method, so we may as well be consistent.

zzag added a comment.Jan 31 2020, 10:28 AM

I just approved another patch that used setRight setBottom in the same method, so we may as well be consistent.

Hmm, then these two https://github.com/KDE/kwin/blob/master/xdgshellclient.cpp#L1653-L1659 also have to be fixed.

zzag added a comment.Jan 31 2020, 10:32 AM

I personally would prefer to continue using QRect::move{Right,Bottom}() and QRect::set{Right,Bottom}() as long as borders match, e.g.

rect.moveRight(anotherRect.right());

I just approved another patch that used setRight setBottom in the same method, so we may as well be consistent.

What I meant, was: you can ship this given we also use setRight(other.right()) elsewhere
I just can't press the button now that it's abandoned.

zzag added a comment.Jan 31 2020, 11:35 AM

Though we don't have a kwin policy on that and we use QRect::right/bottom in other places, so I can't have a formal objection here.

Let's address this in D27060.

zzag reclaimed this revision.Jan 31 2020, 11:52 AM

What I meant, was: you can ship this given we also use setRight(other.right()) elsewhere
I just can't press the button now that it's abandoned.

Heh, your first comment sounded to me like a NACK.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 3 2020, 12:09 PM
This revision was automatically updated to reflect the committed changes.