changeset 38792:c9b9238088f3

(make_lispy_event): Interpret double_click_fuzz in units of 1/8 character on non window-system frames. (syms_of_keyboard) <double-click-fuzz>: Doc fix.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 13 Aug 2001 09:27:43 +0000
parents a670b4af3cb4
children 4800b18d484f
files src/keyboard.c
diffstat 1 files changed, 34 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sun Aug 12 21:22:26 2001 +0000
+++ b/src/keyboard.c	Mon Aug 13 09:27:43 2001 +0000
@@ -4690,6 +4690,7 @@
 	Lisp_Object position;
 	Lisp_Object *start_pos_ptr;
 	Lisp_Object start_pos;
+	Lisp_Object window;
 
 	position = Qnil;
 
@@ -4697,8 +4698,7 @@
 	if (event->kind == mouse_click)
 	  {
 	    int part;
-	    FRAME_PTR f = XFRAME (event->frame_or_window);
-	    Lisp_Object window;
+	    struct frame *f = XFRAME (event->frame_or_window);
 	    Lisp_Object posn;
 	    Lisp_Object string_info = Qnil;
 	    int row, column;
@@ -4836,7 +4836,6 @@
 	else
 	  {
 	    /* It's a scrollbar click.  */
-	    Lisp_Object window;
 	    Lisp_Object portion_whole;
 	    Lisp_Object part;
 
@@ -4864,16 +4863,34 @@
 	start_pos = *start_pos_ptr;
 	*start_pos_ptr = Qnil;
 
-	is_double = (button == last_mouse_button
-		     && (abs (XINT (event->x) - last_mouse_x)
-			 <= double_click_fuzz)
-		     && (abs (XINT (event->y) - last_mouse_y)
-			 <= double_click_fuzz)
-		     && button_down_time != 0
-		     && (EQ (Vdouble_click_time, Qt)
-			 || (INTEGERP (Vdouble_click_time)
-			     && ((int)(event->timestamp - button_down_time)
-				 < XINT (Vdouble_click_time)))));
+	{
+	  /* On window-system frames, use the value of
+	     double-click-fuzz as is.  On other frames, interpret it
+	     as a multiple of 1/8 characters.  */
+	  struct frame *f;
+	  int fuzz;
+
+	  if (WINDOWP (event->frame_or_window))
+	    f = XFRAME (XWINDOW (event->frame_or_window)->frame);
+	  else if (FRAMEP (event->frame_or_window))
+	    f = XFRAME (event->frame_or_window);
+	  else
+	    abort ();
+
+	  if (FRAME_WINDOW_P (f))
+	    fuzz = double_click_fuzz;
+	  else
+	    fuzz = double_click_fuzz / 8;
+
+	  is_double = (button == last_mouse_button
+		       && (abs (XINT (event->x) - last_mouse_x) <= fuzz)
+		       && (abs (XINT (event->y) - last_mouse_y) <= fuzz)
+		       && button_down_time != 0
+		       && (EQ (Vdouble_click_time, Qt)
+			   || (INTEGERP (Vdouble_click_time)
+			       && ((int)(event->timestamp - button_down_time)
+				   < XINT (Vdouble_click_time)))));
+	}
 	
 	last_mouse_button = button;
 	last_mouse_x = XINT (event->x);
@@ -10541,8 +10558,10 @@
 
   DEFVAR_INT ("double-click-fuzz", &double_click_fuzz,
     "*Maximum mouse movement between clicks to make a double-click.\n\
-Value is the number of pixels the mouse may have moved horizontally or\n\
-vertically between two clicks to make a double-click.");
+On window-system frames, value is the number of pixels the mouse may have\n\
+moved horizontally or vertically between two clicks to make a double-click.\n\
+On non window-system frames, value is interpreted in units of 1/8 characters\n\
+instead of pixels.");
   double_click_fuzz = 3;
   
   DEFVAR_BOOL ("inhibit-local-menu-bar-menus", &inhibit_local_menu_bar_menus,