-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 not working for images #3102
Comments
Hello, I would like to share some findings/issues we are facing with clipboard support and xrdp software. Please assess if this is an issue, a bug or if a possible workaround exists. Thank you for your support We are facing exactly the same issue as StrilGit. We have tested this feature on Ubuntu 22.04 & Ubuntu 24.04.
The Clipboard feature seems broken starting with version xrdp 0.9.23.x. If you compile from source xrdp package version 0.10.x, same behavior happens on Ubuntu 22.04 & Ubuntu 24.04, ie clipboard not working Operating system & version Installation method Which backend do you use? What desktop environment do you use? Environment xrdp running on What's your client? Area(s) with issue? Steps to reproduce ✔️ Expected Behavior ❌ Actual Behavior Anything else? |
@griffondemo Thank you for the report, too. I will check the changes between 0.9.22 and 0.9.23.1. |
I think I reproduce it. I still not found the root cause though. |
This is probably an application-specific issue. I can paste from Windows to Linux gimp but cannot paste to LibreOffice. |
I recalled #1994 that client-to-server copy&paste doesn't work depending on the application to paste. |
An image copied from RDP client to xrdp server is held in clipboard like this:
I use this image for test: https://commons.wikimedia.org/wiki/File:Felis_catus-cat_on_snow.jpg To confirm if the issue is xrdp specific, copy an image to clipboard not using xrdp.
Paste in LibreOffice: not possible Regardless of whether image data is copied via xrdp or not, LibreOffice cannot paste image data held as image/bmp. So this is not an xrdp issue but we may be possible to address the issue on xrdp side. |
xrdp v0.9.22.1 has the following clipboard. The difference is
Probably this is a regression of #2766? |
I've had a look at this. The pasting into Libre Office appears to be quite picky. The image you've got is a jpeg, but you're giving it a MIME type of bmp. This works for me in Libre Office:-
Also, if I convert the image to a bmp using GIMP, I can insert it on the clipboard with:-
That also pastes into Libre Office. That doesn't answer the question of why having STRING or UTF8_STRING present would cause a difference. On the latest devel snapshot I tried a screenshot and got this :-
I couldn't paste the image into Libre Office. On v0.9.22 I get this:-
I can paste the image into Libre Office. However, both of these commands hang (which is one of the #2766 fixes):-
On both builds I then copied the image from the clipboard using xclip:-
The files are a little different:-
Both files can be loaded by an image viewer. However, Libre Office cannot load devel.bmp. I noticed that devel.bmp is smaller than works.bmp. I made a devel2.bmp which is the same size as works.bmp:-
I CAN load devel2.bmp in Libre Office. My conclusion is the clipboard code in devel is cutting the pasted image short somehow, and this is causing Libre Office to not load the bitmap. |
Thanks for the clarification. I think ImageMagick is a better tool for describing an image file. Indeed, the pasted image is corrupted and shortened.
|
There is another issue other than cut-off of data. The BMP image header is hardcoded but is incorrect compared to the specification. It cannot be hardcoded because the whole file size is included in the BMP header. 4 bytes after static char g_bmp_image_header[] =
{
/* this is known to work */
//0x42, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* THIS IS BEING SENT BY WIN2008 */
0x42, 0x4d, 0x16, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00
// ^^^^^^^^^^^^^^^^^^^^^^
// here is total data length
}; 0x116 is 278 in decimal however it should be 16588854 = 3840 x 1080 x 32bit+ 14 (BMP file header) + 40 (BITMAPINFOHEADER).
I see that the total data length is always 2 bytes shortened. v0.9.22 gives 12 bytes longer data than expected. |
Crossing messages here! I think this bug was introduced in v0.9.24, not v0.9.23 with #2824. @griffondemo appears to have tested with v0.9.22 and v0.9.24, but not v0.9.23 if I'm reading his message correctly. The reason I think this, is that some of the code removed by #2824 included a hack to increase the sent data by 14 bytes, which is the length of a bitmap header:- if (req->target == g_image_bmp_atom)
{
incr_bytes += 14;
} This is a bit of a mess. Looking in If I add 14 to the length set in We absolutely should fix the header problem too I think. |
That makes sense v0.9.22 produces 12 bytes longer data. -2 bytes + another 14 bytes. |
Regarding your comment about version 0.9.23.x, we have tried and test it as well. The copy/paste clipboard function with image was working with version 0.9.23.x. indeed. I missed to communicate this information in my initial report We can confirm the behavior starting in 0.9.24 and later.... (no image copied over... ) As an additional comment/challenge/request, we have also users that are complaining that when the paste text from Libre Office from the local session and using xrdp clipboard to paste the text in the LibreOffice running in the remote session, all the text formatting get lost. This was already mentioned/discussed/reported in issue #3056 Since this behavior is also related to the clipboard code section, I wanted to report this specific situation as well. Since there might be code changes for the clipboard feature, maybe we can look into including the text copy/paste formatting enhancement feature as well .... Again, here just an idea.... :) Thank you for your support and for looking into this issue... |
@griffondemo - thanks for the additional information. I'm aware that @metalefty is working on a fix for this particular issue at the moment. I think we'd like to keep #3056 separate as it's not entirely clear what the implications will be for implementing this at present. |
I think I have fixed the bmp file header issue. However, the bmp file with the correct header cannot be recognized by The bmp file created by mspaint.exe @ Win 11 cannot be recognized by file utility as well. So it seems not an issue with the bitmap file header I made.
I'm waiting for the original reporter @StrilGit 's feedback in a private channel to go forward. AlmaLinux 9
FreeBSD 14
|
That looks OK to me :-
If you can zip a small file up which |
Oh sorry - you have. I'll take a look now. |
On Linux Mint 21.3 (based on Ubuntu 22.04):-
I don't have an Alma Linux 9 VM available, but on CentOS 8:-
I should really install Alma Linux on a VM. I'll kick off a download now. |
Surprisingly,
|
Probably fixed at this commit: file/file@03b6dcb |
Agreed. If I copy the updated images file to
|
While here, embed correct file size in BMP file header. Fixes: neutrinolabs#3102 Sponsored by: Krämer Pferdesport GmbH & Co KG
While here, embed correct file size in BMP file header. Fixes: neutrinolabs#3102 Sponsored by: Krämer Pferdesport GmbH & Co KG
While here, embed correct file size in BMP file header. Fixes: neutrinolabs#3102 Sponsored by: Krämer Pferdesport GmbH & Co KG
While here, embed correct file size in BMP file header. Fixes: neutrinolabs#3102 Sponsored by: Krämer Pferdesport GmbH & Co KG
@metalefty Thank you for your support and for working on this issue.. |
@griffondemo Thanks for the quick feedback. I am glad to hear now it works properly. I have added a tidy-up commit but it is functionally the same. |
While here, embed correct file size in BMP file header. Fixes: neutrinolabs#3102 Sponsored by: Krämer Pferdesport GmbH & Co KG (cherry picked from commit 4968a34)
xrdp version
0.10.0
Detailed xrdp version, build options
xrdp 0.10.0
A Remote Desktop Protocol Server.
Copyright (C) 2004-2024 Jay Sorg, Neutrino Labs, and all contributors.
See https://github.com/neutrinolabs/xrdp for more information.
Configure options:
--enable-fuse
--enable-jpeg
--enable-rfxcodec
--enable-mp3lame
--enable-vsock
--enable-painter
Compiled with OpenSSL 3.0.2 15 Mar 2022
Operating system & version
Ubuntu 22.04
Installation method
dnf / apt / zypper / pkg / etc
Which backend do you use?
xorgxrdp
What desktop environment do you use?
XFCE
Environment xrdp running on
VM
What's your client?
Microsoft MSTSC
Area(s) with issue?
Clipboard
Steps to reproduce
Copy Image (e.g. screenshot) on Windows. Paste in LibreOffice
✔️ Expected Behavior
Image should be pasted
❌ Actual Behavior
"The contents of the clipboard could not be pasted" --> Nothing inserted
Anything else?
When I am using the repository-version 0.9.17, the image is pasted without problems
The text was updated successfully, but these errors were encountered: