Subject: FvwmIconBox patch

From: Marcus Lundblad <[email-masked]>
Date: Tue, 26 Nov 2002 23:14:46 +0100 (CET)

I made a patch that adds the following options to FvwmIconBox.

*FvwmIconBox: NoIconifiedParenthese

Turns off the parenthesis around the titles of iconified windows.

*FvwmIconBox: NormalTitleRelief num

Sets the width of the relief for the title of uniconified windows (0 no
relief).

*FvwmIconBox: IconifiedTitleRelief num 

Same for iconified windows.

I didn't implement inverted reliefs (as someone suggested), I could add
this also, if it's considered a useful feature.

//Marcus

? IconBox.diff
Index: ChangeLog
===================================================================
RCS file: /home/cvs/fvwm/fvwm/ChangeLog,v
retrieving revision 1.2161
diff -u -u -r1.2161 ChangeLog
--- ChangeLog	2002/11/26 13:56:45	1.2161
+++ ChangeLog	2002/11/26 22:09:13
@@ -1,3 +1,14 @@
+2002-11-26  Marcus Lundblad <[email-masked]>
+	* modules/FvwmIconBox/FvwmIconBox.c (RedrawIcon, CreateWindow,
+	                                     ParseOptions):
+	* modules/FvwmIconBox/icons.c (AdjustIconWindow):
+	impemented options for turning off parenthesisation of iconified
+	window title
+					    
+	* modules/FvwmIconBox/FvwmIconBox.1:
+	documented options for turning off parenthesisation of iconified
+	window title
+
 2002-11-26  Mikhael Goikhman  <[email-masked]>
 
 	* fvwm/fvwm.c (InitVariables):
Index: modules/FvwmIconBox/FvwmIconBox.1
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconBox/FvwmIconBox.1,v
retrieving revision 1.15
diff -u -u -r1.15 FvwmIconBox.1
--- modules/FvwmIconBox/FvwmIconBox.1	2002/04/25 16:34:29	1.15
+++ modules/FvwmIconBox/FvwmIconBox.1	2002/11/26 22:09:16
@@ -243,6 +243,20 @@
 is "*FvwmIconBox: NoIconAction SendToModule FvwmAnimate animate". A blank or null
 action turns this feature off.
 
+.IP "*FvwmIconBox: NoIconifiedParentheses"
+Tells FvwmIconBox to not enclose the title of an iconified window within
+parantheses.
+
+.IP "*FvwmIconBox: NormalTitleRelief \fInum\fP"
+Sets the width in pixels of the relief that is put around icon titles for
+windows that are not iconified. The default if this option is not specified is
+2 pixels.
+
+.IP "*FvwmIconBox: IconifiedTitleRelief \fInum\fP"
+Sets the width in pixels of the relief that is put around icon titles for
+windows that are iconified. The default if this option is not specified is
+2 pixels.
+
 .SH SAMPLE CONFIGURATION
 The following are excepts from a .fvwm2rc file which describe
 FvwmIconBox initialization commands:
Index: modules/FvwmIconBox/FvwmIconBox.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconBox/FvwmIconBox.c,v
retrieving revision 1.90
diff -u -u -r1.90 FvwmIconBox.c
--- modules/FvwmIconBox/FvwmIconBox.c	2002/11/13 22:37:43	1.90
+++ modules/FvwmIconBox/FvwmIconBox.c	2002/11/26 22:09:23
@@ -68,7 +68,6 @@
 
 #include "FvwmIconBox.h"
 
-
 char *MyName;
 
 Display *dpy;                   /* which display are we talking to */
@@ -153,6 +152,12 @@
 int margin1 = 8;
 int margin2 = 6;
 
+/* true if iconified windows doesn't have () around the title */
+Bool iconified_has_normal_title = False;
+
+int normal_title_relief = 2;
+int iconified_title_relief = 2;
+
 Pixmap IconwinPixmap = None;
 char *IconwinPixmapFile = NULL;
 
@@ -760,6 +765,7 @@
 {
 	int hr, len;
 	int diff, lm ,w, h, tw;
+	int title_relief;
 	char label[256];
 	int cs;
 	XRectangle inter;
@@ -885,17 +891,16 @@
 		{
 			if (item->icon_w > 0 && item->icon_h > 0)
 				RelieveRectangle(dpy, item->icon_pixmap_w,
-						 0, 0, item->icon_w
-						 +icon_relief - 1,
+						 0, 0, 
+						 item->icon_w + icon_relief - 1,
 						 item->icon_h + icon_relief - 1,
 						 IconReliefGC,
 						 IconShadowGC, 2);
 			else
 				RelieveRectangle(dpy, item->icon_pixmap_w,
-						 0, 0, max_icon_width
-						 + icon_relief - 1,
-						 max_icon_height +
-						 icon_relief - 1,
+						 0, 0,
+						 max_icon_width + icon_relief - 1,
+						 max_icon_height + icon_relief - 1,
 						 IconReliefGC,
 						 IconShadowGC, 2);
 		}
@@ -909,12 +914,23 @@
 
 		if (IS_ICONIFIED(item))
 		{
-			sprintf(label, "(%s)", item->name);
+		        if( ! iconified_has_normal_title )
+			        sprintf(label, "(%s)", item->name);
+			else
+			        strcpy(label, item->name);
+		    
 		}
 		else
 		{
 			strcpy(label, item->name);
 		}
+
+		/* calculate the actual relief thickness */
+		title_relief = IS_ICONIFIED(item) ? 
+			                iconified_title_relief :
+			                normal_title_relief;
+		
+
 		if (evp)
 		{
 			inter.x = evp->xexpose.x;
@@ -934,13 +950,15 @@
 		tw = FlocaleTextWidth(Ffont, label, len);
 		diff = max_icon_width + icon_relief - tw;
 		lm = diff/2;
-		lm = lm > 4 ? lm : 4;
+		lm = lm > 2 + title_relief ? lm : 2 + title_relief;
 
 		FwinString->str = label;
 		FwinString->win = item->IconWin;
 		FwinString->gc =  NormalGC;
 		FwinString->x = lm;
-		FwinString->y = 3 + Ffont->ascent;
+		FwinString->y = 1 + max(normal_title_relief,
+					iconified_title_relief) + 
+		                Ffont->ascent;
 		if (cs >= 0)
 		{
 			FwinString->colorset = &Colorset[cs];
@@ -950,14 +968,20 @@
 		{
 			FwinString->flags.has_colorset = False;
 		}
+		
 
+		
 		if (Hilite == item)
 		{
 			XRaiseWindow(dpy, item->IconWin);
 			XMoveResizeWindow(dpy, item->IconWin,
 					  item->x + min(0, (diff - 8))/2,
 					  item->y + h,
-					  max(tw + 8, w), 6 + Ffont->height);
+					  max(tw + 4 + 2 * title_relief, w), 
+					  2 + 
+					  2 * max(iconified_title_relief,
+						  normal_title_relief) + 
+					  Ffont->height);
 			if (evp)
 			{
 				XClearArea(
@@ -971,16 +995,26 @@
 				XClearWindow(dpy, item->IconWin);
 			}
 			FlocaleDrawString(dpy, Ffont, FwinString, 0);
+
 			RelieveRectangle(dpy, item->IconWin, 0, 0,
-					 max(tw + 8, w) - 1,
-					 6 + Ffont->height - 1,
-					 IconReliefGC, IconShadowGC, 2);
+					 max(tw + 4 + 2 * title_relief, w) - 1,
+					 2 + 
+					 2 * max(iconified_title_relief,
+						 normal_title_relief) + 
+					 Ffont->height - 1,
+					 IconReliefGC, IconShadowGC, 
+					 title_relief);
 		}
+
 		else
 		{
 			XMoveResizeWindow(dpy, item->IconWin,
 					  item->x, item->y + h,
-					  w, 6 + Ffont->height);
+					  w, 
+					  2 + 
+					  2 * max(iconified_title_relief,
+						  normal_title_relief) + 
+					  Ffont->height);
 			if (evp)
 			{
 				XClearArea(
@@ -994,9 +1028,16 @@
 				XClearWindow(dpy, item->IconWin);
 			}
 			FlocaleDrawString(dpy, Ffont, FwinString, 0);
+			
 			RelieveRectangle(dpy, item->IconWin, 0, 0,
-					 w - 1, 5 + Ffont->height,
-					 IconReliefGC, IconShadowGC, 2);
+					 w - 1,
+					 2 + 
+					 2 * max(iconified_title_relief,
+						 normal_title_relief) + 
+					 Ffont->height - 1,
+					 IconReliefGC, IconShadowGC,
+					 title_relief );
+			
 		}
 		if (region)
 		{
@@ -1231,8 +1272,10 @@
   if ((local_flags & HIDE_V))
     h_margin -= bar_width + margin2 + 4;
 
+  /* calculate the (maximal) width and height of an icon */
   UWidth = max_icon_width + icon_relief + interval;
-  UHeight = Ffont->height + max_icon_height + icon_relief + 6 + interval;
+  UHeight = Ffont->height + 2 + 2 * max(normal_title_relief,iconified_title_relief) + 
+            max_icon_height + icon_relief + interval;
   Width = UWidth * num_columns + interval -1;
   Height = UHeight * num_rows + interval -1;
 
@@ -1912,6 +1955,29 @@
 	  max_icon_width += 4;
 	}
       }
+      else if (strncasecmp(tline, CatString3(
+			   "*", MyName, "NoIconifiedParentheses"),
+			   Clength+23) == 0)
+      {
+	iconified_has_normal_title = True;
+      }
+
+      else if (strncasecmp(tline, CatString3(
+			   "*", MyName, "NormalTitleRelief"),
+			   Clength+18) == 0)
+      {
+	normal_title_relief = atoi(&tline[Clength+18]);
+	fprintf(stderr, "normal relief: %d\n", normal_title_relief);
+      }	
+      
+      else if (strncasecmp(tline, CatString3(
+			   "*", MyName, "IconifiedTitleRelief"),
+			   Clength+21) == 0)
+      {
+	iconified_title_relief = atoi(&tline[Clength+21]);
+	fprintf(stderr, "icon relief: %d\n", iconified_title_relief);
+      }
+
       else if (strncasecmp(tline, "Colorset", 8) == 0)
       {
 	LoadColorset(&tline[8]);
Index: modules/FvwmIconBox/icons.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconBox/icons.c,v
retrieving revision 1.31
diff -u -u -r1.31 icons.c
--- modules/FvwmIconBox/icons.c	2002/10/31 21:39:17	1.31
+++ modules/FvwmIconBox/icons.c	2002/11/26 22:09:24
@@ -61,6 +61,9 @@
 extern char *MyName;
 extern int Iconcolorset;
 
+extern int normal_title_relief;
+extern int iconified_title_relief;
+
 #define ICON_EVENTS (ExposureMask |\
 ButtonReleaseMask | ButtonPressMask | EnterWindowMask | LeaveWindowMask)
 
@@ -179,8 +182,9 @@
   int x=0,y=0,w,h,h2,h3,w3;
 
   w3 = w = max_icon_width + icon_relief;
+  /* the height of the picture window */
   h3 = h2 = max_icon_height + icon_relief;
-  h = h2 + 6 + Ffont->height;
+  h = h2 + 2 + 2 * max(normal_title_relief,iconified_title_relief) + Ffont->height;
 
   switch (primary){
   case LEFT:

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 28 Nov 2002 10:45:22 +0100

> this also, if it's considered a useful feature.

Note that I am not against inverted reliefs in general, but only
against the syntax using cryptic negative values for them.  A
separate option for "reverted" is fine with me.

Bye

Dominik ^_^  ^_^
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Dan Espen <[email-masked]>
Date: Thu, 28 Nov 2002 10:05:49 -0500

> separate option for "reverted" is fine with me.

Fvwm already uses:

raised/sunk/flat

since this controls width, its a bit like borderwidth.

Maybe

*FvwmIconBox: IconifiedTitleBorder flat|raised|sunk
*FvwmIconBox: IconifiedTitleBorderWidth num

-- 
Dan Espen                           E-mail: [email-masked]

---

From: Marcus Lundblad <[email-masked]>
Date: Sat, 30 Nov 2002 20:57:00 +0100 (CET)

> > separate option for "reverted" is fine with me.

What would "flat" do?

//Marcus

---

From: Dan Espen <[email-masked]>
Date: Sat, 30 Nov 2002 15:00:20 -0500

> > > separate option for "reverted" is fine with me.

There would be no 3d effect at all, just a border.

---

From: Marcus Lundblad <[email-masked]>
Date: Sun, 1 Dec 2002 01:01:49 +0100 (CET)

> There would be no 3d effect at all, just a border.

I implemented relief widths so that the title is "padded out" to the
maximum size of the reliefs for iconified and non iconified windows.
So I think it would be a bit confusing to have "flat" as an option.
Say I define:

FvwmIconBox: NormalTitleRelief   0
FvwmIconBox: IconifiedTitleRelief 2

then this would be equivalent to setting a flat border of 2 pixels for
uniconified windows.

I think I would prefer options:

FvwmIconBox: NormalTitleInvertedRelief
FvwmIconBox: IconifiedTitleInvertedRelief

//Marcus