On Tue, 31 Aug 2010 08:16:03 +0200 Gerard Vermeulen wrote:

> playing around with FvwmProxy, I discovered that the proxied window only
> moved right- and down-wards when dragging the proxy window.
> The move commands sent by FvwmProxy for dragging left- and upwards are
> of the form (from a log file of my login manager 'slim'):
> 07:14:51      1 [fvwm][LOG]: M: Move w+-5p w+-2p
> and rejected by the code in fvwm/move_resize.c.
> 
> The attached patch provides a fix (one can infer from the manual that
> 'Move w+-5p w+-2p' should be valid).
[...]
> --- fvwm/move_resize.c        28 Feb 2010 01:11:37 -0000
> 1.307 +++ fvwm/move_resize.c  31 Aug 2010 05:56:41 -0000
> @@ -401,7 +401,19 @@
>               float f;
>  
>               /* parse value */
> -             if (sscanf(s1, "%d%n", &val, &n) < 1)
> +             if (sscanf(s1, "-%d%n", &val, &n) >= 1)
> +             {
> +                     /* i.e. -1, -+1 or --1 */
> +                     final_pos += (screen_size - window_size);
> +                     val = -val;
> +             }
> +             else if (
> +                     sscanf(s1, "+%d%n", &val, &n) >= 1 ||
> +                     sscanf(s1, "%d%n", &val, &n) >= 1)
> +             {
> +                     /* i.e. 1, +1, ++1 or +-1 */
> +             }
> +             else
>               {
>                       /* syntax error, ignore rest of string */
>                       break;

This patch breaks other documented forms of the Move command - e.g.,
"Move 50-50w 50-50w", which should move window to the center of
screen.  The final_pos adjustment for positions with '-' here is not
needed - it is useful only for the initial position (to indicate
distance from the right/bottom edge of the screen to the corresponding
edge of the window), not for the subsequent relative additions which
are handled by this part of code.

Removing the offending line fixes the problem.

===========================================================================

2010-09-16  Sergey Vlasov <v...@altlinux.ru>
        * fvwm/move_resize.c (GetOnePositionArgument):
        Fix parsing of commands like 'Move 50-50w 50-50w'.

Index: fvwm/move_resize.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/move_resize.c,v
retrieving revision 1.308
diff -u -p -r1.308 move_resize.c
--- fvwm/move_resize.c  31 Aug 2010 07:05:06 -0000      1.308
+++ fvwm/move_resize.c  16 Sep 2010 11:35:28 -0000
@@ -404,7 +404,6 @@ static int GetOnePositionArgument(
                if (sscanf(s1, "-%d%n", &val, &n) >= 1)
                {
                        /* i.e. -1, -+1 or --1 */
-                       final_pos += (screen_size - window_size);
                        val = -val;
                }
                else if (


Reply via email to