Copy-Paste between wx app far2l and Telegram Desktop not working under Wayland on Ubuntu 23.10 (Issue #24391)

114 views
Skip to first unread message

unxed

unread,
Mar 10, 2024, 1:12:12 PM3/10/24
to wx-...@googlegroups.com, Subscribed

far2l file manager linux port is using wxWidgets for interface rendering and system clipboard interaction. Unfortunately, on Wayland systems (like Ubuntu 23.10) clipboard copy-paste is not working between far2l and Telegram Desktop app.

Steps to reproduce:

  1. Install Ubuntu 23.10
  2. Install far2l-gui from ppa
  3. Run far2l
  4. Download, unpack and run Telegram Desktop
  5. Copy any string from Telegram Desktop to clipboard
  6. Try to paste to far2l
  7. Try to copy text from any other app (for example, Firefox)
  8. Try to paste to far2l

Workaround:

GDK_BACKEND=x11 far2l

Corresponding far2l issue:
elfmz/far2l#2053


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391@github.com>

oneeyeman1

unread,
Mar 10, 2024, 1:15:41 PM3/10/24
to wx-...@googlegroups.com, Subscribed

Can you reproduce it in the end sample that comes with wxWidgets?

Thank you.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1987299213@github.com>

VZ

unread,
Mar 10, 2024, 2:28:38 PM3/10/24
to wx-...@googlegroups.com, Subscribed

Do you use UsePrimarySelection() in your code? Copying from wx text sample to Telegram works for me (Wayland, GNOME, Debian).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1987318374@github.com>

unxed

unread,
Mar 10, 2024, 2:44:53 PM3/10/24
to wx-...@googlegroups.com, Subscribed

Only if specially requested by user

	bool primary_selection = false;
	for (int i = 0; i < a->argc; ++i) {
		if (strcmp(a->argv[i], "--primary-selection") == 0) {
			primary_selection = true;

		} else if (strcmp(a->argv[i], "--maximize") == 0) {
			g_maximize = 1;

		} else if (strcmp(a->argv[i], "--nomaximize") == 0) {
			g_maximize = -1;
		}
	}
	if (primary_selection) {
		wxTheClipboard->UsePrimarySelection(true);
	}


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1987324404@github.com>

VZ

unread,
Mar 10, 2024, 2:47:33 PM3/10/24
to wx-...@googlegroups.com, Subscribed

I'd like to know if the sample works for you because I don't really see why would it work for me but not you. If it does work, please try to find what does far2l do differently. If it doesn't... I don't know :-(


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1987327470@github.com>

unxed

unread,
Mar 11, 2024, 11:24:35 AM3/11/24
to wx-...@googlegroups.com, Subscribed

Corresponding Telegram Desktop issue:
https://bugs.telegram.org/c/37976


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1988705551@github.com>

VZ

unread,
Mar 11, 2024, 11:43:14 AM3/11/24
to wx-...@googlegroups.com, Subscribed

Please check the sample, we really need to narrow down the problem.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1988750984@github.com>

unxed

unread,
Mar 11, 2024, 1:18:44 PM3/11/24
to wx-...@googlegroups.com, Subscribed

Haven’t figured out what “the end sample” is. Do you mean clipboard sample from
https://docs.wxwidgets.org/3.2/page_samples.html#page_samples_clipboard
?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989006140@github.com>

VZ

unread,
Mar 11, 2024, 1:21:50 PM3/11/24
to wx-...@googlegroups.com, Subscribed

Err, where did you see the "end sample"? As I wrote above

Copying from wx text sample to Telegram works for me (Wayland, GNOME, Debian).

Please try the text sample, it has "Clipboard" menu allowing to copy using wxClipboard.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989012283@github.com>

unxed

unread,
Mar 11, 2024, 1:59:14 PM3/11/24
to wx-...@googlegroups.com, Subscribed

Ubuntu 23.10, Wayland.
Built text, clipboard examples.
The text from Telegram is pasted ok into them!
At the same time, from the Telegram to far2l - no.
Paste also works from Telegram to gnome-terminal.
From text and clipboard examples - paste into far2l - select text, do Copy - paste works.
From far2l the text is ok pasted into the text application.
From far2l the text is ok pasted into Telegram.

From https://t.me/far2l_ru/15883


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989100947@github.com>

VZ

unread,
Mar 11, 2024, 2:04:27 PM3/11/24
to wx-...@googlegroups.com, Subscribed

If I understand correctly, this means that there is no problem with the text sample (I'm not sure because you only mention that pasting into it works, but not that copying from it does)? Also, just to make sure: you're using the menu commands or their accelerators for testing, right? Because if you use Ctrl-{C,V} in the text controls, then it tests built-in GtkTextView functionality and not wx.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989111052@github.com>

unxed

unread,
Mar 11, 2024, 2:29:49 PM3/11/24
to wx-...@googlegroups.com, Subscribed

Tested myself.

Telegram -> Text sample copy/paste works ok by Ctrl+V, Shift+Ins and right mouse click -> Paste.
Menu item Paste is always seen as disabled.
Menu item Copy is enabled, but not actually working.

Ubuntu 23.10, Telegram Desktop latest, wx from git master.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989166462@github.com>

unxed

unread,
Mar 11, 2024, 2:31:12 PM3/11/24
to wx-...@googlegroups.com, Subscribed

Copying from text sample to Telegram desktop also works ok.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989168907@github.com>

VZ

unread,
Mar 11, 2024, 2:41:59 PM3/11/24
to wx-...@googlegroups.com, Subscribed

I can confirm that pasting from Telegram to text sample doesn't work in Wayland but does work in X11. I'll check this.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989187518@github.com>

atolismesh

unread,
Mar 11, 2024, 2:42:16 PM3/11/24
to wx-...@googlegroups.com, Subscribed

elegram -> Text sample copy/paste works ok by Ctrl+V, Shift+Ins and right mouse click -> Paste. Menu item Paste is always seen as disabled. Menu item Copy is enabled, but not actually working.

Ubuntu 23.10, Telegram Desktop latest, wx from git master.

I have the same results.

In addition, I can insert text through the Paste menu item from gnome-terminal


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989187958@github.com>

VZ

unread,
Mar 11, 2024, 2:47:29 PM3/11/24
to wx-...@googlegroups.com, Subscribed

OK, this happens because we request STRING format but Telegram only provides data in text/plain;charset=utf-8 and text/plain formats (for comparison, most of the other programs, including e.g. Firefox from which I'm posting this or Vim where I'm actually typing this, include those as well as STRING, TEXT, COMPOUND_TEXT and UTF8_STRING).

Anyhow, the fix should be straightforward, we should accept data in text/plain format as text too. I'll try to find time to implement this.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989195956@github.com>

unxed

unread,
Mar 11, 2024, 3:05:56 PM3/11/24
to wx-...@googlegroups.com, Subscribed

Can this bug be caused by the same reason?
elfmz/far2l#1658


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989227068@github.com>

atolismesh

unread,
Mar 11, 2024, 3:15:35 PM3/11/24
to wx-...@googlegroups.com, Subscribed

But it is unclear why pasting text from Telegram Desktop works under x11?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989242657@github.com>

unxed

unread,
Mar 11, 2024, 3:16:36 PM3/11/24
to wx-...@googlegroups.com, Subscribed

@vadz that wx build options do you use?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989244109@github.com>

VZ

unread,
Mar 11, 2024, 3:19:47 PM3/11/24
to wx-...@googlegroups.com, Subscribed

But it is unclear why pasting text from Telegram Desktop works under x11?

It looks like XWayland synthesizes STRING and UTF8_STRING, at least they're available when running under it, even though Telegram clearly doesn't provide them as seen by running native Wayland wl-paste -l for example.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989248970@github.com>

VZ

unread,
Mar 11, 2024, 3:20:32 PM3/11/24
to wx-...@googlegroups.com, Subscribed

@vadz that wx build options do you use?

Default ones, but then I don't think this is affected by any build options (unless you set wxUSE_CLIPBOARD=0...).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989250271@github.com>

unxed

unread,
Mar 11, 2024, 3:25:08 PM3/11/24
to wx-...@googlegroups.com, Subscribed

How do you think, is it possible to work this around on far2l's side?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989257353@github.com>

unxed

unread,
Mar 11, 2024, 4:19:08 PM3/11/24
to wx-...@googlegroups.com, Subscribed

May #23544 be related to this issue somehow?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989361386@github.com>

unxed

unread,
Mar 11, 2024, 6:39:30 PM3/11/24
to wx-...@googlegroups.com, Subscribed

May #23544 be related to this issue somehow?

Looks very similar:
#23544 (comment)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1989566444@github.com>

unxed

unread,
Mar 12, 2024, 4:04:03 PM3/12/24
to wx-...@googlegroups.com, Subscribed

What data format id should be used for
text/plain;charset=utf-8
and
text/plain
?

Should it be wxDF_UNICODETEXT as for UTF8_STRING or some other constants should be added?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1992476524@github.com>

unxed

unread,
Mar 13, 2024, 12:21:12 PM3/13/24
to wx-...@googlegroups.com, Subscribed

Same bug with GNOME Text editor:
https://gitlab.gnome.org/GNOME/gnome-text-editor/-/issues/657


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1994858899@github.com>

unxed

unread,
Mar 13, 2024, 12:29:21 PM3/13/24
to wx-...@googlegroups.com, Subscribed

Same bug with qBittorrent 4.5.4. Help - About - Special thanks - copy any text - try to paste to far2l wxWidgets GUI.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1994888283@github.com>

unxed

unread,
Mar 13, 2024, 12:52:22 PM3/13/24
to wx-...@googlegroups.com, Subscribed

Same bug with KDE default text editor:
https://bugs.kde.org/show_bug.cgi?id=483459


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1994971323@github.com>

unxed

unread,
Mar 13, 2024, 1:57:49 PM3/13/24
to wx-...@googlegroups.com, Subscribed

qBittorrent developer wrote:

This seems to me like a toolkit problem. And since Qt/Gtk work under Wayland correctly it is probably a responsibility of wxWidgets to work too.
Also from scattered info on the net it seems that the STRING and UTF8_STRING targets are X11 targets.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1995190077@github.com>

unxed

unread,
Mar 13, 2024, 4:33:04 PM3/13/24
to wx-...@googlegroups.com, Subscribed

As documentation says, it is standard for Wayland to use mime types as clipboard targets.
Many programs only provide mime targets for texts on Wayland.

So lets detect Wayland sessions and use Wayland-friendly targets under it:
#24400


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1995704332@github.com>

unxed

unread,
Mar 13, 2024, 6:01:08 PM3/13/24
to wx-...@googlegroups.com, Subscribed

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1995949431@github.com>

unxed

unread,
Mar 14, 2024, 4:44:21 AM3/14/24
to wx-...@googlegroups.com, Subscribed

Also implemented workaround on far2l side:
https://github.com/elfmz/far2l/pull/2070/files


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/1996881375@github.com>

VZ

unread,
Mar 16, 2024, 7:45:58 PM3/16/24
to wx-...@googlegroups.com, Subscribed

FWIW I've tried to work on this today but I'm running into 2 problems:

  1. We really need to completely rewrite our clipboard code because it currently supposes that there is a 1-to-1 mapping between wxDF_XXX and GDK atoms, but this is just not the case. Unfortunately not only this change nontrivial, but it also can't be done in an ABI-compatible way, which means that we need some hacks that can be backported to 3.2 first and then replace them with a proper solution in master.
  2. There is something very weird going on with gtk_selection_add_target() under Wayland. One thing is, perhaps, positive, even if unexpected (and not documented anywhere AFAICS): it automatically maps [UTF8_]STRING to text/plain[;charset=utf-8]. The other one is much less so: somehow, it replaces UTF-8 atoms with non-UTF-8 ones if you call it for both. It's very much not supposed to do this (the docs clearly say that it appends), but it does, so we also need an ugly hack to prevent this from happening. I wonder if the latter could be something GNOME/mutter-specific (the former is clearly done in GTK code itself).

Anyhow, I'll make a PR with my hacks soon, but if anybody knows more about what's going on here/sees some other way to see it in backwards-compatible way, I'd certainly like to know about it.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/2002188737@github.com>

unxed

unread,
Mar 16, 2024, 8:12:21 PM3/16/24
to wx-...@googlegroups.com, Subscribed

Please also keep in mind that Wayland on wslg has its own problems, like #23544
Still not sure if it is related issue or not


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/2002198244@github.com>

VZ

unread,
Mar 16, 2024, 8:24:59 PM3/16/24
to wx-...@googlegroups.com, Subscribed

Sorry, I don't have WSL, so I can't do anything about this.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/2002203892@github.com>

unxed

unread,
Mar 16, 2024, 8:37:39 PM3/16/24
to wx-...@googlegroups.com, Subscribed

My friends do have, so if some kind of logs collection, testing etc could help, I can ask for it


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/2002208038@github.com>

VZ

unread,
Mar 20, 2024, 11:09:51 AM3/20/24
to wx-...@googlegroups.com, Subscribed

Please test #24423, it works for me under Wayland but I have no idea if it affects WSL. TIA!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/2009803534@github.com>

unxed

unread,
Mar 20, 2024, 2:00:42 PM3/20/24
to wx-...@googlegroups.com, Subscribed

Works for me! (Ubuntu 23.10, Wayland session, Telegram <-> far2l wx GUI (tested both with its own workaround enabled and disabled)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/2010271938@github.com>

atolismesh

unread,
Mar 20, 2024, 4:33:55 PM3/20/24
to wx-...@googlegroups.com, Subscribed

Does not work for me. Ubuntu 23.10, Wayland, WSLg, Telegram. Plus "text" wxWidgets sample.
I can't copy from/to Telegram from the "text" using menu "Copy" and "Paste" items. They are greyed out.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/2010573238@github.com>

VZ

unread,
Mar 20, 2024, 7:11:51 PM3/20/24
to wx-...@googlegroups.com, Subscribed

To enable "Copy" you need to select some text in the focused text control. If "Paste" is disabled it means that it doesn't see any text format on the clipboard.

Running the sample with WXTRACE=clipboard in the environment will produce some hopefully helpful information.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24391/2010877613@github.com>

VZ

unread,
Mar 22, 2024, 2:28:27 PM3/22/24
to wx-...@googlegroups.com, Subscribed

Closed #24391 as completed via bc28e46.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/24391/issue_event/12219475506@github.com>

Reply all
Reply to author
Forward
0 new messages