diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 6d23d61f865502b20fb9c4210a85be9b209eebf9..08a1247482e13402eb9dae9da82be652d3526675 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 9dec3ed3059ec20969292cc8ff603004bb58533d..348bad8dddc358c91e84c2a55790f7e4e00de8ba 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) @@ -380,11 +381,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 b3f54ed31e573cd3b422f1e40a7a7bc8fa4301e1..52c0f02c601476f0cc2c5f928ade08e6b76f5147 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -1404,6 +1404,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; @@ -1465,6 +1470,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); @@ -1475,6 +1481,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) @@ -1846,8 +1855,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 @@ -1885,7 +1893,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); @@ -2457,8 +2465,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); }