Port PopupInputFilter to Window::clientGeometry()

Saves us some math operations.
This commit is contained in:
Vlad Zahorodnii 2022-11-08 19:42:47 +02:00 committed by David Edmundson
parent 5e04977d31
commit 0ec732491b

View file

@ -56,8 +56,7 @@ bool PopupInputFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton)
} }
if (pointerFocus && pointerFocus->isDecorated()) { if (pointerFocus && pointerFocus->isDecorated()) {
// test whether it is on the decoration // test whether it is on the decoration
const QRectF clientRect = QRectF(pointerFocus->clientPos(), pointerFocus->clientSize()).translated(pointerFocus->pos()); if (!pointerFocus->clientGeometry().contains(event->globalPos())) {
if (!clientRect.contains(event->globalPos())) {
cancelPopups(); cancelPopups();
return true; return true;
} }
@ -102,8 +101,7 @@ bool PopupInputFilter::touchDown(qint32 id, const QPointF &pos, quint32 time)
} }
if (pointerFocus && pointerFocus->isDecorated()) { if (pointerFocus && pointerFocus->isDecorated()) {
// test whether it is on the decoration // test whether it is on the decoration
const QRectF clientRect = QRectF(pointerFocus->clientPos(), pointerFocus->clientSize()).translated(pointerFocus->pos()); if (!pointerFocus->clientGeometry().contains(pos)) {
if (!clientRect.contains(pos)) {
cancelPopups(); cancelPopups();
return true; return true;
} }