SDL
SDL copied to clipboard
API for distinguishing individual mice
Please add an API to:
- enumerate mice present in the system (possibility to get their names)
- get notifications if a mouse is connected or disconnected
- get the events of particular mice only
Use case
I have recently started contributing code to a DOSBox Staging emulator, I mainly work on improving mouse support. Right now I'm adding a new feature: ability to map individual physical mice to emulated mouse interfaces (https://github.com/FeralChild64/dosbox-staging/commits/fc/mouse-updates-4 - the feature actually already works) - this will allow users to have a two player Settlers game on a split screen, using separate USB mice for each human player.
Unfortunately, SDL does not provide an API to implement this - I had to use a 3rd party library for mouse handling (https://github.com/icculus/manymouse/blob/main/manymouse.h - API definition). It would be nice to have such functionality built into SDL - I suppose it would be beneficial to other emulators (of PC, Amiga, SNES, ...) too.
This might fall into 3.0 territory but having a similar feature for keyboards would help a lot too - we have at least one NDA platform that exposes multiple keyboards and mice and I think the last of the padding got used recently, so we can't wedge it into the current structs :(
I recently implemented functionality that would allow this API to be implemented very easily. That's very funny. See #5972 and #5066
related request is #6724
Duplicate of https://github.com/libsdl-org/SDL/issues/7498