Re: FVWM: fvwm misses mouse-release sometimes

From: Robert Nation 885-9815 <rnation_at_mansvr.sanders.lockheed.com>
Date: Wed, 3 Jan 96 10:07:37 EST

>Has anyone else noticed that if you hold down the mouse button for exactly
>the right amount of time on say a title bar, and then release the button,
>and then move the mouse, fvwm will drag the window anyway and not release
>the drag until you click again?

I've noticed this before, but never debugged it. It is annoying. I believe
that I have finally located the problem. Its in complex.c. Routine IsClick()
checks to see if we have a mouse move or a click:

Bool IsClick(int x,int y,unsigned EndMask, XEvent *d)
{
  int xcurrent,ycurrent,total = 0;
  Time t0;
  extern Time lastTimestamp;

  xcurrent = x;
  ycurrent = y;
  t0 = lastTimestamp;

  while((total < Scr.ClickTime)&&
        (x - xcurrent < 3)&&(x - xcurrent > -3)&&
        (y - ycurrent < 3)&&(y - ycurrent > -3))
    {
      sleep_a_little(10000);
      total+=10;
      if(XCheckMaskEvent (dpy,EndMask, d))
        {
          StashEventTime(d);
          if((lastTimestamp - t0) < Scr.ClickTime)
            return True;
          else
            return False;
        }
      if(XCheckMaskEvent (dpy,ButtonMotionMask|PointerMotionMask, d))
        {
          xcurrent = d->xmotion.x_root;
          ycurrent = d->xmotion.y_root;
          StashEventTime(d);
        }
    }
  return False;
}

When we get a Button Release, we pass the test:
      if(XCheckMaskEvent (dpy,EndMask, d))
and then check:
          if((lastTimestamp - t0) < Scr.ClickTime)
If we fail the second test, then we discard the button release! (Oops)

This error can be triggered by releasing the mouse just before ClickTime
expires.

Solutions? One would be to make the click-move decision based on pointer motion
only. Perhaps better would be a re-write from
  while((total < Scr.ClickTime)&&
        (x - xcurrent < 3)&&(x - xcurrent > -3)&&
        (y - ycurrent < 3)&&(y - ycurrent > -3))

to something like:
  while((total < Scr.ClickTime)&&
        (x - xcurrent < 3)&&(x - xcurrent > -3)&&
        (y - ycurrent < 3)&&(y - ycurrent > -3)&&
        (lastTimestamp - t0) < Scr.ClickTime))
and remove the test for expiration time which occurs later:
          if((lastTimestamp - t0) < Scr.ClickTime)

This second solution would probably allow infinite click-times if the
mouse is never moved.

Perhaps the best solution is to try to peek in the event queue without
removing the button release. I think the function XPeekIfEvent might
allow this.

Rob

--
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Wed Jan 03 1996 - 09:08:18 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:58 BST