I am using KDE Plasma 5.26 under Wayland. If I try to copy some text from Scintilla widget and paste it into a KDE app, then nothing is pasted. Though, pasting into XWayland or GTK apps works fine.
The bug is reproducible both with Geany 1.38 ( https://github.com/geany/geany/issues/3320 ) and SciTE 5.3.1.
Diff:
Here is a screenshot after successfully pasting from SciTE 5.3.1 on Ubuntu 22.10 with Wayland into Qt Creator, KWrite, and Calligra Words.

The about boxes from GNOME and KWrite show that it is using Wayland and other versions are KDE Frameworks 5.98.0 and Qt 5.15.6.
This bug report is non-specific: say which operating system, distribution, and version are being used along with the KDE app and its version.
I am using the most recent Debian GNU/Linux Testing with a KDE Plasma 5.26 session under Wayland. The bug happens with many different KDE and Qt apps, moreover, the clipboard history in the KDE Plasma itself is not populated with the copied text.
Maybe the main difference which triggers the bug is using KDE session instead of GNOME session.
Copying from other GTK+ apps, or, considering Geany, copying from anywhere except the Scintilla widget, works.
Reproduced with copying from SciTE to Kate on Debian Wayland. On this system, it still copies from SciTE to gedit.
Copying the path with the
File | Copy Pathcommand does copy to Kate. That is using the simplergtk_clipboard_set_textAPI instead ofgtk_clipboard_set_with_datawhich is called in Scintilla to allow multiple formats and asynchronous access. Its likely that the current KDE implementation on Wayland has a problem with this API or its use. Since it works with GTK applications on Debian + Wayland and also with KDE applications on Ubuntu + Wayland, I'd hope that it gets fixed with updates to KDE's Wayland support.If anyone is sufficiently motivated, it may be possible to provide an optional alternative code path in Scintilla, possibly with decreased functionality by not supporting multiple clipboard formats. However, supporting multiple clipboard formats is important to future extensibility to allow better provision of columnar and line-oriented copies as is done on Win32.
Also reported the bug to the KDE side: https://bugs.kde.org/show_bug.cgi?id=461301
The bug is definitely on the Scintilla side.
The code sets "UTF8_STRING" and "STRING" as MIME types when copying the text:
https://sourceforge.net/p/scintilla/code/ci/default/tree/gtk/ScintillaGTK.cxx#l123
At the same time, Qt under Wayland doesn't understand such MIMEs and accepts only "text/plain;charset=utf8" or "text/plain":
https://github.com/qt/qtwayland/blob/dev/src/client/qwaylanddataoffer.cpp#L18-L21
https://github.com/qt/qtwayland/blob/dev/src/client/qwaylanddataoffer.cpp#L126-L127
GTK apps, as well as GNOME under Wayland seem to understand these MIME types, but KDE doesn't (and AFAIK doesn't have to).
The attached patch seems to fix the original issue. There are also issues with drag&drop and middle button copying between GTK and Qt apps, however I hope that the issue there is basically the same and can be fixed by using the right MIME types.
This is definitely a KDE bug as it works with GTK.
These are target atoms, not MIME types and are defined by the Inter-Client Communication Conventions Manual https://www.x.org/releases/X11R7.7/doc/xorg-docs/icccm/icccm.pdf and subsequent documents https://www.irif.fr/~jch//software/UTF8_STRING/
This code works with KDE applications in other circumstances so would be best fixed upstream.
KDE may choose to be incompatible with older software but that makes it less useful.
Are they specific to X.org or are the same target atoms also specified for Wayland?
Last edit: Alexander 2022-11-06
freedesktop.org is the organisation that is supposed to harmonize different windowing systems and toolkits. Wayland (https://wayland.freedesktop.org/) is a freedesktop.org project. While they have documents about some aspects of clipboard handling, I haven't found one that defines mime-types and target atoms and their relationship.
https://www.freedesktop.org/wiki/Specifications/
Anyway, ICCCM is only related to X.org, not Wayland. Relying on the X.org conventions under Wayland is not a good idea.
By the way, GTK4 has removed the support for UTF8_STRING and STRING atoms under Wayland.
Also, the concerns related to usage of text/plain;encoding=utf8 alongside with UTF8_STRING were risen before, see https://sourceforge.net/p/scintilla/bugs/2175/, for example.
Last edit: Alexander 2022-11-08
Where are the Wayland conventions documented?
I am unsure if they are currently documented anywhere, unfortunately.
Scintilla's GTK platform layer is written to the GTK API which covers multiple underlying platforms: X, Wayland, Win32, macOS, and potentially others. On Win32 and macOS,
UTF8_STRINGandSTRINGare not the literal clipboard types since they are from X and the clipboard code needs to interoperate with native applications.On Win32 the normal text type identifier is
CF_UNICODETEXT(aCLIPFORMAT) and on macOS it ispublic.text(a Uniform Type Identifier). Both of these place UTF-16 on the clipboard instead of UTF-8. Thus, there is interpretation of clipboard actions occurring.If some MIME types have become the way to specify clipboard types on Wayland then we need to know the scope and history of this - Scintilla still works with GTK 2. What happens when
text/plain;charset=utf-8is used on macOS or Win32? Does this depend on GTK version?Do you mean GTK under Windows and macOS here, right?
Yes, GTK on Windows and macOS which are supported by Geany.
By the way, pasting into GTK4 applications doesn't work either. Seems that GTK has dropped the support for compatibility atoms on the toolkit level, but I don't know how it works in the recent GNOME.
There is a change in GTK 3.24.35:
wayland: Translate STRING/UTF8_STRING selection atoms to mimetypes
https://gitlab.gnome.org/GNOME/gtk/-/commit/0c1ea9221976b838101d2593754b658808fdc542
Got included in Debian Testing gtk+3.0 (3.24.34-4)
https://metadata.ftp-master.debian.org/changelogs//main/g/gtk+3.0/gtk+3.0_3.24.34-5_changelog
as:
wayland-Translate-STRING-UTF8_STRING-selection-atoms-to-m.patch
I've seen the same problem with SciTE 5.3.1 on GNOME 43, i.e. pasting to Wayland programs, but not XWayland after updating to gtk+-3.24.3.
After reverting the above GTK commit pasting worked again.
Apologies, this ticket predates gtk+3.0 (3.24.34-4) which was released on Fri, 18 Nov 2022 11:53:03 +0000.
I guess this is similar, but different.
Except that, scintilla.patch above does fix this on vanilla GTK 3.24.35.
It looks like the problem will be solved once the GTK 0c1ea9221976b838101d2593754b658808fdc542 commit reaches distributions implying that there is no need to change Scintilla.
The issue that led to the commit shows this issue was also occurring with Eclipse.
https://gitlab.gnome.org/GNOME/gtk/-/issues/5217
After upgrading to GTK 3.24.35 (which seems to include the commit 0c1ea9221976b838101d2593754b658808fdc542) I cannot paste the text from Geany and SciTE even to the GTK3 and XWayland apps.
So, the bug definitely needs to be patched from the Scintilla side.
Not definitive enough for me. As GTK upstream have worked on a fix, any problems with that fix should be reported there.
Raised:
https://gitlab.gnome.org/GNOME/gtk/-/issues/5397