Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.98k stars 169 forks source link

Copying 🥳 from Windows to Ubuntu works, from Ubuntu to Windows it gives `🥳` #4225

Closed stdedos closed 5 months ago

stdedos commented 6 months ago

Describe the bug

A clear and concise description of what the bug is.

Actual paste contents image

I can very reliably replicate it by copying from Ubuntu Sublime Merge to Windows Sublime Text. I don't know if the applications involved affect this*. Also, there don't seem to be errors in the log

"Xpra-Light-x86_64_6.1-r35733\xpra_cmd" shadow ssh://user@ip/0  --modal-windows=no --headerbar=off --title="@title@ on @@/@server-display@" --encodings=-webp --microphone=off --speaker=off --webcam=no --pulseaudio=no --opengl=no --min-speed=70 --key-shortcut=Shift+F2:toggle_pointer_grab

XPRA_EXECUTABLE=Xpra-Light-x86_64_6.1-r35733
XPRA_FILE_CHOOSER_NATIVE=2

2024-05-12 12:05:58,029 Xpra GTK3 client version 6.1-r35733 (gfec4bb7e41) beta (light build)
2024-05-12 12:05:58,265  running on Microsoft Windows Microsoft Windows 10 Enterprise
2024-05-12 12:05:58,266  cpython 3.11
2024-05-12 12:05:59,067 GStreamer version 1.24.3
2024-05-12 12:05:59,078 created named pipe 'Xpra\34620'
2024-05-12 12:05:59,138 keyboard layout 'United States - English' : 'us' (0x409)
2024-05-12 12:05:59,246 Connected (version 2.0, client OpenSSH_8.2p1)
2024-05-12 12:05:59,330 SSH password authentication failed:
2024-05-12 12:05:59,330  Bad authentication type
2024-05-12 12:05:59,330   allowed types: ['publickey', 'password']
2024-05-12 12:06:06,089 Authentication (password) successful!
2024-05-12 12:06:06,961 ssh server OS is 'linux-gnu'
2024-05-12 12:06:07,093 paramiko SSH agent forwarding enabled
2024-05-12 12:06:07,141  keyboard settings: layout=us
2024-05-12 12:06:07,143  desktop size is 4480x1516:
2024-05-12 12:06:07,144   Default (1185x401 mm - DPI: 96x96) workarea: 4480x1476
2024-05-12 12:06:07,144     Samsung C32JG5x  2560x1440 at    0x0    (697x392 mm - DPI: 93x93) workarea: 2560x1400
2024-05-12 12:06:07,144     LG IPS234        1920x1080 at 2560x436  (510x290 mm - DPI: 96x95) workarea: 1920x1040 at 2560x436
2024-05-12 12:06:07,624  SSH: 'Entering daemon mode; any further errors will be reported to:'
2024-05-12 12:06:07,625  SSH: "  '/run/user/1000/xpra/0/server.log'"
2024-05-12 12:06:09,784 enabled remote logging
2024-05-12 12:06:09,798 Xpra shadow server version 5.0
2024-05-12 12:06:09,799  remote desktop size is 1920x1080
2024-05-12 12:06:09,800   :0.0 (508x285 mm - DPI: 96x96) workarea: 1848x1053 at   72x27
2024-05-12 12:06:09,801     LGD eDP-1        (309x174 mm - DPI: 158x158)
2024-05-12 12:06:10,499 running, 1 windows
2024-05-12 12:06:15,842 UI thread is now blocked

(xpra_cmd:34620): Pango-WARNING **: 12:06:16.336: couldn't load font "Gentium Book Basic Bold Italic Not-Rotated 57.331", falling back to "Sans Bold Italic Not-Rotated 57.331", expect ugly output.

(xpra_cmd:34620): Pango-WARNING **: 12:06:16.365: couldn't load font "Gentium Book Basic Bold Italic Not-Rotated 57.096", falling back to "Sans Bold Italic Not-Rotated 57.096", expect ugly output.

(xpra_cmd:34620): Pango-WARNING **: 12:06:16.716: couldn't load font "DejaVu Serif Not-Rotated 59.797", falling back to "Sans Not-Rotated 59.797", expect ugly output.

(xpra_cmd:34620): Pango-WARNING **: 12:06:16.727: couldn't load font "URW Bookman L Not-Rotated 52.762", falling back to "Sans Not-Rotated 52.762", expect ugly output.
2024-05-12 12:06:16,776 UI thread is running again, resuming
2024-05-12 12:06:17,218 server is not responding, drawing spinners over the windows
2024-05-12 12:06:18,476 server is OK again

To Reproduce Steps to reproduce the behavior:

  1. server command
  2. client command
  3. specific action to trigger the bug

System Information (please complete the following information):

Additional context Add any other context about the problem here. Please see "reporting bugs" in the wiki section.

*: On a "newer" server (still Ubuntu 20.04.6), when copying from PyCharm Professional v242 (I think) e.g. this

def test_pudb_hookspec_arguments(testdir):
    p1 = testdir.makepyfile(
        """
        def test_1():
            import pudb
            pudb.set_trace()
            assert True
    """
    )

to Windows, I get the "HTML Rich Text format" as a result (instead of the raw text above)

Does not seem to happen on the "older" server, with PC-232.10227.11 PyCharm Community installed, though.

I tried to replicate it to xterm ... but idk how to paste on it 😓 It seems to be a bug when copy-pasting from e.g. gnome-text-editor

totaam commented 5 months ago

I tried to replicate it to xterm ... but idk how to paste on it 😓

This is documented! https://github.com/Xpra-org/xpra/blob/master/docs/Features/Clipboard.md#tool

totaam commented 5 months ago

Running the client with -d clipboard and copying from pycharm running on Fedora to notepad++ running on Windows 10, I see:

2024-05-23 13:12:33,840 process_clipboard_packet: clipboard-token, helper=ClipboardProtocolHelperCore
2024-05-23 13:12:33,842 process clipboard token selection=CLIPBOARD, local clipboard name=CLIPBOARD, proxy=Win32ClipboardProxy
2024-05-23 13:12:33,844 _filter_targets(UTF8_STRING, TEXT, STRING, text/plain)=('UTF8_STRING', 'TEXT', 'STRING', 'text/plain')
2024-05-23 13:12:33,845 wire selection to raw, encoding=bytes, type=UTF8_STRING, format=8, len(data)=189
2024-05-23 13:12:33,846 got token, selection=CLIPBOARD, targets=('UTF8_STRING', 'TEXT', 'STRING', 'text/plain'), target data={'UTF8_STRING': ('UTF8_STRING', 8, b'    def aud .. rce:\n            self.stop_sending_audio()\n')}, claim=True, can-receive=True
2024-05-23 13:12:33,847 _filter_targets(UTF8_STRING, TEXT, STRING, text/plain)=('UTF8_STRING', 'TEXT', 'STRING', 'text/plain')
2024-05-23 13:12:33,849 _filter_targets(UTF8_STRING, TEXT, STRING, text/plain)=('UTF8_STRING', 'TEXT', 'STRING', 'text/plain')
2024-05-23 13:12:33,849 got_contents: tell OS we have UTF8_STRING, TEXT, STRING, text/plain
2024-05-23 13:12:33,851 we got a byte string: b'    def audio_source_exit(self, source, *args) .. ource:\n            self.stop_sending_audio()\n'
2024-05-23 13:12:33,852 MultiByteToWideChar wlen=193
2024-05-23 13:12:33,853 GlobalAlloc buf=0x2c5f2020078
2024-05-23 13:12:33,853 with_clipboard_lock(460026, <function Win32ClipboardProxy.set_clipboard_text<locals>.set_clipboard_data at 0x000002c5f321c180>, <function Win32ClipboardProxy.set_clipboard_text.<locals>.set_clipboard_error at 0x000002c5f321c360>, 5, 10)
2024-05-23 13:12:33,853 OpenClipboard(0x704fa)=1
2024-05-23 13:12:33,855 EmptyClipboard()=1
2024-05-23 13:12:33,855 SetClipboardData(CF_UNICODETEXT, 193 chars)=3049192030328
2024-05-23 13:12:33,856 <function Win32ClipboardProxy.set_clipboard_text.<locals>.set_clipboard_data at 0x000002c5f321c180>()=True
2024-05-23 13:12:33,857 CloseClipboard()=1
2024-05-23 13:12:33,858 clipboard event: CLIPBOARDUPDATE, current owner: our window (hwnd=0x704fa)
2024-05-23 13:12:33,859 remove_block: CLIPBOARD

And I get the method pasted into notepad++ exactly as expected, that's both before and after the UTF8 fix for #4233.

@stdedos what am I doing wrong?

stdedos commented 5 months ago

Right ... I seem not to be able to trigger it anymore 😕

"Xpra-Light-x86_64_6.1-r35826\xpra_cmd" shadow ssh://user@ip/0  --modal-windows=no --headerbar=off --title="@title@ on @@/@server-display@" --encodings=-webp --microphone=off --speaker=off --webcam=no --pulseaudio=no --opengl=no --min-speed=70 --key-shortcut=Shift+F2:toggle_pointer_grab

XPRA_EXECUTABLE=Xpra-Light-x86_64_6.1-r35826
XPRA_FILE_CHOOSER_NATIVE=2

2024-05-25 23:00:05,053 Xpra GTK3 client version 6.1-r35826 (g4b8baa544b) beta (light build)
2024-05-25 23:00:05,945  running on Microsoft Windows Microsoft Windows 10 Enterprise
2024-05-25 23:00:05,945  cpython 3.11
2024-05-25 23:00:16,351 GStreamer version 1.24.3
2024-05-25 23:00:16,369 created named pipe 'Xpra\49656'
2024-05-25 23:00:50,810 keyboard layout 'United States - English' : 'us' (0x409)
2024-05-25 23:00:50,960 Connected (version 2.0, client OpenSSH_8.2p1)
2024-05-25 23:00:51,300 SSH password authentication failed:
2024-05-25 23:00:51,300  Bad authentication type
2024-05-25 23:00:51,300   allowed types: ['publickey', 'password']
2024-05-25 23:00:56,516 Authentication (password) successful!
2024-05-25 23:00:57,111 ssh server OS is 'linux-gnu'
2024-05-25 23:00:57,237 paramiko SSH agent forwarding enabled
2024-05-25 23:00:57,250  keyboard settings: layout=us
2024-05-25 23:00:57,252  desktop size is 4480x1516:
2024-05-25 23:00:57,252   Default (1185x401 mm - DPI: 96x96) workarea: 4480x1476
2024-05-25 23:00:57,253     Samsung C32JG5x  2560x1440 at    0x0    (697x392 mm - DPI: 93x93) workarea: 2560x1400
2024-05-25 23:00:57,253     LG IPS234        1920x1080 at 2560x436  (510x290 mm - DPI: 96x95) workarea: 1920x1040 at 2560x436
2024-05-25 23:00:57,672  SSH: 'Entering daemon mode; any further errors will be reported to:'
2024-05-25 23:00:57,673  SSH: "  '/run/user/1000/xpra/0/server.log'"
2024-05-25 23:00:59,663 enabled remote logging
2024-05-25 23:00:59,664 Xpra shadow server version 5.0
2024-05-25 23:00:59,664  remote desktop size is 1920x1080
2024-05-25 23:00:59,665   :0.0 (508x285 mm - DPI: 96x96) workarea: 1848x1053 at   72x27
2024-05-25 23:00:59,666     LGD eDP-1        (309x174 mm - DPI: 158x158)
2024-05-25 23:01:01,181 running, 1 windows