|The "collision" signal|  in|ClutterBox2DChild  has no default handler.

box2d_child_signals[COLLISION] = g_signal_new ("collision",
                                 G_TYPE_FROM_CLASS (gobject_class),
                                 G_SIGNAL_RUN_LAST,
                                 0,        //<------ class_offset == 0: no 
default handler
                                 NULL, NULL,
                                 _clutter_box2d_marshal_VOID__OBJECT,
                                 G_TYPE_NONE, 1,
                                 CLUTTER_TYPE_BOX2D_COLLISION);

Then you must add no_default_handler in _WRAP_SIGNAL.
|

_WRAP_SIGNAL(void collision(Glib::RefPtr<Clutter::Box2D::Box2DCollision> & c), "collision", no_default_handler)

The gtkmm tutorial
http://developer.gnome.org/gtkmm-tutorial/stable/sec-wrapping-hg-files.html.en
mentions only one of at least two possible reasons to use this optional argument.

Kjell

2012-03-02 13:24, [email protected] skrev:
Dear all,
        I'm trying to expose the "collision" signal of a ClutterBox2DChild.
I've wrapped the class as per the documentation (included below) which
uses the _WRAP_SIGNAL() macro.  The generated code (immediately below)
gets the parent class of the current object's class and then looks for
the "collision" signal handler in the base class.  However, in general
g_signal_new is used to create a new signal which is normally stored in
static gint my_type_signals[LAST_SIGNAL];
rather than being stored in some structure in the base class.

My question is, why then does the generated code from _WRAP_SIGNAL try
and access base->the_signal_name?

void
Clutter::Box2D::Box2DChild::on_collision(Glib::RefPtr<Clutter::Box2D::Box2DCollision>
  &  c)
{
   BaseClassType *const base = static_cast<BaseClassType*>(
       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the
parent class of the object class (The original underlying C class).
   );

   if(base&&  base->collision)

(*base->collision)(gobj(),_CONVERT(Glib::RefPtr<Clutter::Box2D::Box2DCollision>&,ClutterBox2DCollision*,c,57));
}

snipped box2d-child.hg:
class Box2DChild :
   public Clutter::ChildMeta
{
   _CLASS_GOBJECT(Box2DChild, ClutterBox2DChild, CLUTTER_BOX2D_CHILD,
Clutter::ChildMeta, ClutterChildMeta)

protected:
   _CTOR_DEFAULT

public:
   _WRAP_CREATE()
   _WRAP_SIGNAL(void
collision(Glib::RefPtr<Clutter::Box2D::Box2DCollision>  &  c),
"collision")
};

snipped convert_clutter_box2d.m4:
_CONVERSION(`const
Glib::RefPtr<Box2DCollision>&',`ClutterBox2DCollision*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`ClutterBox2DCollision*',`Glib::RefPtr<Box2DCollision>',`Glib::wrap($3)')
_CONVERSION(`ClutterBox2DCollision*',`Glib::RefPtr<const
Box2DCollision>',`Glib::wrap($3)')
_CONVERSION(`const
Glib::RefPtr<Clutter::Box2D::Box2DCollision>&',`ClutterBox2DCollision*',__CONVERT_REFPTR_TO_P)


_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to