Subject: FVWM: Patch for FvwmTaskBar

From: Victor Vislobokov <[email-masked]>
Date: Wed, 31 Oct 2001 04:59:02 +0500

Hi All!

There is little patch for FvwmTaskBar module.
It is allow locale depending tip for FvwmTaskBar clock and
change date format in this tip.

There is new configuration parameter FvwmTaskBarDateFormat.
Man page is updated too.

With best wishes
Victor Vislobokov
Perm, Russia

diff -u -r FvwmTaskBar/FvwmTaskBar.1 FvwmTaskBar.new/FvwmTaskBar.1
--- FvwmTaskBar/FvwmTaskBar.1	Tue Jul  3 13:21:14 2001
+++ FvwmTaskBar.new/FvwmTaskBar.1	Wed Oct 31 04:35:46 2001
@@ -215,7 +215,14 @@
 .IP "*FvwmTaskBar: ClockFormat \fIformat-string\fP"
 This option specifies the time format for the digital clock.
 It is a \fIstrftime(3)\fP compatible format string.
-By default it is "%R".
+By default it is "%R". There is 24 characters limit for string
+expansion. The string depends of locale settings now.
+
+.IP "*FvwmTaskBar: DateFormat \fIformat-string\fP"
+This option specifies the date and/or time format for clock tip.
+It is a \fIstrftime(3)\fP compatible format string.
+By default it is "%A, %B %d, %Y". There is 40 characters limit for
+string expansion. The string depends of locale settings now.
 
 .IP "*FvwmTaskBar: UpdateInterval \fIseconds\fP"
 Specifies how often the clock display should be refreshed, so that times of
diff -u -r FvwmTaskBar/FvwmTaskBar.c FvwmTaskBar.new/FvwmTaskBar.c
--- FvwmTaskBar/FvwmTaskBar.c	Tue May 15 19:39:18 2001
+++ FvwmTaskBar.new/FvwmTaskBar.c	Wed Oct 31 04:10:46 2001
@@ -50,6 +50,7 @@
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <stdarg.h>
+#include <locale.h>
 
 #include <unistd.h>
 #include <ctype.h>
@@ -238,6 +239,8 @@
   char *s;
   int i;
 
+  setlocale(LC_ALL, "");
+
   for (i = 3; i < NUMBER_OF_MOUSE_BUTTONS; i++)
   {
     ClickAction[i] = DEFAULT_CLICK_N;
diff -u -r FvwmTaskBar/Goodies.c FvwmTaskBar.new/Goodies.c
--- FvwmTaskBar/Goodies.c	Sun Dec  3 20:56:08 2000
+++ FvwmTaskBar.new/Goodies.c	Wed Oct 31 04:24:26 2001
@@ -74,6 +74,7 @@
 int fontheight, clock_width;
 char *mailpath = NULL;
 char *clockfmt = NULL;
+char *datefmt = NULL;
 int BellVolume = DEFAULT_BELL_VOLUME;
 Pixmap mailpix = None;
 Pixmap wmailpix = None;
@@ -168,6 +169,7 @@
   "MailCommand",
   "IgnoreOldMail",
   "ShowTips",
+  "DateFormat",
   NULL
 };
 
@@ -237,6 +239,9 @@
   case 10: /* ShowTips */
     ShowTips = True;
     break;
+  case 11: /* DateFormat */
+    UpdateString(&datefmt, rest);
+    break;
   default:
     /* unknow option */
     return False;
@@ -392,7 +397,11 @@
 
   time(&timer);
   tms = localtime(&timer);
-  strftime(str, 40, "%A, %B %d, %Y", tms);
+  if (datefmt) {
+    strftime(str, 40, datefmt, tms);
+  } else {
+    strftime(str, 40, "%A, %B %d, %Y", tms);
+  }
   last_date = tms->tm_mday;
 
   PopupTipWindow(win_width, 0, str);