2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-09-02 15:25:14 +00:00

Make process_text() optional

Not all key processors support text injection (HID keyboard does not
support it).

Instead of providing a dummy op function, set it to NULL and check on
the caller side before calling it.
This commit is contained in:
Romain Vimont
2021-12-30 15:03:39 +01:00
parent 63e29b1782
commit bc674721dc
3 changed files with 17 additions and 11 deletions

View File

@@ -384,6 +384,11 @@ rotate_client_right(struct screen *screen) {
static void
input_manager_process_text_input(struct input_manager *im,
const SDL_TextInputEvent *event) {
if (!im->kp->ops->process_text) {
// The key processor does not support text input
return;
}
if (is_shortcut_mod(im, SDL_GetModState())) {
// A shortcut must never generate text events
return;
@@ -620,6 +625,7 @@ input_manager_process_key(struct input_manager *im,
.mods_state = sc_mods_state_from_sdl(event->keysym.mod),
};
assert(im->kp->ops->process_key);
im->kp->ops->process_key(im->kp, &evt, ack_to_wait);
}