Check against QRect whether pointer is inside DecorationButton
ClosedPublic

Authored by zzag on Sep 2 2018, 9:45 PM.

Details

Summary

If several buttons share an edge, i.e. spacing between decoration
buttons is set to 0, and the pointer is on that edge, both buttons will
be hovered.

This happens because QRectF::contains returns true for points that are
on "outer" edges, e.g.

QRectF rect(0, 0, 10, 10);
rect.contains(QPointF(10, 5)); // returns true
Test Plan

Ran tests.

Diff Detail

Repository
R129 Window Decoration Library
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.Sep 2 2018, 9:45 PM
Restricted Application added a project: Plasma. · View Herald TranscriptSep 2 2018, 9:45 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
zzag requested review of this revision.Sep 2 2018, 9:45 PM
zzag updated this revision to Diff 40900.Sep 3 2018, 9:52 AM

Add test

zzag edited the test plan for this revision. (Show Details)Sep 3 2018, 9:53 AM
zzag added a reviewer: KWin.
davidedmundson accepted this revision.Sep 3 2018, 10:05 AM
davidedmundson added a subscriber: davidedmundson.

would adding

bool DecorationButton::contains(QPoint) const

make sense?

src/decoration.cpp
386

Missed one

This revision is now accepted and ready to land.Sep 3 2018, 10:05 AM
zzag added a comment.Sep 3 2018, 10:11 AM

would adding

bool DecorationButton::contains(QPoint) const

make sense?

Yes, it would. I'll add this method. :-)

zzag updated this revision to Diff 40905.Sep 3 2018, 10:35 AM

Add contais method

This revision was automatically updated to reflect the committed changes.