mirror of
https://github.com/debauchee/barrier.git
synced 2026-10-23 08:07:53 -06:00
[PR #2150] [CLOSED] Windows: sync clipboard immediately on copy (both directions) + per-screen seqnum #1860
Labels
No labels
HiDPI
bounty
bsd/freebsd
bsd/openbsd
bug
bug
build-infra
cantfix
critical
doc
duplicate
enhancement
fix-available
from git
from release
good first issue
help wanted
installer/package
invalid
linux
macOS
meta
needs testing
pull-request
query
question
regression
regression
v2.4.0
windows
wontfix
work-in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/barrier#1860
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/debauchee/barrier/pull/2150
Author: @ivanov84
Created: 9/1/2026
Status: ❌ Closed
Base:
master← Head:fix/windows-clipboard-sync📝 Commits (6)
92627abWindows: sync clipboard immediately on copy (both directions) + per-screen seqnum85f02d4Build: MSVC 2022 toolchain compatibility (C++17, std::filesystem, static CRT)a0de883Version 1.0.0 - first release of the barrier-win7-clipboard-auto-sync forka8b830aAdd tools/barriertray: always-visible tray helper with log access29b7238barriertray: guard locale macros against command-line redefinitioned0e186README: describe the clipboard auto-sync fork📊 Changes
16 files changed (+593 additions, -181 deletions)
View changed files
📝
.gitignore(+6 -0)📝
CMakeLists.txt(+5 -4)📝
README.md(+93 -148)📝
cmake/Version.cmake(+4 -4)📝
src/CMakeLists.txt(+1 -2)📝
src/lib/barrier/App.cpp(+51 -0)📝
src/lib/client/Client.cpp(+3 -5)📝
src/lib/io/filesystem.cpp(+0 -3)📝
src/lib/io/filesystem.h(+2 -2)📝
src/lib/platform/MSWindowsScreen.cpp(+9 -4)📝
src/lib/server/BaseClientProxy.cpp(+22 -1)📝
src/lib/server/BaseClientProxy.h(+13 -0)📝
src/lib/server/Server.cpp(+35 -8)➕
tools/barriertray/barriertray.cpp(+348 -0)➕
tools/barriertray/barriertray.rc(+1 -0)➕
tools/barriertray/tray.ico(+0 -0)📄 Description
Windows: sync clipboard immediately on copy (both directions) + per-screen seqnum
Problem
On Windows, copied text was only propagated to the other machine when the
mouse actually crossed into the other screen (grab), not on the copy itself.
On a headless server the user cannot see the remote mouse/second screen, so
they had to use external menu tricks to move the clipboard.
Additionally the server logs showed repeated
ignored screen "..." grab of clipboard 0/1and missequenced clipboardevents: the server kept ONE shared per-clipboard sequence number while each
screen maintains its OWN seqnum. After the primary raised the shared seqnum,
the client's (effectively 0) grabs/updates were rejected as missequenced —
this is what caused intermittent dropped copies.
Fix
MSWindowsScreen::onClipboardChange— report every clipboard changeimmediately (ungate the detection), not only on grab / mouse-leave.
Client::handleClipboardGrabbed— push the current clipboard to theserver immediately on grab (client → server).
Server::handleClipboardGrabbed— read the primary clipboard andbroadcast it to all clients on grab (server → client).
Server::onClipboardChanged— broadcast to all clients immediately.Server+BaseClientProxy— track clipboard sequence numbers perscreen (each
BaseClientProxyowns its own seqnum table, checked viacheckClipboardSeqNum), so a screen's independent seqnum is no longercompared against another screen's value and rejected.
App::setupFileLogging(win32) — when no-lfile is given, the node nowstill keeps a complete rolling log at
%APPDATA%\Barrier\logs\<exe>.log.Previously the GUI only forwarded a limited stdout buffer, so "Show Log"
in the GUI was small and stale and there was nothing to copy for
diagnostics.
Testing
End-to-end on Windows:
barriers+barriercover loopback, 6+ repeatedcopies from one machine to the other:
missequencedrejections, 0 real drops (the only "ignored" lines arethe server correctly deduplicating the receiving client's echo of an
unchanged value);
This is a Windows-only behavioral change; Linux/macOS paths are untouched
(the always-on file log is guarded by
SYSAPI_WIN32).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.