Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always synchronize clipboard on explicit COPY/CUT #2834

Merged
merged 4 commits into from
Nov 29, 2021
Merged

Always synchronize clipboard on explicit COPY/CUT #2834

merged 4 commits into from
Nov 29, 2021

Conversation

rom1v
Copy link
Collaborator

@rom1v rom1v commented Nov 29, 2021

Always synchronize clipboard on explicit COPY/CUT

If --no-clipboard-autosync is enabled, the automatic clipboard synchronization whenever the device clipboard changes is disabled.

But on explicit COPY and CUT scrcpy shortcuts (MOD+c and MOD+x), the clipboard should still be synchronized, so that it remains possible to copy-paste from the device to the computer.

This is consistent with the behavior of MOD+v, which pastes the computer clipboard to the device.

Refs #2228
Refs #2817


Here are binaries so that you can test easily. Please replace these files in your v1.20 release:

  • scrcpy.exe sha256:0cee83cb1c44cf159845b16f3a0ad348fea76c75b846f19d1548866db71e275a
  • scrcpy-server sha256:c740e7888cdafb1d2753ee5858e8bd566d26498a79a49fe95a47c6f416130495

@rom1v rom1v changed the base branch from master to dev November 29, 2021 08:49
@Helaer
Copy link

Helaer commented Nov 29, 2021

--no-clipboard-autosync

No problem, it can be synchronized on my Huawei device.

@Helaer
Copy link

Helaer commented Nov 29, 2021

@rom1v However, on my Xiaomi device, even if --no-clipboard-autosync is not enabled, the device clipboard cannot be synchronized to the computer. I guess that the Xiaomi system may be blocking access to the device clipboard,I don’t know if you can No repair.

@rom1v
Copy link
Collaborator Author

rom1v commented Nov 29, 2021

@Helaer Does this help: #1423 (comment) / #1423 (comment) ?

@Helaer
Copy link

Helaer commented Nov 29, 2021

When I copy the text on the Xiaomi device, the console displays the following log information:
D:\scrcpy-win64-v1.20>scrcpy -Vdebug
INFO: scrcpy 1.20 https://github.com/Genymobile/scrcpy
DEBUG: Using server (portable): D:\scrcpy-win64-v1.20\scrcpy-server
DEBUG: Screensaver enabled
D:\scrcpy-win64-v1.20\scrcpy-server: 1 file pushed, 0 skipped. 76.3 MB/s (37191 bytes in 0.000s)
DEBUG: tunnel reverse 27183
DEBUG: === Tunnel reverse
DEBUG: === video_socket accept()
[server] INFO: Device: Xiaomi M2007J3SC (Android 11)
DEBUG: --> video_socket ok
DEBUG: === control_socket accept()
DEBUG: --> control_socket ok
DEBUG: === Close adb tunnel
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
DEBUG: === Device read info
DEBUG: --> device info: [M2007J3SC] 1080x2400
DEBUG: Server connected
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer)
DEBUG: Using icon (portable): D:\scrcpy-win64-v1.20\icon.png
INFO: Initial texture: 1080x2400
DEBUG: Starting stream thread
DEBUG: Computer clipboard unchanged

@rom1v
Copy link
Collaborator Author

rom1v commented Nov 29, 2021

DEBUG: === Tunnel reverse
DEBUG: === video_socket accept()
[server] INFO: Device: Xiaomi M2007J3SC (Android 11)
DEBUG: --> video_socket ok
DEBUG: === control_socket accept()
DEBUG: --> control_socket ok
DEBUG: === Close adb tunnel

Are these your custom logs? (=== or -->)
If not, which binary do you use? (I may have forgot to remove some debug logs on some branches)

DEBUG: Computer clipboard unchanged

This happens when the device sends a clipboard content which is already the same as the computer clipboard.

@Helaer
Copy link

Helaer commented Nov 29, 2021

@Helaer这有帮助吗:#1423(评论)

Unfortunately, in the latest system, there is no longer a close option.

B86391FE6F84528A6C9583C4C70DFEC2
B1E38589DDEAF5BE921F870F312EB5AE

@Helaer
Copy link

Helaer commented Nov 29, 2021

DEBUG: === Tunnel reverse
DEBUG: === video_socket accept()
[server] INFO: Device: Xiaomi M2007J3SC (Android 11)
DEBUG: --> video_socket ok
DEBUG: === control_socket accept()
DEBUG: --> control_socket ok
DEBUG: === Close adb tunnel

这些是您的自定义日志吗?(===-->) 如果不是,您使用哪个二进制文件?(我可能忘记删除某些分支上的一些调试日志)

调试:计算机剪贴板不变

当设备发送已经与计算机剪贴板相同的剪贴板内容时,就会发生这种情况。

This is a test version you provided when I reported a bug in version 1.20.

@rom1v
Copy link
Collaborator Author

rom1v commented Nov 29, 2021

Oh, ok, #2779 👍

@Helaer
Copy link

Helaer commented Nov 29, 2021

哦,好的,#2779 👍

I originally thought that this version could display more logs, so I used this version for testing.

@Helaer
Copy link

Helaer commented Nov 29, 2021

@Helaer这有帮助吗:#1423(评论) / #1423(评论)

Many mobile phone manufacturers have begun to restrict clipboard access, If scrcpy cannot request access permissions, it may no longer be able to synchronize the Android clipboard to the computer, which is a pity.

If paste is disabled on set_clipboard, then the PASTE key is not
injected, but COPY is unrelated.

PR #2834 <#2834>
Handle all actions related to SET_CLIPBOARD from the dedicated method.

PR #2834 <#2834>
Expose the inject input event mode so that it is possible to wait for
the events to be "finished". This will be necessary to read the
clipboard content only after the COPY or CUT key event is handled.

PR #2834 <#2834>
If --no-clipboard-autosync is enabled, the automatic clipboard
synchronization performed whenever the device clipboard changes is
disabled.

But on explicit COPY and CUT scrcpy shortcuts (MOD+c and MOD+x), the
clipboard should still be synchronized, so that it remains possible to
copy-paste from the device to the computer.

This is consistent with the behavior of MOD+v, which pastes the computer
clipboard to the device.

Refs #2228 <#2228>
Refs #2817 <#2817>
PR #2834 <#2834>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants