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

Only announce clipboard for plain text data #1840

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

samhed
Copy link
Member

@samhed samhed commented Oct 1, 2024

FLTK has support for both image and plain text clipboard data, we don't. This means we only send plain text clipboard from the viewer to the server. Some applications can get confused when we announce that clipboard is available and later don't send anything. An example of such an application is QGIS, in the remote session it froze when an image was copied on the client side.

Steps to reproduce:

  1. Connect using the vncviewer on Windows
  2. In the remote session, open the app QGIS and open the sample project "Bee Farming" (can be downloaded from here).
  3. On the Windows side (client-side), copy an image
  4. Notice that the QGIS app freezes

Xvnc logs the following:

 Tue Oct  1 11:30:06 2024
  Selection:   Remote clipboard announced, grabbing local ownership
  Selection:   Grabbed PRIMARY selection
  Selection:   Grabbed CLIPBOARD selection
  Selection:   Selection request for PRIMARY (type TARGETS)
  Selection:   Selection request for PRIMARY (type UTF8_STRING)
  Selection:   Requesting clipboard data from client
 
 Tue Oct  1 11:30:11 2024
  Selection:   Selection request for PRIMARY (type UTF8_STRING)
  Selection:   Requesting clipboard data from client
 
 Tue Oct  1 11:30:16 2024
  Selection:   Selection request for PRIMARY (type UTF8_STRING)
  Selection:   Requesting clipboard data from client
 
 Tue Oct  1 11:30:21 2024
  Selection:   Selection request for CLIPBOARD (type TARGETS)

While vncviewer logs:

 Tue Oct 01 11:30:04 2024
  Viewport:    Local clipboard changed whilst not focused, will notify server
              later
 
 Tue Oct 01 11:30:06 2024
  Viewport:    Focus regained after local clipboard change, notifying server

The problem for the QGIS application seems to occur when it has been notified by the VNC server that clipboard is available, and then doesn't get anything after asking for it.

This fix means we only call announceClipboard() when the clipboard contains plain text. That means TigerVNC is now more robust and doesn't trigger freezes in buggy applications.

FLTK has support for both image and plain text clipboard data, we don't.
This means we only send plain text clipboard from the viewer to the
server. Some applications can get confused when we announce that
clipboard is available and later don't send anything. An example of such
an application is QGIS, in the remote session it froze when an image was
copied on the client side.

This fix means we only call announceClipboard() when the clipboard
contains plain text. That means TigerVNC is now more robust and doesn't
trigger freezes in buggy applications.
@samhed samhed added the bug Something isn't working label Oct 1, 2024
@samhed samhed merged commit 2f53c28 into TigerVNC:master Oct 1, 2024
11 checks passed
@samhed samhed deleted the clipboard_contains branch October 1, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants