Skip to content

Handling of input devices which identify as both mouse and keyboard #258

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

Closed
laynor opened this issue Jul 4, 2022 · 1 comment · Fixed by #323
Closed

Handling of input devices which identify as both mouse and keyboard #258

laynor opened this issue Jul 4, 2022 · 1 comment · Fixed by #323
Labels
enhancement New feature or request

Comments

@laynor
Copy link
Contributor

laynor commented Jul 4, 2022

Some input devices may identify as both mouse and keyboard. In this case, flutter-pi handles only mouse input, and the keyboard is non-functional.

In our case, the input device is a virtual device created with evdev (which identifies only as a keyboard on my development machine, but for reasons I haven't investigated well, identifies as both pointer and keyboard on the PI).

I worked around the issue checking for keyboard first in user_input.c::on_device_added, but I think in the general case all events should be handled.
While modifying the code from

    // Our workaround for the virtual keyboard, check for keyboard first
    if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) {  
       ...
    }else  if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER)) {
        ...
    } else if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH)) {

to

if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) {
   ...
}
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER)) {
    ...
}
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH)) {
may be enough, I'm not familiar enough with the code at hand to propose a PR for this
@ardera
Copy link
Owner

ardera commented Jul 4, 2022

Yeah I think just removing the else is fine, though handling a device that is both a pointer and a touch device requires some modifications to flutter device id calculations, so I'd keep the else if there. I don't know how to handle tablets correctly anyway.

@ardera ardera added the enhancement New feature or request label Nov 1, 2022
This was linked to pull requests Aug 18, 2023
@ardera ardera removed a link to a pull request Aug 18, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants