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:
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
@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.![]()
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.![]()
@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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
You are receiving this because you are subscribed to this thread.![]()
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.![]()
FWIW I've tried to work on this today but I'm running into 2 problems:
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.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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()