libwacom
Wacom model identification library
Loading...
Searching...
No Matches
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

LIBWACOM_DEPRECATED const int * libwacom_get_supported_styli (const WacomDevice *device, int *num_styli)
 
const WacomStylus ** libwacom_get_styli (const WacomDevice *device, int *num_styli)
 
LIBWACOM_DEPRECATED const WacomStyluslibwacom_stylus_get_for_id (const WacomDeviceDatabase *db, int id)
 Get the WacomStylus for the given tool ID.
 
int libwacom_stylus_get_id (const WacomStylus *stylus)
 
int libwacom_stylus_get_vendor_id (const WacomStylus *stylus)
 
const char * libwacom_stylus_get_name (const WacomStylus *stylus)
 
LIBWACOM_DEPRECATED const int * libwacom_stylus_get_paired_ids (const WacomStylus *stylus, int *num_paired_ids)
 
const WacomStylus ** libwacom_stylus_get_paired_styli (const WacomStylus *stylus, int *num_paired)
 
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.
 
int libwacom_stylus_is_eraser (const WacomStylus *stylus)
 Check if the given stylus may act like an eraser.
 
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.
 

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_styli()

const WacomStylus ** libwacom_get_styli ( const WacomDevice device,
int *  num_styli 
)
Parameters
deviceThe tablet to query
[out]num_styliOptional return location for the number of listed styli, excluding the NULL terminator.
Returns
A null-terminated array of WacomStylus that are supported by this device

The content of the list is owned by the database and must not be modified or freed. Use free() to free the list.

Since
2.14

◆ libwacom_get_supported_styli()

LIBWACOM_DEPRECATED 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
Deprecated:
2.14 Use libwacom_get_styli() instead.

◆ 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()

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

Get the WacomStylus for the given tool ID.

The vendor ID is assumed to be the Wacom vendor id 0x56a.

Parameters
dbA Tablet and Stylus database.
idThe Tool ID for this stylus
Returns
A WacomStylus representing the stylus. Do not free.
Deprecated:
2.14 Use libwacom_get_styli() and libwacom_stylus_get_paired_styli() to obtain the WacomStylus directly

◆ 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()

LIBWACOM_DEPRECATED 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

For historical reasons this function will only return paired ids that match Wacom's vendor ID 0x56a. Callers should use libwacom_stylus_get_paired_styli() instead.

Deprecated:
2.14 Use libwacom_stylus_get_paired_styli() instead

◆ libwacom_stylus_get_paired_styli()

const WacomStylus ** libwacom_stylus_get_paired_styli ( const WacomStylus stylus,
int *  num_paired 
)
Parameters
stylusThe stylus to query
[out]num_pairedOptional return location for the length of the returned list, excluding the NULL terminator
Returns
A NULL-terminated list contain the styli paired with this stylus

The content of the list is owned by the database and must not be modified or freed. Use free() to free the list.

Since
2.14

◆ libwacom_stylus_get_type()

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

◆ libwacom_stylus_get_vendor_id()

int libwacom_stylus_get_vendor_id ( const WacomStylus stylus)
Parameters
stylusThe stylus to query
Returns
the vendor ID of the tool
Since
2.14

◆ 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