Re: [pygtk] Copy to X clipboard
Michael JasonSmith wrote: >On Tue, 2002-05-28 at 16:56, Seth Kurtzberg wrote: > > >>My problem is slightly different; I'm copying from a pygtk application to a >>legacy application using the clipboard. With the code in the selection.py >>sample file, the middle button paste works but a paste from the taskbar (in >>gnome-terminal, for example) doesn't work. >> >> >[snip] > > >>Obviously I'm missing something. Is this related to selection names, such as >>GDK_SELECTION_PRIMARY (which I just copied under emacs, and pasted under >>kmail, and both middle button and edit/paste work, so it is possible). >> >> >Ahhh, the Joy of X Selections :) You are correct, there are multiple >selections and how you select something affects which one is used. > >When you select something using click and drag, and paste using the >middle mouse-button, the PRIMARY selection is used. When you select >something and use "Cut", or "Copy" from the menu, the CLIPBOARD >selection is used. > >The closest thing to a standard is > http://www.freedesktop.org/standards/clipboards.txt >To handle legacy apps you have to put the data in both, IIRC. > > The general concensus is to just do it right in your apps. If you use the cut/copy menu items in an app, then the CLIPBOARD selection is claimed. When you select some text, the app should be claiming the PRIMARY selection. Doing anything different will lead to a more broken and confusing desktop (You will find that users get really pissed off when the contents of their clipboard disapear because they selected some text). If you don't make the distinction between PRIMARY and CLIPBOARD, then some operations are impossible (such as selecting some text, then choosing paste from the menus to replace the selected text with the contents of the clipboard). Gtk gets it right. Qt 3.0 (and probably 2.x) get it right. Emacs 21 gets it right. Mozilla sometimes gets it wrong. Please try to make sure your apps are in the "got it right" pile, rather than the broken pile. James. -- Email: [EMAIL PROTECTED] | Linux.conf.au 2003 Call for Papers out WWW: http://www.daa.com.au/~james/ | http://conf.linux.org.au/cfp.html ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Copy to X clipboard
On Tue, 2002-05-28 at 16:56, Seth Kurtzberg wrote: > My problem is slightly different; I'm copying from a pygtk application to a > legacy application using the clipboard. With the code in the selection.py > sample file, the middle button paste works but a paste from the taskbar (in > gnome-terminal, for example) doesn't work. [snip] > Obviously I'm missing something. Is this related to selection names, such as > GDK_SELECTION_PRIMARY (which I just copied under emacs, and pasted under > kmail, and both middle button and edit/paste work, so it is possible). Ahhh, the Joy of X Selections :) You are correct, there are multiple selections and how you select something affects which one is used. When you select something using click and drag, and paste using the middle mouse-button, the PRIMARY selection is used. When you select something and use "Cut", or "Copy" from the menu, the CLIPBOARD selection is used. The closest thing to a standard is http://www.freedesktop.org/standards/clipboards.txt To handle legacy apps you have to put the data in both, IIRC. -- Michael JasonSmith http://www.cosc.canterbury.ac.nz/~mpj17/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Copy to X clipboard
My problem is slightly different; I'm copying from a pygtk application to a legacy application using the clipboard. With the code in the selection.py sample file, the middle button paste works but a paste from the taskbar (in gnome-terminal, for example) doesn't work. Using xclipboard I got it to work using Edit/Paste, but the middle button paste doesn't work. That is, I haven't managed to get *both* middle button and Edit/Paste to paste. (In the cases where xclipboard is being used, Edit/Paste works but middle button doesn't.) Obviously I'm missing something. Is this related to selection names, such as GDK_SELECTION_PRIMARY (which I just copied under emacs, and pasted under kmail, and both middle button and edit/paste work, so it is possible). On Monday 27 May 2002 08:57 pm, Christian Reis wrote: > On Tue, May 28, 2002 at 09:47:08AM +0800, James Henstridge wrote: > > X selection handling is an asynchronous operation. When a user "copies" > > some text to the clipboard, the text doesn't necessarily get copied > > anywhere. Instead, the application claims the CLIPBOARD selection. When > > another app wants to paste the contents of the clipboard, they request > > the contents of the CLIPBOARD selection in a particular format (eg. UTF8 > > text, html, an image, etc), which sends a message to the first app. The > > first app then sends the data back in the requested format. This has > > the benefit that no data is sent over the wire until it is requested, > > and content type negotiation can be performed. > > > > As you can see, this model breaks down when the selection owner window > > gets destroyed. There are some tools to work around this problem such > > as xclipboard. The downside to xclipboard is that every time the > > CLIPBOARD selection is claimed, the data gets requested by xclipboard, > > and xclipboard will only store the data in one format. > > Added http://async.com.br/faq/pygtk/index.py?req=show&file=faq20.010.htp > > Take care, -- Seth Kurtzberg MIS Corp. Office: (480) 661-1849 Fax: (480) 614-8909 email: [EMAIL PROTECTED] pager: 888-605-9296 or email [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Copy to X clipboard
On Tue, May 28, 2002 at 09:47:08AM +0800, James Henstridge wrote: > > > X selection handling is an asynchronous operation. When a user "copies" > some text to the clipboard, the text doesn't necessarily get copied > anywhere. Instead, the application claims the CLIPBOARD selection. When > another app wants to paste the contents of the clipboard, they request > the contents of the CLIPBOARD selection in a particular format (eg. UTF8 > text, html, an image, etc), which sends a message to the first app. The > first app then sends the data back in the requested format. This has > the benefit that no data is sent over the wire until it is requested, > and content type negotiation can be performed. > > As you can see, this model breaks down when the selection owner window > gets destroyed. There are some tools to work around this problem such > as xclipboard. The downside to xclipboard is that every time the > CLIPBOARD selection is claimed, the data gets requested by xclipboard, > and xclipboard will only store the data in one format. Added http://async.com.br/faq/pygtk/index.py?req=show&file=faq20.010.htp Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Copy to X clipboard
Ricardo Froehlich wrote: > Hello, > > I appreciate last help I had from Jon Nelson, the link he suggested is >great, but there is still one problem: if I close my app, the string I copied >is removed from the X clipboard. > Unfortunately the tutorial didn't say anything about it. How do I make >the string stay in the clipboard, even when I close my app? Am I missing any >detail? > > X selection handling is an asynchronous operation. When a user "copies" some text to the clipboard, the text doesn't necessarily get copied anywhere. Instead, the application claims the CLIPBOARD selection. When another app wants to paste the contents of the clipboard, they request the contents of the CLIPBOARD selection in a particular format (eg. UTF8 text, html, an image, etc), which sends a message to the first app. The first app then sends the data back in the requested format. This has the benefit that no data is sent over the wire until it is requested, and content type negotiation can be performed. As you can see, this model breaks down when the selection owner window gets destroyed. There are some tools to work around this problem such as xclipboard. The downside to xclipboard is that every time the CLIPBOARD selection is claimed, the data gets requested by xclipboard, and xclipboard will only store the data in one format. James. -- Email: [EMAIL PROTECTED] | Linux.conf.au 2003 Call for Papers out WWW: http://www.daa.com.au/~james/ | http://conf.linux.org.au/cfp.html ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Copy to X clipboard
Hello, I appreciate last help I had from Jon Nelson, the link he suggested is great, but there is still one problem: if I close my app, the string I copied is removed from the X clipboard. Unfortunately the tutorial didn't say anything about it. How do I make the string stay in the clipboard, even when I close my app? Am I missing any detail? Thank you for your time, Ricardo --- Ricardo Froehlich Async Open Source ([EMAIL PROTECTED]) http://www.async.com.br/ (16) 9132 5538 +55 (16) 272 3330 /"\ \ / Campanha da fita ASCII - Contra mail HTML X ASCII ribbon campaign - Against HTML mail / \ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/