Subject: Re: Vector offsets patch

From: Dominik Vogt <[email-masked]>
Date: Fri, 1 Nov 2002 18:10:34 +0100

On Sat, Oct 26, 2002 at 01:21:23PM +0200, Marcus Lundblad wrote:
> I made a patch to implement the vector offset additions I suggested a
> while ago on the FVWM-list.
> 
> I followed the instructions on the web for CVS, I hope I did everything
> correct.
> 
> With this you can do for example:
> 
> ButtonStyle 2 5 0+3x0+3@2 100-5x0+3@2 100-5x100-5@2 0+3x100-5@2 0+3x0+3@2
> 
> to get a button that is aligned with an absolute number of pixels from the
> border.
> With this it's also possible to get lines of double witdh by using offset
> of 1 pixel.

Okay, I have applied the patch with a few changes.

 - Fixed a core dump in fvwm.c (freed .xoff twice and never .yoff)
 - Split the Vector line parsing code into separate functions to
   reduce indentation depth.
 - For consistency with other commands and readability, the suffix
   'p' has to be added to the offset definition, for example

     10+1px10+1p@2
         ^     ^

 - More verbose description in the man page.
 - Reindented and tabified some lines.
 - Added entries in NEWS and AUTHORS.

And a note about sscanf (from the sscanf man page on my Linux
box):  when the "%n" assignment is used, this may add 1 to the
return code on some systems but nothing on others.  Hence, this
code is not portable:

  n = sscanf(s, "%d%n", &x, &offset);
  if (n != 1)
  {
    /* errror */
  }

This is a better (i.e. portable) version:

  ...
  if (n < 1)
  ...

And yes, I know that this bug was in the code before your patch.  I
just mentioned it 

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
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]