moonlight-stream / moonlight-embedded

Gamestream client for embedded systems
https://github.com/moonlight-stream/moonlight-embedded/wiki
GNU General Public License v3.0
1.51k stars 324 forks source link

Fix double mouse capture, add isc option for custom input handling #639

Closed StevenDoesStuffs closed 5 years ago

StevenDoesStuffs commented 6 years ago

Note: Changes here only apply to X11 platforms. Also, this is my first ever time working with C code. And yes, I've read the contributing guidelines.

Purpose Fix double mouse capture, fixes #637 . Add -isc <file> option. Allows for better handling of non-gamestream input passthrough mechanisms such as usbip or virtualhere (I'm using it for USB-passthrough with a VM). There's more information in the help. Misc binding changes for better user experience. Description Double mouse capture: This was happening because the keyboard and mice both had mappings so it was passing it through like it would a game controller which overrided all the stuff in input/X11.c. Unfortunately the only fix I could come up with was to disable the autoadd for X11 which means that users will have to manually specify their controllers using -input.

isc: This works by disabling binding of mouse/keyboard during startup, overriding any mechanism of binding, and running a given script whenever the user clicks inside the window. There are possible security risks attached when using this option, so I've included a very through warning in the help.

Misc binding changes: Mouse and keyboard will only register on gamestream host when they're captured. Left clicking on the window now captures. The reason for these changes is that originally, there would be two cursors and while moving the mouse over the moonlight window, it would also move the mouse of the GS host (which was in a different position, so there were 2 moving cursors) and when clicking to focus the window, the click would also register on the GS host which was really annoying because the cursors were in different places.

irtimmer commented 6 years ago

While I like to fix the mouse capture issues and having an option to disable input, I'm not so sure about the -isc option. I do not see why it's needed to have an script run after Moonlight is started instead of using first a script setting up the alternative input methods before starting Moonlight Embedded.