diff src/keyboard.c @ 65816:95baa5a5fb95

(make_lispy_event): If point has moved between down and up event, make it a drag, not a click, to mirror what mouse-drag-region expects.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 04 Oct 2005 04:23:12 +0000
parents 9bbfc8301ea6
children 070aaff00398 2a679c81f552 aa89c814f853
line wrap: on
line diff
--- a/src/keyboard.c	Tue Oct 04 00:21:58 2005 +0000
+++ b/src/keyboard.c	Tue Oct 04 04:23:12 2005 +0000
@@ -5507,13 +5507,23 @@
 		if (CONSP (down)
 		    && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down)))
 		  {
-		    xdiff = XFASTINT (event->x) - XFASTINT (XCAR (down));
-		    ydiff = XFASTINT (event->y) - XFASTINT (XCDR (down));
+		    xdiff = XINT (event->x) - XINT (XCAR (down));
+		    ydiff = XINT (event->y) - XINT (XCDR (down));
 		  }
 
 		if (xdiff < double_click_fuzz && xdiff > - double_click_fuzz
-		    && ydiff < double_click_fuzz
-		    && ydiff > - double_click_fuzz)
+		    && ydiff < double_click_fuzz && ydiff > - double_click_fuzz
+		  /* Maybe the mouse has moved a lot, caused scrolling, and
+		     eventually ended up at the same screen position (but
+		     not buffer position) in which case it is a drag, not
+		     a click.  */
+		    /* FIXME: OTOH if the buffer position has changed
+		       because of a timer or process filter rather than
+		       because of mouse movement, it should be considered as
+		       a click.  But mouse-drag-region completely ignores
+		       this case and it hasn't caused any real problem, so
+		       it's probably OK to ignore it as well.  */
+		    && EQ (Fcar (Fcdr (start_pos)), Fcar (Fcdr (position))))
 		  /* Mouse hasn't moved (much).  */
 		  event->modifiers |= click_modifier;
 		else