[PD-dev] getting mouse coords without using t_clickfn

Hans-Christoph Steiner hans at eds.org
Mon Feb 20 02:36:47 CET 2006


(I got no answer before, so I'll try again)

So I am trying to write [cursor] starting from Günter's [gcanvas].   
This is my understanding of what's going one: [gcanvas] uses a  
t_widgetbehavior.w_clickfn function to get the mouse coords on click.   
Then that t_clickfn registers a t_glistmotionfn so that it will  
continue getting the mouse coords.

What I want to do is using the t_glistmotionfn but add it with a  
[start( message.   Why doesn't this work?  This is what I am doing in  
externals/ggee/gui/gcanvas.c:

static void cursor_motion(t_cursor *x, t_floatarg dx, t_floatarg dy)
{
   x->x += dx;
   x->y += dy;
   outlet_float(x->out2,x->y);
   outlet_float(x->x_obj.ob_outlet,x->x);
}

static void cursor_start(t_cursor *x)
{
	glist_grab(x->x_glist, &x->x_obj.te_g, (t_glistmotionfn) cursor_motion,
			   (t_glistkeyfn) NULL, NULL, NULL);
}

class_addmethod(cursor_class,(t_method) cursor_start,gensym("start"),0);


________________________________________________________________________ 
____

If you are not part of the solution, you are part of the problem.
                                                               -  
Eldridge Cleaver





More information about the Pd-dev mailing list