[PD-dev] [patch] fix number box bug

Miller Puckette mpuckett at imusic1.ucsd.edu
Sat Jun 3 21:44:42 CEST 2006


Hi all,

THis is most likely to be useful for Hans-Christoph's upcoming 0.39-2
extended release... the following patch fixes the number box list bug
reported by Iohannes.  I'm fixing this directly in 0.40 but here's a fix
to 0.39; I'm not putting it in the "patch" tracker since it already comes
from 0.40.

---------------------

--- src/g_text.c        2005-12-31 12:08:37.000000000 -0800
+++ src-new/g_text.c    2006-06-03 12:39:47.497747800 -0700
@@ -566,6 +566,19 @@
     gatom_bang(x);
 }
 
+    /* We need a list method because, since there's both an "inlet" and a
+    "nofirstin" flag, the standard list behavior gets confused. */
+static void gatom_list(t_gatom *x, t_symbol *s, int argc, t_atom *argv)
+{
+    if (!argc)
+        gatom_bang(x);
+    else if (argv->a_type == A_FLOAT)
+        gatom_float(x, argv->a_w.w_float);
+    else if (argv->a_type == A_SYMBOL)
+        gatom_symbol(x, argv->a_w.w_symbol);
+    else pd_error(x, "gatom_list: need float or symbol");
+}
+
 static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy)
 {
     t_gatom *x = (t_gatom *)z;
@@ -1349,6 +1362,7 @@
     class_addbang(gatom_class, gatom_bang);
     class_addfloat(gatom_class, gatom_float);
     class_addsymbol(gatom_class, gatom_symbol);
+    class_addlist(gatom_class, gatom_list);
     class_addmethod(gatom_class, (t_method)gatom_set, gensym("set"),
         A_GIMME, 0);
     class_addmethod(gatom_class, (t_method)gatom_click, gensym("click"),





More information about the Pd-dev mailing list