From 0386c2a15412b2ec719d1acad95cccce7aa00793 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@monsoon.(none)>
Date: Thu, 4 Oct 2012 11:20:31 -0400
Subject: [PATCH] preemptively added fix for objects not being reselected after
 being redrawn

---
 src/g_canvas.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/g_canvas.c b/src/g_canvas.c
index 2d4a67e15..833ab7336 100644
--- a/src/g_canvas.c
+++ b/src/g_canvas.c
@@ -15,6 +15,7 @@ to be different but are now unified except for some fossilized names.) */
 #include "g_all_guis.h"
 #include <string.h>
 
+extern int do_not_redraw;
 
     /* LATER consider adding font size to this struct (see glist_getfont()) */
 struct _canvasenvironment
@@ -800,6 +801,7 @@ void canvas_map(t_canvas *x, t_floatarg f)
 
 void canvas_redraw(t_canvas *x)
 {
+	if (do_not_redraw) return;
 	//fprintf(stderr,"canvas_redraw\n");
     if (glist_isvisible(x))
     {
@@ -1478,6 +1480,7 @@ void *canvas_getblock(t_class *blockclass, t_canvas **canvasp)
     redraw.   Action = 0 for redraw, 1 for draw only, 2 for erase. */
 static void glist_redrawall(t_glist *gl, int action)
 {
+	//fprintf(stderr,"glist_redrawall\n");
     t_gobj *g;
     int vis = glist_isvisible(gl);
     for (g = gl->gl_list; g; g = g->g_next)
@@ -1500,6 +1503,9 @@ static void glist_redrawall(t_glist *gl, int action)
         else if (g->g_pd == canvas_class)
             glist_redrawall((t_glist *)g, action);
     }
+	if (glist_isselected(glist_getcanvas(gl), (t_gobj *)gl)) {
+		sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", glist_getcanvas(gl), gl, 1);
+	}
 }
 
     /* public interface for above. */
@@ -1515,6 +1521,7 @@ void canvas_redrawallfortemplate(t_template *template, int action)
     for that */
 void canvas_redrawallfortemplatecanvas(t_canvas *x, int action)
 {
+	//fprintf(stderr,"canvas_redrawallfortemplatecanvas\n");
     t_gobj *g;
     t_template *tmpl;
     t_symbol *s1 = gensym("struct");
-- 
GitLab