-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Add HID mouse support #2916
Add HID mouse support #2916
Commits on Jan 4, 2022
-
Use separate struct for input manager params
This avoids to directly pass the options instance (which contains more data than strictly necessary), and limit the number of parameters for the init function.
Configuration menu - View commit details
-
Copy full SHA for 2b34e12 - Browse repository at this point
Copy the full SHA 2b34e12View commit details -
Move input_manager into screen
The input_manager is strongly tied to the screen, it could not work independently of the specific screen implementation. To implement a user-friendly HID mouse behavior, some SDL events will need to be handled both by the screen and by the input manager. For example, a click must typically be handled by the input_manager so that it is forwarded to the device, but in HID mouse mode, the first click should be handled by the screen to capture the mouse (enable relative mouse mode). Make the input_manager a descendant of the screen, so that the screen decides what to do on SDL events. Concretely, replace this structure hierarchy: +- struct scrcpy +- struct input_manager +- struct screen by this one: +- struct scrcpy +- struct screen +- struct input_manager
Configuration menu - View commit details
-
Copy full SHA for 6102a0b - Browse repository at this point
Copy the full SHA 6102a0bView commit details -
Reorder controller and HID initialization
This allows to merge two "#ifdef HAVE_AOA_HID" blocks to simplify.
Configuration menu - View commit details
-
Copy full SHA for 5ce1ccd - Browse repository at this point
Copy the full SHA 5ce1ccdView commit details -
The AOA initialization state is already tracked by aoa_hid_initialized.
Configuration menu - View commit details
-
Copy full SHA for f04812f - Browse repository at this point
Copy the full SHA f04812fView commit details -
Destroy acksync immediately on error
If AOA or HID keyboard may not be initialized for some reason, acksync is useless.
Configuration menu - View commit details
-
Copy full SHA for 7121a0d - Browse repository at this point
Copy the full SHA 7121a0dView commit details -
Pass buttons state in scroll events
A scroll event might be produced when a mouse button is pressed (for example when scrolling while selecting a text). For consistency, pass the actual buttons state (instead of 0). In practice, it seems that this use case does not work properly with Android event injection, but it will work with HID mouse.
Configuration menu - View commit details
-
Copy full SHA for 9243754 - Browse repository at this point
Copy the full SHA 9243754View commit details -
Add relative mode flag to mouse processors
The default mouse injection works in absolute mode: it forwards clicks at a specific position on screen. To support HID mouse, add a flag to indicate that the mouse processor works in relative mode: it forwards mouse motion vectors, without any absolute reference to the screen.
Configuration menu - View commit details
-
Copy full SHA for b5855e5 - Browse repository at this point
Copy the full SHA b5855e5View commit details -
Provide relative mouse motion vector in event
This will allow the mouse processor to handle relative motion easily.
Configuration menu - View commit details
-
Copy full SHA for 6432937 - Browse repository at this point
Copy the full SHA 6432937View commit details -
Forward all motion events to mouse processors
The decision to not send motion events when no click is pressed is specific to Android mouse injection. Other mouse processors (e.g. for HID mouse) will need to receive all events.
Configuration menu - View commit details
-
Copy full SHA for 40fca82 - Browse repository at this point
Copy the full SHA 40fca82View commit details -
Add UI/UX support for relative mouse mode
In relative mouse mode, the mouse pointer must be "captured" from the computer. Toggle (disable/enable) relative mouse mode using any of the hardcoded capture keys: - left-Alt - left-Super - right-Super These capture keys do not conflict with shortcuts, since a shortcut is always a combination of the MOD key and some other key, while the capture key triggers an action only if it is pressed and released alone. The relative mouse mode is also automatically enabled on any click in the window, and automatically disabled on focus lost (it is possible to lose focus even without the mouse).
Configuration menu - View commit details
-
Copy full SHA for 17d01b5 - Browse repository at this point
Copy the full SHA 17d01b5View commit details -
Configuration menu - View commit details
-
Copy full SHA for aee1b39 - Browse repository at this point
Copy the full SHA aee1b39View commit details -
Refactor AOA/HID keyboard initialization
This paves the way to add support for HID mouse initialization.
Configuration menu - View commit details
-
Copy full SHA for ed2e45e - Browse repository at this point
Copy the full SHA ed2e45eView commit details -
Configuration menu - View commit details
-
Copy full SHA for cba84f6 - Browse repository at this point
Copy the full SHA cba84f6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 43aff4a - Browse repository at this point
Copy the full SHA 43aff4aView commit details