This is the mail archive of the guile-gtk@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Selection and DND completed


Kevin Ryde <user42@zip.com.au>:

> Marko Rauhamaa <marko@pacujo.net> writes:
> >   return length ? scm_take_str (data, length) : SCM_BOOL_F;
> 
> Not sure if length==0 would be valid data, though I don't see a reason
> it wouldn't be. It might be nice to return an empty string for that.

I misread the code (and the documentation) as though 0 was the error
return value, but as you say:

> data==NULL is supposedly the error indication, perhaps that could give
> the #f.

I have fixed it:

  return data ? scm_take_str (data, length) : SCM_BOOL_F;

(but not yet submitted since I'm in the middle of other changes).

> However the 1.2 code looks like it doesn't store anything to data if
> the window has been destroyed, so it might be prudent to initialize to
> NULL.

That's where I probably got the idea that 0 is the error return value --
it definitely is a bug in gdk-1.2.

I now initialize data with NULL and comment the kludge.

> It also looks like prop_type and prop_format are not set if the window
> has been destroyed, maybe they should get initial values to avoid
> problems too.  GDK_NONE and 0 might be enough.

Prop_format is an integral value -- a random value is not an issue.
Prop_type is sent to sgtk_atom2scm(), which returns SCM_BOOL_F if the
atom is garbage.

So I don't think those values need to be accounted for. (If I wanted to
do it, I wouldn't rely on initializing their values, but I would rather
set them to known values after returning from
gdk_selection_property_get().


Marko

-- 
Marko Rauhamaa      mailto:marko@pacujo.net     http://pacujo.net/marko/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]