Re: GTK TreeView control in Windows (DND issue)




On 15 Sep 2011, at 18:35, David Nečas wrote:


Could you please post the debugging code in the form of a patch so that
others can easily and precisely reproduce it?

That's not quite as simple as I'd hope because I'm not using a version control system (at the moment).  However, the 2 functions are very small so here they are in their entirety.  First the code for libgtk (gtk/gtkdnd.c):-

static void
gtk_drag_dest_set_internal (GtkWidget       *widget,
   GtkDragDestSite *site)
{
  GtkDragDestSite *old_site;
  
  g_return_if_fail (widget != NULL);

/* This is my addition */ printf ("Widget originally set as drag_dest target was 0x%p\n", widget);

  /* HACK, do this in the destroy */
  old_site = g_object_get_data (G_OBJECT (widget), "gtk-drag-dest");
  if (old_site)
    {
      g_signal_handlers_disconnect_by_func (widget,
   gtk_drag_dest_realized,
   old_site);
      g_signal_handlers_disconnect_by_func (widget,
   gtk_drag_dest_hierarchy_changed,
   old_site);

      site->track_motion = old_site->track_motion;
    }

  if (gtk_widget_get_realized (widget))
    gtk_drag_dest_realized (widget);

  g_signal_connect (widget, "realize",
   G_CALLBACK (gtk_drag_dest_realized), site);
  g_signal_connect (widget, "hierarchy-changed",
   G_CALLBACK (gtk_drag_dest_hierarchy_changed), site);

  g_object_set_data_full (G_OBJECT (widget), I_("gtk-drag-dest"),
 site, gtk_drag_dest_site_destroy);
}

The only thing to be careful of is that you don't look in gdkdnd.c instead of gtkdnd.c  Next, the code for libglib (gobject/gobject.c):-

gpointer
g_object_get_data (GObject     *object,
                   const gchar *key)
{
  GQuark quark;

  g_return_val_if_fail (G_IS_OBJECT (object), NULL);
  g_return_val_if_fail (key != NULL, NULL);

  if (0 == strcmp (key, "gtk-drag-dest")) /* These 2 lines are my addition */
    printf ("Widget being tested is 0x%p\n", object);

  quark = g_quark_try_string (key);

  return quark ? g_datalist_id_get_data (&object->qdata, quark) : NULL;
}


On 15 Sep 2011, at 18:35, David Nečas wrote:


Using functions such as gtk_widget_class_path() and gtk_widget_path() it
should be relatively easy to figure out which widget it is.

That'd be a great step forward..!  Regards,

John


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