mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-21 12:05:00 +00:00
Add --no-game-controller option
This commit is contained in:
parent
9d50a9e3b4
commit
6feb8adfb0
4 changed files with 15 additions and 3 deletions
|
@ -112,6 +112,9 @@ scrcpy_print_usage(const char *arg0) {
|
|||
" Do not display device (only when screen recording is\n"
|
||||
" enabled).\n"
|
||||
"\n"
|
||||
" --no-game-controller\n"
|
||||
" Disable game controller support.\n"
|
||||
"\n"
|
||||
" --no-key-repeat\n"
|
||||
" Do not forward repeated key events when a key is held down.\n"
|
||||
"\n"
|
||||
|
@ -719,6 +722,7 @@ guess_record_format(const char *filename) {
|
|||
#define OPT_V4L2_SINK 1027
|
||||
#define OPT_DISPLAY_BUFFER 1028
|
||||
#define OPT_V4L2_BUFFER 1029
|
||||
#define OPT_NO_GAME_CONTROLLER 1030
|
||||
|
||||
bool
|
||||
scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) {
|
||||
|
@ -745,6 +749,7 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) {
|
|||
{"max-size", required_argument, NULL, 'm'},
|
||||
{"no-control", no_argument, NULL, 'n'},
|
||||
{"no-display", no_argument, NULL, 'N'},
|
||||
{"no-game-controller", no_argument, NULL, OPT_NO_GAME_CONTROLLER},
|
||||
{"no-key-repeat", no_argument, NULL, OPT_NO_KEY_REPEAT},
|
||||
{"no-mipmaps", no_argument, NULL, OPT_NO_MIPMAPS},
|
||||
{"port", required_argument, NULL, 'p'},
|
||||
|
@ -920,6 +925,9 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) {
|
|||
case OPT_NO_MIPMAPS:
|
||||
opts->mipmaps = false;
|
||||
break;
|
||||
case OPT_NO_GAME_CONTROLLER:
|
||||
opts->forward_game_controllers = false;
|
||||
break;
|
||||
case OPT_NO_KEY_REPEAT:
|
||||
opts->forward_key_repeat = false;
|
||||
break;
|
||||
|
|
|
@ -61,6 +61,7 @@ input_manager_init(struct input_manager *im, struct controller *controller,
|
|||
im->repeat = 0;
|
||||
|
||||
im->control = options->control;
|
||||
im->forward_game_controllers = options->forward_game_controllers;
|
||||
im->forward_key_repeat = options->forward_key_repeat;
|
||||
im->prefer_text = options->prefer_text;
|
||||
im->forward_all_clicks = options->forward_all_clicks;
|
||||
|
@ -953,14 +954,14 @@ input_manager_handle_event(struct input_manager *im, SDL_Event *event) {
|
|||
input_manager_process_touch(im, &event->tfinger);
|
||||
return true;
|
||||
case SDL_CONTROLLERAXISMOTION:
|
||||
if (!im->control) {
|
||||
if (!im->control || !im->forward_game_controllers) {
|
||||
break;
|
||||
}
|
||||
input_manager_process_controller_axis(im, &event->caxis);
|
||||
break;
|
||||
case SDL_CONTROLLERBUTTONDOWN:
|
||||
case SDL_CONTROLLERBUTTONUP:
|
||||
if (!im->control) {
|
||||
if (!im->control || !im->forward_game_controllers) {
|
||||
break;
|
||||
}
|
||||
input_manager_process_controller_button(im, &event->cbutton);
|
||||
|
@ -968,7 +969,7 @@ input_manager_handle_event(struct input_manager *im, SDL_Event *event) {
|
|||
case SDL_CONTROLLERDEVICEADDED:
|
||||
// case SDL_CONTROLLERDEVICEREMAPPED:
|
||||
case SDL_CONTROLLERDEVICEREMOVED:
|
||||
if (!im->control) {
|
||||
if (!im->control || !im->forward_game_controllers) {
|
||||
break;
|
||||
}
|
||||
input_manager_process_controller_device(im, &event->cdevice);
|
||||
|
|
|
@ -24,6 +24,7 @@ struct input_manager {
|
|||
unsigned repeat;
|
||||
|
||||
bool control;
|
||||
bool forward_game_controllers;
|
||||
bool forward_key_repeat;
|
||||
bool prefer_text;
|
||||
bool forward_all_clicks;
|
||||
|
|
|
@ -94,6 +94,7 @@ struct scrcpy_options {
|
|||
bool stay_awake;
|
||||
bool force_adb_forward;
|
||||
bool disable_screensaver;
|
||||
bool forward_game_controllers;
|
||||
bool forward_key_repeat;
|
||||
bool forward_all_clicks;
|
||||
bool legacy_paste;
|
||||
|
@ -144,6 +145,7 @@ struct scrcpy_options {
|
|||
.stay_awake = false, \
|
||||
.force_adb_forward = false, \
|
||||
.disable_screensaver = false, \
|
||||
.forward_game_controllers = true, \
|
||||
.forward_key_repeat = true, \
|
||||
.forward_all_clicks = false, \
|
||||
.legacy_paste = false, \
|
||||
|
|
Loading…
Add table
Reference in a new issue