Re: [gtk-list] [Q] Properly overriding dnd default behaviour ?




Renaud <renaud.chaillat@isr.thomson-csf.com> writes:

>   Hi,
> 
> When you use gtk_drag_source_set() on a widget, it connects 
> "button_press_event" and "motion_notify_event" to 
> gtk_drag_source_event_cb(). So you have no control on when the 
> "drag_begin" signal is triggered (you may want to have a different 
> threshold or use a timer, for instance).
> 
> I've overriden all that by writing my own gtk_drag_source_set() and 
> gtk_drag_source_event_cb(), but this way I have to use private gtk 
> structures (for registering dnd site).

DND source sites don't need to be registered.

> Is there a cleaner way to achieve the same goal ?
> Shouldn't gtk_drag_source_set() get another argument, which would 
> be a pointer to our own handler ? A NULL pointer would mean to use 
> the default behaviour (gtk_drag_source_event_cb) in that case.

There is no reason to use gtk_drag_source_set() if you don't
want to use gtk_drag_source_set().

If you don't want to use gtk_drag_source_set(), simply call
gtk_drag_begin() from your motion handler.

(BTW - using a different threshhold would be broken. At some
point the GTK+ threshhold will be user configurable - and if
you don't use the GTK+ value, then your drag source won't
follow the user's settings.)

Regards,
                                        Owen



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