Subject: enhancement request: WarpToWindow with negative args

From: Tim Phipps <[email-masked]>
Date: Wed, 09 May 2001 12:57:20 +0100

Configuration Information [Automatically generated, do not change]:
uname output: SunOS silver 5.5.1 Generic_103640-35 sun4u sparc SUNW,Ultra-5_10
Compiler: gcc
Compilation CFLAGS: -g -O2
prefix: /u/phippst/sunos

FVWM Version:	2.3.33
FVWM_MODULEDIR:	/u/phippst/sunos/libexec/fvwm/2.3.33
FVWM_DATADIR:	/u/phippst/sunos/share/fvwm
FVWM_USERDIR:	/u/phippst/.fvwm

Description:
	I'd like WarpToWindow to understand negative numbers to mean 
	distance from the opposite edge liek standard X geomteries.

Fix:
Low priority patch follows hope this format is OK

Index: ChangeLog
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/ChangeLog,v
retrieving revision 1.7
diff -u -r1.7 ChangeLog
--- ChangeLog	2001/05/09 08:58:55	1.7
+++ ChangeLog	2001/05/09 11:45:59
@@ -1,3 +1,8 @@
+2001-05-09  Hippo
+
+	* fvwm/focus.c (warp_to_fvwm_window):
+	WarpToWindow handles negative numbers
+
 2001-05-07  Dominik Vogt  <[email-masked]>
 
 	* fvwm/icons.c (DrawIconWindow):
Index: fvwm/fvwm2.1
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/fvwm/fvwm2.1,v
retrieving revision 1.4
diff -u -r1.4 fvwm2.1
--- fvwm/fvwm2.1	2001/05/08 10:54:17	1.4
+++ fvwm/fvwm2.1	2001/05/09 11:43:59
@@ -3718,7 +3718,8 @@
 default to percentage of window down and in from the upper left hand
 corner (or number of pixels down and in if
 .RI ' p '
-is appended to the numbers).  This command works also with windows
+is appended to the numbers).  If a number is negative the opposite edge
+is used and the direction reversed.  This command works also with windows
 that are not managed by fvwm.  In this case fvwm does not bring
 the window onto the screen if it is not visible.  For example it is
 possible to warp the pointer to the center of the root window on
Index: fvwm/focus.c
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/fvwm/focus.c,v
retrieving revision 1.4
diff -u -r1.4 focus.c
--- fvwm/focus.c	2001/05/09 08:58:55	1.4
+++ fvwm/focus.c	2001/05/09 11:15:28
@@ -462,30 +462,37 @@
   }
 
   dx = (cx + Scr.Vx) / Scr.MyDisplayWidth * Scr.MyDisplayWidth;
-  dy = (cy +Scr.Vy) / Scr.MyDisplayHeight * Scr.MyDisplayHeight;
+  dy = (cy + Scr.Vy) / Scr.MyDisplayHeight * Scr.MyDisplayHeight;
 
   MoveViewport(dx,dy,True);
 
   if(IS_ICONIFIED(t))
   {
-    x = t->icon_xl_loc + t->icon_g.width/2;
+    x = t->icon_xl_loc + t->icon_g.width / 2;
     y = t->icon_g.y + t->icon_p_height + ICON_HEIGHT(t) / 2;
   }
   else
   {
-    if (x_unit != Scr.MyDisplayWidth)
+    if (x_unit != Scr.MyDisplayWidth && warp_x >= 0)
       x = t->frame_g.x + warp_x;
-    else
+    else if (x_unit != Scr.MyDisplayWidth)
+      x = t->frame_g.x + t->frame_g.width + warp_x;
+    else if (warp_x >= 0)
       x = t->frame_g.x + (t->frame_g.width - 1) * warp_x / 100;
-    if (y_unit != Scr.MyDisplayHeight)
-      y = t->frame_g.y + warp_y;
     else
+      x = t->frame_g.x + (t->frame_g.width - 1) * (100 + warp_x) / 100;
+
+    if (y_unit != Scr.MyDisplayHeight && warp_y >= 0)
+      y = t->frame_g.y + warp_y;
+    else if (y_unit != Scr.MyDisplayHeight)
+      y = t->frame_g.y + t->frame_g.height + warp_y;
+    else if (warp_y >= 0)
       y = t->frame_g.y + (t->frame_g.height - 1) * warp_y / 100;
-  }
-  if (warp_x >= 0 && warp_y >= 0) {
-    XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, x, y);
-    SetPointerEventPosition(eventp, x, y);
+    else
+      y = t->frame_g.y + (t->frame_g.height - 1) * (100 + warp_y) / 100;
   }
+  XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, x, y);
+  SetPointerEventPosition(eventp, x, y);
   RaiseWindow(t);
 
   /* If the window is still not visible, make it visible! */
--
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]