Do not pass scrcpy_options to keyboard inject
The components should be configurable independently of the global scrcpy_options instance: their configuration could be provided separately, like it is the case for example for some screen parameters. For consistency, keyboard injection should not depend on scrcpy_options.
This commit is contained in:
parent
43aff4af73
commit
75655194fb
3 changed files with 8 additions and 5 deletions
|
@ -325,10 +325,11 @@ sc_key_processor_process_text(struct sc_key_processor *kp,
|
||||||
void
|
void
|
||||||
sc_keyboard_inject_init(struct sc_keyboard_inject *ki,
|
sc_keyboard_inject_init(struct sc_keyboard_inject *ki,
|
||||||
struct controller *controller,
|
struct controller *controller,
|
||||||
const struct scrcpy_options *options) {
|
enum sc_key_inject_mode key_inject_mode,
|
||||||
|
bool forward_key_repeat) {
|
||||||
ki->controller = controller;
|
ki->controller = controller;
|
||||||
ki->key_inject_mode = options->key_inject_mode;
|
ki->key_inject_mode = key_inject_mode;
|
||||||
ki->forward_key_repeat = options->forward_key_repeat;
|
ki->forward_key_repeat = forward_key_repeat;
|
||||||
|
|
||||||
ki->repeat = 0;
|
ki->repeat = 0;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct sc_keyboard_inject {
|
||||||
void
|
void
|
||||||
sc_keyboard_inject_init(struct sc_keyboard_inject *ki,
|
sc_keyboard_inject_init(struct sc_keyboard_inject *ki,
|
||||||
struct controller *controller,
|
struct controller *controller,
|
||||||
const struct scrcpy_options *options);
|
enum sc_key_inject_mode key_inject_mode,
|
||||||
|
bool forward_key_repeat);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -535,7 +535,8 @@ aoa_hid_end:
|
||||||
// keyboard_input_mode may have been reset if HID mode failed
|
// keyboard_input_mode may have been reset if HID mode failed
|
||||||
if (options->keyboard_input_mode == SC_KEYBOARD_INPUT_MODE_INJECT) {
|
if (options->keyboard_input_mode == SC_KEYBOARD_INPUT_MODE_INJECT) {
|
||||||
sc_keyboard_inject_init(&s->keyboard_inject, &s->controller,
|
sc_keyboard_inject_init(&s->keyboard_inject, &s->controller,
|
||||||
options);
|
options->key_inject_mode,
|
||||||
|
options->forward_key_repeat);
|
||||||
kp = &s->keyboard_inject.key_processor;
|
kp = &s->keyboard_inject.key_processor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue