Skip to content

Commit

Permalink
Fix clipboard paste condition
Browse files Browse the repository at this point in the history
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 1223a72
Fixes #1658 <#1658>
  • Loading branch information
rom1v committed Aug 10, 2020
1 parent af8e62f commit 80a240c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/src/main/java/com/genymobile/scrcpy/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 80a240c

Please sign in to comment.