Compare commits
1 Commits
master
...
forward_al
Author | SHA1 | Date | |
---|---|---|---|
|
e3edb522e4 |
@ -165,7 +165,14 @@ Do not attempt to use "adb reverse" to connect to the device.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-forward\-all\-clicks
|
.B \-\-forward\-all\-clicks
|
||||||
By default, right-click triggers BACK (or POWER on) and middle-click triggers HOME. This option disables these shortcuts and forward the clicks to the device instead.
|
Two behaviors are possible: either right-click triggers BACK (or POWER on) and middle-click triggers HOME, or these shortcuts are disabled and the clicks are forwarded to the device.
|
||||||
|
|
||||||
|
Possible values are "auto" (forward all clicks only for UHID and AOA mouse modes), "true" (fordward all clicks) and "false" (enable shortcuts for right-click and middle-click).
|
||||||
|
|
||||||
|
Default is "auto".
|
||||||
|
|
||||||
|
Passing the option without argument is equivalent to passing "true".
|
||||||
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-h, \-\-help
|
.B \-h, \-\-help
|
||||||
|
@ -354,9 +354,18 @@ static const struct sc_option options[] = {
|
|||||||
{
|
{
|
||||||
.longopt_id = OPT_FORWARD_ALL_CLICKS,
|
.longopt_id = OPT_FORWARD_ALL_CLICKS,
|
||||||
.longopt = "forward-all-clicks",
|
.longopt = "forward-all-clicks",
|
||||||
.text = "By default, right-click triggers BACK (or POWER on) and "
|
.argdesc = "value",
|
||||||
"middle-click triggers HOME. This option disables these "
|
.optional_arg = true,
|
||||||
"shortcuts and forwards the clicks to the device instead.",
|
.text = "Two behaviors are possible: either right-click triggers BACK "
|
||||||
|
"(or POWER on) and middle-click triggers HOME, or these "
|
||||||
|
"shortcuts are disabled and the clicks are forwarded to the "
|
||||||
|
"device.\n"
|
||||||
|
"Possible values are \"auto\" (forward all clicks only for "
|
||||||
|
"UHID and AOA mouse modes), \"true\" (forward all clicks) and "
|
||||||
|
"\"false\" (enable shortcuts for right and middle clicks).\n"
|
||||||
|
"Default is \"auto\".\n"
|
||||||
|
"Passing the option without argument is equivalent to passing "
|
||||||
|
"\"true\".",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.shortopt = 'h',
|
.shortopt = 'h',
|
||||||
@ -1531,6 +1540,28 @@ parse_lock_video_orientation(const char *s,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
parse_forward_all_clicks(const char *s, enum sc_forward_all_clicks *value) {
|
||||||
|
if (!s || !strcmp(s, "true")) {
|
||||||
|
*value = SC_FORWARD_ALL_CLICKS_TRUE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(s, "false")) {
|
||||||
|
*value = SC_FORWARD_ALL_CLICKS_FALSE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(s, "auto")) {
|
||||||
|
*value = SC_FORWARD_ALL_CLICKS_AUTO;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGE("Unsupported --forward-all-clicks value: %s (expected auto, true or "
|
||||||
|
"false).", s);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
parse_rotation(const char *s, uint8_t *rotation) {
|
parse_rotation(const char *s, uint8_t *rotation) {
|
||||||
long value;
|
long value;
|
||||||
@ -2322,7 +2353,10 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_FORWARD_ALL_CLICKS:
|
case OPT_FORWARD_ALL_CLICKS:
|
||||||
opts->forward_all_clicks = true;
|
if (!parse_forward_all_clicks(optarg,
|
||||||
|
&opts->forward_all_clicks)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_LEGACY_PASTE:
|
case OPT_LEGACY_PASTE:
|
||||||
opts->legacy_paste = true;
|
opts->legacy_paste = true;
|
||||||
@ -2608,6 +2642,15 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||||||
LOGE("SDK mouse mode requires video playback. Try --mouse=uhid.");
|
LOGE("SDK mouse mode requires video playback. Try --mouse=uhid.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts->forward_all_clicks == SC_FORWARD_ALL_CLICKS_AUTO) {
|
||||||
|
// By default, forward all clicks only for UHID and AOA
|
||||||
|
if (opts->mouse_input_mode == SC_MOUSE_INPUT_MODE_SDK) {
|
||||||
|
opts->forward_all_clicks = SC_FORWARD_ALL_CLICKS_FALSE;
|
||||||
|
} else {
|
||||||
|
opts->forward_all_clicks = SC_FORWARD_ALL_CLICKS_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otg) {
|
if (otg) {
|
||||||
|
@ -68,7 +68,7 @@ const struct scrcpy_options scrcpy_options_default = {
|
|||||||
.force_adb_forward = false,
|
.force_adb_forward = false,
|
||||||
.disable_screensaver = false,
|
.disable_screensaver = false,
|
||||||
.forward_key_repeat = true,
|
.forward_key_repeat = true,
|
||||||
.forward_all_clicks = false,
|
.forward_all_clicks = SC_FORWARD_ALL_CLICKS_AUTO,
|
||||||
.legacy_paste = false,
|
.legacy_paste = false,
|
||||||
.power_off_on_close = false,
|
.power_off_on_close = false,
|
||||||
.clipboard_autosync = true,
|
.clipboard_autosync = true,
|
||||||
|
@ -83,6 +83,12 @@ enum sc_orientation { // v v v
|
|||||||
SC_ORIENTATION_FLIP_270, // 1 1 1
|
SC_ORIENTATION_FLIP_270, // 1 1 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum sc_forward_all_clicks {
|
||||||
|
SC_FORWARD_ALL_CLICKS_AUTO,
|
||||||
|
SC_FORWARD_ALL_CLICKS_TRUE,
|
||||||
|
SC_FORWARD_ALL_CLICKS_FALSE,
|
||||||
|
};
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
sc_orientation_is_mirror(enum sc_orientation orientation) {
|
sc_orientation_is_mirror(enum sc_orientation orientation) {
|
||||||
assert(!(orientation & ~7));
|
assert(!(orientation & ~7));
|
||||||
@ -250,7 +256,7 @@ struct scrcpy_options {
|
|||||||
bool force_adb_forward;
|
bool force_adb_forward;
|
||||||
bool disable_screensaver;
|
bool disable_screensaver;
|
||||||
bool forward_key_repeat;
|
bool forward_key_repeat;
|
||||||
bool forward_all_clicks;
|
enum sc_forward_all_clicks forward_all_clicks;
|
||||||
bool legacy_paste;
|
bool legacy_paste;
|
||||||
bool power_off_on_close;
|
bool power_off_on_close;
|
||||||
bool clipboard_autosync;
|
bool clipboard_autosync;
|
||||||
|
@ -706,13 +706,18 @@ scrcpy(struct scrcpy_options *options) {
|
|||||||
const char *window_title =
|
const char *window_title =
|
||||||
options->window_title ? options->window_title : info->device_name;
|
options->window_title ? options->window_title : info->device_name;
|
||||||
|
|
||||||
|
// The option forward_all_clicks must have been resolved at this point
|
||||||
|
assert(options->forward_all_clicks != SC_FORWARD_ALL_CLICKS_AUTO);
|
||||||
|
bool forward_all_clicks =
|
||||||
|
options->forward_all_clicks == SC_FORWARD_ALL_CLICKS_TRUE;
|
||||||
|
|
||||||
struct sc_screen_params screen_params = {
|
struct sc_screen_params screen_params = {
|
||||||
.video = options->video_playback,
|
.video = options->video_playback,
|
||||||
.controller = controller,
|
.controller = controller,
|
||||||
.fp = fp,
|
.fp = fp,
|
||||||
.kp = kp,
|
.kp = kp,
|
||||||
.mp = mp,
|
.mp = mp,
|
||||||
.forward_all_clicks = options->forward_all_clicks,
|
.forward_all_clicks = forward_all_clicks,
|
||||||
.legacy_paste = options->legacy_paste,
|
.legacy_paste = options->legacy_paste,
|
||||||
.clipboard_autosync = options->clipboard_autosync,
|
.clipboard_autosync = options->clipboard_autosync,
|
||||||
.shortcut_mods = options->shortcut_mods,
|
.shortcut_mods = options->shortcut_mods,
|
||||||
|
@ -108,11 +108,20 @@ This only works for the default mouse mode (`--mouse=sdk`).
|
|||||||
|
|
||||||
## Right-click and middle-click
|
## Right-click and middle-click
|
||||||
|
|
||||||
By default, right-click triggers BACK (or POWER on) and middle-click triggers
|
Two behaviors are possible:
|
||||||
HOME. To disable these shortcuts and forward the clicks to the device instead:
|
|
||||||
|
- either right-click triggers BACK (or POWER on) and middle-click triggers
|
||||||
|
HOME, or
|
||||||
|
- these shortcuts are disabled and the clicks are forwarded to the device.
|
||||||
|
|
||||||
|
By default, the clicks are forwarded only for UHID and AOA [mouse
|
||||||
|
modes](mouse.md).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --forward-all-clicks
|
scrcpy --forward-all-clicks # enable
|
||||||
|
scrcpy --forward-all-clicks=auto # enable only for UHID and AOA (default)
|
||||||
|
scrcpy --forward-all-clicks=true # enable (equivalent to no argument)
|
||||||
|
scrcpy --forward-all-clicks=false # disable
|
||||||
```
|
```
|
||||||
|
|
||||||
## File drop
|
## File drop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user