snowcone-ltd / libmatoya

Cross-platform application development.
MIT License
593 stars 53 forks source link

Check Keyboard Source before Gamepad Source for keyEvent handling #120

Open tastelessjolt opened 1 year ago

tastelessjolt commented 1 year ago

Downstream PR: https://github.com/parsec-cloud/libmatoya/pull/87

According to InputDevice:

A multi-function keyboard may compose the capabilities of a standard keyboard together with a track pad mouse or other pointing device

When handling keyEvent from such device, between SOURCE_KEYBOARD and [SOURCE_GAMEPAD, SOURCE_JOYSTICK, SOURCE_DPAD], it might be better to prefer SOURCE_KEYBOARD handling.

There is a downstream issue in Parsec, on Samsung Galaxy Tab S8/S9 with Book Cover Keyboard, the keyEvents from this keyboard have both SOURCE_KEYBOARD and SOURCE_DPAD sources. But since the existing code handles these keyEvents as Gamepad event, normal keyboard presses don't do anything.

This change adds a SOURCE_KEYBOARD check before the Gamepad check so that Keyboard handling is preferred over Gamepad handling in multi source devices.

PohanThePagan commented 1 year ago

HI i am having exactly the same issue. I hawe sansung 5 tablet with bluetooth keybord and it is seeing it like gamepad. I wrote about it in parsec disrodr "HI guys I am having trouble with my parsec. The connection of fine ! however my keyboard is not connecting.I am using samsung DEX tablet and i am connecting to my windows PC. I bought a bluetooth keybord with tatchped. The keybord is fne and work 100% with the tablet. However The parsec is not registoring the keybord. I thing parsec is seeng it like GamePad and is showing me new gamepad : HID controller #11 (04E8/7021) what shold i do ?" and they send me here.

is there enithing you can do about this keybor issue ?

tastelessjolt commented 12 months ago

Hi @chrisd1100, I hope this message finds you well. I am following up on this PR, as it has been a while since I submitted it, and I have not yet received any reviews or comments. I wanted to bring it to your attention and ask if there are any questions or concerns that need to be addressed or if there is an estimated timeline for when the review might take place. Thank you both for your hard work and dedication to maintaining this project, and I appreciate your time and consideration.