[GH-ISSUE #769] Under linux, select the text first, then take a screenshot, the selected text appears in the windows clipboard instead of the image data. #604

Open
opened 2026-05-05 06:46:04 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @mokyle on GitHub (Jun 25, 2020).
Original GitHub issue: https://github.com/debauchee/barrier/issues/769

Operating Systems

Server: Manjaro 20.0.3 Lysia

Client: windows 10 v2004

Barrier Version

2.3.2-1

Steps to reproduce bug

When I first selected a piece of text (not copied to the clipboard), then took a screenshot (the image data was copied to the clipboard), and then switched to the windows screen, the text of the selected text appeared in the windows clipboard, but there was no image data.

Other info

Later I learned that X under Linux does have two clipboards: https://unix.stackexchange.com/questions/139191/whats-the-difference-between-primary-selection-and-clipboard-buffer. Knowing this feature, I slightly changed the source code to ignore the clipboard called primary:

diff -r barrier-2.3.2/src/lib/server/Server.cpp /tmp/b/barrier-2.3.2/src/lib/server/Server.cpp
490c490
<for (ClipboardID id = 0; id <kClipboardEnd; ++id) {
---
> for (ClipboardID id = 0; id <kClipboardEnd-1; ++id) {
512c512
<for (ClipboardID id = 0; id <kClipboardEnd; ++id) {
---
> for (ClipboardID id = 0; id <kClipboardEnd-1; ++id) {

Sorry, I only learned C language at the university for dozens of classes, but the changes did work.

I'm not sure if I just encountered this problem, maybe this issue can help some people.

Originally created by @mokyle on GitHub (Jun 25, 2020). Original GitHub issue: https://github.com/debauchee/barrier/issues/769 ### Operating Systems ### Server: Manjaro 20.0.3 Lysia Client: windows 10 v2004 ### Barrier Version ### 2.3.2-1 ### Steps to reproduce bug ### When I first selected a piece of text (not copied to the clipboard), then took a screenshot (the image data was copied to the clipboard), and then switched to the windows screen, the text of the selected text appeared in the windows clipboard, but there was no image data. ### Other info ### Later I learned that X under Linux does have two clipboards: https://unix.stackexchange.com/questions/139191/whats-the-difference-between-primary-selection-and-clipboard-buffer. Knowing this feature, I slightly changed the source code to ignore the clipboard called primary: ``` diff -r barrier-2.3.2/src/lib/server/Server.cpp /tmp/b/barrier-2.3.2/src/lib/server/Server.cpp 490c490 <for (ClipboardID id = 0; id <kClipboardEnd; ++id) { --- > for (ClipboardID id = 0; id <kClipboardEnd-1; ++id) { 512c512 <for (ClipboardID id = 0; id <kClipboardEnd; ++id) { --- > for (ClipboardID id = 0; id <kClipboardEnd-1; ++id) { ``` Sorry, I only learned C language at the university for dozens of classes, but the changes did work. I'm not sure if I just encountered this problem, maybe this issue can help some people.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 18, 2020):

This issue has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Thank you for your contributions.

<!-- gh-comment-id:694597015 --> @github-actions[bot] commented on GitHub (Sep 18, 2020): This issue has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Thank you for your contributions.
Author
Owner

@p12tic commented on GitHub (Jan 10, 2021):

Let's not close valid bugs without a valid reason.

<!-- gh-comment-id:757533138 --> @p12tic commented on GitHub (Jan 10, 2021): Let's not close valid bugs without a valid reason.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#604
No description provided.