Subject: Patch proposal for message 996

From: Carsten Prescher <[email-masked]>
Date: Mon, 17 Mar 2003 15:09:09 +0100 (CET)

Hello,

I would like to propose the attached patch to fix the problem described in 
message 996.

This patch has been created against fvwm-snap-20030313.

Kind regards

Carsten

-- 
Carsten Prescher
EADS Deutschland GmbH
NGO22
Bontekai 55
26382 Wilhelmshaven

Tel.: +49-4421-1543-284
Fax: +49-4421-1543-560
[email-masked]

diff -ur modules/ChangeLog modules.patch/ChangeLog
--- modules/ChangeLog	2003-03-12 13:30:02.000000000 +0100
+++ modules.patch/ChangeLog	2003-03-17 14:51:55.000000000 +0100
@@ -1,3 +1,8 @@
+2003-03-17  Carsten Prescher (EADS)  <[email-masked]>
+
+	* FvwmCommand/FvwmCommand.c (main): FvwmCommand adds now missing
+	screen numbers of the display to the display string.
+
 2003-03-12  Dominik Vogt  <[email-masked]>
 
 	* FvwmButtons/parse.c (ParseButton):
diff -ur modules/FvwmCommand/FvwmCommand.c modules.patch/FvwmCommand/FvwmCommand.c
--- modules/FvwmCommand/FvwmCommand.c	2002-12-08 14:03:51.000000000 +0100
+++ modules.patch/FvwmCommand/FvwmCommand.c	2003-03-14 12:27:15.000000000 +0100
@@ -202,6 +202,11 @@
   if( f_stem == NULL )
   {
     char *dpy_name;
+    char *dpy_name_local; /* strtok() modifies the string. */
+    char *dpy_hostname;
+    char *dpy_display_no;
+    char *dpy_screen_no;
+    
 
     /* default name */
     dpy_name = getenv("DISPLAY");
@@ -209,6 +214,41 @@
       dpy_name = ":0";
     if (strncmp(dpy_name, "unix:", 5) == 0)
       dpy_name += 4;
+
+    /* parse display string */
+    dpy_name_local = safestrdup (dpy_name);
+    if (dpy_name_local[0] == ':')
+    {    
+      dpy_hostname = 0;
+      dpy_display_no = strtok (dpy_name_local, ":.");
+    }
+    else
+    {
+      dpy_hostname   = strtok (dpy_name_local, ":");
+      dpy_display_no = strtok (0, ".");
+    }
+    dpy_screen_no  = strtok (0, "");
+  
+    // Reassemble display string.
+    dpy_name = safemalloc (3 +
+                           (dpy_hostname ? strlen (dpy_hostname) : 0) +
+                           (dpy_display_no ? strlen (dpy_display_no) : 1) +
+                           (dpy_screen_no ? strlen (dpy_screen_no) : 1));
+    dpy_name[0] = 0;
+    if (dpy_hostname)
+      strcat (dpy_name, dpy_hostname);
+    strcat (dpy_name, ":");
+    if (dpy_display_no)
+      strcat (dpy_name, dpy_display_no);
+    else
+      strcat (dpy_name, "0");
+    strcat (dpy_name, ".");
+    if (dpy_screen_no)
+      strcat (dpy_name, dpy_screen_no);
+    else
+      strcat (dpy_name, "0");
+    free (dpy_name_local);
+
     f_stem = safemalloc(11 + strlen(F_NAME) + MAXHOSTNAME + strlen(dpy_name));
 
     if ((stat("/var/tmp", &stat_buf) == 0) && (stat_buf.st_mode & S_IFDIR))

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 17 Mar 2003 16:40:50 +0100

> This patch has been created against fvwm-snap-20030313.

:-)

I've already fixed that.  Sorry, I forgot to tell you.

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]