mirror of
https://github.com/Genymobile/scrcpy
synced 2025-08-30 22:05:12 +00:00
Add --raw-key-events
This option allows to inject all input keys as key events, and ignore text events. Fixes #2816 <https://github.com/Genymobile/scrcpy/issues/2816> PR #2831 <https://github.com/Genymobile/scrcpy/pull/2831>
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#define OPT_TUNNEL_PORT 1031
|
||||
#define OPT_NO_CLIPBOARD_AUTOSYNC 1032
|
||||
#define OPT_TCPIP 1033
|
||||
#define OPT_RAW_KEY_EVENTS 1034
|
||||
|
||||
struct sc_option {
|
||||
char shortopt;
|
||||
@@ -282,6 +283,11 @@ static const struct sc_option options[] = {
|
||||
"drag & drop. It is passed as is to \"adb push\".\n"
|
||||
"Default is \"/sdcard/Download/\".",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_RAW_KEY_EVENTS,
|
||||
.longopt = "raw-key-events",
|
||||
.text = "Inject key events for all input keys, and ignore text events."
|
||||
},
|
||||
{
|
||||
.shortopt = 'r',
|
||||
.longopt = "record",
|
||||
@@ -1350,8 +1356,19 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
opts->push_target = optarg;
|
||||
break;
|
||||
case OPT_PREFER_TEXT:
|
||||
if (opts->key_inject_mode != SC_KEY_INJECT_MODE_MIXED) {
|
||||
LOGE("--prefer-text is incompatible with --raw-key-events");
|
||||
return false;
|
||||
}
|
||||
opts->key_inject_mode = SC_KEY_INJECT_MODE_TEXT;
|
||||
break;
|
||||
case OPT_RAW_KEY_EVENTS:
|
||||
if (opts->key_inject_mode != SC_KEY_INJECT_MODE_MIXED) {
|
||||
LOGE("--prefer-text is incompatible with --raw-key-events");
|
||||
return false;
|
||||
}
|
||||
opts->key_inject_mode = SC_KEY_INJECT_MODE_RAW;
|
||||
break;
|
||||
case OPT_ROTATION:
|
||||
if (!parse_rotation(optarg, &opts->rotation)) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user