From e792cdc5036936d08d43467dfaa31cc8827e166d Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Tue, 29 Nov 2011 17:07:04 -0500
Subject: [PATCH] Further refined auto-resizing logic and improved redrawing of
 the gop rectangle to account for object text size

---
 src/g_canvas.c | 2 +-
 src/g_text.c   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/g_canvas.c b/src/g_canvas.c
index abaccd31a..391429ec7 100644
--- a/src/g_canvas.c
+++ b/src/g_canvas.c
@@ -1803,7 +1803,7 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo
 				if (x->gl_pixheight < SCALE_GOP_MINHEIGHT)
 					x->gl_pixheight = SCALE_GOP_MINHEIGHT;
 
-				// TODO check if the text is not hidden
+				// check if the text is not hidden
 				// if so make minimum width and height based retrieved from getrect
 				if (x->gl_hidetext == 0 && x->gl_owner) {
 					gobj_getrect((t_gobj*)x, x->gl_owner, &x1, &y1, &x2, &y2);
diff --git a/src/g_text.c b/src/g_text.c
index eb3eb2c5e..b04daff19 100644
--- a/src/g_text.c
+++ b/src/g_text.c
@@ -1091,7 +1091,8 @@ static void text_getrect(t_gobj *z, t_glist *glist,
 		int m = ( ni > no ? ni : no);
 		//let's see if the object has more nlets than its text width and resize them accordingly
 		//UNLESS we are gop in which case it is user's choice how big/small they want the object
-		if (!((t_glist *)z)->gl_isgraph) {
+		if (pd_class(&z->g_pd) != canvas_class || 
+				pd_class(&z->g_pd) == canvas_class && !((t_glist *)z)->gl_isgraph) {
 			if (width < (IOWIDTH * m) * 2 - IOWIDTH) {
 				//we have to resize the object
 				width = (IOWIDTH * m) * 2 - IOWIDTH;
-- 
GitLab