Re: Clipboard daemon



On Wed, 2003-10-29 at 15:46, Mike Hearn wrote:
> There is a key distinction here that you must realise:
> 
> * The OLE clipboard on Windows is scoped local to a PROCESS not a WINDOW *
> 
> The reason everybody hates the X clipboard is because it's window scoped.
> For instance, if I type something into an Evolution mail window, copy it,
> create a new message window then try and paste it in, it'll work only as
> long as the original window exists. This has bit me several times.
> 
> If the clipboard persisted as long as Evolution did, really this would not
> be a huge problem.

This is not inherent in the X model. Its just something Evolution does.
If you use GtkClipboard to handle copy and paste it will create an
invisible widget that lives as long as the app lives. If you just use
e.g. gtk_clipboard_set_text() it will live on forever. Try copying
something from the Subject line in evolution and then closing the
window, the clipboard data is still there.

However, if you use gtk_clipboard_set_with_owner() and you use a widget
in the window as the owner then the clipboard contents will go away when
the window is destroyed. If you want to keep clipboard contents around
after a window close you really have to duplicate the data and put the
duplicated data on the clipboard. This can of course be optimized in
various ways by sharing copy-on-write/destroy if you want to get
advanced.

I looked at e.g. gnome-terminal that also has this problem. This seems
to be a vte issue. On a cut/copy it makes a copy of the data, but stores
it in the vte widget which it sets as owner, so when it gets destroy the
data is gone. If it instead was put somewhere separately and got freed
on loss of clipboard ownership this wouldn't be a problem.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a bookish devious cowboy with a passion for fast cars. She's a plucky 
paranoid angel fleeing from a Satanic cult. They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]