Subject: FVWM: Problem with *FvwmButtons(Title(side) CPU Swallow xload xload)

From: Tim Phipps <[email-masked]>
Date: Wed, 25 Jun 1997 16:23:42 +0100 (BST)

Fvwm2.0.45 : the man page for FvwmButtons states that the (side) option can be 
used for swallowed windows and pixmaps.  If I try:

*FvwmButtons(Title(side) CPU Swallow xload xload)

The label is drawn in the button until xload and then it is overwritten.  What 
am I doing wrong?

Cheers,
Tim.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked] (Thomas Honigmann)
Date: Sat, 28 Jun 1997 22:05:10 +0200

> The label is drawn in the button until xload and then it is overwritten.  What 

It seems that the man page is not correct in this point. As far as I can
see the existing code deals with icons only. In the README it says that 
side option is just a hack which will be replaced by a more general solution.
For the time being the attached patch might be useful. It will reserve space
for the title up to half of the width of the button.

Thomas

--- draw.c.orig	Sat Jun 28 13:40:46 1997
+++ draw.c	Sat Jun 28 21:11:20 1997
@@ -140,9 +140,17 @@
 	  exit(2);
 	}
 
-      if(b->flags&b_Title && font && !(buttonJustify(b)&b_Horizontal))
-	ih -= font->ascent+font->descent;
-	
+      if(b->flags&b_Title && font) 
+	if (buttonJustify(b)&b_Horizontal)
+	  { 
+	    int title_w;
+	    if (2*(title_w=XTextWidth(font, b->title, strlen(b->title))) > iw)
+	      iw /= 2;
+	    else
+	      iw -= title_w;
+	  }  
+	else
+	  ih -= font->ascent+font->descent;
       b->icon_w=iw;
       b->icon_h=ih;