libwacom
Wacom model identification library
libwacom styli

Functions to create and manage libwacom styli. More...

Macros

#define WACOM_STYLUS_FALLBACK_ID   0xfffff
 
#define WACOM_ERASER_FALLBACK_ID   0xffffe
 

Typedefs

typedef struct _WacomStylus WacomStylus
 

Enumerations

enum  WacomStylusType {
  WSTYLUS_UNKNOWN , WSTYLUS_GENERAL , WSTYLUS_INKING , WSTYLUS_AIRBRUSH ,
  WSTYLUS_CLASSIC , WSTYLUS_MARKER , WSTYLUS_STROKE , WSTYLUS_PUCK ,
  WSTYLUS_3D , WSTYLUS_MOBILE
}
 Class of stylus. More...
 
enum  WacomEraserType { WACOM_ERASER_UNKNOWN , WACOM_ERASER_NONE , WACOM_ERASER_INVERT , WACOM_ERASER_BUTTON }
 Type of eraser on a stylus. More...
 
enum  WacomAxisTypeFlags {
  WACOM_AXIS_TYPE_NONE = 0 , WACOM_AXIS_TYPE_TILT = (1 << 1) , WACOM_AXIS_TYPE_ROTATION_Z = (1 << 2) , WACOM_AXIS_TYPE_DISTANCE = (1 << 3) ,
  WACOM_AXIS_TYPE_PRESSURE = (1 << 4) , WACOM_AXIS_TYPE_SLIDER = (1 << 5)
}
 Axis type for a stylus. More...
 

Functions

const int * libwacom_get_supported_styli (const WacomDevice *device, int *num_styli)
 
const WacomStyluslibwacom_stylus_get_for_id (const WacomDeviceDatabase *db, int id)
 Get the WacomStylus for the given tool ID. More...
 
int libwacom_stylus_get_id (const WacomStylus *stylus)
 
const char * libwacom_stylus_get_name (const WacomStylus *stylus)
 
const int * libwacom_stylus_get_paired_ids (const WacomStylus *stylus, int *num_paired_ids)
 
int libwacom_stylus_get_num_buttons (const WacomStylus *stylus)
 
int libwacom_stylus_has_eraser (const WacomStylus *stylus)
 Check if the given stylus is paired with a separate eraser. More...
 
int libwacom_stylus_is_eraser (const WacomStylus *stylus)
 Check if the given stylus may act like an eraser. More...
 
int libwacom_stylus_has_lens (const WacomStylus *stylus)
 
int libwacom_stylus_has_wheel (const WacomStylus *stylus)
 
WacomAxisTypeFlags libwacom_stylus_get_axes (const WacomStylus *stylus)
 
WacomStylusType libwacom_stylus_get_type (const WacomStylus *stylus)
 
WacomEraserType libwacom_stylus_get_eraser_type (const WacomStylus *stylus)
 
void libwacom_print_stylus_description (int fd, const WacomStylus *stylus)
 Print the description of this stylus to the given file. More...
 

Detailed Description

Functions to create and manage libwacom styli.

Macro Definition Documentation

◆ WACOM_ERASER_FALLBACK_ID

#define WACOM_ERASER_FALLBACK_ID   0xffffe

◆ WACOM_STYLUS_FALLBACK_ID

#define WACOM_STYLUS_FALLBACK_ID   0xfffff

Typedef Documentation

◆ WacomStylus

typedef struct _WacomStylus WacomStylus

Enumeration Type Documentation

◆ WacomAxisTypeFlags

Axis type for a stylus.

Note that x/y is implied.

Enumerator
WACOM_AXIS_TYPE_NONE 
WACOM_AXIS_TYPE_TILT 

Tilt in x and y direction.

WACOM_AXIS_TYPE_ROTATION_Z 

Rotation in the z-axis.

WACOM_AXIS_TYPE_DISTANCE 

Distance to surface.

WACOM_AXIS_TYPE_PRESSURE 

Tip pressure.

WACOM_AXIS_TYPE_SLIDER 

A absolute-position slider like the wheel on the airbrush.

◆ WacomEraserType

Type of eraser on a stylus.

Enumerator
WACOM_ERASER_UNKNOWN 
WACOM_ERASER_NONE 

No eraser is present on the stylus.

WACOM_ERASER_INVERT 

Eraser is a separate tool on the opposite end of the stylus.

WACOM_ERASER_BUTTON 

Eraser is a button alongside any other stylus buttons.

◆ WacomStylusType

Class of stylus.

Enumerator
WSTYLUS_UNKNOWN 
WSTYLUS_GENERAL 
WSTYLUS_INKING 
WSTYLUS_AIRBRUSH 
WSTYLUS_CLASSIC 
WSTYLUS_MARKER 
WSTYLUS_STROKE 
WSTYLUS_PUCK 
WSTYLUS_3D 
WSTYLUS_MOBILE 

Function Documentation

◆ libwacom_get_supported_styli()

const int* libwacom_get_supported_styli ( const WacomDevice device,
int *  num_styli 
)
Parameters
deviceThe tablet to query
num_styliReturn location for the number of listed styli
Returns
an array of Styli IDs supported by the device

◆ libwacom_print_stylus_description()

void libwacom_print_stylus_description ( int  fd,
const WacomStylus stylus 
)

Print the description of this stylus to the given file.

Parameters
fdThe file descriptor
stylusThe stylus to print the description for.

◆ libwacom_stylus_get_axes()

WacomAxisTypeFlags libwacom_stylus_get_axes ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
The flags specifying the list of absolute axes

◆ libwacom_stylus_get_eraser_type()

WacomEraserType libwacom_stylus_get_eraser_type ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
The type of eraser on the stylus

◆ libwacom_stylus_get_for_id()

const WacomStylus* libwacom_stylus_get_for_id ( const WacomDeviceDatabase db,
int  id 
)

Get the WacomStylus for the given tool ID.

Parameters
dbA Tablet and Stylus database.
idThe Tool ID for this stylus
Returns
A WacomStylus representing the stylus. Do not free.

◆ libwacom_stylus_get_id()

int libwacom_stylus_get_id ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
the ID of the tool

◆ libwacom_stylus_get_name()

const char* libwacom_stylus_get_name ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
The name of the stylus

◆ libwacom_stylus_get_num_buttons()

int libwacom_stylus_get_num_buttons ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
The number of buttons on the stylus

◆ libwacom_stylus_get_paired_ids()

const int* libwacom_stylus_get_paired_ids ( const WacomStylus stylus,
int *  num_paired_ids 
)
Parameters
stylusThe stylus to query
num_paired_idsThe length of the returned list
Returns
The list of other IDs paired to this stylus

◆ libwacom_stylus_get_type()

WacomStylusType libwacom_stylus_get_type ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
The type of stylus

◆ libwacom_stylus_has_eraser()

int libwacom_stylus_has_eraser ( const WacomStylus stylus)

Check if the given stylus is paired with a separate eraser.

If this function returns true then the tool described by the given WacomStylus is paired with a separate eraser tool. The actual eraser tool may be located by iterating over the list of paired styli.

Parameters
stylusThe stylus to query
Returns
Whether the stylus is paired with an eraser
See also
libwacom_stylus_get_paired_ids
libwacom_stylus_is_eraser

◆ libwacom_stylus_has_lens()

int libwacom_stylus_has_lens ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
Whether the stylus has a lens

◆ libwacom_stylus_has_wheel()

int libwacom_stylus_has_wheel ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
Whether the stylus has a relative mouse wheel

◆ libwacom_stylus_is_eraser()

int libwacom_stylus_is_eraser ( const WacomStylus stylus)

Check if the given stylus may act like an eraser.

If this function returns true then the tool described by the given WacomStylus may act like an eraser. Such a tool may be dedicated to sending just eraser events (and paired with a separate tool for "tip" events) or capable of sending both both tip and eraser events.

Parameters
stylusThe stylus to query
Returns
Whether the stylus can act as an eraser
See also
libwacom_stylus_get_eraser_type
libwacom_stylus_has_eraser