From 1630f923ef9847142839907a9c2f3c3bde3a3369 Mon Sep 17 00:00:00 2001 From: Yu-Chen Lin Date: Sun, 19 May 2019 09:00:15 +0800 Subject: [PATCH] Return success count in injectText It will insert as many text as possible now. Fix #509, tested on Windows 10 and Arch Linux. Signed-off-by: Yu-Chen Lin --- .../main/java/com/genymobile/scrcpy/EventController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/EventController.java b/server/src/main/java/com/genymobile/scrcpy/EventController.java index 341869fa..87aee61b 100644 --- a/server/src/main/java/com/genymobile/scrcpy/EventController.java +++ b/server/src/main/java/com/genymobile/scrcpy/EventController.java @@ -104,13 +104,15 @@ public class EventController { return true; } - private boolean injectText(String text) { + private int injectText(String text) { + int successCount = 0; for (char c : text.toCharArray()) { if (!injectChar(c)) { - return false; + continue; } + successCount++; } - return true; + return successCount; } private boolean injectMouse(int action, int buttons, Position position) {