diff options
author | Owen Taylor <otaylor@redhat.com> | 1999-01-12 23:27:30 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1999-01-12 23:27:30 +0000 |
commit | 24f6d8b887ffdd24e1841340c81b54e41811e165 (patch) | |
tree | a320b3efe6053ceb3d4e17e06d515f0d943fd989 /tests/testdnd.c | |
parent | 5a86cbd116bd55fbb31b3c90baca8cd30dd395d0 (diff) | |
download | gtk+-24f6d8b887ffdd24e1841340c81b54e41811e165.tar.gz |
Add a drag_data_received handler for the label.
Tue Jan 12 18:30:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testdnd.c (label_drag_data_received): Add
a drag_data_received handler for the label.
Tue Jan 12 15:01:50 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c: Removed the putback_events queue,
since it was causing problems with event ordering -
just keep a single queue. If we need it, we can
add priorities to events.
* gdk/gdkevents.c: Annotate events with flags - we allocate
a GdkEventPrivate structure in gdk_event_new() and use these
flags to mark an event being translated as "pending" -
I.e., not yet ready to be dequeued. So we can put
the event on the queue and get the order of the
events right. (This solves the double-click problems)
* gdk/gdk.h gdk/gdkevents.h: Add gdk_event_peek() to get a copy
of the next event on the event queue.
* gtk/gtkmain.c (gtk_main_do_event): Use gdk_event_peek()
to check the next event without causing event queue
reordering.
Diffstat (limited to 'tests/testdnd.c')
-rw-r--r-- | tests/testdnd.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/testdnd.c b/tests/testdnd.c index 118e04d427..263e7f50dc 100644 --- a/tests/testdnd.c +++ b/tests/testdnd.c @@ -350,7 +350,7 @@ target_drag_data_received (GtkWidget *widget, { if ((data->length >= 0) && (data->format == 8)) { - g_print ("Received %s\n", (gchar *)data->data); + g_print ("Received \"%s\" in trashcan\n", (gchar *)data->data); gtk_drag_finish (context, TRUE, FALSE, time); return; } @@ -359,6 +359,25 @@ target_drag_data_received (GtkWidget *widget, } void +label_drag_data_received (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *data, + guint info, + guint time) +{ + if ((data->length >= 0) && (data->format == 8)) + { + g_print ("Received \"%s\" in label\n", (gchar *)data->data); + gtk_drag_finish (context, TRUE, FALSE, time); + return; + } + + gtk_drag_finish (context, FALSE, FALSE, time); +} + +void source_drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, @@ -560,6 +579,9 @@ main (int argc, char **argv) target_table, n_targets - 1, /* no rootwin */ GDK_ACTION_COPY | GDK_ACTION_MOVE); + gtk_signal_connect( GTK_OBJECT(label), "drag_data_received", + GTK_SIGNAL_FUNC( label_drag_data_received), NULL); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); |