Remove AbstractClient plumbing casts in PopupInputFilter

This commit is contained in:
Vlad Zahorodnii 2022-04-18 11:04:18 +03:00
parent 94bbe14f4c
commit 9157b1303e

View file

@ -48,9 +48,8 @@ bool PopupInputFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton)
return false; return false;
} }
if (event->type() == QMouseEvent::MouseButtonPress) { if (event->type() == QMouseEvent::MouseButtonPress) {
auto t = input()->findToplevel(event->globalPos()); auto pointerFocus = input()->findToplevel(event->globalPos());
auto pointerFocus = static_cast<AbstractClient *>(t && t->isClient() ? t : nullptr); if (!pointerFocus || !AbstractClient::belongToSameApplication(pointerFocus, m_popupClients.constLast())) {
if (!pointerFocus || !AbstractClient::belongToSameApplication(pointerFocus, static_cast<AbstractClient *>(m_popupClients.constLast()->isClient() ? m_popupClients.constLast() : nullptr))) {
// a press on a window (or no window) not belonging to the popup window // a press on a window (or no window) not belonging to the popup window
cancelPopups(); cancelPopups();
// filter out this press // filter out this press
@ -97,9 +96,8 @@ bool PopupInputFilter::touchDown(qint32 id, const QPointF &pos, quint32 time)
if (m_popupClients.isEmpty()) { if (m_popupClients.isEmpty()) {
return false; return false;
} }
auto t = input()->findToplevel(pos.toPoint()); auto pointerFocus = input()->findToplevel(pos.toPoint());
auto pointerFocus = static_cast<AbstractClient *>(t && t->isClient() ? t : nullptr); if (!pointerFocus || !AbstractClient::belongToSameApplication(pointerFocus, m_popupClients.constLast())) {
if (!pointerFocus || !AbstractClient::belongToSameApplication(pointerFocus, static_cast<AbstractClient *>(m_popupClients.constLast()->isClient() ? m_popupClients.constLast() : nullptr))) {
// a touch on a window (or no window) not belonging to the popup window // a touch on a window (or no window) not belonging to the popup window
cancelPopups(); cancelPopups();
// filter out this touch // filter out this touch