Qt 4.2: Qtopia Core Pointer Handling

|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# Qtopia Core Pointer Handling

When running a Qtopia Core application, it either runs as a server or connects to an existing server. The mouse driver is loaded by the server application when it starts running, using Qt's plugin system.

Internally in the client/server protocol, all system generated events, including pointer events, are passed to the server application which then propagates the event to the appropiate client. Note that pointer handling in Qtopia Core works for both mouse and mouse-like devices such as touch panels and trackballs.

Contents:

- Available Drivers
- Specifying a Driver

## Available Drivers

Qtopia Core provides ready-made drivers for the MouseMan, IntelliMouse, Microsoft, NEC Vr41XX, Linux Touch Panel and Yopy protocols as well as the universal touch screen library, tslib. Run the `configure` script to list the available drivers:

     ./configure -help

In the default Qt configuration, only the "pc" mouse driver is enabled. The various drivers can be enabled and disabled using the `configure` script. For example:

     configure -qt-mouse-tslib

Custom mouse drivers can be implemented by subclassing the QWSMouseHandler class and creating a mouse driver plugin (derived from the QMouseDriverPlugin class). Qtopia Core's implementation of the QMouseDriverFactory class will automatically detect the plugin, loading the driver into the server application at runtime.

## Specifying a Driver

Provided that the "pc" mouse driver is enabled, Qtopia Core will try to auto-detect the mouse device if it is one of the supported types on `/dev/psaux` or one of the `/dev/ttyS`? serial lines. If multiple mice are detected, all may be used simultaneously.

Note that Qtopia Core does not support auto-detection of touch panels in which case the driver must be specified explicitly to determine which device to use.

To manually specify which driver to use, set the QWS_MOUSE_PROTO environment variable. For example (if the current shell is bash, ksh, zsh or sh):

     export QWS_MOUSE_PROTO=<driver>[:<driver specific options>]

The valid values for the `<driver>` argument are `MouseMan`, `IntelliMouse`, `Microsoft`, `VR41xx`, `LinuxTP`, `Yopy`, `Tslib` and keys identifying custom drivers, and the driver specific options are typically a device, e.g., `/dev/mouse` for mouse devices and `/dev/ts` for touch panels.

Note that the `Vr41xx` driver also accepts two optional arguments: `press=<value>` defining a mouse click (the default value is 750) and `filter=<value>` specifying the length of the filter used to eliminate noise (the default length is 3). For example:

     export QWS_MOUSE_PROTO="Vr41xx:press=500:/dev/misc/ts"

The Tslib Mouse Driver
The tslib mouse driver inherits the QWSCalibratedMouseHandler class, providing calibration and noise reduction functionality in addition to generating mouse events for devices using the Universal Touch Screen Library. To be able to compile this mouse handler, Qtopia Core must be configured with the `-qt-mouse-tslib` option as described above. In addition, the tslib headers and library must be present in the build environment. The tslib sources can be downloaded from http://cvs.arm.linux.org.uk. Use the `configure` script's -L and -I options to explicitly specify the location of the library and its headers:
     ./configure  -L <path to tslib library> -I <path to tslib headers>
In order to use this mouse driver, tslib must also be correctly installed on the target machine. This includes providing a `ts.conf` configuration file and setting the neccessary environment variables (see the README file provided with tslib for details). The `ts.conf` file will usually contain the following two lines:
      module_raw input
      module linear
To make Qtopia Core explicitly choose the tslib mouse handler, set the QWS_MOUSE_PROTO environment variable as explained above.