[Lazarus] Clipboard Data Goes Away

Michael Van Canneyt michael at freepascal.org
Thu Apr 1 09:44:26 CEST 2021



On Thu, 1 Apr 2021, Anthony Walter via lazarus wrote:

> I noticed a recent discussion touching on this problem posted by Bo
> Berglund on November 20, 2020 to this same mailing list.
>
> Andreas Schneider replied in that thread, 'Pasting basically asks the
> application that "copied" it to get the content. If that app is gone in the
> meantime, there's nothing to paste anymore.'
>
> Also, Colin Western replied this is how Linux applications work, 'the data
> is kept with the source program, so goes when the program closes'.
>
> I disagree.
>
> I've tested several Gtk2 applications, including older versions of Gimp
> and  Geany. Both these programs have clipboard copy functions and the data
> on the clipboard from those applications my tests show their clipboard data
> persists after they have been closed. So it would seem that Gtk2 the
> clipboard works correctly and handles persisting data after an application
> has exited.
>
> I stepped through the LCL source and it looks like the clipboard code is
> using some Gtk clipboard functions, and not using X windows functions,
> thereby introducing a possible problem, but I am unsure if the LCL is using
> the Gtk clipboard correctly. That is, the LCL might be using some Gtk
> clipboard functions which seem to work well, but exhibit the problematic
> behaviour I've described.

I think the programs you tested use some extra functions, because as these
2 persons already said: under X11, the selection is owned by the program,
not by X11.

See e.g.

https://www.uninformativ.de/blog/postings/2017-04-02/0/POSTING-en.html
https://wiki.ubuntu.com/ClipboardPersistence

for an explanation.

Basically: if you don't communicate with a persistent clipboard app, then
nothing will happen to persist your selection.

Michael.



More information about the lazarus mailing list