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

Copy-Paste between far2l wx and Telegram Desktop not working under Wayland on Ubuntu 23.10 #2053

Closed
unxed opened this issue Mar 10, 2024 · 18 comments · Fixed by #2070
Closed

Comments

@unxed
Copy link
Contributor

unxed commented Mar 10, 2024

Originally noticed here:
#1350 (comment)

Possibly related issue:
#1658 (comment)

Workaround 1:
#1350 (comment)

Workaround 2:
Run

GDK_BACKEND=x11 far2l

(source: #1350 (comment))

Workaround 3:
Use kitty or any other OSC52-supporting terminal (like Windows Terminal, for example) and TTY or TTY|X far2l backend. Don't forget to enable OSC52 in far2l in Options -> Interface settings.

Workaround 4:
#1658 (comment)

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 in far2l
@unxed unxed changed the title Copy-Paste between far2l and Telegram Desktop not working under Wayland on Ubuntu 23.10 Copy-Paste between far2l wx and Telegram Desktop not working under Wayland on Ubuntu 23.10 Mar 10, 2024
@unxed
Copy link
Contributor Author

unxed commented Mar 11, 2024

@elfmz can we use ttyx for clipboard access on Wayland systems if xwayland and ttyx are available until upstream bug is fixed?

@unxed
Copy link
Contributor Author

unxed commented Mar 11, 2024

Corresponding Telegram Desktop issue:
https://bugs.telegram.org/c/37976
telegramdesktop/tdesktop#27569

@unxed
Copy link
Contributor Author

unxed commented Mar 11, 2024

From wxWidgets bug tracker:

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.

From Telegram Desktop bug tracker:

I think this info would be more valuable to Qt. All tdesktop does is instantiates a QTextEdit and Qt provides the menu with the default actions, shortcut handling and etc.

@unxed
Copy link
Contributor Author

unxed commented Mar 11, 2024

Corresponding Qt issue:
https://bugreports.qt.io/browse/QTBUG-123176

@unxed
Copy link
Contributor Author

unxed commented Mar 12, 2024

Exact reason:


~/far2l/far2l/_build/install$ wl-paste -l
text/plain;charset=utf-8
text/plain

~/far2l/far2l/_build/install$ xclip -o -t TARGETS
text/plain;charset=utf-8
text/plain
UTF8_STRING
STRING
TARGETS
TIMESTAMP

wx know nothing about text/plain;charset=utf-8 type. xWayland does some kind of conversion to UTF8_STRING that is ok for wx

@unxed
Copy link
Contributor Author

unxed commented Mar 13, 2024

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

btw, @elfmz can we work it around by providing support for text/plain;charset=utf-8 format on our side?

@unxed
Copy link
Contributor Author

unxed commented Mar 13, 2024

Same bug with qBittorrent:
qbittorrent/qBittorrent#20547

@unxed
Copy link
Contributor Author

unxed commented Mar 13, 2024

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

@unxed
Copy link
Contributor Author

unxed commented Mar 13, 2024

Fix for wx:
wxWidgets/wxWidgets#24400

@unxed
Copy link
Contributor Author

unxed commented Mar 14, 2024

Workaround on our side:
#2070

@atolismesh
Copy link
Contributor

atolismesh commented Mar 16, 2024

Проверил под native Ubuntu 23.10 + Wayland.

export WXTRACE="clipboard"
FAR2L_STD=~/far2l.log ./far2l --notty 

Копирование из телеграмма в fa2l gui заработало:

OpenClipboard
13:43:48: Trace: (clipboard) Checking if format UTF8_STRING is available
13:43:48: Trace: (clipboard) Received available formats for clipboard CLIPBOARD
13:43:48: Trace: (clipboard)   text/plain
13:43:48: Trace: (clipboard)   text/plain;charset=utf-8
13:43:48: Trace: (clipboard) Checking if format STRING is available
13:43:48: Trace: (clipboard) Received available formats for clipboard CLIPBOARD
13:43:48: Trace: (clipboard)   text/plain
13:43:48: Trace: (clipboard)   text/plain;charset=utf-8
13:43:48: Trace: (clipboard) GetData(): format not found
13:43:48: Trace: (clipboard) Checking if format text/plain;charset=utf-8 is available
13:43:48: Trace: (clipboard) Received available formats for clipboard CLIPBOARD
13:43:48: Trace: (clipboard)   text/plain
13:43:48: Trace: (clipboard)   text/plain;charset=utf-8
13:43:48: Trace: (clipboard) Requesting format text/plain;charset=utf-8
13:43:48: Trace: (clipboard) Received selection text/plain;charset=utf-8, len=304
OnClipboardGetData(13) - found MIME-compatible text format
CloseClipboard without data

Копирование из fa2l gui в телеграмм заработало:

13:45:05: Trace: (clipboard) Adding support for text/plain;charset=utf-8
13:45:05: Trace: (clipboard) Adding support for STRING
13:45:05: Trace: (clipboard) Adding support for UTF8_STRING
wxTheClipboard->SetData - OK
13:45:05: Trace: (clipboard) Clipboard data requested
13:45:05: Trace: (clipboard) clipboard data in format text/plain;charset=utf-8, GtkSelectionData is target=text/plain;charset=utf-8 type=ATOM selection=CLIPBOARD timestamp=0
13:45:05: Trace: (clipboard) Valid clipboard data of size 73 found


OpenClipboard
13:45:08: Trace: (clipboard) Checking if format UTF8_STRING is available
13:45:08: Trace: (clipboard) Received available formats for clipboard CLIPBOARD
13:45:08: Trace: (clipboard)   TIMESTAMP
13:45:08: Trace: (clipboard)   TARGETS
13:45:08: Trace: (clipboard)   MULTIPLE
13:45:08: Trace: (clipboard)   TIMESTAMP
13:45:08: Trace: (clipboard)   text/plain;charset=utf-8
13:45:08: Trace: (clipboard)   STRING
13:45:08: Trace: (clipboard)   UTF8_STRING
13:45:08: Trace: (clipboard) Requesting format UTF8_STRING
13:45:08: Trace: (clipboard) Clipboard data requested
13:45:08: Trace: (clipboard) clipboard data in format UTF8_STRING, GtkSelectionData is target=UTF8_STRING type=NONE selection=CLIPBOARD timestamp=0
13:45:08: Trace: (clipboard) Valid clipboard data of size 73 found
13:45:08: Trace: (clipboard) Received selection UTF8_STRING, len=73
OnClipboardGetData(13) - found wx-compatible text format
13:45:08: Trace: (clipboard) Checking if format FAR_VerticalBlock_Unicode is available
13:45:08: Trace: (clipboard) Received available formats for clipboard CLIPBOARD
13:45:08: Trace: (clipboard)   TIMESTAMP
13:45:08: Trace: (clipboard)   TARGETS
13:45:08: Trace: (clipboard)   MULTIPLE
13:45:08: Trace: (clipboard)   TIMESTAMP
13:45:08: Trace: (clipboard)   text/plain;charset=utf-8
13:45:08: Trace: (clipboard)   STRING
13:45:08: Trace: (clipboard)   UTF8_STRING
CloseClipboard without data

@unxed
Copy link
Contributor Author

unxed commented Mar 16, 2024

На всякий случай уточню, что речь идёт о проверке фикса из #2070

@unxed
Copy link
Contributor Author

unxed commented Mar 16, 2024

Copying from far2l GUI to Telegram Desktop (as well as to any other app) still not work under Wayland on wslg, though, even after 1e7b2a7. Maybe wslg bug?

See #1658

@unxed
Copy link
Contributor Author

unxed commented Mar 21, 2024

В чате пишут:
https://t.me/far2l_ru/17086

Бага с вставкой именно в телегу (у меня x11 desktop) из любого текста последнего мастера far2l (хоть имени файла по Ctrl-Ins, хоть фрагмента из редактора) вставленное завершается непонятным концевым символом:
FarEng.hlf.m4
(который не виден при просмотре, но есть при редактировании в телеге)

Проверил со старой февральской версией far2l (до последних фиксов) - вставляет без этого символа
FarEng.hlf.m4

Возможно из-за including ending NUL char в ca3ccdc

Проверьте, у кого есть время, проявляется ли у вас.

@unxed
Copy link
Contributor Author

unxed commented Mar 21, 2024

Также из чата про этот лишний символ:

В far2m это прослеживается, начиная от коммита 17 марта. Соответственно в far2l это произошло очень незадолго до этого.

@unxed
Copy link
Contributor Author

unxed commented Jul 14, 2024

@atolismesh просьбочка перепроверить ещё раз, не сломалось ли чего.

@unxed
Copy link
Contributor Author

unxed commented Jul 16, 2024

После недавних исправлений проблемы с буфером обмена под Wayland должны были уйти. У кого они оставались, перепроверьте, пожалуйста.

After recent fixes, problems with the clipboard under Wayland should have gone away. Whoever had them, please check now.

@unxed
Copy link
Contributor Author

unxed commented Jul 20, 2024

Там ещё в wsl[g] обнаружились проблемы с кодировками при работе с буфером обмена. Поправили. У кого такое было, перепроверьте, пожалуйста, на свежем мастере.

In wsl[g] were discovered problems with encodings when working with the clipboard. They are now fixed. If anyone has had such problems, please check again in recent master.

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

Successfully merging a pull request may close this issue.

2 participants