Re: Calling gtk_drag_get_data() in a drag-motion signal handler.

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

 



Am Dienstag, den 11.12.2007, 14:46 +0100 schrieb Murray Cumming: 
> As the attached test case shows, this problem is fixed by calling 
> gtk_drag_dest_set() with 0 instead of GTK_DEST_DEFAULT_ALL (0 causes the
> targets array to be ignored too, but just passing NULL for the targets
> doesn't change the behaviour.)

The meaning of gtk_drag_dest_set's flags argument is to install default
behaviors, so that you have just a few signal handlers for implementing
primitive DnD support. With GTK_DEST_DEFAULT_ALL for instance you just
have to connect the "drag-data-received" signal to get primitive DnD
support suitable for accepting plain text.

I've updated the documentation for gtk_drag_dest_set and
GtkWidget:drag-motion:

gtk_drag_dest_set:

Sets a widget as a potential drop destination, and adds default
behaviors.

The default behaviors listed in flags have an effect similar to
installing default handlers for the widget's drag-and-drop signals
("drag-motion", "drag-drop", ...). They all exist for convenience. When
passing GTK_DEST_DEFAULT_ALL for instance it is sufficient to connect to
the widget's "drag-data-received" signal to get primitive, but
consistent drag-and-drop support.

Things become more complicated when you try to preview the dragged data,
as described in the documentation for "drag-motion". The default
behaviors described by flags make some assumptions, that can conflict
with your own signal handlers. For instance GTK_DEST_DEFAULT_DROP causes
invokations of gdk_drag_status() in the context of "drag-motion", and
invokations of gtk_drag_finish() in "drag-data-received". Especially the
later is dramatic, when your own "drag-motion" handler calls
gtk_drag_get_data() to inspect the dragged data.

widget :
a GtkWidget
flags :
which types of default drag behavior
to use
targets :
a pointer to an array of
GtkTargetEntrys indicating the drop
types that this widget will accept.
Later you can access the list with
gtk_drag_dest_get_target_list() and
gtk_drag_dest_find_target().
n_targets :
the number of entries in targets.
actions :
a bitmask of possible actions for a
drop onto this widget.

GtkWidget:drag-motion:

[...] Note that you cannot not pass GTK_DEST_DEFAULT_DROP,
GTK_DEST_DEFAULT_MOTION or GTK_DEST_DEFAULT_ALL to gtk_drag_dest_set()
when using the drag-motion signal that way. [...]

Ciao,
Mathias
-- 
Mathias Hasselmann <mathias@xxxxxxxxxxxxx>
www.openismus.com
-- 
Mathias Hasselmann <mathias.hasselmann@xxxxxx>
http://taschenorakel.de/

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux