quakeforge/include/evdev/inputlib.h
Bill Currie a91dac60d9 [input] Start work on improved input system
The common input code (input outer loop and event handling) has been
moved into libQFinput, and modified to have the concept of input drivers
that are registered by the appropriate system-level code (x11, win,
etc).

As well, my evdev input library code (with hotplug support) has been
added, but is not yet fully functional. However, the idea is that it
will be available on all systems that support evdev (Linux, and from
what I've read, FreeBSD).
2021-08-27 09:10:21 +09:00

46 lines
1.3 KiB
C

#ifndef evdev_inputlib_h
#define evdev_inputlib_h
typedef struct {
int num; ///< The high-level index of the button. Always 0-N
int evnum; ///< The low-level index of the button. May be sparse
int state; ///< Current state of the button.
} button_t;
typedef struct {
int num; ///< The high-level index of the axis. Always 0-N
int evnum; ///< The low-level index of the axis. May be sparse
int value; ///< Current value of the input axis.
// relative axes set these to 0
int min; ///< Minimum value for the axis (usually constant).
int max; ///< Maximum value for the axis (usually constant).
} axis_t;
typedef struct device_s {
struct device_s *next;
char *path;
char *name;
char *phys;
char *uniq;
int fd;
int max_button;
int *button_map;
int num_buttons;
button_t *buttons;
int max_abs_axis;
int *abs_axis_map;
int max_rel_axis;
int *rel_axis_map;
int num_abs_axes;
int num_rel_axes;
// includes both abs and rel axes, with abs first
int num_axes;
axis_t *axes;
int event_count;
} device_t;
int inputlib_check_input (void);
void inputlib_close (void);
int inputlib_init (void (*dev_add) (device_t *), void (*dev_rem) (device_t *));
#endif//evdev_inputlib_h