Disable mouse by default if no video playback

If video playback is disabled, then SDK mouse (which uses absolute
positions) could not be used, so the default mouse mode was
automatically switched to UHID.

But UHID does not work on all devices, so it could make the whole scrcpy
session fail.

Instead, disable the mouse by default. It is still possible to pass -M
or --mouse=uhid to enable it explicitly.

Fixes #5410 <https://github.com/Genymobile/scrcpy/issues/5410>
This commit is contained in:
Romain Vimont 2024-10-29 18:59:29 +01:00
parent ce21f515e3
commit 2c25fd7a80

View File

@ -2841,8 +2841,8 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
if (otg) {
opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_AOA;
} else if (!opts->video_playback) {
LOGI("No video mirroring, mouse mode switched to UHID");
opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_UHID;
LOGI("No video mirroring, SDK mouse disabled");
opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_DISABLED;
} else {
opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_SDK;
}