static GParamSpec *properties[NUM_PROPERTIES];
enum {
+ DRAG_ENTER,
DRAG_LEAVE,
DRAG_MOTION,
DRAG_DROP,
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
+ /**
+ * GtkDropTarget::drag-enter:
+ * @dest: the #GtkDropTarget
+ * @drop: the #GdkDrop
+ *
+ * The ::drag-enter signal is emitted on the drop site when the cursor
+ * enters the widget.
+ */
+ signals[DRAG_ENTER] =
+ g_signal_new (I_("drag-enter"),
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_DROP);
+
/**
* GtkDropTarget::drag-leave:
* @dest: the #GtkDropTarget
* The ::drag-leave signal is emitted on the drop site when the cursor
* leaves the widget. A typical reason to connect to this signal is to
* undo things done in #GtkDropTarget::drag-motion, e.g. undo highlighting.
- *
- * Likewise, the #GtkWidget::drag-leave signal is also emitted before the
- * #GtkDropTarget::drag-drop signal, for instance to allow cleaning up of
- * a preview item created in the #GtkDropTarget::drag-motion signal handler.
*/
signals[DRAG_LEAVE] =
g_signal_new (I_("drag-leave"),
g_object_add_weak_pointer (G_OBJECT (dest->drop), (gpointer *)&dest->drop);
}
+static void
+gtk_drop_target_emit_drag_enter (GtkDropTarget *dest,
+ GdkDrop *drop)
+{
+ set_drop (dest, drop);
+ g_signal_emit (dest, signals[DRAG_ENTER], 0, drop);
+}
+
static void
gtk_drop_target_emit_drag_leave (GtkDropTarget *dest,
GdkDrop *drop)
{
set_drop (dest, drop);
- g_signal_emit (dest, signals[DRAG_LEAVE], 0, drop, time);
+ g_signal_emit (dest, signals[DRAG_LEAVE], 0, drop);
set_drop (dest, NULL);
}
if (old_dest == dest)
return;
-g_print ("set current dest %p\n", dest);
if (old_dest)
{
gtk_drop_target_set_contains (old_dest, FALSE);
{
g_object_weak_ref (G_OBJECT (dest), clear_current_dest, drop);
+ gtk_drop_target_emit_drag_enter (dest, drop);
+
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
if (widget)
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_DROP_ACTIVE, FALSE);