Defer clipboard inspection until focused - #2134
Conversation
CendioOssman
left a comment
There was a problem hiding this comment.
Thank you for your suggestion.
I think we just add needless complexity and confusion by making this Windows-only. Please adjust the commit so that this behaviour is the standard one.
700f1c0 to
85ae1b5
Compare
85ae1b5 to
39ed1d4
Compare
|
Thanks, agreed. I've removed the Windows-specific branch, so clipboard inspection is now deferred consistently across platforms. I also rebased onto current |
|
Please hold off on reviewing this for now - I've converted the PR back to draft. Further live testing exposed a remaining Windows clipboard failure. The patch addresses clipboard inspection/contention after a notification is received, but it does not address loss of notifications caused by FLTK’s Windows clipboard-viewer chain. I need to separate those behaviors and reassess the scope before requesting review again. |
Clipboard notifications can arrive while another application is still updating the clipboard, causing the format check to fail and the viewer to discard the change. When the viewer is unfocused, defer that inspection until focus returns. This avoids competing with clipboard producers while retaining the plain-text check added for remote applications.
39ed1d4 to
4c4a476
Compare
|
Further testing confirmed that this patch has a narrower scope than I initially thought: it avoids immediate clipboard inspection by an unfocused viewer, reducing contention and preventing a transient failed check from discarding a notification that was received. However it does not address missed Windows clipboard notifications caused by FLTK's own clipboard-viewer chain. I've updated the PR description accordingly, rebased onto current master, preserved the #2129 behavior and tightened the clipboardSource assignment. So this is intended as a targeted improvement, not a complete fix for Windows clipboard reliability, which requires a platform specific fix in FLTK. |
Summary
Defer plain-text clipboard inspection while the viewer is unfocused. TigerVNC already delays advertising the client clipboard until focus returns; this change also delays
Fl::clipboard_contains()until that point.This avoids unnecessary platform clipboard access from every unfocused viewer and prevents a transient failed format check from immediately being treated as a non-text clipboard.
Scope
This addresses the unfocused clipboard-inspection and contention path described in #2128. It does not change how FLTK delivers clipboard-change notifications, retry failed clipboard access, or recover notifications lost by the Windows clipboard-viewer chain.
The
source != 0check is retained, preserving the PRIMARY-selection behavior fixed by #2129.Addresses #2128.