Random tidbits of information about projects I'm hacking on...
Contents |
The kernel's multi-touch-protocol is now supported in MeeGo. Qt applications will receive Touch events and can use the Qt gesture infrastructure. Non-Qt applications will need to write to XInput2.0 and extract contact data from the XEvent data.
The general flow is:
HW => Kernel driver => multi-touch-protocol => xorg-x11-input-mtev => XEvent => Application
xorg-x11-input-mtev users libmtdev in order to easily support both of the protocol A and B exposed by the kernel.
If you are using the evtouch driver on your system, you may experience problems due to the input driver your kernel is using. If the kernel driver does not advertise to user space that it supports the left button (by setting the BTN_LEFT bit in the input_device's keybit field) then the X input driver will not map those button identifiers to the "Button Left" label. Qt relies on correctly set button labels in order to map the incoming touch data to the appropriate touch device.
You can determine if this is the case on your system by running:
xinput list --long "Virtual core pointer"
On a functional input driver, you will see various text names for the field 'Button labels:' On a broken input driver, you will see a series of X BadAtom errors or "Button Unknown" labels. A correct driver will report labels such as: Button Left, Button Right, etc.
See BMC#12777 for additional details on this problem.
Fixing the driver for your system may be as easy as adding the following line to the driver's initialization sequence:
ts->idev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT);
Prior to having patches to Qt to add XInput2.0 support, applications had to load a plugin that would connect to the X event queue and process the XInput2.0 events. That is no longer necessary and applications will now just work.
With Qt 4.7.0 through 4.7.2, you can use the qml-gesturearea project from qt-labs to add multi-point touch gestures to your QML applications.
As of Qt 4.7.3, you should use the MouseArea, Flickable, PinchArea, PanArea, and TouchArea. The GIT tree for TouchArea is here.
Additional information in JIRA can be found here.
Qt is configured to listen to pointer (mouse) events the first core pointer provided by X. Additional core pointers are ignored. Touch events are received from any touch device bound to the first core pointer, as well as any touch devices which are floating (not bound to any core pointer)
If you do nothing, X will default to binding an input device to the first Core Pointer. This means that the touch screen will default to control the cursor --as you move your finger around, mouse events will be generated, the cursor will move, etc.
You can use the xinput utility to "float" the touch device. On the Lenovo S10, running 'xinput list' shows something like the following:
⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Cando Corporation Cando 10.1 Multi Touch Panel with Controller id=13 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=16 [slave pointer (2)] ...
Looking at the above, you can see the touch device (Cando Corporation...) is device id 13. To float that input device, run:
xinput float 13
NOTE: If you don't have xinput, you can install it on MeeGo by running:
zypper install xorg-x11-utils-xinput
Once you float the input device, it will no longer move the mouse pointer. To reattach it, run:
xinput reattach 13 2
'2' is the device ID for the 'Virtual core pointer' you are reattaching the device to.
To keep X from connecting a device to the core pointer when starting the system, you can add:
Option "SendCoreEvents" "false"
to the InputClass section for the device, for example you can place the following in /usr/share/X11/xorg.conf.d as 60-cando.conf:
Section "InputClass"
Identifier "Cando Multi Touch Panel"
MatchVendor "Cando"
MatchDevicePath "/dev/input/event*"
Driver "mtev"
Option "SendCoreEvents" "false"
EndSection
To perform the above steps on this wiki, you may need to install the xinput utility:
zypper install xorg-x11-utils-xinput