mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 08:41:11 +00:00
[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).
This commit is contained in:
parent
8a5c3c1ac1
commit
a91dac60d9
14 changed files with 867 additions and 43 deletions
14
include/evdev/hotplug.h
Normal file
14
include/evdev/hotplug.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef evdev_hotplug_h
|
||||
#define evdev_hotplug_h
|
||||
|
||||
int inputlib_hotplug_init(const char *path,
|
||||
void (*created) (const char*),
|
||||
void (*deleted) (const char *));
|
||||
|
||||
void inputlib_hotplug_close (void);
|
||||
|
||||
int inputlib_hotplug_add_select (fd_set *fdset, int *maxfd);
|
||||
|
||||
int inputlib_hotplug_check_select (fd_set *fdset);
|
||||
|
||||
#endif//evdev_hotplug_h
|
46
include/evdev/inputlib.h
Normal file
46
include/evdev/inputlib.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
#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
|
Loading…
Add table
Add a link
Reference in a new issue