Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multitouch in Linux

I have two questions:

  1. How to simulate touch event in linux.
  2. How to work with multitouch on Qt in Linux.
like image 937
Alex Raeder Avatar asked Mar 12 '10 07:03

Alex Raeder


People also ask

Does Linux support multitouch?

I just told you that linux kernel version 3.8 and onwards support multi-touch functionality. +multitouch +linux now lands here!

How do I enable multitouch in Linux?

To enable two touch gestures: Open "System Settings", go to Mouse and Touchpad, go to the Touchpad tab, then: Uncheck "Enable mouse clicks with touchpad" Disable scrolling or select Edge scrolling.

How do I use trackpad gestures in Linux?

Touchégg Enables Touchpad Gestures include:Swipe up, down, left, and right with 3 fingers and/or 4 fingers. Pinch in / out with 2, 3, and/or 4 fingers. Tap with 2, 3, 4, and/or 5 fingers.


1 Answers

You can simulate touch events by calling qt_translateRawTouchEvent directly. (This method is not documented, but it's in qapplication.cpp and it's exported).

You want to put this at the top of your file:

// forward-declaration of Qt internal function
Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, 
                                        QTouchEvent::DeviceType deviceType,
                                        const QList<QTouchEvent::TouchPoint> &touchPoints);

The function call syntax is :

qt_translateRawTouchEvent(targetWidget, deviceType, points.values());

In your case call this method with (NULL, QTouchEvent::TouchScreen, touchPoints) where touchPoints is your list of points being currently touched by the user. This should work in Qt 4.7 and 4.8 at least, possibly before in Qt 5 but I didn't check that.

like image 170
David Faure Avatar answered Oct 16 '22 22:10

David Faure