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

clipboard images with html5 client #71

Closed
totaam opened this issue Jun 3, 2019 · 26 comments
Closed

clipboard images with html5 client #71

totaam opened this issue Jun 3, 2019 · 26 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Jun 3, 2019

Issue migrated from trac ticket # 2312

component: html5 | priority: major | resolution: fixed

2019-06-03 05:00:41: antoine created the issue


We want to transfer the pixel data as image/png and set it as best we can using setData or newer methods (#1844).

See THE DEFINITIVE GUIDE TO COPYING AND PASTING IN JAVASCRIPT

The difficulty here is that because the html5 clibpoard is greedy, we need to choose png as soon as we get the clipboard event so we can send the binary data with the token.

Some pointers in Xpra-org/xpra#812#comment:29

@totaam
Copy link
Collaborator Author

totaam commented Jun 3, 2019

More pointers:

Raising Xpra-org/xpra#1844.

@totaam
Copy link
Collaborator Author

totaam commented Jun 3, 2019

As per Chrome Platform Status: Asynchronous Clipboard API: Support for images and other data types is still under development.

@totaam
Copy link
Collaborator Author

totaam commented Jun 3, 2019

MDN: Clipboard: only Firefox has support for read() and write. (since Firefox 63)

@totaam
Copy link
Collaborator Author

totaam commented Jun 3, 2019

Firefox only: clipboard.setImageData The image is provided as an ArrayBuffer containing the encoded image. JPEG and PNG formats are supported.

Chrome: chrome.clipboard setImageData : Since Chrome 76. Warning: this is the current Dev channel.

@totaam
Copy link
Collaborator Author

totaam commented Jun 4, 2019

The image API is now available in chrome beta: https://bugs.chromium.org/p/chromium/issues/detail?id=150835#c118
This can also be enabled in M75 (released in stable tomorrow) through enabling the experimental flag here:
chrome://flags/#enable-experimental-web-platform-features
(use this as a link)

@totaam
Copy link
Collaborator Author

totaam commented Jun 4, 2019

2019-06-04 16:28:06: antoine uploaded file clipboard.html (2.5 KiB)

test page that crashes the chrome tab

@totaam
Copy link
Collaborator Author

totaam commented Jun 4, 2019

2019-06-04 16:34:59: antoine uploaded file clipboard-html5-images.patch (11.3 KiB)

support for images in and out with latest chrome - almost working

@totaam
Copy link
Collaborator Author

totaam commented Jun 4, 2019

The patch above almost works, but there is a problem with chrome: the tabs crash... reproducer in [/attachment/ticket/2312/clipboard.html].

With the new read() and write() API calls, we could modify the new clipboard code to work more like the regular X11 asynchronous clipboard and return the list of data types it supports, without bundling the data with it. Saving lots of bandwidth and making it more reliable when there are multiple options: the client application can then choose the format most suitable instead of us picking one.
This would require a reversible mapping from clipboard data types to the wire ones. Tricky?

It would be useful to collect the list of mimetypes we can get from the async API so we can handle them properly rather than assuming we just get UTF8 for text and image/png for images.


Related links:

@totaam
Copy link
Collaborator Author

totaam commented Jun 6, 2019

Merged the image transfer clipboard code (disabled by default) in r22857.
(so it won't bitrot)

@totaam
Copy link
Collaborator Author

totaam commented Jul 3, 2019

chrome bug reported here: clipboard.write can crash the tab

@totaam
Copy link
Collaborator Author

totaam commented Jul 25, 2019

They claim that the bug has been fixed, but it's still present in the latest beta builds.
Version 76.0.3809.80 (Official Build) beta (64-bit)

Also, the png data from the example I have given is clearly valid, so it should not be throwing a DOMException in the first place: bug 981006: comment 22

@totaam
Copy link
Collaborator Author

totaam commented Jul 26, 2019

2019-07-26 06:16:05: antoine uploaded file clipboard-fixed.html (2.5 KiB)

working clipboard image copy

@totaam
Copy link
Collaborator Author

totaam commented Jul 26, 2019

Updates:

  • r23310 fixes the Blob instantiation, copying images to the clipboard works!
  • r23311 (+rr23312 fixup) enables it by default
  • r23313 same for server-to-client

Tested by:

  • starting a TCP server
  • connecting with chrome 76 and enabling the feature (see comment:6)
  • within the session, using eog to browse some local images
  • then control-C to copy the image to the clipboard
  • on the client, run gimp and create a new picture
  • paste the image into gimp

Things to consider:

  • the copy is asynchronous and if you alt-tab away from the browser window quickly after copying the image, chrome will fail and complain that the document is not active (as a log message only..)
  • size limit: clipboard transfers are not rate-limited, so maybe we should re-use the file-transfer code for chunking them? or downsize the image if we find that the data is too big? (16MB is now the limit - which is pretty big for one packet!)
  • we don't test for the "png" clipboard feature in the browser, only for the new API availability - though in practice the end result is almost the same: if copying images is not supported then it will fail but transferring an image as plain text is unlikely to be useful anyway (ie: with eog, you get the file path as text, which is not useful)
  • having clipit running can still cause problem, even though we try to ignore it
  • some clipboard attributes should be refactored: move clipboard attributes to clipboard class xpra#2370
  • when sharing the same session with multiple clients, the type of data transferred for clipboard copying will change depending on what the client is capable of handling (should work - not tested)
  • could add "jpeg" support, looks like chrome has this already
  • by parsing image data on the server side (adding the image timestamp and optional overlay), we ensure that the image data is valid png as produced by python-pillow, but this may also strip metadata from the file

@afarr: this should be of interest to you

@totaam
Copy link
Collaborator Author

totaam commented Sep 19, 2019

2019-09-19 20:54:13: afarr commented


Just as an FYI - Chrome 76 now seems to be stable (76.0.3809.132), but testing without nocicing the enabling detail of comment6... it is still failing.

@totaam
Copy link
Collaborator Author

totaam commented Sep 20, 2019

it is still failing.

Does it work if you enable the experimental features as per comment:6?

@totaam
Copy link
Collaborator Author

totaam commented Oct 21, 2019

Warning: see Xpra-org/xpra#1844 comment:13 (Firefox is a no go, IE / MS Edge use the legacy code)

@totaam
Copy link
Collaborator Author

totaam commented Oct 24, 2019

2019-10-24 23:19:52: afarr commented


Decided to update to 4.0 and try - 4.0-24232 with Chrome 77 on Windows 7 as html5 client (did not explicitly enable the experimental features).

Launched the fedora 30 server with my favorite command.

xpra start :13 --no-daemon --bind-tcp=0.0.0.0:1234 --bind-ws=0.0.0.0:1237 --start-child=xterm --start-child=xterm --exit-with-children

... then launched chromium-browser from an xterm and tried to copy one of the images from https://www.techjunkie.com/setup-64-bit-guest-virtualbox/ and paste it into a word doc (.txt files don't take pasted images so word seems simplest?).

Oddly, it looks like I was seeing behavior similar to that with attempts to copy/paste from an in-session launched Firefox browser (#2452).

I copied one of the images locally, and pasted into word doc locally - successfully.

I then copied the site address and pasted it into the address bar of a new tab of the server-side running chromium-browser... that was also successful.

I then tried to copy the same image, then tried to paste it into the word doc... and it pasted the url of the site, rather than an image. (Technically, it triggered the tracebacks in Xpra-org/xpra#2463, and I accidentally copied some of that content, then pasted that into the word doc... then went back to copy the image... and it STILL wound up pasting the url... which means either that the right-click copy image option is simply not doing anything... and the server-side clipboard didn't update when copying or pasting the accidental copy of the traceback... and the second attempt to right-click copy the image somehow resulted in the url that was last pasted ... still... being the contents of the clipboard, or perhaps that copy attempt server-side is what re-sync'd those previous clipboard contents into the local clipboard?)

It also fails when trying from a server-side Firefox.

It also fails pasting into a server-side gedit (not sure it would ever work with gedit)... but then I noticed that I also can't paste text into a gedit application server-side... not even clipboard content from a server-side chromium-browser to the server-side gedit.

In any case, the traceback seems to also be causing issues with rendering of text, so I'll leave this test here.

@totaam
Copy link
Collaborator Author

totaam commented Oct 25, 2019

That's an unlucky coincidence, there was a regression in r24231, fixed in r24247. See Xpra-org/xpra#2461

The 3.0.1 builds had been fixed, the 4.0 beta builds had not..

@totaam
Copy link
Collaborator Author

totaam commented Oct 29, 2019

2019-10-29 22:10:31: afarr commented


Tried some more with 3.0.1-r24252 fedora 30 server with Chrome 77 on Windows 7. Didn't switch the experimental property on (but shouldn't need to with Chrome 77 I suspect).

Clipboard behavior for text is as mentioned in #12 - but I am still unable to copy/paste images from inside the session out to any local applications.

I tried to copy images from chromium-browser or firefox server-side and then paste into word or paint locally with no luck.

I then tried downloading an image to the fedora server and opening it server side with pinta to edit, selecting regions and copying them to the clipboard... which I was then able to paste into server-side email composition fields (using the right-click paste option only, never successfully with keyboard shortcuts)... but when trying to then paste into word locally I usually get nothing, but occasionally I get the text 'image.png', and sometimes get a little 'OBJ' text icon surrounded by a dotted frame? Trying to paste into paint I get an object frame with a ? inside.

Meanwhile, trying to copy an image locally (the xpra icon, why not?) and paste it into an email compose field or Pinta application fails... in the case of trying to paste into an email compose field I see a warning about more than 30 requests...

2019-10-29 15:03:59,345 Warning: more than 30 clipboard requests per second!
2019-10-29 15:04:00,845 Warning: remote clipboard request timed out
2019-10-29 15:04:00,846  request id 95, selection=CLIPBOARD, target=STRING
2019-10-29 15:04:04,114 Warning: more than 30 clipboard requests per second!
2019-10-29 15:04:05,614 Warning: remote clipboard request timed out
2019-10-29 15:04:05,615  request id 143, selection=CLIPBOARD, target=text/plain;charset=utf-8
2019-10-29 15:04:07,498 Warning: more than 30 clipboard requests per second!
2019-10-29 15:04:08,999 Warning: remote clipboard request timed out
2019-10-29 15:04:08,999  request id 179, selection=CLIPBOARD, target=text/plain;charset=utf-8

While, trying to paste into pinta I get a warning that there is no image in the clipboard, and I get this in the server logs.

2019-10-29 15:07:00,152 Warning: PRIMARY selection request for 'UTF8_STRING' timed out
2019-10-29 15:07:00,152  request 51 at time=0

I guess I'll pass this back - is there a debug flag in particular I should enable perhaps?

@totaam
Copy link
Collaborator Author

totaam commented Oct 29, 2019

2019-10-29 22:27:04: afarr commented


Fancy that - I suppose -d clipboard might be a good start?

Looks like there's a traceback when I open a lawn gnome image in pinta, select a portion of the image, and use the 'copy' button to load it to the clipboard.

2019-10-29 15:13:52,987 Request timed out: timeout('timed out')
2019-10-29 15:14:01,536 setting keyboard layout to 'us'
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Internal error:   Could not resolve keysym XF86MonBrightnessCycle
> Internal error:   Could not resolve keysym XF86RotationLockToggle
Errors from xkbcomp are not fatal to the X server
2019-10-29 15:14:03,611 client   1 broadway decoder initialized
2019-10-29 15:14:19,202 client   1 broadway decoder initialized
2019-10-29 15:14:23,226 client   1 broadway decoder initialized
2019-10-29 15:14:23,773 client   1 broadway decoder initialized
2019-10-29 15:14:26,155 client   1 broadway decoder initialized
2019-10-29 15:14:28,682 client   1 broadway decoder initialized
2019-10-29 15:14:28,846 client   1 broadway decoder initialized
2019-10-29 15:14:30,992 client   1 broadway decoder initialized
/usr/lib64/python3.7/site-packages/gi/overrides/Gtk.py:1630: Warning: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
  return _Gtk_main(*args, **kwargs)
2019-10-29 15:14:35,838 client   1 broadway decoder initialized
2019-10-29 15:14:40,944 client   1 broadway decoder initialized
2019-10-29 15:14:42,861 do_xpra_selection_clear(<X11:SelectionClear {'send_event': '0', 'serial': '0x2f9e', 'delivered_to': '0x400008', 'window': '0x400008', 'selection': 'CLIPBOARD', 'time': '907255702'}>)
2019-10-29 15:14:42,861 do_xpra_selection_clear(<X11:SelectionClear {'send_event': '0', 'serial': '0x2f9e', 'delivered_to': '0x400008', 'window': '0x400008', 'selection': 'CLIPBOARD', 'time': '907255702'}>) was owned=True
2019-10-29 15:14:42,862 do_owner_changed()
2019-10-29 15:14:42,862 do_xpra_xfixes_selection_notify_event(<X11:XFSelectionNotify {'send_event': '0', 'serial': '0x2f9e', 'delivered_to': '0x400008', 'window': '0x400008', 'subtype': '0', 'owner': '0xa00581', 'selection': 'CLIPBOARD', 'timestamp': '907255707', 'selection_timestamp': '907255702'}>)
2019-10-29 15:14:42,862 do_selection_notify_event(<X11:XFSelectionNotify {'send_event': '0', 'serial': '0x2f9e', 'delivered_to': '0x400008', 'window': '0x400008', 'subtype': '0', 'owner': '0xa00581', 'selection': 'CLIPBOARD', 'timestamp': '907255707', 'selection_timestamp': '907255702'}>) owned=False, was False, enabled=True, can-send=True
2019-10-29 15:14:42,862 get_contents(TARGETS, <function ClipboardProxy.schedule_emit_token.<locals>.got_targets at 0x7fe2992a3560>, 0) owned=False, have-token=False
2019-10-29 15:14:42,863 requesting local XConvertSelection from 'Pinta' as 'TARGETS' into 'CLIPBOARD-TARGETS'
2019-10-29 15:14:42,864 do_xpra_property_notify_event(<X11:PropertyNotify {'send_event': '0', 'serial': '0x2faa', 'delivered_to': '0x400008', 'window': '0x400008', 'atom': 'CLIPBOARD-TARGETS', 'time': '907255710'}>)
2019-10-29 15:14:42,864 do_property_notify(<X11:PropertyNotify {'send_event': '0', 'serial': '0x2faa', 'delivered_to': '0x400008', 'window': '0x400008', 'atom': 'CLIPBOARD-TARGETS', 'time': '907255710'}>)
2019-10-29 15:14:42,864 CLIPBOARD-TARGETS='\x9f\x01\x00\x00\x00\x00\x00\x00\x9e\x01\x00\x0 .. 00\x00\x00\x00\x00¯\x01\x00\x00\x00\x00\x00\x00' (ATOM : 32)
2019-10-29 15:14:42,865 filter_data(TARGETS, ATOM, 32, ..)
2019-10-29 15:14:42,865 got_local_contents: calling <function ClipboardProxy.schedule_emit_token.<locals>.got_targets at 0x7fe2992a3560>('ATOM', 32, '"b\'\\\\x9f\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x9e .. 0\\\\x00\\\\xaf\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\'"'), time=0
2019-10-29 15:14:42,865 got_targets: ('TIMESTAMP', 'TARGETS', 'MULTIPLE', 'SAVE_TARGETS', 'image/png', 'image/bmp', 'image/x-bmp', 'image/x-MS-bmp', 'image/x-icon', 'image/x-ico', 'image/x-win-bitmap', 'image/vnd.microsoft.icon', 'application/ico', 'image/ico', 'image/icon', 'text/ico', 'image/jpeg', 'image/tiff')
2019-10-29 15:14:42,866 _send_clipboard_token_handler(X11ClipboardProxy(CLIPBOARD), "(('TIMESTAMP', 'TARGETS', 'MULTIPLE', 'SAVE_TAR .. con', 'text/ico', 'image/jpeg', 'image/tiff'),)")
2019-10-29 15:14:42,866 do_xpra_property_notify_event(<X11:PropertyNotify {'send_event': '0', 'serial': '0x2fad', 'delivered_to': '0x400008', 'window': '0x400008', 'atom': 'CLIPBOARD-TARGETS', 'time': '907255711'}>)
2019-10-29 15:14:42,866 do_property_notify(<X11:PropertyNotify {'send_event': '0', 'serial': '0x2fad', 'delivered_to': '0x400008', 'window': '0x400008', 'atom': 'CLIPBOARD-TARGETS', 'time': '907255711'}>)
2019-10-29 15:14:42,867 do_property_notify() property 'CLIPBOARD-TARGETS' is gone?
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/xpra/x11/gtk_x11/clipboard.py", line 578, in do_property_notify
    dtype, dformat = X11Window.GetWindowPropertyType(self.xid, event.atom, True)
  File "xpra/x11/bindings/window_bindings.pyx", line 1173, in xpra.x11.bindings.window_bindings.X11WindowBindingsInstance.GetWindowPropertyType
xpra.x11.bindings.window_bindings.BadPropertyType: None type

Meanwhile, copying the xpra icon from a server-side chromium-browser, the logs for the copy event seem 'happy'.

2019-10-29 15:18:10,310 do_xpra_xfixes_selection_notify_event(<X11:XFSelectionNotify {'send_event': '0', 'serial': '0x5363', 'delivered_to': '0x400008', 'window': '0x400008', 'subtype': '0', 'owner': '0xe00020', 'selection': 'CLIPBOARD', 'timestamp': '907463155', 'selection_timestamp': '907463155'}>)
2019-10-29 15:18:10,311 do_selection_notify_event(<X11:XFSelectionNotify {'send_event': '0', 'serial': '0x5363', 'delivered_to': '0x400008', 'window': '0x400008', 'subtype': '0', 'owner': '0xe00020', 'selection': 'CLIPBOARD', 'timestamp': '907463155', 'selection_timestamp': '907463155'}>) owned=False, was False, enabled=True, can-send=True
2019-10-29 15:18:10,311 _send_clipboard_token_handler(X11ClipboardProxy(CLIPBOARD), "(('TIMESTAMP', 'TARGETS', 'MULTIPLE', 'SAVE_TAR .. con', 'text/ico', 'image/jpeg', 'image/tiff'),)")

But, even just trying to paste that image into a gmail compose field, still server side, there seem to be some errors nested into the clipboard logs.

2019-10-29 15:18:38,425 process clipboard token selection=CLIPBOARD, local clipboard name=CLIPBOARD, proxy=X11ClipboardProxy(CLIPBOARD)
2019-10-29 15:18:38,425 wire selection to raw, encoding=bytes, type=UTF8_STRING, format=8, len(data)=4955
2019-10-29 15:18:38,425 got token, selection=CLIPBOARD, targets=[b'UTF8_STRING', b'text/plain'], target data={'UTF8_STRING': ('UTF8_STRING', 8, b'2019-10-29 15:13:52,987 Request timed out: timeout(\'timed out\')\r\n2019-10-29 15:14:01,536 setting keyboard layout to \'us\'\r\nThe XKEYBOARD keymap compiler (xkbcomp) reports:\r\n> Internal error:   Could not resolve keysym XF86MonBrightnessCycle\r\n> Internal error:   Could not resolve keysym XF86RotationLockToggle\r\nErrors from xkbcomp are not fatal to the X server\r\n2019-10-29 15:14:03,611 client   1 broadway decoder initialized\r\n2019-10-29 15:14:19,202 client   1 broadway decoder initialized\r\n2019-10-29 15:14:23,226 client   1 broadway decoder initialized\r\n2019-10-29 15:14:23,773 client   1 broadway decoder initialized\r\n2019-10-29 15:14:26,155 client   1 broadway decoder initialized\r\n2019-10-29 15:14:28,682 client   1 broadway decoder initialized\r\n2019-10-29 15:14:28,846 client   1 broadway decoder initialized\r\n2019-10-29 15:14:30,992 client   1 broadway decoder initialized\r\n/usr/lib64/python3.7/site-packages/gi/overrides/Gtk.py:1630: Warning: g_object_ref: assertion \'G_IS_OBJECT (object)\' failed\r\n  return _Gtk_main(*args, **kwargs)\r\n2019-10-29 15:14:35,838 client   1 broadway decoder initialized\r\n2019-10-29 15:14:40,944 client   1 broadway decoder initialized\r\n2019-10-29 15:14:42,861 do_xpra_selection_clear(<X11:SelectionClear {\'send_event\': \'0\', \'serial\': \'0x2f9e\', \'delivered_to\': \'0x400008\', \'window\': \'0x400008\', \'selection\': \'CLIPBOARD\', \'time\': \'907255702\'}>)\r\n2019-10-29 15:14:42,861 do_xpra_selection_clear(<X11:SelectionClear {\'send_event\': \'0\', \'serial\': \'0x2f9e\', \'delivered_to\': \'0x400008\', \'window\': \'0x400008\', \'selection\': \'CLIPBOARD\', \'time\': \'907255702\'}>) was owned=True\r\n2019-10-29 15:14:42,862 do_owner_changed()\r\n2019-10-29 15:14:42,862 do_xpra_xfixes_selection_notify_event(<X11:XFSelectionNotify {\'send_event\': \'0\', \'serial\': \'0x2f9e\', \'delivered_to\': \'0x400008\', \'window\': \'0x400008\', \'subtype\': \'0\', \'owner\': \'0xa00581\', \'selection\': \'CLIPBOARD\', \'timestamp\': \'907255707\', \'selection_timestamp\': \'907255702\'}>)\r\n2019-10-29 15:14:42,862 do_selection_notify_event(<X11:XFSelectionNotify {\'send_event\': \'0\', \'serial\': \'0x2f9e\', \'delivered_to\': \'0x400008\', \'window\': \'0x400008\', \'subtype\': \'0\', \'owner\': \'0xa00581\', \'selection\': \'CLIPBOARD\', \'timestamp\': \'907255707\', \'selection_timestamp\': \'907255702\'}>) owned=False, was False, enabled=True, can-send=True\r\n2019-10-29 15:14:42,862 get_contents(TARGETS, <function ClipboardProxy.schedule_emit_token.<locals>.got_targets at 0x7fe2992a3560>, 0) owned=False, have-token=False\r\n2019-10-29 15:14:42,863 requesting local XConvertSelection from \'Pinta\' as \'TARGETS\' into \'CLIPBOARD-TARGETS\'\r\n2019-10-29 15:14:42,864 do_xpra_property_notify_event(<X11:PropertyNotify {\'send_event\': \'0\', \'serial\': \'0x2faa\', \'delivered_to\': \'0x400008\', \'window\': \'0x400008\', \'atom\': \'CLIPBOARD-TARGETS\', \'time\': \'907255710\'}>)\r\n2019-10-29 15:14:42,864 do_property_notify(<X11:PropertyNotify {\'send_event\': \'0\', \'serial\': \'0x2faa\', \'delivered_to\': \'0x400008\', \'window\': \'0x400008\', \'atom\': \'CLIPBOARD-TARGETS\', \'time\': \'907255710\'}>)\r\n2019-10-29 15:14:42,864 CLIPBOARD-TARGETS=\'\\x9f\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x9e\\x01\\x00\\x0 .. 00\\x00\\x00\\x00\\x00\xc2\xaf\\x01\\x00\\x00\\x00\\x00\\x00\\x00\' (ATOM : 32)\r\n2019-10-29 15:14:42,865 filter_data(TARGETS, ATOM, 32, ..)\r\n2019-10-29 15:14:42,865 got_local_contents: calling <function ClipboardProxy.schedule_emit_token.<locals>.got_targets at 0x7fe2992a3560>(\'ATOM\', 32, \'"b\\\'\\\\\\\\x9f\\\\\\\\x01\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x9e .. 0\\\\\\\\x00\\\\\\\\xaf\\\\\\\\x01\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\\\\\\x00\\\'"\'), time=0\r\n2019-10-29 15:14:42,865 got_targets: (\'TIMESTAMP\', \'TARGETS\', \'MULTIPLE\', \'SAVE_TARGETS\', \'image/png\', \'image/bmp\', \'image/x-bmp\', \'image/x-MS-bmp\', \'image/x-icon\', \'image/x-ico\', \'image/x-win-bitmap\', \'image/vnd.microsoft.icon\', \'application/ico\', \'image/ico\', \'image/icon\', \'text/ico\', \'image/jpeg\', \'image/tiff\')\r\n2019-10-29 15:14:42,866 _send_clipboard_token_handler(X11ClipboardProxy(CLIPBOARD), "((\'TIMESTAMP\', \'TARGETS\', \'MULTIPLE\', \'SAVE_TAR .. con\', \'text/ico\', \'image/jpeg\', \'image/tiff\'),)")\r\n2019-10-29 15:14:42,866 do_xpra_property_notify_event(<X11:PropertyNotify {\'send_event\': \'0\', \'serial\': \'0x2fad\', \'delivered_to\': \'0x400008\', \'window\': \'0x400008\', \'atom\': \'CLIPBOARD-TARGETS\', \'time\': \'907255711\'}>)\r\n2019-10-29 15:14:42,866 do_property_notify(<X11:PropertyNotify {\'send_event\': \'0\', \'serial\': \'0x2fad\', \'delivered_to\': \'0x400008\', \'window\': \'0x400008\', \'atom\': \'CLIPBOARD-TARGETS\', \'time\': \'907255711\'}>)\r\n2019-10-29 15:14:42,867 do_property_notify() property \'CLIPBOARD-TARGETS\' is gone?\r\nTraceback (most recent call last):\r\n  File "/usr/lib64/python3.7/site-packages/xpra/x11/gtk_x11/clipboard.py", line 578, in do_property_notify\r\n    dtype, dformat = X11Window.GetWindowPropertyType(self.xid, event.atom, True)\r\n  File "xpra/x11/bindings/window_bindings.pyx", line 1173, in xpra.x11.bindings.window_bindings.X11WindowBindingsInstance.GetWindowPropertyType\r\nxpra.x11.bindings.window_bindings.BadPropertyType: None type\r\n')}, claim=True, can-receive=True
2019-10-29 15:18:38,425 got_contents('TARGETS', 'ATOM', 32, '"b\'\\\\xe7\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\xfd\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\'"') pending=
2019-10-29 15:18:38,425 got_contents('UTF8_STRING', 'UTF8_STRING', 8, "'b\\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\\\r\\\\n\\''") pending=
2019-10-29 15:18:38,426 claim_selection: set selection owner returned 1, owner=0x400008
2019-10-29 15:18:38,426 claim_selection: sending message to root window
2019-10-29 15:18:38,426 claim_selection: done, owned=True
2019-10-29 15:18:38,426 do_xpra_xfixes_selection_notify_event(<X11:XFSelectionNotify {'send_event': '0', 'serial': '0x698a', 'delivered_to': '0x400008', 'window': '0x400008', 'subtype': '0', 'owner': '0x400008', 'selection': 'CLIPBOARD', 'timestamp': '907491272', 'selection_timestamp': '907491272'}>)
2019-10-29 15:18:38,427 do_selection_notify_event(<X11:XFSelectionNotify {'send_event': '0', 'serial': '0x698a', 'delivered_to': '0x400008', 'window': '0x400008', 'subtype': '0', 'owner': '0x400008', 'selection': 'CLIPBOARD', 'timestamp': '907491272', 'selection_timestamp': '907491272'}>) owned=True, was True, enabled=True, can-send=True
2019-10-29 15:18:38,429 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x6994', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,429 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x6994', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,429 clipboard request for CLIPBOARD from window 0xe00020: 'Chromium clipboard', target=TARGETS, prop=CHROME_SELECTION
2019-10-29 15:18:38,429 using existing TARGETS value as response: ('UTF8_STRING', 'text/plain')
2019-10-29 15:18:38,430 set_selection_response(<GdkX11.X11Window object at 0x7fe2987164b0 (GdkX11Window at 0x55785c32ea30)>, TARGETS, CHROME_SELECTION, ATOM, 32, "'ç\\x00\\x00\\x00\\x00\\x00\\x00\\x00ý\\x01\\x00\\x00\\x00\\x00\\x00\\x00'", 0)
2019-10-29 15:18:38,430 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x699e', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'UTF8_STRING', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,430 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x699e', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'UTF8_STRING', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,431 clipboard request for CLIPBOARD from window 0xe00020: 'Chromium clipboard', target=UTF8_STRING, prop=CHROME_SELECTION
2019-10-29 15:18:38,431 send_clipboard_request_handler(X11ClipboardProxy(CLIPBOARD), 'CLIPBOARD', 'UTF8_STRING')
2019-10-29 15:18:38,431 send_clipboard_request id=0
2019-10-29 15:18:38,440 process clipboard contents, selection=CLIPBOARD, type=UTF8_STRING, format=8
2019-10-29 15:18:38,440 wire selection to raw, encoding=bytes, type=UTF8_STRING, format=8, len(data)=4955
2019-10-29 15:18:38,441 clipboard wire -> raw: ('UTF8_STRING', 8, 'bytes', "'b\\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\\\r\\\\n\\*") -> 'b\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\r\\n\*
2019-10-29 15:18:38,441 clipboard got contents(0, 'UTF8_STRING', 8, "'b\\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\\\r\\\\n\\''"): proxy=X11ClipboardProxy(CLIPBOARD) for selection=CLIPBOARD
2019-10-29 15:18:38,441 got_contents('UTF8_STRING', 'UTF8_STRING', 8, "'b\\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\\\r\\\\n\\''") pending=(<GdkX11.X11Window object at 0x7fe2ba021050 (GdkX11Window at 0x55785c32ea30)>, 'CHROME_SELECTION', 0)
2019-10-29 15:18:38,441 setting response '2019-10-29 15:13:52,987 Request timed out: time .. .window_bindings.BadPropertyType: None type\r\n' to property CHROME_SELECTION of window 'Chromium clipboard' as UTF8_STRING
2019-10-29 15:18:38,442 set_selection_response(<GdkX11.X11Window object at 0x7fe2ba021050 (GdkX11Window at 0x55785c32ea30)>, UTF8_STRING, CHROME_SELECTION, UTF8_STRING, 8, "'2019-10-29 15:13:52,987 Request timed out: time .. .window_bindings.BadPropertyType: None type\\r\\n'", 0)
2019-10-29 15:18:38,442 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69a5', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,442 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69a5', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,443 clipboard request for CLIPBOARD from window 0xe00020: 'Chromium clipboard', target=TARGETS, prop=CHROME_SELECTION
2019-10-29 15:18:38,443 using existing TARGETS value as response: ('UTF8_STRING', 'text/plain')
2019-10-29 15:18:38,443 set_selection_response(<GdkX11.X11Window object at 0x7fe2992d61e0 (GdkX11Window at 0x55785c32ea30)>, TARGETS, CHROME_SELECTION, ATOM, 32, "'ç\\x00\\x00\\x00\\x00\\x00\\x00\\x00ý\\x01\\x00\\x00\\x00\\x00\\x00\\x00'", 0)
2019-10-29 15:18:38,444 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69ab', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,444 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69ab', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,444 clipboard request for CLIPBOARD from window 0xe00020: 'Chromium clipboard', target=TARGETS, prop=CHROME_SELECTION
2019-10-29 15:18:38,444 using existing TARGETS value as response: ('UTF8_STRING', 'text/plain')
2019-10-29 15:18:38,444 set_selection_response(<GdkX11.X11Window object at 0x7fe2ba021050 (GdkX11Window at 0x55785c32ea30)>, TARGETS, CHROME_SELECTION, ATOM, 32, "'ç\\x00\\x00\\x00\\x00\\x00\\x00\\x00ý\\x01\\x00\\x00\\x00\\x00\\x00\\x00'", 0)
2019-10-29 15:18:38,447 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69b1', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,447 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69b1', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,447 clipboard request for CLIPBOARD from window 0xe00020: 'Chromium clipboard', target=TARGETS, prop=CHROME_SELECTION
2019-10-29 15:18:38,448 using existing TARGETS value as response: ('UTF8_STRING', 'text/plain')
2019-10-29 15:18:38,448 set_selection_response(<GdkX11.X11Window object at 0x7fe2992d61e0 (GdkX11Window at 0x55785c32ea30)>, TARGETS, CHROME_SELECTION, ATOM, 32, "'ç\\x00\\x00\\x00\\x00\\x00\\x00\\x00ý\\x01\\x00\\x00\\x00\\x00\\x00\\x00'", 0)
2019-10-29 15:18:38,448 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69b7', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,448 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69b7', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'TARGETS', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,449 clipboard request for CLIPBOARD from window 0xe00020: 'Chromium clipboard', target=TARGETS, prop=CHROME_SELECTION
2019-10-29 15:18:38,449 using existing TARGETS value as response: ('UTF8_STRING', 'text/plain')
2019-10-29 15:18:38,449 set_selection_response(<GdkX11.X11Window object at 0x7fe2ba021050 (GdkX11Window at 0x55785c32ea30)>, TARGETS, CHROME_SELECTION, ATOM, 32, "'ç\\x00\\x00\\x00\\x00\\x00\\x00\\x00ý\\x01\\x00\\x00\\x00\\x00\\x00\\x00'", 0)
2019-10-29 15:18:38,450 do_xpra_selection_request(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69bd', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'UTF8_STRING', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,450 do_selection_request_event(<X11:SelectionRequest {'send_event': '0', 'serial': '0x69bd', 'delivered_to': '0x400008', 'window': '0x400008', 'requestor': '0xe00020', 'selection': 'CLIPBOARD', 'target': 'UTF8_STRING', 'property': 'CHROME_SELECTION', 'time': '0'}>)
2019-10-29 15:18:38,450 clipboard request for CLIPBOARD from window 0xe00020: 'Chromium clipboard', target=UTF8_STRING, prop=CHROME_SELECTION
2019-10-29 15:18:38,450 send_clipboard_request_handler(X11ClipboardProxy(CLIPBOARD), 'CLIPBOARD', 'UTF8_STRING')
2019-10-29 15:18:38,450 send_clipboard_request id=1
2019-10-29 15:18:38,462 process clipboard contents, selection=CLIPBOARD, type=UTF8_STRING, format=8
2019-10-29 15:18:38,462 wire selection to raw, encoding=bytes, type=UTF8_STRING, format=8, len(data)=4955
2019-10-29 15:18:38,463 clipboard wire -> raw: ('UTF8_STRING', 8, 'bytes', "'b\\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\\\r\\\\n\\*") -> 'b\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\r\\n\*
2019-10-29 15:18:38,463 clipboard got contents(1, 'UTF8_STRING', 8, "'b\\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\\\r\\\\n\\''"): proxy=X11ClipboardProxy(CLIPBOARD) for selection=CLIPBOARD
2019-10-29 15:18:38,463 got_contents('UTF8_STRING', 'UTF8_STRING', 8, "'b\\'2019-10-29 15:13:52,987 Request timed out: t .. dow_bindings.BadPropertyType: None type\\\\r\\\\n\\''") pending=(<GdkX11.X11Window object at 0x7fe2992d61e0 (GdkX11Window at 0x55785c32ea30)>, 'CHROME_SELECTION', 0)
2019-10-29 15:18:38,463 setting response '2019-10-29 15:13:52,987 Request timed out: time .. .window_bindings.BadPropertyType: None type\r\n' to property CHROME_SELECTION of window 'Chromium clipboard' as UTF8_STRING
2019-10-29 15:18:38,464 set_selection_response(<GdkX11.X11Window object at 0x7fe2992d61e0 (GdkX11Window at 0x55785c32ea30)>, UTF8_STRING, CHROME_SELECTION, UTF8_STRING, 8, "'2019-10-29 15:13:52,987 Request timed out: time .. .window_bindings.BadPropertyType: None type\\r\\n'", 0)

After repeating the copy of the xpra icon to test results of pasting into local word - the above logs text was pasted again... so the copy event server-side is failing to sync any contents to the local clipboard.

@totaam
Copy link
Collaborator Author

totaam commented Oct 31, 2019

I tried it with a Fedora 31 client and it worked perfectly on the first attempt (not something that happens every day!):

  • control-c to copy an image from eog running inside the session (connected using Chrome 78.0.3904.70)
  • then pasting it into gimp running locally with control-v

Here's what the debug log shows ("clipboard" debugging enabled on the connect.html page):

clipboard copy event, clipboard buffer= Version 78.0.3904.70 (Official Build) beta (64-bit)
clipboard token received
targets= ["image/png"]
target= image/png is valid: true
dtype= image/png dformat= 8 wire-encoding= bytes
png image received
created blob Blob {size: 4154, type: "image/png"}
created ClipboardItem ClipboardItem {types: Array(1)}
created ClipboardItem list [ClipboardItem]
copied png image to clipboard

Then I tried it on win7... and nothing!?
Because navigator.clipboard returns null. r24328 will now log a message to the javascript console when that happens.
Then I remembered that I had to use https instead of http when connecting to something other than localhost (after telling chrome that yes, I do want to trust this self-signed cert), and things just worked as expected. (same steps as above, Chrome 78)

Note: your browser is likely to ask you about allowing xpra to access the clipboard. If you somehow refuse, it won't ask again and things just won't work from then on... I'm not saying that this is the case here, just something to be aware of.

You can verify that the client's browser has support for copying images on the server using:

$ xpra info | grep clipboard.preferred-targets
features.clipboard.preferred-targets=('UTF8_STRING', 'TEXT', 'STRING', 'text/plain', 'image/png')

image/png should be in that list.

@totaam
Copy link
Collaborator Author

totaam commented Nov 12, 2019

2019-11-12 22:42:46: afarr commented


Ok, tried again with the 4.0-r24412 & a Firefox html5 local client on Windows 7 - the image wouldn't sync across clipboards.

Connected a session with my usual launch command and used server-side chromium-browser to search for and then copy a random lawn gnome image (https://ak1.ostkcdn.com/images/products/25491413/Lawn-Gnome-Statue-Fun-Classic-Style-Resin-Figurine-by-Pure-Garden-cd4b7582-e54f-48f1-af8e-fdf45816efe3.jpg).
Then opened a gmail compose server-side and pasted the image, just to be sure it was on the clipboard server-side (success).
Then I try to paste into a Word doc server side (Windows 7 still)... and the image hasn't sync'd (pastes previous local clipboard contents).

This is the only thing I saw in server-side logs with -d clipboard on the initial copy (prior to then successfully pasting into an email compose field also server-side, then failing to paste locally - with the last local clipboard contents being pasted).

2019-11-12 14:24:01,479 do_xpra_selection_clear(<X11:SelectionClear {'send_event': '0', 'serial': '0x33565', 'delivered_to': '0x400008', 'window': '0x400008', 'selection': 'CLIPBOARD', 'time': '2117414325'}>)
2019-11-12 14:24:01,479 do_xpra_selection_clear(<X11:SelectionClear {'send_event': '0', 'serial': '0x33565', 'delivered_to': '0x400008', 'window': '0x400008', 'selection': 'CLIPBOARD', 'time': '2117414325'}>) was owned=True
2019-11-12 14:24:01,479 do_owner_changed()
2019-11-12 14:24:01,480 do_xpra_xfixes_selection_notify_event(<X11:XFSelectionNotify {'send_event': '0', 'serial': '0x33565', 'delivered_to': '0x400008', 'window': '0x400008', 'subtype': '0', 'owner': '0xc00013', 'selection': 'CLIPBOARD', 'timestamp': '2117414325', 'selection_timestamp': '2117414325'}>)
2019-11-12 14:24:01,480 do_selection_notify_event(<X11:XFSelectionNotify {'send_event': '0', 'serial': '0x33565', 'delivered_to': '0x400008', 'window': '0x400008', 'subtype': '0', 'owner': '0xc00013', 'selection': 'CLIPBOARD', 'timestamp': '2117414325', 'selection_timestamp': '2117414325'}>) owned=False, was False (owner=0xc00013, xid=0x400008), enabled=True, can-send=True
2019-11-12 14:24:01,480 get_contents(TARGETS, <function ClipboardProxy.schedule_emit_token.<locals>.got_targets at 0x7f4a99fb5050>, 0) owned=False, have-token=True
2019-11-12 14:24:01,481 requesting local XConvertSelection from 'Chromium clipboard' as 'TARGETS' into 'CLIPBOARD-TARGETS'
2019-11-12 14:24:01,483 do_xpra_property_notify_event(<X11:PropertyNotify {'send_event': '0', 'serial': '0x3356d', 'delivered_to': '0x400008', 'window': '0x400008', 'atom': 'CLIPBOARD-TARGETS', 'time': '2117414328'}>)
2019-11-12 14:24:01,483 do_property_notify(<X11:PropertyNotify {'send_event': '0', 'serial': '0x3356d', 'delivered_to': '0x400008', 'window': '0x400008', 'atom': 'CLIPBOARD-TARGETS', 'time': '2117414328'}>)
2019-11-12 14:24:01,483 CLIPBOARD-TARGETS='°\x01\x00\x00\x00\x00\x00\x00¬\x01\x00\x00\x00\x00\x00\x00»\x01\x00\x00\x00\x00\x00\x00±\x01\x00\x00\x00\x00\x00\x00\x03\x02\x00\x00\x00\x00\x00\x00\x06\x02\x00\x00\x00\x00\x00\x00' (ATOM : 32)
2019-11-12 14:24:01,483 filter_data(TARGETS, ATOM, 32, ..)
2019-11-12 14:24:01,484 got_local_contents: calling <function ClipboardProxy.schedule_emit_token.<locals>.got_targets at 0x7f4a99fb5050>('ATOM', 32, '"b\'\\\\xb0\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\xac .. 0\\\\x00\\\\x06\\\\x02\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\'"'), time=0
2019-11-12 14:24:01,484 got_targets: ('TIMESTAMP', 'TARGETS', 'SAVE_TARGETS', 'MULTIPLE', 'image/png', 'text/html')
2019-11-12 14:24:01,484 _send_clipboard_token_handler(X11ClipboardProxy(CLIPBOARD), "(('TIMESTAMP', 'TARGETS', 'SAVE_TARGETS', 'MULTIPLE', 'image/png', 'text/html'),)")
2019-11-12 14:24:01,484 send_clipboard(..) elapsed=576.25, clipboard_stats=deque([6410635.822382213, 6410641.766373358, 6411105.245907546, 6411119.406499787, 6411161.556260954, 6411164.748102415, 6411288.185891677, 6411288.186992626, 6411288.201407011, 6411289.568077561, 6411290.813128681, 6411290.826592322, 6411290.902166607, 6411290.93848819, 6411290.970695954, 6411291.00528176, 6411291.017244221, 6411291.038554933, 6411291.139444348, 6411291.152267763, 6411291.169749976, 6411291.286961208, 6411291.301308555, 6411291.407992555, 6411291.420898717, 6411292.029266213, 6411293.4333047, 6411307.051857186, 6411758.545258376, 6411785.531189892, 6411785.532562669, 6411785.772228449, 6411785.774665381, 6411787.312388716, 6411787.313757252, 6411787.495702833, 6411787.496698294, 6411789.28657857, 6411789.287618754, 6411790.391921602, 6411790.393708369, 6411791.384715191, 6411791.385943395, 6411791.576032442, 6411791.577460813, 6411794.928734997, 6411794.929651577, 6411795.098225768, 6411795.099534948, 6411796.66393757, 6411796.664532306, 6411798.696638875, 6411798.697570383, 6411802.257570389, 6411802.258443794, 6411803.841420424, 6411803.843981347, 6411803.995102557, 6411803.995874328, 6411805.380417482, 6411805.382159206, 6411805.525773787, 6411805.526433178, 6411806.513143294, 6411806.51458742, 6411810.396396796, 6411810.397772128, 6411821.507831331, 6411821.509012889, 6411823.267092553, 6411823.268759068, 6411823.27182877, 6411823.273376611, 6411865.47803727, 6411955.209652601, 6412072.896325849, 6412079.031785918, 6412079.054244, 6412095.487443926, 6412104.684653642, 6412104.698647541, 6412110.184897615, 6412110.195919079, 6412121.961130032, 6412162.03124144, 6412167.924017167, 6412167.938166605, 6412266.111611625, 6412358.475633465, 6412381.628620358], maxlen=90)
2019-11-12 14:24:01,485 do_xpra_property_notify_event(<X11:PropertyNotify {'send_event': '0', 'serial': '0x33572', 'delivered_to': '0x400008', 'window': '0x400008', 'atom': 'CLIPBOARD-TARGETS', 'time': '2117414330'}>)
2019-11-12 14:24:01,486 do_property_notify(<X11:PropertyNotify {'send_event': '0', 'serial': '0x33572', 'delivered_to': '0x400008', 'window': '0x400008', 'atom': 'CLIPBOARD-TARGETS', 'time': '2117414330'}>)
2019-11-12 14:24:01,486 do_property_notify() property 'CLIPBOARD-TARGETS' is gone?
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/xpra/x11/gtk_x11/clipboard.py", line 574, in do_property_notify
    dtype, dformat = X11Window.GetWindowPropertyType(self.xid, event.atom, True)
  File "xpra/x11/bindings/window_bindings.pyx", line 1171, in xpra.x11.bindings.window_bindings.X11WindowBindingsInstance.GetWindowPropertyType
xpra.x11.bindings.window_bindings.BadPropertyType: None type

Double checked and I'm getting the same behavior with Chrome local html5 client.

I guess I'll pass this back to you to look at once you decide what to do with the other last clipboard details.

@totaam
Copy link
Collaborator Author

totaam commented Nov 13, 2019

2019-11-13 17:30:22: antoine commented


Testing was slightly hampered by Xpra-org/xpra#2479.

Then I try to paste into a Word doc server side (Windows 7 still)
I assume you mean client side here, as there's no msword you can install server side on Linux. (well, there is via wine, but let's not go there).
And I can't use your steps as I don't have msword installed on my win7 vm.
I have tested using my steps from comment:20, and those still work fine.
Then I tried copying from a Firefox window instead of eog, and that also worked fine.

So please try those first as baseline, and only after that, try your test with gmail and word. When you can't paste into gimp, it will show a warning at the bottom of the content window explaining why.
In both cases, please enable "clipboard" debugging on the connect page.
As per comment:20, this should show png image received on the server's -d clipboard output.

As with Xpra-org/xpra#1844 and #12: https + grant clipboard-access permissions are required.

@totaam
Copy link
Collaborator Author

totaam commented Nov 20, 2019

2019-11-20 23:46:34: afarr commented


Re-tested with 4.0-r24461, using Chrome 78 on Windows 7 HTML5 client, and the new usual command to launch the server.

It worked!

I'm not sure what the eog mentioned in comment:20 is, but I went back to my trick of launching chromium-browser server side, searching for lawn gnomes, click a search result, open the image in a new tab, then right-click to copy the image.

I then opened a pinta window server-side and used the paste button to confirm the image was on the clipboard server-side.

I then successfully paste the image into a word doc (support for pasting images being the whole reason I opened the application)... using the right-click menu or control-v. I'm also able to copy test locally, paste server-side, then copy an image and paste back locally.

Then I checked Firefox (apparently because I'm a glutton for punishment) - I presume you are not surprised to hear that it wasn't possible to sync the images to the Firefox HTML5 client clipboard.

I'll reassign this to you to decide whether this should be closed and left to rest for a while, before tackling other HTML5 client types... or if you want to just keep using this ticket.

@totaam
Copy link
Collaborator Author

totaam commented Dec 12, 2019

Let's close this.
Firefox is unlikely to support images soon. (too many permission hoops to go through)

@totaam totaam closed this as completed Dec 12, 2019
@totaam
Copy link
Collaborator Author

totaam commented May 29, 2020

2020-05-29 07:53:10: antoine commented


For others this may work: Copy image to clipboard: using html with an embedded image as base64?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant