Re: Why strings? (was Re: GTK problem)




tiggr@gerbil.org (Pieter Schoenmakers) writes:

>    From: Owen Taylor <owt1@cornell.edu>
>    Date: 07 Apr 1998 17:15:51 -0400
> 
>    Strings are used largely because of flexibility. If constants were
>    used, then it would be a big chore to make sure that every signal
>    in every widget got a unique constant. 
> 
> This is even more true for GdkSelectionType (and GDK_SELECTION property).
> Selection types should be strings too (or I am either clueless or spoiled
> by nextstep pasteboard handling or both).  --Tiggr

Well, they are strings, in a way. Selection types in GTK and
in X are atoms, which are strings indexed by integers.

(The terminology is that to ask the server to assign an integer
for a string is to "intern" it - beats me why)

You can translate with gdk_atom_intern() and gdk_atom_name().

The question is what strings do programs agree upon? The
ICCCM defines a fairly short (and incomplete) list of standard
types. (Some of these are pre-translated into standard 
atoms such as XA_STRING/GDK_TARGET_STRING - which is what
you may be thinking of).

The Xdnd and Xde drag-and-drop protocols on the other hand
use mime types interned as atoms. What might be cool would
be to use un-interned mime-types throughout GTK, and translate
them into the standard X selection types when possible for
cut-and-paste and for Motif DND.

Regards,
                                        Owen



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