xpra icon
Bug tracker and wiki

Opened 8 months ago

Closed 8 months ago

#2673 closed defect (fixed)

Clipboard: Can't copy from Windows client to Motif gvim on Linux server

Reported by: pm54389 Owned by: pm54389
Priority: major Milestone: 4.0
Component: clipboard Version: 3.0.x
Keywords: Cc:

Description

(Continued from #2368)

Client: Windows 7, v4.0-r25747 (beta) (also seen with v3.0.8-r25712)
Server: RHEL 7.6, v3.0.5-r24939

Copying from Notepad to Motif gvim doesn't work. This is with remote clipboard set to either PRIMARY or CLIPBOARD. Copying from Notepad to xpra clipboard-test and also from xpra clipboard-test to Motif gvim does work with both PRIMARY and CLIPBOARD.

Building Motif gvim: install the motif-devel package (it's possible there were other dependencies already installed...). Then:

git clone https://github.com/vim/vim.git
cd vim
./configure --enable-gui=motif --with-motif-lib=-lXm
make

Then you can run it with

src/vim -g

Client xpra.conf:

remote-clipboard=PRIMARY
opengl=0
ssh=paramiko
encoding=rgb
min-speed=70
title=@title@
modal-windows=no

Let me know if you need more info...

Change History (5)

comment:1 Changed 8 months ago by Antoine Martin

Status: newassigned

On my Fedora system, this was needed (the first one is a bit overkill):

sudo dnf builddep vim-X11
sudo dnf install motif-devel

Otherwise it just ignores the gui=motif argument because some of the headers are missing.

comment:2 Changed 8 months ago by Antoine Martin

Owner: changed from Antoine Martin to pm54389
Status: assignednew

Works OK with 4.0-r25767 Fedora server and r25767 win10 client.
Also works with 3.0.8-r25767 Fedora server.

Not tried centos, but I wouldn't expect any differences.
@pm54389: please try the latest beta builds for centos and mswindows, and if you still have problems then please attach the server log of the missing copy event, running both client and server with -d clipboard.

Here's me pasting hello into vim -g from win10 using "*p connecting with --remote-clipboard=PRIMARY:

244 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x278a', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xa0002e', 'selection': 'PRIMARY', 'target': '_VIMENC_TEXT', 'property': '_XT_SELECTION_0', 'time': '0'}>)
244 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x278a', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xa0002e', 'selection': 'PRIMARY', 'target': '_VIMENC_TEXT', 'property': '_XT_SELECTION_0', 'time': '0'}>)
246 clipboard request for PRIMARY from window 0xa0002e: '[No Name] + - VIM', target=_VIMENC_TEXT, prop=_XT_SELECTION_0
247 send_clipboard_request_handler(X11ClipboardProxy(PRIMARY), 'PRIMARY', '_VIMENC_TEXT')
247 send_clipboard_request id=3
248 sending clipboard-pending-requests=1 to ClientConnection(2 : Protocol(tcp socket: 192.168.0.10:10000 <- 192.168.0.103:49857))
253 process clipboard contents, selection=PRIMARY, type=_VIMENC_TEXT, format=8
253 wire selection to raw, encoding=bytes, type=_VIMENC_TEXT, format=8, len(data)=0
253 clipboard wire -> raw: ('_VIMENC_TEXT', 8, 'bytes', '"b\'\'"') -> "b''"
254 clipboard got contents(3, '_VIMENC_TEXT', 8, '"b\'\'"'): proxy=X11ClipboardProxy(PRIMARY) for selection=PRIMARY
254 got_contents('_VIMENC_TEXT', '_VIMENC_TEXT', 8, '"b\'\'"') pending=(<GdkX11.X11Window object at 0x7f1164115c30 (GdkX11Window at 0x55c2c997ebc0)>, '_XT_SELECTION_0', 0)
255 setting response '' to property _XT_SELECTION_0 of window '[No Name] + - VIM' as _VIMENC_TEXT
255 set_selection_response(<GdkX11.X11Window object at 0x7f1164115c30 (GdkX11Window at 0x55c2c997ebc0)>, _VIMENC_TEXT, _XT_SELECTION_0, _VIMENC_TEXT, 8, "''", 0)
259 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x2795', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xa0002e', 'selection': 'PRIMARY', 'target': '_VIM_TEXT', 'property': '_XT_SELECTION_0', 'time': '0'}>)
260 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x2795', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xa0002e', 'selection': 'PRIMARY', 'target': '_VIM_TEXT', 'property': '_XT_SELECTION_0', 'time': '0'}>)
261 clipboard request for PRIMARY from window 0xa0002e: '[No Name] + - VIM', target=_VIM_TEXT, prop=_XT_SELECTION_0
261 send_clipboard_request_handler(X11ClipboardProxy(PRIMARY), 'PRIMARY', '_VIM_TEXT')
261 send_clipboard_request id=4
278 process clipboard contents, selection=PRIMARY, type=_VIM_TEXT, format=8
278 wire selection to raw, encoding=bytes, type=_VIM_TEXT, format=8, len(data)=0
278 clipboard wire -> raw: ('_VIM_TEXT', 8, 'bytes', '"b\'\'"') -> "b''"
278 clipboard got contents(4, '_VIM_TEXT', 8, '"b\'\'"'): proxy=X11ClipboardProxy(PRIMARY) for selection=PRIMARY
278 got_contents('_VIM_TEXT', '_VIM_TEXT', 8, '"b\'\'"') pending=(<GdkX11.X11Window object at 0x7f1164115c30 (GdkX11Window at 0x55c2c997ebc0)>, '_XT_SELECTION_0', 0)
278 setting response '' to property _XT_SELECTION_0 of window '[No Name] + - VIM' as _VIM_TEXT
279 set_selection_response(<GdkX11.X11Window object at 0x7f1164115c30 (GdkX11Window at 0x55c2c997ebc0)>, _VIM_TEXT, _XT_SELECTION_0, _VIM_TEXT, 8, "''", 0)
280 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x27a5', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xa0002e', 'selection': 'PRIMARY', 'target': 'UTF8_STRING', 'property': '_XT_SELECTION_0', 'time': '0'}>)
280 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x27a5', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xa0002e', 'selection': 'PRIMARY', 'target': 'UTF8_STRING', 'property': '_XT_SELECTION_0', 'time': '0'}>)
281 clipboard request for PRIMARY from window 0xa0002e: '[No Name] + - VIM', target=UTF8_STRING, prop=_XT_SELECTION_0
281 send_clipboard_request_handler(X11ClipboardProxy(PRIMARY), 'PRIMARY', 'UTF8_STRING')
281 send_clipboard_request id=5
284 process clipboard contents, selection=PRIMARY, type=UTF8_STRING, format=8
284 wire selection to raw, encoding=bytes, type=UTF8_STRING, format=8, len(data)=5
284 clipboard wire -> raw: ('UTF8_STRING', 8, 'bytes', '"b\'hello\'"') -> "b'hello'"
284 clipboard got contents(5, 'UTF8_STRING', 8, '"b\'hello\'"'): proxy=X11ClipboardProxy(PRIMARY) for selection=PRIMARY
284 got_contents('UTF8_STRING', 'UTF8_STRING', 8, '"b\'hello\'"') pending=(<GdkX11.X11Window object at 0x7f1164115c30 (GdkX11Window at 0x55c2c997ebc0)>, '_XT_SELECTION_0', 0)
284 setting response 'hello' to property _XT_SELECTION_0 of window '[No Name] + - VIM' as UTF8_STRING
284 set_selection_response(<GdkX11.X11Window object at 0x7f1164115c30 (GdkX11Window at 0x55c2c997ebc0)>, UTF8_STRING, _XT_SELECTION_0, UTF8_STRING, 8, "'hello'", 0)
354 sending clipboard-pending-requests=0 to ClientConnection(2 : Protocol(tcp socket: 192.168.0.10:10000 <- 192.168.0.103:49857))

comment:3 Changed 8 months ago by pm54389

Owner: changed from pm54389 to Antoine Martin

Thanks for investigating this Antoine.

I can't easily test with the server beta as I'm in a corporate environment where I can't install software on the server and have to ask the IT department. It took almost a month to get v3.0.5 installed...

Anyway, I think I worked out how to reproduce this. I ran it with -d clipboard and compared the logging you helpfully included to mine. The obvious difference is mine doesn't contain the lines with 'UTF8_STRING' and hello.

In my environment, the environment variable LANG is set to en_GB. If I change it to en_GB.utf8 before launching Motif gvim, it fixes the problem.

(I assume copy/paste is expected to work in non-utf8 locales?)

comment:4 Changed 8 months ago by Antoine Martin

Owner: changed from Antoine Martin to pm54389

The obvious difference is mine doesn't contain the lines with UTF8_STRING and hello.

Ah. Reproduced it with LANG=en_GB.

vim doesn't request the list of TARGETS, it just tries some until one works (..): _VIMENC_TEXT, then _VIM_TEXT, COMPOUND_TEXT, TEXT and STRING.

Now, that should work and we should be able to handle TEXT or STRING, converting those to text/plain or whatever, but because motif doesn't use the TARGETS part of the clipboard spec (does it predate it?) we have no way of knowing that the other end can't honour that request and that we need to translate it, until it is too late.

The quick fix done in r25770 is to accept TEXT and STRING` in the macos and win32 clipboards.
Other minor fixes in r25768, r25769. All of this has been backported to the v3.0.x branch and will be included in 3.0.8

A better long term solution is to clean this up more properly: #2679

@pm54389: the latest mswindows beta builds have this fix and should work.
If not, please include the debug log as per comment:2.

comment:5 Changed 8 months ago by pm54389

Resolution: fixed
Status: newclosed

Confirm fixed in client v4.0-r25770. Thanks so much!

Note: See TracTickets for help on using tickets.