microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
9.9k stars 296 forks source link

Copy/Paste from far2l (wxWidgets GUI) to Telegram Desktop not working #1216

Open unxed opened 3 months ago

unxed commented 3 months ago

Windows build number:

10.0.22631.3296

Your Distribution version:

Ubuntu 23.10

Your WSL versions:

WSL version: 2.1.5.0 Kernel version: 5.15.146.1-2 WSLg version: 1.0.60 MSRDC version: 1.2.5105 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22631.3296

Steps to reproduce:

  1. Install far2l-gui from ppa: https://launchpad.net/~far2l-team/+archive/ubuntu/ppa
  2. Install Telegram Desktop https://desktop.telegram.org/ (Linux version)
  3. Run far2l like this:
    FAR2L_WSL_NATIVE=1 far2l
  4. Try to copy some text from far2l gui to Telegram Desktop

WSL logs:

No response

WSL dumps:

No response

Expected behavior:

Then I copy text from far2l (Linux port of Far Manager, gui wxWidgets-based version), to Telegram Desktop, text should be copied fine.

Actual behavior:

Then I copy text from far2l (Linux port of Far Manager, gui wxWidgets-based version), to Telegram Desktop, text is not copied at all.

In native Ubuntu 23.10 such copy-paste works fine.

far2l ppa https://launchpad.net/~far2l-team/+archive/ubuntu/ppa

far2l sources https://github.com/elfmz/far2l

Telegram Desktop https://desktop.telegram.org/

Related far2l issue: https://github.com/elfmz/far2l/issues/1658

unxed commented 3 months ago

It's worth nothing that even a very simple call to gtk fails to place the text in the Windows clipboard:

    GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
    gtk_clipboard_set_text(clipboard, "Hello World!", -1);

https://github.com/wxWidgets/wxWidgets/issues/23544#issuecomment-1859639216

unxed commented 3 months ago

Implemented workaround on our side. Please run

FAR2L_WSL_NATIVE=1 far2l

to reproduce the bug after this PR is accepted

unxed commented 3 months ago

Also please note that even with GDK_BACKEND=x11 clipboard has problems under wslg under Wayland: you can't copy/paste multi line text. I guess that some kind of \n -> \r\n conversion and vice versa should be added, but I am not actually sure.