mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-19 22:01:05 +00:00
Move acknowledgment handling
Handle all actions related to SET_CLIPBOARD from the dedicated method. PR #2834 <https://github.com/Genymobile/scrcpy/pull/2834>
This commit is contained in:
parent
cbe73b0bc3
commit
dc19ae334d
@ -120,12 +120,7 @@ public class Controller {
|
||||
}
|
||||
break;
|
||||
case ControlMessage.TYPE_SET_CLIPBOARD:
|
||||
long sequence = msg.getSequence();
|
||||
setClipboard(msg.getText(), msg.getPaste());
|
||||
if (sequence != ControlMessage.SEQUENCE_INVALID) {
|
||||
// Acknowledgement requested
|
||||
sender.pushAckClipboard(sequence);
|
||||
}
|
||||
setClipboard(msg.getText(), msg.getPaste(), msg.getSequence());
|
||||
break;
|
||||
case ControlMessage.TYPE_SET_SCREEN_POWER_MODE:
|
||||
if (device.supportsInputEvents()) {
|
||||
@ -281,7 +276,7 @@ public class Controller {
|
||||
return device.pressReleaseKeycode(KeyEvent.KEYCODE_POWER);
|
||||
}
|
||||
|
||||
private boolean setClipboard(String text, boolean paste) {
|
||||
private boolean setClipboard(String text, boolean paste, long sequence) {
|
||||
boolean ok = device.setClipboardText(text);
|
||||
if (ok) {
|
||||
Ln.i("Device clipboard set");
|
||||
@ -292,6 +287,11 @@ public class Controller {
|
||||
device.pressReleaseKeycode(KeyEvent.KEYCODE_PASTE);
|
||||
}
|
||||
|
||||
if (sequence != ControlMessage.SEQUENCE_INVALID) {
|
||||
// Acknowledgement requested
|
||||
sender.pushAckClipboard(sequence);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user