Update of /cvsroot/pure-data/externals/miXed/toxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16220/toxy
Modified Files: widget.c Log Message: safer widget-to-text transform
Index: widget.c =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/toxy/widget.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** widget.c 25 Feb 2004 10:54:43 -0000 1.4 --- widget.c 27 Feb 2004 13:38:26 -0000 1.5 *************** *** 3,8 **** * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
- /* FIXME crash if closing window with a failed widget (e.g. .wid missing) */ - /* LATER think about reloading method for .wid files */
--- 3,6 ---- *************** *** 160,171 **** }
static void widget_transtick(t_widget *x) { - glist_delete(x->x_glist, (t_gobj *)x); - } - - /* called from widget__failure(), LATER also bind this to F4 or something */ - static void widget_transedit(t_widget *x) - { t_text *newt, *oldt = (t_text *)x; t_binbuf *bb = binbuf_new(); --- 158,171 ---- }
+ /* If Tk widget creation fails, gui will send the '_failure' message + to the Pd widget object, asking the receiving object to transform + itself into a regular text object. Due to the 'bindlist' corruption + danger, this cannot be done directly from the '_failure' call, but + has to be scheduled through a 'transclock', instead. When the clock + fires, the widget object creates, and glist_adds a 'makeshift' text + object, then glist_deletes itself. */ + /* LATER also bind this to F4 or something */ static void widget_transtick(t_widget *x) { t_text *newt, *oldt = (t_text *)x; t_binbuf *bb = binbuf_new(); *************** *** 186,196 **** newt->te_ypix = oldt->te_ypix; glist_add(x->x_glist, &newt->te_g); ! glist_noselect(x->x_glist); ! glist_select(x->x_glist, &newt->te_g); ! gobj_activate(&newt->te_g, x->x_glist, 1); ! x->x_glist->gl_editor->e_textdirty = 1; /* force evaluation */ canvas_unsetcurrent(x->x_glist); canvas_dirty(x->x_glist, 1); ! clock_delay(x->x_transclock, 0); /* LATER rethink */ }
--- 186,199 ---- newt->te_ypix = oldt->te_ypix; glist_add(x->x_glist, &newt->te_g); ! if (glist_isvisible(x->x_glist)) ! { ! glist_noselect(x->x_glist); ! glist_select(x->x_glist, &newt->te_g); ! gobj_activate(&newt->te_g, x->x_glist, 1); ! x->x_glist->gl_editor->e_textdirty = 1; /* force evaluation */ ! } canvas_unsetcurrent(x->x_glist); canvas_dirty(x->x_glist, 1); ! glist_delete(x->x_glist, (t_gobj *)x); }
*************** *** 675,679 **** loud_error((t_pd *)x, "creation failure"); x->x_vised = 0; ! widget_transedit(x); }
--- 678,682 ---- loud_error((t_pd *)x, "creation failure"); x->x_vised = 0; ! clock_delay(x->x_transclock, 0); }