# HG changeset patch # User Gerd Moellmann # Date 996501518 0 # Node ID 8c9cec90d787d13776b5990ed65a4e2eec909030 # Parent 1b4bd3eb0f270839d409c43c86147d26871348ef (abs): New macro. (double_click_fuzz): New variable. (make_lispy_event): Use it to determine what makes a double-click. (syms_of_keyboard): DEFVAR_INT it. diff -r 1b4bd3eb0f27 -r 8c9cec90d787 src/keyboard.c --- a/src/keyboard.c Mon Jul 30 11:09:22 2001 +0000 +++ b/src/keyboard.c Mon Jul 30 13:58:38 2001 +0000 @@ -106,6 +106,8 @@ #define KBD_BUFFER_SIZE 4096 #endif /* No X-windows */ +#define abs(x) ((x) >= 0 ? (x) : -(x)) + /* Following definition copied from eval.c */ struct backtrace @@ -4543,11 +4545,16 @@ static int last_mouse_y; static unsigned long button_down_time; -/* The maximum time between clicks to make a double-click, - or Qnil to disable double-click detection, - or Qt for no time limit. */ +/* The maximum time between clicks to make a double-click, or Qnil to + disable double-click detection, or Qt for no time limit. */ + Lisp_Object Vdouble_click_time; +/* Maximum number of pixels the mouse may be moved between clicks + to make a double-click. */ + +int double_click_fuzz; + /* The number of clicks in this multiple-click. */ int double_click_count; @@ -4846,13 +4853,16 @@ *start_pos_ptr = Qnil; is_double = (button == last_mouse_button - && XINT (event->x) == last_mouse_x - && XINT (event->y) == last_mouse_y + && (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))))); + last_mouse_button = button; last_mouse_x = XINT (event->x); last_mouse_y = XINT (event->y); @@ -10514,6 +10524,12 @@ by position only."); Vdouble_click_time = make_number (500); + 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 ha moved horizontally or\n\ +vertically between two clicks to make a double-click."); + double_click_fuzz = 3; + DEFVAR_BOOL ("inhibit-local-menu-bar-menus", &inhibit_local_menu_bar_menus, "*Non-nil means inhibit local map menu bar menus."); inhibit_local_menu_bar_menus = 0;