Subject: FVWM: fvwm Scroll Resistance Timer Patch

From: Mike Blatchley <[email-masked]>
Date: Wed, 17 Jul 1996 18:47:37 -0600 (MDT)

Chuck,

Since the early days of fvwm-2, I have seen a problem when using a 
large value for the EdgeResistance timer such as:

   EdgeResistance 1000 50
   EdgeScroll 100 100

The 1000 says the pointer must be left at the screen edge for 1second 
before moving the viewport to a different page.  If the pointer is 
_retracted_ within this time period, life is supposed to go on 
uninterrupted.  Normally, it does.

However, if a window is being moved or resized when the pointer hits the 
edge, life does not go on _if the pointer is retracted within this time_ 
period.  Everything is temporarily put on hold for, say, 1second.  If it 
enters and exits the pan frame region multiple times before the mouse 
button is released, things can be put on hold for even longer!

The problem is the Pan Frames are "covered" by the window being 
moved/resized, so the "LeaveWindowMask" event is never seen and we get 
trapped inside of the sleep loop for the entire duration.  The patch 
below fixes this.  It also eliminates the window from lagging behind the 
pointer at the moment you hit the screen edge during a move/resize (a 
little aesthetic fix-up).

I submitted a patch for this a while back, but it seems to have never 
made its way into fvwm.  Here's a cleaner patch to fvwm-2.0.43.

Thanks,

Mike Blatchley
======================================================================
                         * Mike Blatchley * 
                * email: [email-masked] *
              * MIME Mail Reader * PGP Key Available *
======================================================================

File: fvwm-2.0.43-mab.p1
(be careful that the mail reader does not wrap any of the longer lines)
------------------------------ cut here ---------------------------
--- fvwm-2.0.43/fvwm/move.c	Fri Jun 30 09:06:01 1995
+++ fvwm-2.0.43.patched/fvwm/move.c	Sun Jul 14 18:38:49 1996
@@ -111,7 +111,7 @@
 {
   Bool finished = False;
   Bool done;
-  int xl,yt,delta_x,delta_y;
+  int xl,yt,delta_x,delta_y,paged;
 
   XQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild,&xl, &yt,
 		&JunkX, &JunkY, &JunkMask);
@@ -202,8 +202,8 @@
 	case MotionNotify:
 	  xl = Event.xmotion.x_root;
 	  yt = Event.xmotion.y_root;
-	  HandlePaging(Scr.MyDisplayWidth,Scr.MyDisplayHeight,&xl,&yt,
-		       &delta_x,&delta_y,False);
+/*	  HandlePaging(Scr.MyDisplayWidth,Scr.MyDisplayHeight,&xl,&yt,
+		       &delta_x,&delta_y,False);  mab */
 	  /* redraw the rubberband */
 	  xl += XOffset;
 	  yt += YOffset;
@@ -220,6 +220,11 @@
 	  if((yt <= 0)&&(yt > -Scr.MoveResistance))
 	    yt = 0;
 
+	/* check Paging request once and only once after outline redrawn */
+	/* redraw after paging if needed - mab */
+	paged=0;
+	while(paged<=1)
+	 {
 	  if(!opaque_move)
 	    MoveOutline(Scr.Root, xl, yt, Width,Height);
 	  else
@@ -242,6 +247,21 @@
 		XMoveWindow(dpy,tmp_win->frame,xl,yt);
 	    }
 	  DisplayPosition(tmp_win,xl+Scr.Vx,yt+Scr.Vy,False);
+
+/* prevent window from lagging behind mouse when paging - mab */
+	  if(paged==0)
+	    {
+	    xl = Event.xmotion.x_root;
+	    yt = Event.xmotion.y_root;
+	    HandlePaging(Scr.MyDisplayWidth,Scr.MyDisplayHeight,&xl,&yt,
+		       &delta_x,&delta_y,False);
+	    xl += XOffset;
+	    yt += YOffset;
+	    if ( (delta_x==0) && (delta_y==0)) break; /* break from while paged */
+	    }
+	  paged++;
+	 }  /* end while paged */
+
 	  done = TRUE;
 	  break;
 
--- fvwm-2.0.43/fvwm/resize.c	Fri Jun 30 09:07:23 1995
+++ fvwm-2.0.43.patched/fvwm/resize.c	Sun Jul 14 19:30:07 1996
@@ -214,15 +214,21 @@
 	case MotionNotify:
 	  x = Event.xmotion.x_root;
 	  y = Event.xmotion.y_root;
+	  /* resize before paging request to prevent resize from lagging mouse - mab */
+	  DoResize(x, y, tmp_win);  
 	  /* need to move the viewport */
 	  HandlePaging(Scr.EdgeScrollX,Scr.EdgeScrollY,&x,&y,
 		       &delta_x,&delta_y,False);
+	/* redraw outline if we paged - mab */
+	if ( (delta_x != 0) || (delta_y != 0) )
+	  {
 	  origx -= delta_x;
 	  origy -= delta_y;
 	  dragx -= delta_x;
 	  dragy -= delta_y;
 
 	  DoResize(x, y, tmp_win);
+	  }
 	  done = TRUE;
 	default:
 	  break;
--- fvwm-2.0.43/fvwm/virtual.c	Wed Apr 24 09:45:27 1996
+++ fvwm-2.0.43.patched/fvwm/virtual.c	Sun Jul 14 00:36:24 1996
@@ -42,6 +42,10 @@
     {
       sleep_a_little(10000);
       total+=10;
+
+  XQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild,
+		&x, &y, &JunkX, &JunkY, &JunkMask); 
+
       if(XCheckWindowEvent(dpy,Scr.PanFrameTop.win,
 			   LeaveWindowMask,&Event))
 	{
@@ -66,6 +70,11 @@
 	  StashEventTime(&Event);
 	  return;
 	}
+      /* check actual pointer location since PanFrames can get buried under
+         a window being moved or resized - mab */
+      if(( x >= SCROLL_REGION )&&( x < Scr.MyDisplayWidth-SCROLL_REGION )&&
+         ( y >= SCROLL_REGION )&&( y < Scr.MyDisplayHeight-SCROLL_REGION ))
+           return ;
     }
   
   XQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild,
------------------------------ cut here ------------------------------------

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].