Skip to main content

Overview

The GTK+ toolkit provides everything necessary to make pressure-sensitive applications for Linux and other platforms. In addition to classically-supported (X11-based) Linux, Windows, and OSX targets, recent releases have added support for Wayland-based flavors of the Linux desktop.

Tablet APIs

GTK+ includes numerous UI widgets in its API, along with classes to interact with them. Applications which are interested in directly processing input events make use of the GdkDevice API. This API applies to all input devices: keyboards, mice, and even tablets. Once your application has a reference to the GdkDevice which precipitated an event (e.g. pointer motion or a button click) it may request the value of any and all associated device axes. It is also possible to request tool information from a GdkDevice object, allowing your application to distinguish e.g. the stylus and eraser end of a pen, or to get the pen's unique serial number (if supported by hardware) to uniquely identify a specific tool across program executions.

In addition to the GdkDevice API for handling events from the pen, recent versions of GTK+3 also include additional APIs for handling events from the tablet's "pad". These APIs are only fully functional on some platforms since not all drivers provide sufficient access to the pad state. These pad-centric APIs include new GdkEvent subtypes, the GdkDevicePad API for probing the current pad state, and GtkPadController for wiring pad events up to application actions.

A final API is GtkGestureStylus which may be of particular interest for highly pen-centric user interfaces. Like the rest of the GtkGesture API, this allows applications to define gestures that the toolkit will recognize when drawn. An application might use this API, for example, to allow quick navigation forward and back by swiping a pen from side to side.