Ignore touch events originating from trackpads

Fixes multi-finger gestures causing spurious touch screen presses
Also fix some deprecations when we're at it anyway
This commit is contained in:
Nadia Holmquist Pedersen 2024-07-15 13:57:21 +02:00
parent 2031f491f0
commit 6d2ad2a3f0
1 changed files with 5 additions and 2 deletions

View File

@ -302,15 +302,18 @@ void ScreenPanel::tabletEvent(QTabletEvent* event)
void ScreenPanel::touchEvent(QTouchEvent* event)
{
if (event->deviceType() == QInputDevice::DeviceType::TouchPad)
return;
event->accept();
switch(event->type())
{
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
if (event->touchPoints().length() > 0)
if (event->points().length() > 0)
{
QPointF lastPosition = event->touchPoints().first().lastPos();
QPointF lastPosition = event->points().first().lastPosition();
int x = (int)lastPosition.x();
int y = (int)lastPosition.y();