[SOLVED] Non functioning clipboard in Linux TrayIcon lazarus / 31-LCL ---------------------------------------------------------------------- desliem · 2022-10-27 22:55 Text assigned to the Clipboard in a Linux TrayIcon cannot be pasted if the main form was hidden in the OnShow event handler. However, text set with gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), @mystring[1], -1) can be pasted. It is best to hide the main form in the OnActivate event handler, because the Clipboard can then be used without problem. This behaviour was verified in Linux Mint Mate 20.1 and Linux Mint 21, using Lazarus 2.3.0 (rev main-2_3-1602-gdb285860e3) FPC 3.3.1 x86_64-linux-gtk2. The problem has not been observed in Windows 10 using Lazarus 2.2.4 (rev lazarus_2_2_4) FPC 3.2.2 i386-win32-win32/win64. Other distros and other widgesets have not been investigated. ---------------------------------------------------------------------- dbannon · 2022-10-28 01:01 Interesting observation. Will almost certainly be Linux (or Unix) only, possibly GTK2 only issue. All modern Linux Distros support only a limited subset of LCL's SysTrayIcon these days, due to Gnome's war on screen clutter. But I am surprised to see it affect the clipboard like that ! You might like to make a note on the wiki too, https://wiki.freepascal.org/How_to_use_a_TrayIcon Thanks for the well document report ! Davo ---------------------------------------------------------------------- desliem · 2022-11-01 01:09 Quote from: dbannon on October 28, 2022, 03:01:04 amYou might like to make a note on the wiki too, https://wiki.freepascal.org/How_to_use_a_TrayIcon Before doing that, it seemed best to investigate some of the other widget sets. As Davo suggested there is no problem with Qt5. However, things got complicated when it came to Gtk3. It looks like the source of the problem has nothing to do with TrayIcon. It could be a bug with the TClipboard class  or, more likely, something wrong with how the widget set was installed or used (see https://forum.lazarus.freepascal.org/index.php/topic,61093.0.html). ---------------------------------------------------------------------- dbannon · 2022-11-01 23:25 Quote from: desliem on November 01, 2022, 02:09:45 amQuote from: dbannon on October 28, 2022, 03:01:04 amYou might like to make a note on the wiki too, https://wiki.freepascal.org/How_to_use_a_TrayIcon Before doing that, it seemed best to investigate some of the other widget sets. As Davo suggested there is no problem with Qt5. However, things got complicated when it came to Gtk3. It looks like the source of the problem has nothing to do with TrayIcon. It could be a bug with the TClipboard class  or, more likely, something wrong with how the widget set was installed or used (see https://forum.lazarus.freepascal.org/index.php/topic,61093.0.html). A simpler explanation might be that LCL's GTK3 TrayIcon code is based heavily on the GTK2 version, if  thats the underlying cause, I am afraid its down to me ! Both use the same libayana library so there is a lot of commonality there .... I am heavily committed right now but will look into it some time in the not too distant future. Davo