Subject: duplicate geometry handling

From: Andrew Pimlott <[email-masked]>
Date: Mon, 7 Jan 2002 14:00:24 -0500

I was using the fvwm distributed in the Debian Testing distribution (based
on 2.2.5), and I noticed that if the configuration had two
*FwwmPagerGeometry settings (eg, one in the system config file, one in the
user config file), they would interfere with each other.  For example, the
default /etc/X11/fvwm/system.fvwm2rc has

    *FvwmPagerGeometry -0-0

and my own ~/.fvwm/post.hook (part of Debian's config setup) has

    *FvwmPagerGeometry -0+0

but the result is that the pager appears in the lower-right corner, instead
of the upper-right.

The reason is that the config reader in FvwmPager.c updates the parts of the
geometry independently, based on what was specified in the geometry string.
So my geometry string doesn't override the fact that YNegative was already
set by the system geometry string.

I downloaded 2.4.4 and found that it had been fixed in the obvious way, by
resetting all components of the geometry every time a new geometry setting
is encountered.  But I poked around a little more and discovered that
several other files have the same bug.  Below is a patch that corrects every
instance I found (by grepping for ParseGeometry in **/*.c) in a recent
snapshot.  I tried to address only the cases where the geometry might
plausibly be specified more than once.

I compiled this but did not run it.  This is the first time I've looked at
the fvwm sources, so please take only what makes sense.

Making these changes was a pain, because I had to hunt down the default
values of all the geometry parts and duplicate them (which sucks for future
maintenance).  I note that some modules (such as FvwmTaskBar) do something
much simpler and saner: they store only the geometry string when reading the
config, and parse it (ie, the last one read) after the whole config is read.
This is a better solution if someone feels like doing it.

I'm not subscribed, so please Cc: me on any follow-ups.

Andrew

diff -uNr fvwm-snap-20011228.orig/modules/FvwmButtons/parse.c fvwm-snap-20011228/modules/FvwmButtons/parse.c
--- fvwm-snap-20011228.orig/modules/FvwmButtons/parse.c	Mon Aug 27 07:30:03 2001
+++ fvwm-snap-20011228/modules/FvwmButtons/parse.c	Sun Jan  6 18:38:22 2002
@@ -1325,6 +1325,8 @@
 	break;
       UberButton->w = 0;
       UberButton->h = 0;
+      UberButton->x = 0;
+      UberButton->y = 0;
       if (flags&WidthValue)
 	button_width = width;
       if (flags&HeightValue)
@@ -1636,6 +1638,8 @@
   flags = FScreenParseGeometry(geom,&g_x,&g_y,&width,&height);
   UberButton->w = 0;
   UberButton->h = 0;
+  UberButton->x = 0;
+  UberButton->y = 0;
   if (flags&WidthValue)
     w = width;
   if (flags&HeightValue)
diff -uNr fvwm-snap-20011228.orig/modules/FvwmDragWell/fvwmDragWell.c fvwm-snap-20011228/modules/FvwmDragWell/fvwmDragWell.c
--- fvwm-snap-20011228.orig/modules/FvwmDragWell/fvwmDragWell.c	Mon Sep 17 07:00:08 2001
+++ fvwm-snap-20011228/modules/FvwmDragWell/fvwmDragWell.c	Sun Jan  6 17:38:43 2002
@@ -610,6 +610,13 @@
     } else if (StrEquals(resource, "Geometry")) {
       int g_x,g_y,flags;
       unsigned width,height;
+      xg.w = 48;
+      xg.h = 48;
+      xg.x = 0;
+      xg.y = 0;
+      xg.xneg = 0;
+      xg.yneg = 0;
+      xg.usposition = 0;
       flags = FScreenParseGeometry(arg1,&g_x,&g_y,&width,&height);
       if (flags & WidthValue) {
 	xg.w = width;
@@ -634,6 +641,10 @@
     } else if (StrEquals(resource, "DragWellGeometry")) {
       int g_x,g_y,flags;
       unsigned width,height;
+      xg.dbw = 30;
+      xg.dbh = 30;
+      xg.dbx = 9;
+      xg.dby = 9;
       flags = FScreenParseGeometry(arg1,&g_x,&g_y,&width,&height);
       if (flags & WidthValue) {
 	xg.dbw = width;
diff -uNr fvwm-snap-20011228.orig/modules/FvwmForm/FvwmForm.c fvwm-snap-20011228/modules/FvwmForm/FvwmForm.c
--- fvwm-snap-20011228.orig/modules/FvwmForm/FvwmForm.c	Mon Oct 15 07:00:05 2001
+++ fvwm-snap-20011228/modules/FvwmForm/FvwmForm.c	Sun Jan  6 17:38:51 2002
@@ -432,6 +432,10 @@
   int y = 0;
   int flags;
   unsigned int dummy;
+  CF.gx = 0;
+  CF.gy = 0;
+  CF.xneg = 0;
+  CF.yneg = 0;
 
   while (isspace(*cp))
     cp++;
diff -uNr fvwm-snap-20011228.orig/modules/FvwmIconBox/FvwmIconBox.c fvwm-snap-20011228/modules/FvwmIconBox/FvwmIconBox.c
--- fvwm-snap-20011228.orig/modules/FvwmIconBox/FvwmIconBox.c	Thu Dec  6 07:30:03 2001
+++ fvwm-snap-20011228/modules/FvwmIconBox/FvwmIconBox.c	Sun Jan  6 17:39:06 2002
@@ -1651,6 +1651,12 @@
     {
       if (strncasecmp(tline,CatString3("*", MyName, "Geometry"),Clength+9)==0)
       {
+	num_columns = 6;
+	num_rows = 1;
+	geom_x = -10000;
+	geom_y = -10000;
+	xneg = 0;
+	yneg = 0;
 	tmp = &tline[Clength+9];
 	while(((isspace((unsigned char)*tmp))&&(*tmp != '\n'))&&(*tmp != 0))
 	  tmp++;
diff -uNr fvwm-snap-20011228.orig/modules/FvwmWharf/FvwmWharf.c fvwm-snap-20011228/modules/FvwmWharf/FvwmWharf.c
--- fvwm-snap-20011228.orig/modules/FvwmWharf/FvwmWharf.c	Mon Sep 17 07:00:09 2001
+++ fvwm-snap-20011228/modules/FvwmWharf/FvwmWharf.c	Sun Jan  6 17:42:15 2002
@@ -1586,6 +1586,10 @@
 
     if((strncasecmp(tline,CatString3("*", MyName, "Geometry"),Clength+9)==0))
     {
+      w= -1;
+      h= -1;
+      x= -100000;
+      y= -100000;
       tmp = &tline[Clength+9];
       while(((isspace(*tmp))&&(*tmp != '\n'))&&(*tmp != 0))
       {
--
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: Tue, 8 Jan 2002 11:18:21 +0100

> I'm not subscribed, so please Cc: me on any follow-ups.

Thanks for your help.  I'll apply that patch shortly.

Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20