From bdab7df136424f06355471cdca91e810a8de166c Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@monsoon-hp.(none)>
Date: Fri, 24 Feb 2012 01:12:18 -0500
Subject: [PATCH] further refined calculating size of g_mycanvas (when inside
 GOP getrect returns full size, whereas when on the toplevel canvas, it
 returns only the selectable rectangle)

---
 src/g_mycanvas.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/g_mycanvas.c b/src/g_mycanvas.c
index 19fe019b3..d5c0b817b 100644
--- a/src/g_mycanvas.c
+++ b/src/g_mycanvas.c
@@ -420,8 +420,17 @@ static void my_canvas_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int
     
     *xp1 = text_xpix(&x->x_gui.x_obj, glist);
     *yp1 = text_ypix(&x->x_gui.x_obj, glist);
-    *xp2 = *xp1 + x->x_vis_w;
-    *yp2 = *yp1 + x->x_vis_h;
+	if (!glist_istoplevel(glist))
+	{
+		//if we are trying to calculate visibility of a widget inside a GOP
+	    *xp2 = *xp1 + x->x_vis_w;
+	    *yp2 = *yp1 + x->x_vis_h;
+	}
+	else
+	{
+	    *xp2 = *xp1 + x->x_gui.x_w;
+	    *yp2 = *yp1 + x->x_gui.x_h;
+	}
 }
 
 static void my_canvas_save(t_gobj *z, t_binbuf *b)
-- 
GitLab