Michal B,
A couple of good answers to how to use the clipboard globally just came through the GTK mailing list last night. I kept them because I think they will be really useful for making the clipboard object. Here is what they said:
=======================================================
I wrote a gtk appl. in which I connected the special SUNkeys (cut/copy/paste) with the gtk_editable... functions and it worked all right. Even when you use a lot of different applications. Probably you know that, but there is a nice little prg. for seeing the clipboard (and what has been it it before...) named xclipboard. I used it to control what the cut,copy,paste keys were doing.
=======================================================
Read the tutorial and RDP about selections (gtk_selection_*). This is used to work with the global X clipboard. It takes a moment to understand and get into. I suggest you experiment with the testselection tool from the gtk+ distribution to understand what each element and function does. Take care with the tutorial, 'cause it seems that some described functions are a bit outdated and not available any more in gtk 1.2.3, but it explains the general framework quite well.
Show quoted text 13 lines
Somone on this list was kind enough to explain to me how to implement
Copy/Paste in my application, however, I forgot to point out that I want
to be able to make that information that I copy to the clipboard
available to other applications. Does GTK+ have such an API?
This is what I used:
gtk_editable_copy_clipboard (GTK_EDITABLE (text));
gtk_editable_paste_clipboard (GTK_EDITABLE (text));
But they don't seem to export to a "global clipboard". They work fine
within the app, but not to get the data to other apps.
=======================================================
I am working on the TClipboard class right now. I am hoping it will be as easy as they make it sound :-)
Curtis
On 11-Aug-99 Jeff Wormsley wrote 41 lines
Michal, sorry about this, but be careful when replying to my emails to the
list. It is a pain, but something in my mail package causes the list to
chuck out my mails unless my ReplyTo is set, and that means that your replies
go to my email address instead of the list if you don't change it.
Jeff.
*********** REPLY SEPARATOR ***********
On 8/11/99, at 10:39 PM, Michal Bukovjan wrote:
>In GTK it is a bunch of functions in GtkEditable, so it should be easy to
>implement those CutToClipboard, PasteFromClipboard and CopyToClipboard
>things.
>
>Thinking about the TClipboard object, though, one has to dwelve into GDK, the
>clipboard is an internal GdkAtom called CLIPBOARD, and while it could be
>possible to copy some code from GtkEditable, the concepts of these atoms is
>not that much clear to me (except that it deals with X). And in GtkEditable I
>can see thay set the clipboard to be the owner of the selection ... Wow. I'm
>lost.
>
>Anyone understands this concept to shed a light? Or knows about some decent
>docs? The GDK reference is not very usable :-(
>
>Michal Bukovjan
>
>"Jeff Wormsley" wrote:
>> On 8/11/99, at 9:37 PM, Michal Bukovjan wrote:
>>
>> >But I am not sure GTK embraces such thing. I think that I'll have to deal
>with
>> >X directly, there might be some clipboard support in GLib, though.
>>
>> Somehow it is done in the Gnome desktop. At least I can cut from GNotepad
>and paste into Netscape, anyway...
>>
>> Jeff.
>>