SDL icon indicating copy to clipboard operation
SDL copied to clipboard

API for distinguishing individual mice

Open FeralChild64 opened this issue 1 year ago • 2 comments

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.

FeralChild64 avatar Jul 17 '22 20:07 FeralChild64

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 :(

flibitijibibo avatar Jul 18 '22 00:07 flibitijibibo

I recently implemented functionality that would allow this API to be implemented very easily. That's very funny. See #5972 and #5066

Axilot avatar Jul 30 '22 10:07 Axilot

related request is #6724

Torinde avatar Mar 08 '23 06:03 Torinde

Duplicate of https://github.com/libsdl-org/SDL/issues/7498

slouken avatar Nov 07 '23 05:11 slouken