libwacom
Wacom model identification library
Loading...
Searching...
No Matches
libwacom context

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

Typedefs

typedef struct _WacomError WacomError
 
typedef struct _WacomDeviceDatabase WacomDeviceDatabase
 

Enumerations

enum  WacomErrorCode {
  WERROR_NONE , WERROR_BAD_ALLOC , WERROR_INVALID_PATH , WERROR_INVALID_DB ,
  WERROR_BAD_ACCESS , WERROR_UNKNOWN_MODEL , WERROR_BUG_CALLER
}
 Possible error codes. More...
 

Functions

WacomErrorlibwacom_error_new (void)
 Allocate a new structure for error reporting.
 
void libwacom_error_free (WacomError **error)
 Free the error and associated memory.
 
enum WacomErrorCode libwacom_error_get_code (WacomError *error)
 
const char * libwacom_error_get_message (WacomError *error)
 
WacomDeviceDatabaselibwacom_database_new (void)
 Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions.
 
WacomDeviceDatabaselibwacom_database_new_for_path (const char *datadir)
 Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions, from the datadir given in the argument.
 
void libwacom_database_destroy (WacomDeviceDatabase *db)
 Free all memory used by the database.
 

Detailed Description

Functions to create and manage libwacom context.

Typedef Documentation

◆ WacomDeviceDatabase

typedef struct _WacomDeviceDatabase WacomDeviceDatabase

◆ WacomError

typedef struct _WacomError WacomError

Enumeration Type Documentation

◆ WacomErrorCode

Possible error codes.

Enumerator
WERROR_NONE 

No error has occured.

WERROR_BAD_ALLOC 

Allocation error.

WERROR_INVALID_PATH 

A path specified is invalid.

WERROR_INVALID_DB 

The passed DB is invalid.

WERROR_BAD_ACCESS 

Invalid permissions to access the path.

WERROR_UNKNOWN_MODEL 

Unsupported/unknown device.

WERROR_BUG_CALLER 

A bug in the caller.

Function Documentation

◆ libwacom_database_destroy()

void libwacom_database_destroy ( WacomDeviceDatabase db)

Free all memory used by the database.

Parameters
dbA Tablet and Stylus database.

◆ libwacom_database_new()

WacomDeviceDatabase * libwacom_database_new ( void  )

Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions.

Returns
A new database or NULL on error.

◆ libwacom_database_new_for_path()

WacomDeviceDatabase * libwacom_database_new_for_path ( const char *  datadir)

Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions, from the datadir given in the argument.

This is only useful for diagnostics applications.

The datadir must contain the libwacom .tablet files and optionally a layouts/ subdirectory for the svg files if any of the .tablet files references an svg.

datadir may be a colon-separated list of directories.

Returns
A new database or NULL on error.

◆ libwacom_error_free()

void libwacom_error_free ( WacomError **  error)

Free the error and associated memory.

Resets error to NULL.

Parameters
errorA reference to a error struct.
See also
libwacom_error_new

◆ libwacom_error_get_code()

enum WacomErrorCode libwacom_error_get_code ( WacomError error)
Returns
The code for this error.

◆ libwacom_error_get_message()

const char * libwacom_error_get_message ( WacomError error)
Returns
A human-readable message for this error

◆ libwacom_error_new()

WacomError * libwacom_error_new ( void  )

Allocate a new structure for error reporting.

Returns
A newly allocated error structure or NULL if the allocation failed.