summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-01-08 17:07:30 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-01-08 18:48:23 -0500
commit1c03bbeb9c4e37989f3c1c2eb14a1621f93d4286 (patch)
tree1b26edb8c0a5eae1950c63a0437db57ae60ca923 /tests
parenta4059cd02d575a23bb5da4153da65d17bf86a347 (diff)
downloadgtk+-1c03bbeb9c4e37989f3c1c2eb14a1621f93d4286.tar.gz
Update all users
Diffstat (limited to 'tests')
-rw-r--r--tests/testdnd.c6
-rw-r--r--tests/testdnd2.c34
-rw-r--r--tests/testdnd3.c2
3 files changed, 38 insertions, 4 deletions
diff --git a/tests/testdnd.c b/tests/testdnd.c
index d267c70866..1c89fccbc5 100644
--- a/tests/testdnd.c
+++ b/tests/testdnd.c
@@ -503,7 +503,7 @@ popup_cb (gpointer data)
gtk_grid_attach (GTK_GRID (grid), button, i, j, 1, 1);
dest = gtk_drop_target_new (targets, GDK_ACTION_COPY | GDK_ACTION_MOVE);
- g_signal_connect (dest, "drag-motion", G_CALLBACK (popup_motion), NULL);
+ g_signal_connect (dest, "accept", G_CALLBACK (popup_motion), NULL);
g_signal_connect (dest, "drag-leave", G_CALLBACK (popup_leave), NULL);
gtk_widget_add_controller (button, GTK_EVENT_CONTROLLER (dest));
}
@@ -607,7 +607,7 @@ main (int argc, char **argv)
label = gtk_label_new ("Popup\n");
dest = gtk_drop_target_new (targets, GDK_ACTION_COPY | GDK_ACTION_MOVE);
- g_signal_connect (dest, "drag-motion", G_CALLBACK (popsite_motion), NULL);
+ g_signal_connect (dest, "accept", G_CALLBACK (popsite_motion), NULL);
g_signal_connect (dest, "drag-leave", G_CALLBACK (popsite_leave), NULL);
gtk_widget_add_controller (label, GTK_EVENT_CONTROLLER (dest));
@@ -621,7 +621,7 @@ main (int argc, char **argv)
targets = gdk_content_formats_new (NULL, 0);
dest = gtk_drop_target_new (targets, 0);
g_signal_connect (dest, "drag-leave", G_CALLBACK (target_drag_leave), pixmap);
- g_signal_connect (dest, "drag-motion", G_CALLBACK (target_drag_motion), pixmap);
+ g_signal_connect (dest, "accept", G_CALLBACK (target_drag_motion), pixmap);
g_signal_connect (dest, "drag-drop", G_CALLBACK (target_drag_drop), pixmap);
gtk_widget_add_controller (pixmap, GTK_EVENT_CONTROLLER (dest));
gdk_content_formats_unref (targets);
diff --git a/tests/testdnd2.c b/tests/testdnd2.c
index b601ad6bcb..09cefbfae9 100644
--- a/tests/testdnd2.c
+++ b/tests/testdnd2.c
@@ -161,6 +161,39 @@ ask_actions (GdkDrop *drop,
}
static gboolean
+delayed_deny (gpointer data)
+{
+ GtkDropTarget *dest = data;
+ GtkWidget *image = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
+ GdkDrop *drop = GDK_DROP (g_object_get_data (G_OBJECT (image), "drop"));
+
+ if (drop)
+ {
+ g_print ("denying drop, late\n");
+ gtk_drop_target_deny_drop (dest, drop);
+ }
+
+ return G_SOURCE_REMOVE;
+}
+
+static gboolean
+image_drag_motion (GtkDropTarget *dest,
+ GdkDrop *drop,
+ int x,
+ int y,
+ gpointer data)
+{
+ GtkWidget *image = data;
+ g_object_set_data_full (G_OBJECT (image), "drop", g_object_ref (drop), g_object_unref);
+
+ g_timeout_add (1000, delayed_deny, dest);
+
+ gdk_drop_status (drop, gtk_drop_target_get_actions (dest));
+
+ return TRUE;
+}
+
+static gboolean
image_drag_drop (GtkDropTarget *dest,
GdkDrop *drop,
int x,
@@ -312,6 +345,7 @@ make_image (const gchar *icon_name, int hotspot)
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY|GDK_ACTION_MOVE|GDK_ACTION_ASK);
+ g_signal_connect (dest, "accept", G_CALLBACK (image_drag_motion), image);
g_signal_connect (dest, "drag-drop", G_CALLBACK (image_drag_drop), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (dest));
diff --git a/tests/testdnd3.c b/tests/testdnd3.c
index a2c5c8115b..5f2bb0e92b 100644
--- a/tests/testdnd3.c
+++ b/tests/testdnd3.c
@@ -306,7 +306,7 @@ canvas_item_new (int i,
formats = gdk_content_formats_new_for_gtype (GDK_TYPE_RGBA);
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY);
g_signal_connect (dest, "drag-drop", G_CALLBACK (item_drag_drop), NULL);
- g_signal_connect (dest, "drag-motion", G_CALLBACK (item_drag_motion), NULL);
+ g_signal_connect (dest, "accept", G_CALLBACK (item_drag_motion), NULL);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (dest));
gdk_content_formats_unref (formats);