diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 72de40ae8abf5573e8da26d83abb28e6832e2797..9bb87158e44cafd14fb8be534cfef84d2aac44e1 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -2149,7 +2149,7 @@ function gui_atom_draw_border(cid, tag, type, width, height) { var m = height < 20 ? 1 : height / 12; var arrow = create_item(cid, "polygon", { points: atom_arrow_points(width, height), - "class": type === 1 ? "index_arrow" : "value_arrow" + "class": type === 1 ? "arrow index_arrow" : "arrow value_arrow" }); frag.appendChild(arrow); } @@ -2158,16 +2158,14 @@ function gui_atom_draw_border(cid, tag, type, width, height) { } function gui_atom_redraw_border(cid, tag, type, width, height) { - gui(cid).get_elem(tag) + gui(cid).get_gobj(tag) .q("polygon", { points: atom_border_points(width, height, type !== 0) }); if (type !== 0) { - gui(cid).get_elem(tag, function(e) { - var a = e.querySelectorAll("polygon")[1]; - configure_item(a, { - points: atom_arrow_points(width, height) - }); + gui(cid).get_gobj(tag) + .q(".arrow", { + points: atom_arrow_points(width, height) }); } } diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index 04a8f6761bb8e89dadeed98aa57df9f0db272a41..6588838496e984a4f6e008f58902b91d50c98c3d 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -205,6 +205,7 @@ static int lastone(char *s, int c, int n) flag is set from the GUI if this happens. LATER take this out: early 2006? */ extern int sys_oldtclversion; +extern int is_dropdown(t_text *x); static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, int *indexp) @@ -383,11 +384,16 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, // pd_canvas.html. I could remove the conditional, but // this part of Pd is convoluted enough that I'm not sure // if there'd be any side effects. - if (glist_isvisible(x->x_glist) && (pixwide != x->x_drawnwidth || + // Additionally we avoid redrawing the border here for the + // dropdown_class as that has its own special width handling. + if (glist_isvisible(x->x_glist) && !is_dropdown(x->x_text) && + (pixwide != x->x_drawnwidth || pixhigh != x->x_drawnheight || x->x_text->te_type == T_MESSAGE)) + { text_drawborder(x->x_text, x->x_glist, x->x_tag, pixwide, pixhigh, 0); + } if (x->x_active) { if (selend_b > selstart_b) diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 6b735f3ac19c3080b04addce650589dbc7204b46..555e7935fd0af3a6f7546b2662837d50cf5eee40 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -1414,6 +1414,11 @@ typedef struct _dropdown t_symbol *a_expanded_to; /* a_symto after $0, $1, ... expansion */ } t_dropdown; +int is_dropdown(t_text *x) +{ + return (x->te_type == T_ATOM && pd_class(&x->te_pd) == dropdown_class); +} + static void dropdown_redraw(t_gobj *client, t_glist *glist) { t_dropdown *x = (t_dropdown *)client; @@ -1475,6 +1480,7 @@ static int dropdown_names_getmaxwidth(t_dropdown *x) { static void dropdown_names(t_dropdown *x, t_symbol *s, int argc, t_atom *argv) { + t_rtext *y = glist_findrtext(x->a_glist, &x->a_text); binbuf_clear(x->a_names); if (argc) binbuf_add(x->a_names, argc, argv); @@ -1485,6 +1491,9 @@ static void dropdown_names(t_dropdown *x, t_symbol *s, int argc, t_atom *argv) x->a_maxnamewidth = dropdown_names_getmaxwidth(x); //dropdown_max_namelength(x); dropdown_retext(x, 1, 0); + /* Now redraw the border */ + text_drawborder(&x->a_text, x->a_glist, rtext_gettag(y), + rtext_width(y), rtext_height(y), 0); } static void dropdown_bang(t_dropdown *x) @@ -1856,8 +1865,7 @@ static void text_getrect(t_gobj *z, t_glist *glist, int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font); width = (x->te_width > 0 ? x->te_width : 6) * fontwidth + 2; /* add an extra two characters for the dropdown box's arrow */ - if (pd_class(&x->te_pd) == dropdown_class) - width += fontwidth * 2; + if (is_dropdown(x)) width += fontwidth * 2; height = fontheight + 3; /* borrowed from TMARGIN, etc, in g_rtext.c */ } // jsarlo @@ -1895,7 +1903,7 @@ static void text_getrect(t_gobj *z, t_glist *glist, if (y) { width = rtext_width(y); - if (pd_class(&x->te_pd) == dropdown_class) + if (is_dropdown(x)) { int font = glist_getfont(glist); int fontwidth = sys_fontwidth(font); @@ -2728,8 +2736,7 @@ void text_drawborder(t_text *x, t_glist *glist, gui_vmess("gui_atom_draw_border", "xsiii", glist_getcanvas(glist), tag, - pd_class(&x->te_pd) == dropdown_class ? - ((t_dropdown *)x)->a_outtype + 1 : 0, + (is_dropdown(x) ? ((t_dropdown *)x)->a_outtype + 1 : 0), x2 - x1, y2 - y1); }