From 8830e84e363c6bd5e27d16b62c3ac515ac3e0bf9 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Mon, 15 Sep 2014 12:38:31 -0400
Subject: [PATCH] *added sanity check for mknob (a subset of iemgui) to see if
 selected status would require object to be highlighted (if inside
 graph-on-parent, it should be silently selected but not visibly selected)
 *fixed regression where selected variable in the old_g_all_guis.inc did not
 allow for a value larger than 1-bit, resulting in selected=2 being selected=0

---
 externals/moonlib/mknob.c    | 8 ++++++--
 externals/old_g_all_guis.inc | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/externals/moonlib/mknob.c b/externals/moonlib/mknob.c
index 320effd2b..398777c4d 100644
--- a/externals/moonlib/mknob.c
+++ b/externals/moonlib/mknob.c
@@ -265,12 +265,16 @@ static void mknob_draw_io(t_mknob *x,t_glist *glist, int old_snd_rcv_flags)
 static void mknob_draw_select(t_mknob *x,t_glist *glist)
 {
     t_canvas *canvas=glist_getcanvas(glist);
+    //fprintf(stderr,"mknob_draw_select %lx %lx\n", x->x_gui.x_fsf.x_selected, glist);
 
     if(x->x_gui.x_fsf.x_selected)
     {
         //pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym);
-        sys_vgui(".x%lx.c itemconfigure %xBASE -stroke #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED);
-        sys_vgui(".x%lx.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED);
+        if (x->x_gui.x_glist == glist_getcanvas(glist))
+        {
+            sys_vgui(".x%lx.c itemconfigure %xBASE -stroke $pd_colors(selection)\n", canvas, x);
+            sys_vgui(".x%lx.c itemconfigure %xLABEL -fill $pd_colors(selection)\n", canvas, x);
+        }
 		sys_vgui(".x%lx.c addtag selected withtag %lxMKNOB\n", canvas, x);
     }
     else
diff --git a/externals/old_g_all_guis.inc b/externals/old_g_all_guis.inc
index 7eabc05e8..7e092a079 100644
--- a/externals/old_g_all_guis.inc
+++ b/externals/old_g_all_guis.inc
@@ -114,7 +114,7 @@ typedef struct _iem_fstyle_flags
     unsigned int x_lab_arg_tail_len:6;
     unsigned int x_lab_is_arg_num:6;
     unsigned int x_shiftdown:1;
-    unsigned int x_selected:1;
+    unsigned int x_selected:2;
     unsigned int x_finemoved:1;
     unsigned int x_put_in2out:1;
     unsigned int x_change:1;
-- 
GitLab