From f166cf609d2db6016e297c3b70108d6a89dab125 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Wed, 3 Jul 2013 05:35:39 -0400
Subject: [PATCH] fixed gop getrect detection for objects that have been
 previously relocated to allow for consistent positioning

---
 pd/src/g_hslider.c |  2 +-
 pd/src/g_vslider.c |  2 +-
 pd/src/g_vumeter.c | 20 +++++++++++---------
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c
index 37cc7929f..3287f51e8 100644
--- a/pd/src/g_hslider.c
+++ b/pd/src/g_hslider.c
@@ -557,7 +557,7 @@ static void hslider_getrect(t_gobj *z, t_glist *glist,
 
     *xp1 = text_xpix(&x->x_gui.x_obj, glist);
     *yp1 = text_ypix(&x->x_gui.x_obj, glist);
-    *xp2 = *xp1 + x->x_gui.x_w + 8;
+    *xp2 = *xp1 + x->x_gui.x_w + 5;
     *yp2 = *yp1 + x->x_gui.x_h;
 
 	iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c
index c24e61f1c..7514b31e0 100644
--- a/pd/src/g_vslider.c
+++ b/pd/src/g_vslider.c
@@ -568,7 +568,7 @@ static void vslider_getrect(t_gobj *z, t_glist *glist,
     *xp1 = text_xpix(&x->x_gui.x_obj, glist);
     *yp1 = text_ypix(&x->x_gui.x_obj, glist);
     *xp2 = *xp1 + x->x_gui.x_w;
-    *yp2 = *yp1 + x->x_gui.x_h + 7;
+    *yp2 = *yp1 + x->x_gui.x_h + 5;
 
 	iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
 }
diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c
index 93f24a82f..71b04d304 100644
--- a/pd/src/g_vumeter.c
+++ b/pd/src/g_vumeter.c
@@ -839,18 +839,20 @@ static void vu_getrect(t_gobj *z, t_glist *glist,
 	int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2, k4=ypos-k3;
 
     *xp1 = text_xpix(&x->x_gui.x_obj, glist);
-    *yp1 = text_ypix(&x->x_gui.x_obj, glist);
-    *xp2 = *xp1 + x->x_gui.x_w + 3;
-    *yp2 = *yp1 + x->x_gui.x_h + 6;
+    *yp1 = text_ypix(&x->x_gui.x_obj, glist) + 2;
+    *xp2 = *xp1 + x->x_gui.x_w + 2;
+    *yp2 = *yp1 + x->x_gui.x_h + 2;
 
 	iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
 
-	//vu has custom scale all labels unlike other iemgui object
-	end=xpos+x->x_gui.x_w+4;
-	yyy = k4 + k1*(k2-1);
-	vu_scale_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2, end+1, yyy+k3+2);
-	yyy = k4;
-	vu_scale_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2, end+1, yyy+k3+2);
+	if (x->x_scale) {
+		//vu has custom scale all labels unlike other iemgui object
+		end=xpos+x->x_gui.x_w+4;
+		yyy = k4 + k1*(k2-1);
+		vu_scale_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2, end+1, yyy+k3+2);
+		yyy = k4;
+		vu_scale_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2, end+1, yyy+k3+2);
+	}
 }
 
 static void vu_save(t_gobj *z, t_binbuf *b)
-- 
GitLab