Commit Graph

14 Commits

Author SHA1 Message Date
Bill Currie 8db8f91e7d [input] Plug a pile of memory leaks
While most were "harmless" in that they were held pointers at shutdown,
a few bugs were exposed in the imt code.
2022-05-12 19:58:18 +09:00
Bill Currie 3cb93d4cbe [input] Add functions to get single axis/button info
Handy for retrieving the current state (raw) of a single axis or button.
2021-12-24 06:45:13 +09:00
Bill Currie bc0451634a [input] Drop unfocused evdev axis/button events
The kernel knows nothing about X11 application focus, so we need to take
care of it ourselves.

Device add/remove events are unaffected: the are always passed on.
2021-11-22 14:59:32 +09:00
Bill Currie b231b63413 [input] Implement hot-plug support for bindings
Hot-plug support is done via "connections" (not sure I'm happy with the
name) that provide a user specifiable name to input devices.  The
connections record the device name (eg, "6d spacemouse") and id (usually
usb path for evdev devices, but may be the device unique id if
available) and whether automatic reconnection should match just the
device name or both device name and id (prevents problems with changing
the device connected to the one usb port).
2021-11-10 13:22:44 +09:00
Bill Currie b95c749438 [input] Add a per-device event data pointer
This might pose a problem with multiple event targets (we'll see), but
it will make connecting input devices to bindings much easier.
2021-11-10 13:22:10 +09:00
Bill Currie 825d8b7a49 [input] Make a start on the new binding system
Input Mapping Tables are still at the core as they are a good concept,
however they include both axis and button mappings, and the size is not
hard-coded, but dependent on the known devices. Not much actually works
yet (nq segfaults when a key is pressed).
2021-11-03 19:02:39 +09:00
Bill Currie 09e3e62a0a [input] Move in_event.h and binding defs
They now live in the include QF/input directory. This cleans up include/QF
a little, and input.h as well.
2021-11-01 13:05:05 +09:00
Bill Currie cacf0be7f6 [util] Wrap fd_set
While select itself is reasonably portable, it turns out that including
the declaration for fd_set makes a bit of a mess for QF's clean headers.
2021-09-28 10:53:51 +09:00
Bill Currie 7f408351b9 [input] Use a single select call for all drivers
For drivers that support it. Polling is still supported and forces the
select timeout to 0 if any driver requires polling. For now, the default
timeout when all drivers use select is 10ms.
2021-09-26 15:11:07 +09:00
Bill Currie 13bc38a55b [input,ruamoko,qwaq] Fix incorrect use of PR_RESMAP
I had forgotten that _size was the number of rows in the map, not the
number of objects (1024 objects per row). This fixes the missed device
removal messages. And probably a slew of other bugs I'd yet to encounter
:P
2021-09-25 15:50:16 +09:00
Bill Currie cc730c90b4 [input] Rework device registration
And provide functions for collecting axis and button information from a
device id.
2021-09-20 15:21:11 +09:00
Bill Currie 70812b3c49 [input] Hook up low level input to events
This includes device add and remove events, and axis and buttons for
evdev. Will need to sort out X11 input later, but next is getting qwaq
responding.
2021-08-30 14:40:19 +09:00
Bill Currie b39b6031e8 [input] Give input drivers a private data pointer
The pointer can be updated at any time using the driver handle (returned
by IN_RegisterData).
2021-08-30 09:54:36 +09:00
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