Subject: taskbar - new features

From: "Andrei M. Soukharev" <[email-masked]>
Date: Fri, 15 Oct 2004 12:28:10 +0700

Hello,

I've made a couple of changes for FvwmTaskBar:
1) *FvwmTaskBar: ClockFont allows to set font for clock and tips 
independently.
2) *FvwmTaskBar: SystrayWidth allows to extend mail&clock area. Then 
user is able to put some mini-windows above empty space on taskbar using 
conventional fvwm tools thus emulating systray.

Is the community interested in patch?

	A. Soukharev.
--
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: Dominik Vogt <[email-masked]>
Date: Sat, 16 Oct 2004 01:01:39 +0200

> Is the community interested in patch?

Yes, we are intereted.  Can you post it to the list?

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]

---

From: "Andrei M. Soukharev" <[email-masked]>
Date: Fri, 22 Oct 2004 14:41:14 +0700

> Yes, we are intereted.  Can you post it to the list?
Here it is. The only changed file is modules/FvwmTaskBar/Goodies.c.
I used fvwm-2.5.12.

As an illustration I also include my config for patched taskbar.

	A. Soukharev.
--- Goodies.c.orig	2004-10-22 14:29:14.000000000 +0700
+++ Goodies.c	2004-10-22 14:29:19.000000000 +0700
@@ -61,7 +61,8 @@
 GC statusgc = 0;
 GC tipsgc = 0;
 FlocaleFont *FStatusFont;
-int stwin_width = 100, goodies_width = 0;
+FlocaleFont *FClockFont;
+int stwin_width = 100, goodies_width = 0, systray_width = 0;
 int anymail, unreadmail, newmail, mailcleared = 0;
 int goodies_fontheight, clock_width;
 char *mailpath = NULL;
@@ -83,6 +84,7 @@
 int IgnoreOldMail = False;
 int ShowTips = False;
 char *statusfont_string = NULL;
+char *clockfont_string = NULL;
 int last_date = -1;
 Bool using_MailDir = False;
 
@@ -117,9 +119,9 @@
   gcval.foreground = pfore;
   gcval.background = pback;
   gcval.graphics_exposures = False;
-  if (FStatusFont->font != NULL)
+  if (FClockFont->font != NULL)
   {
-    gcval.font = FStatusFont->font->fid;
+    gcval.font = FClockFont->font->fid;
     gcmask = GCFont;
   }
   if (statusgc)
@@ -200,6 +202,8 @@
   "ShowTips",
   "DateFormat",
   "MailDir",
+  "SystrayWidth",
+  "ClockFont",
   NULL
 };
 
@@ -285,6 +289,13 @@
   case 12: /* MailDir */
     using_MailDir = True;
     break;
+  case 13: /* SystrayWidth */
+	systray_width = 0;
+    if(sscanf(rest, "%d", &systray_width) != 1) systray_width = 0;
+    break;
+  case 14: /* ClockFont */
+    CopyStringWithQuotes(&clockfont_string, rest);
+    break;
   default:
     /* unknow option */
     return False;
@@ -301,7 +312,13 @@
 		fprintf(stderr, "%s: Couldn't load font. Exiting!\n",Module);
 		exit(1);
 	}
-	goodies_fontheight = FStatusFont->height;
+	if ((FClockFont =
+	     FlocaleLoadFont(dpy, clockfont_string, Module)) == NULL)
+	{
+		fprintf(stderr, "%s: Couldn't load font. Exiting!\n",Module);
+		exit(1);
+	}
+	goodies_fontheight = FClockFont->height;
 }
 
 void InitGoodies(void)
@@ -333,14 +350,15 @@
 			tms = localtime(&timer);
 			strftime(str, 24, clockfmt, tms);
 			clock_width = FlocaleTextWidth(
-				FStatusFont, str, strlen(str)) + 4;
+				FClockFont, str, strlen(str)) + 4;
 		}
 	}
 	else
 	{
-		clock_width = FlocaleTextWidth(FStatusFont, "XX:XX", 5) + 4;
+		clock_width = FlocaleTextWidth(FClockFont, "XX:XX", 5) + 4;
 	}
 	goodies_width += clock_width;
+	goodies_width += systray_width;
 	stwin_width = goodies_width;
 }
 
@@ -424,9 +442,9 @@
 	FwinString->win = win;
 	FwinString->gc = statusgc;
 	FwinString->str = str;
-	FwinString->x = x + 4;
+	FwinString->x = x + 4 + systray_width;
 	FwinString->y = ((RowHeight - goodies_fontheight) >> 1) +
-		FStatusFont->ascent;
+		FClockFont->ascent;
 	FwinString->flags.has_clip_region = True;
 	FwinString->clip_region = t_region;
 	if (colorset >= 0)
@@ -438,7 +456,7 @@
 	{
 		FwinString->flags.has_colorset = False;
 	}
-	FlocaleDrawString(dpy, FStatusFont, FwinString, 0);
+	FlocaleDrawString(dpy, FClockFont, FwinString, 0);
 	FwinString->flags.has_clip_region = False;
 	XDestroyRegion(t_region);
 
@@ -487,15 +505,16 @@
 
 int MouseInClock(int x, int y)
 {
-  int clockl = win_width - stwin_width;
-  int clockr = win_width - stwin_width + clock_width + (do_check_mail ? 2 : 3);
+  int clockl = win_width - stwin_width + systray_width;
+  int clockr = win_width - stwin_width + clock_width + (do_check_mail ? 2 : 3)
+  			   + systray_width;
   return (x>clockl && x<clockr && y>1 && y<RowHeight-2);
 }
 
 int MouseInMail(int x, int y)
 {
-  int maill = win_width - stwin_width + clock_width + 2;
-  int mailr = win_width - (do_check_mail ? 0 : 3);
+  int maill = win_width - stwin_width + clock_width + 2 + systray_width;
+  int mailr = win_width - (do_check_mail ? 0 : 3) + systray_width;
   return (x>=maill && x<mailr && y>1 && y<RowHeight-2);
 }
 
AddToDecor TaskBarDecor
+ BorderStyle -- HiddenHandles NoInset

Style FvwmTaskBar             NoTitle,\
                              UseDecor TaskBarDecor,\
                              BorderWidth 4,\
                              HandleWidth 4,\
                              Sticky,\
                              NeverFocus,\
                              StaysOnTop,\
                              WindowListSkip,\
                              Colorset 10,\
                              MiniIcon null.png
                      
*FvwmTaskBar: Geometry    		+0-0
*FvwmTaskBar: Colorset		    10
*FvwmTaskBar: IconColorset	  11
*FvwmTaskBar: FocusColorset	  12
*FvwmTaskBar: Font			      -adobe-helvetica-medium-r-*-*-14-*-*-*-*-*-koi8-1
*FvwmTaskBar: SelFont		      -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-koi8-1
*FvwmTaskBar: StatusFont	    -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-koi8-1
*FvwmTaskBar: Action		      Click1 Iconify -1, Raise, Focus
*FvwmTaskBar: Action		      Click2 Iconify
*FvwmTaskBar: Action		      Click3 Popup taskbar-menu
*FvwmTaskBar: UseSkipList
*FvwmTaskBar: NoBrightFocus
*FvwmTaskBar: AutoStick
*FvwmTaskBar: StartName		    óÔÁÒÔ
*FvwmTaskBar: StartMenu		    StartMenu
*FvwmTaskBar: StartIcon
#*FvwmTaskBar: NoDefaultStartButton
*FvwmTaskBar: MailBox 		    None
*FvwmTaskBar: ShowTransients
*FvwmTaskBar: ShowTips
*FvwmTaskBar: TipsColorset    7
*FvwmTaskBar: ClockFont       -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-koi8-1
#*FvwmTaskBar: 3DFvwm
*FvwmTaskBar: DateFormat      %A, %d %B %Y ÇÏÄÁ
#*FvwmTaskBar: UseIconNames
#*FvwmTaskBar: AutoHide
*FvwmTaskBar: WindowButtonsLeftMargin 6
*FvwmTaskBar: StartButtonRightMargin 6
*FvwmTaskBar: Button Icon kpm.xpm, Action Exec exec xterm
*FvwmTaskBar: SystrayWidth 45

Style fookb NoTitle, !Borders, NoHandles, Layer 10, WindowListSkip, Sticky
Style LicqWharf NoTitle, !Borders, NoHandles, Layer 10, WindowListSkip, Sticky
AddToFunc InitFunction
 + I Exec exec fookb
 + I Wait fookb
 + I All (fookb) Move 927p 740p
 + I Exec exec licq
 + I Wait LicqWharf
 + I All (LicqWharf) Move 949p 740p