diff --git a/pd/nw/css/default.css b/pd/nw/css/default.css index 6da6a370954883988bc703f0f4c8a8934b802420..c683b33bc41ffd1f5943f35a60f0754e44c47067 100644 --- a/pd/nw/css/default.css +++ b/pd/nw/css/default.css @@ -264,6 +264,11 @@ text { fill: blue; } +/* gatom "activated" text (i.e., when it has the keyboard focus) */ +.atom.activated text { + fill: red; +} + /* test of xlet hover animation... this should probably use the web animation API instead. That way the animation won't get cut off when you diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 420b6183ada53ba62f468eff39e2a790d5d79359..051b4a294c597cf554239b196a353c652f2ceef0 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3193,6 +3193,16 @@ function gui_gatom_dialog(did, attr_array) { attr_array_to_object(attr_array)); } +function gui_gatom_activate(cid, tag, state) { + var g = get_gobj(cid, tag); + if (state !== 0) { + g.classList.add("activated"); + } else { + g.classList.remove("activated"); + } + post("activating gatom: cid is " + cid + " and tag is " + tag + " and t is " + t); +} + function gui_iemgui_dialog(did, attr_array) { //for (var i = 0; i < attr_array.length; i++) { // attr_array[i] = '"' + attr_array[i] + '"'; diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 1b0b402cba6f3aed7a9c1d6742a5d21543e0073f..97e2b18767233053e6f832b209fc04690b0e3bc4 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -878,6 +878,10 @@ static void gatom_retext(t_gatom *x, int senditup, int recolor) { //sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, // rtext_gettag(y), "$pd_colors(text)"); + gui_vmess("gui_gatom_activate", "xsi", + canvas, + rtext_gettag(y), + 0); } binbuf_clear(x->a_text.te_binbuf); binbuf_add(x->a_text.te_binbuf, 1, &x->a_atom); @@ -1818,6 +1822,10 @@ static int text_click(t_gobj *z, struct _glist *glist, /* Change the gatom blue when it's clicked? Need to test... */ sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, rtext_gettag(y), "$pd_colors(selection)"); + gui_vmess("gui_gatom_activate", "xsi", + canvas, + rtext_gettag(y), + 1); gatom_click((t_gatom *)x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, (t_floatarg)0, (t_floatarg)alt); }