Make popup input filter process tablet tool events

wilder/Plasma/6.3
Vlad Zahorodnii 2 years ago
parent b393077c62
commit f4f15d598f
  1. 24
      src/popup_input_filter.cpp
  2. 1
      src/popup_input_filter.h

@ -112,6 +112,30 @@ bool PopupInputFilter::touchDown(qint32 id, const QPointF &pos, std::chrono::mic
return false;
}
bool PopupInputFilter::tabletToolEvent(TabletEvent *event)
{
if (m_popupWindows.isEmpty()) {
return false;
}
if (event->type() == QEvent::TabletPress) {
auto tabletFocus = input()->findToplevel(event->globalPosition());
if (!tabletFocus || !Window::belongToSameApplication(tabletFocus, m_popupWindows.constLast())) {
// a touch on a window (or no window) not belonging to the popup window
cancelPopups();
// filter out this touch
return true;
}
if (tabletFocus && tabletFocus->isDecorated()) {
// test whether it is on the decoration
if (!exclusiveContains(tabletFocus->clientGeometry(), event->globalPosition())) {
cancelPopups();
return true;
}
}
}
return false;
}
void PopupInputFilter::cancelPopups()
{
while (!m_popupWindows.isEmpty()) {

@ -23,6 +23,7 @@ public:
bool pointerEvent(MouseEvent *event, quint32 nativeButton) override;
bool keyEvent(KeyEvent *event) override;
bool touchDown(qint32 id, const QPointF &pos, std::chrono::microseconds time) override;
bool tabletToolEvent(TabletEvent *event) override;
private:
void handleWindowAdded(Window *client);

Loading…
Cancel
Save