Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcore][drm] Adding support for more than one keyboard/mouse #4631

Open
4 tasks done
jwaxy opened this issue Dec 22, 2024 · 1 comment
Open
4 tasks done

[rcore][drm] Adding support for more than one keyboard/mouse #4631

jwaxy opened this issue Dec 22, 2024 · 1 comment
Labels
platform: DRM/RPI DRM/Raspberry Pi platform

Comments

@jwaxy
Copy link

jwaxy commented Dec 22, 2024

Please, before submitting a new issue verify and check:

  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

Issue description

First of all, thank you for creating and maintaining raylib—it's an amazing library that makes graphics programming fun and accessible!

While working on a project using raylib with the DRM backend (PLATFORM=DRM), I noticed that the DRM backend currently supports:

  • Only 1 mouse
  • Only 1 keyboard
  • A limited, configurable number of gamepads (default: 4).

To address this, I myself implemented dynamic support for multiple mouse and keyboard devices in a custom Raylib source. My approach involved:

  • Making mouseFd and keyboardFd pointers to dynamically allocated arrays.
  • Using RL_REALLOC to adjust the array size as new devices are configured.

I would like to clarify if the current limitation on device counts is intentional or simply a design decision. Additionally, I’m considering creating a pull request for this enhancement and would like feedback on whether it would be desirable. Specifically:

  • Should I implement this dynamic support for all devices (mouse, keyboard, gamepads)?
  • Or should I implement fixed, configurable amount for mouse and keyboard like gamepads are implemented
  • Are there specific concerns or guidelines I should be aware of?

Environment

Operating System: Arch Linux
Platform Backend: DRM
Other details are likely not relevant to this issue but can be provided if necessary.

@jwaxy
Copy link
Author

jwaxy commented Dec 22, 2024

I'm sure that GLFW does support multiple mouse and keyboard, it just can't distinguish them, this what your ref's say. Maybe there was a misunderstanding. I didn't ask for support to distinguish which mouse or keyboard is being used, the DRM backend polls only the last device it finds for each category (mouse, keyboard) except the gamepads which have a limited but configurable amount. And I wanted to know if this is intentional or should be changed. And regarding pointers they will only be used internally when polling so it won't change any APIs.

@raysan5 raysan5 changed the title [rcore_drm] Adding support for more than one keyboard/mouse [rcore][drm] Adding support for more than one keyboard/mouse Dec 23, 2024
@raysan5 raysan5 added the platform: DRM/RPI DRM/Raspberry Pi platform label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: DRM/RPI DRM/Raspberry Pi platform
Projects
None yet
Development

No branches or pull requests

2 participants