Re: Bringing gtkdnd.c into the pixbuf era



Owen Taylor <otaylor redhat com> writes:

> James Henstridge <james daa com au> writes:
> 
> > On 15 Apr 2001, Owen Taylor wrote:
> > 
> > > 
> > > This patch:
> > >  
> > >  - Adds a new icon size GTK_ICON_SIZE_DND and two new stock
> > >    ids: GTK_STOCK_DND, GTK_STOCK_DND_MULTIPLE.
> > > 
> > >  - Makes GTK+ uses GTK_STOCK_DND for the default drag icon
> > > 
> > >  - Adds some new functions for setting the drag icons from
> > >    stock ids and pixbufs:
> > > 
> > > void gtk_drag_set_icon_pixbuf (GdkDragContext *context,
> > >                                GdkPixbuf      *pixbuf,
> > >                                gint            hot_x,
> > >                                gint            hot_y);
> > > void gtk_drag_set_icon_stock  (GdkDragContext *context,
> > >                                const gchar    *stock_id,
> > >                                gint            hot_x,
> > >                                gint            hot_y);
> > 
> > One small comment here:  Wouldn't the hotspot be a property of the actual
> > stock icon used?  I could imagine the icon chosen by some theme having a
> > different hotspot.  Is it worth having hotspots associated with stock
> > icons (could be useful for stock cursors, if we ever add something like
> > that).
> 
> hot_x, hot_y are really not the "hot spot" of the icon, but the
> location where the hot spot of the cursor is located in the icon.
> 
> The main practical use of setting the hot spot is to provide for
> "picking up" an icon - locating the hot spot at the point in
> the icon where the user initially clicked. 
> 
> So, no, I don't generally think the hot spot is a property of the
> icon, though it's possible that the "default hot spot" - the hot
> spot for cases the icon doesn't correspond to the item the was
> clicked on to initiate the drag - might depend on the icon.
> 
> Actually, this raises the point that including the hot spot in
> gtk_drag_source_set_icon_pixbuf() and gtk_drag_source_set_icon_stock()
> is a little dubious, and (thinking back on it) is probably why the
> original gtk_drag_source_set_icon() did not take a hot spot,
> but simply used -2,-2 always.

I decided to remove the hot_x, hot_y arguments from 
gtk_drag_source_set_icon_pixbuf/stock, with the idea:

 - Most people would have no idea what they should set it to
 - People wouldn't be consistent about the choice
 - Putting it into the API prevents adding a decent algorithm
   for picking the location of the hot spot in the icon
   later.

Regards,
                                        Owen




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