From 80a240cbd4657b7ffb67f69df01a4c104f0cfcb7 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 10 Aug 2020 13:15:44 +0200 Subject: [PATCH] Fix clipboard paste condition To avoid possible copy-paste loops between the computer and the device, the device clipboard is not set if it already contains the expected content. But the condition was wrong: it was not set also if it was empty. Refs 1223a72eb83ebafb878a25356250896c45b5cefa Fixes #1658 --- server/src/main/java/com/genymobile/scrcpy/Device.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.java index de551f356c..f23dd05680 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Device.java +++ b/server/src/main/java/com/genymobile/scrcpy/Device.java @@ -223,7 +223,7 @@ public boolean setClipboardText(String text) { } String currentClipboard = getClipboardText(); - if (currentClipboard == null || currentClipboard.equals(text)) { + if (currentClipboard != null && currentClipboard.equals(text)) { // The clipboard already contains the requested text. // Since pasting text from the computer involves setting the device clipboard, it could be set twice on a copy-paste. This would cause // the clipboard listeners to be notified twice, and that would flood the Android keyboard clipboard history. To workaround this