gtk-demo: Fix entry position in dnd demo
authorMatthias Clasen <mclasen@redhat.com>
Fri, 22 May 2020 17:17:59 +0000 (13:17 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 22 May 2020 17:17:59 +0000 (13:17 -0400)
gtk_fixed_get_child_position does not work if children
have transforms that are not just 2D translations.
Use gtk_widget_translate_coordinates instead.

demos/gtk-demo/dnd.c

index fb164e41a283ebc9977191edee39133856ccaf52..0d901af6de4022cc7a74cce47fe639efe61084f9 100644 (file)
@@ -309,9 +309,9 @@ edit_cb (GtkWidget *button, GtkWidget *child)
   GtkWidget *canvas = gtk_widget_get_parent (child);
   CanvasItem *item = CANVAS_ITEM (child);
   GtkWidget *entry;
-  int x, y;
+  double x, y;
 
-  gtk_fixed_get_child_position (GTK_FIXED (canvas), child, &x, &y);
+  gtk_widget_translate_coordinates (child, canvas, 0, 0, &x, &y);
 
   entry = gtk_entry_new ();