Synopsis#include <gdk/gdk.h> GdkDevice; enum GdkInputSource; enum GdkInputMode; GdkDeviceKey; GdkDeviceAxis; enum GdkAxisUse; GList* gdk_devices_list (void); void gdk_device_set_source (GdkDevice *device, GdkInputSource source); gboolean gdk_device_set_mode (GdkDevice *device, GdkInputMode mode); void gdk_device_set_key (GdkDevice *device, guint index_, guint keyval, GdkModifierType modifiers); void gdk_device_set_axis_use (GdkDevice *device, guint index_, GdkAxisUse use); GdkDevice* gdk_device_get_core_pointer (void); void gdk_device_get_state (GdkDevice *device, GdkWindow *window, gdouble *axes, GdkModifierType *mask); gboolean gdk_device_get_history (GdkDevice *device, GdkWindow *window, guint32 start, guint32 stop, GdkTimeCoord ***events, gint *n_events); void gdk_device_free_history (GdkTimeCoord **events, gint n_events); GdkTimeCoord; gboolean gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value); void gdk_input_set_extension_events (GdkWindow *window, gint mask, GdkExtensionMode mode); enum GdkExtensionMode; DescriptionIn addition to the normal keyboard and mouse input devices, GTK+ also contains support for extended input devices. In particular, this support is targeted at graphics tablets. Graphics tablets typically return sub-pixel positioning information and possibly information about the pressure and tilt of the stylus. Under X, the support for extended devices is done through the XInput extension.
Because handling extended input devices may involve considerable
overhead, they need to be turned on for each GdkWindow
individually using
Each pointing device is assigned a unique integer ID; events from a
particular device can be identified by the
One additional field in each event is the
Various aspects of each device may be configured. The easiest way of
creating a GUI to allow the user to configure such a device
is to use the GtkInputDialog widget in GTK+.
However, even when using this widget, application writers
will need to directly query and set the configuration parameters
in order to save the state between invocations of the application.
The configuration of devices is queried using
Devices may also have associated keys
or macro buttons. Such keys can be globally set to map
into normal X keyboard events. The mapping is set using
The interfaces in this section will most likely be considerably
modified in the future to accomodate devices that may have different
sets of additional valuators than the pressure DetailsGdkDevicetypedef struct { GObject parent_instance; /* All fields are read-only */ gchar *name; GdkInputSource source; GdkInputMode mode; gboolean has_cursor; /* TRUE if the X pointer follows device motion */ gint num_axes; GdkDeviceAxis *axes; gint num_keys; GdkDeviceKey *keys; } GdkDevice;
A GdkDevice structure contains
a detailed description of an extended input device. All
fields are read-only; but you can use
enum GdkInputSourcetypedef enum { GDK_SOURCE_MOUSE, GDK_SOURCE_PEN, GDK_SOURCE_ERASER, GDK_SOURCE_CURSOR } GdkInputSource; An enumeration describing the type of an input device in general terms.
enum GdkInputModetypedef enum { GDK_MODE_DISABLED, GDK_MODE_SCREEN, GDK_MODE_WINDOW } GdkInputMode; An enumeration that describes the mode of an input device.
GdkDeviceKeytypedef struct { guint keyval; GdkModifierType modifiers; } GdkDeviceKey; The GdkDeviceKey structure contains information about the mapping of one device macro button onto a normal X key event. It has the following fields:
GdkDeviceAxistypedef struct { GdkAxisUse use; gdouble min; gdouble max; } GdkDeviceAxis; The GdkDeviceAxis structure contains information about the range and mapping of a device axis.
enum GdkAxisUsetypedef enum { GDK_AXIS_IGNORE, GDK_AXIS_X, GDK_AXIS_Y, GDK_AXIS_PRESSURE, GDK_AXIS_XTILT, GDK_AXIS_YTILT, GDK_AXIS_WHEEL, GDK_AXIS_LAST } GdkAxisUse; An enumeration describing the way in which a device axis (valuator) maps onto the predefined valuator types that GTK+ understands.
gdk_devices_list ()GList* gdk_devices_list (void); Returns the list of available input devices for the default display. The list is statically allocated and should not be freed.
gdk_device_set_source ()void gdk_device_set_source (GdkDevice *device, GdkInputSource source); Sets the source type for an input device.
gdk_device_set_mode ()gboolean gdk_device_set_mode (GdkDevice *device, GdkInputMode mode); Sets a the mode of an input device. The mode controls if the device is active and whether the device's range is mapped to the entire screen or to a single window.
gdk_device_set_key ()void gdk_device_set_key (GdkDevice *device, guint index_, guint keyval, GdkModifierType modifiers); Specifies the X key event to generate when a macro button of a device is pressed.
gdk_device_set_axis_use ()void gdk_device_set_axis_use (GdkDevice *device, guint index_, GdkAxisUse use); Specifies how an axis of a device is used.
gdk_device_get_core_pointer ()GdkDevice* gdk_device_get_core_pointer (void); Returns the core pointer device for the default display.
gdk_device_get_state ()void gdk_device_get_state (GdkDevice *device, GdkWindow *window, gdouble *axes, GdkModifierType *mask); Gets the current state of a device. gdk_device_get_history ()gboolean gdk_device_get_history (GdkDevice *device, GdkWindow *window, guint32 start, guint32 stop, GdkTimeCoord ***events, gint *n_events);
Obtains the motion history for a device; given a starting and
ending timestamp, return all events in the motion history for
the device in the given range of time. Some windowing systems
do not support motion history, in which case,
gdk_device_free_history ()void gdk_device_free_history (GdkTimeCoord **events, gint n_events);
Frees an array of GdkTimeCoord that was returned by
GdkTimeCoordtypedef struct { guint32 time; gdouble axes[GDK_MAX_TIMECOORD_AXES]; } GdkTimeCoord; The GdkTimeCoord structure stores a single event in a motion history. It contains the following fields:
gdk_device_get_axis ()gboolean gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value); Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis use.
gdk_input_set_extension_events ()void gdk_input_set_extension_events (GdkWindow *window, gint mask, GdkExtensionMode mode); Turns extension events on or off for a particular window, and specifies the event mask for extension events.
|