Recent

Author Topic: Qt6/Wayland clipboard: pasted Unicode converted to escapes  (Read 4842 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 2697
    • UVviewsoft
Qt6/Wayland clipboard: pasted Unicode converted to escapes
« on: January 25, 2026, 08:20:26 pm »
https://github.com/Alexey-T/CudaText/issues/6192

The report is related to TCustomControl-based components (to ATSynEdit, maybe also to SynEdit?). I don't have CachyOS like the user so cannot test!

CudaText: Qt6 build (cudatext-linux-qt6-amd64-1.23x.x.x.tar.xz)

Steps to reproduce:

-    Copy Unicode text (ÅÄÖ, emoji, Japanese) from Firefox
-    Paste into CudaText

Actual result:

-    ÅÄÖ → ???
-    Emoji/Japanese (e.g. 🤔思考) → \U0001f914\u601d\u8003
« Last Edit: March 14, 2026, 08:55:50 am by AlexTP »

AlexTP

  • Hero Member
  • *****
  • Posts: 2697
    • UVviewsoft
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #1 on: March 08, 2026, 08:15:04 am »
Problem is visible by 2 users:

1)

OS: CachyOS Linux (Arch-based)
Session: Wayland
Desktop: KDE Plasma 6.5.5
KDE Frameworks: 6.22.0
Qt: 6.10.1

2)

OS: Arch Linux x86_64
Kernel: Linux 6.18.9-arch1-2
Shell: zsh 5.9
DE: GNOME 49.4
WM: Mutter (Wayland)
Terminal: GNOME Console 49.2
Locale: ru_RU.UTF-8
Session: Wayland
Qt6
« Last Edit: March 08, 2026, 08:22:07 am by AlexTP »

Fred vS

  • Hero Member
  • *****
  • Posts: 3882
    • StrumPract is the musicians best friend
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #2 on: March 08, 2026, 04:16:14 pm »
Hello Alex.

Not sure it is related but Wayland handles clipboards differently than X11, focusing on security by restricting application access to clipboard data unless they have focus.

Also the content of the clipboard is lost when closing the app.

(One more joy of Wayland. By the way, I will not talk about Xlibre's Xnamespace feature, which lets you choose whether or not to share an application's clipboard, because some would call it exaggerated propaganda  :-X).
« Last Edit: March 08, 2026, 04:33:41 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

AlexTP

  • Hero Member
  • *****
  • Posts: 2697
    • UVviewsoft
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #3 on: March 08, 2026, 05:18:57 pm »
Fred, but do you repeat the issue? You need the Arch based Linux, seems.

Fred vS

  • Hero Member
  • *****
  • Posts: 3882
    • StrumPract is the musicians best friend
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #4 on: March 08, 2026, 07:02:05 pm »
Hello Alex, I unfortunately cannot test it as I do not have a Wayland machine available.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Thaddy

  • Hero Member
  • *****
  • Posts: 18979
  • Glad to be alive.
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #5 on: March 09, 2026, 08:07:15 pm »
I tested Debian Trixie64/Qt6/x86_64 with standard SynEdit and that works correct with fpc/laz both trunk/main.
« Last Edit: March 09, 2026, 08:17:52 pm by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

dbannon

  • Hero Member
  • *****
  • Posts: 3777
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #6 on: March 10, 2026, 06:54:14 am »
Yes, but with what desktop ?  If you are using (eg) Gnome (Shell) then you would be using Wayland, if using (eg) Mate you would be using X11.

And to further complicate, did you tell the Qt6 app to use xcb (ie XWayland) ?

Both of Alex's end users are using Wayland (probably, its the default on those DE). He should ask them if the same problem occurs if the app is instructed to use XWayland.

either -

Code: Bash  [Select][+][-]
  1. $> SomeApp -platform xcb <enter>

Note only one dash and no '='. Does not interfere with the (correct) command line options parsed by Lazarus. Sigh ...
Or -
Code: Bash  [Select][+][-]
  1. $> QT_QPA_PLATFORM=xcb SomeApp <enter>

Case sensitive !

I ensure my install packages set the env var when started, as they should be, from a .desktop file.

Davo

 
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1906
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #7 on: March 10, 2026, 07:38:40 am »
I think it is problem related to the firefox.

Alexx2000

  • New Member
  • *
  • Posts: 25
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #8 on: March 10, 2026, 12:10:17 pm »
Not only Firefox. I also can reproduce this issue with gedit, mousepad and thunar. Looks like this is a GTK specific issue.

Thaddy

  • Hero Member
  • *****
  • Posts: 18979
  • Glad to be alive.
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #9 on: March 10, 2026, 01:20:24 pm »
I should have rephrased that: doesn't work.
Anyway, I have seen many projects that had the gtk2 issue and moved to gtk4, not gtk3.
As I stated before, that is asking for future trouble way to soon, throwing away valuable work for nothing. Better choose something that is supported and current NOW, so either gtk4 or Qt6 or both.
Also, Wayland is a moving target, e.g. for Windows positioning there is now a protocol (but only after worldwide undeniable complaints from a huge part of the Linux community)
« Last Edit: March 11, 2026, 10:30:03 am by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

zeljko

  • Hero Member
  • *****
  • Posts: 1906
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #10 on: March 10, 2026, 08:25:30 pm »
Yes it seems a GTK2 issue when used on Wayland, which actually makes it a Wayland issue ?
Gtk2 does not work on wayland afaik, correct me if I'm wrong, maybe under xwayland, but that's another story.

dbannon

  • Hero Member
  • *****
  • Posts: 3777
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #11 on: March 11, 2026, 12:11:58 am »
Gtk2 does not work on wayland afaik, correct me if I'm wrong, maybe under xwayland, but that's another story.

Correct, Gtk2 does not know about Wayland but uses XWayland which includes things like libxcb. While you can force newer widgets to use XWayland, Gtk2 cannot be forced to use Wayland.

XWayland is, itself, an XServer, it forwards on most of content to Wayland but does have some side channels to the display that lets it do things like proper positioning of a Window.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Thaddy

  • Hero Member
  • *****
  • Posts: 18979
  • Glad to be alive.
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #12 on: March 11, 2026, 10:31:58 am »
My previous post is edited by me. Changes the context alas a bit.
I blame it on that only recently I was released in the wild again after surgery.
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

dbannon

  • Hero Member
  • *****
  • Posts: 3777
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #13 on: March 11, 2026, 11:32:20 am »
My previous post is edited by me. Changes the context alas a bit.
I blame it on that only recently I was released in the wild again after surgery.

A bit of that anesthetic in your system Thaddy, you could say almost anything !

Seriously, hope its all good now.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1906
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Qt6/Wayland clipboard: pasted Unicode converted to escapes
« Reply #14 on: March 11, 2026, 11:53:24 am »
My previous post is edited by me. Changes the context alas a bit.
I blame it on that only recently I was released in the wild again after surgery.

Hope you're well  :)

 

TinyPortal © 2005-2018