From 222d557c865a25d504f41b704e56ddf4e36ab184 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Mon, 30 Jul 2001 13:58:38 +0000 Subject: [PATCH] (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. --- src/keyboard.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 85657dc21be..f44ccf55bb8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -106,6 +106,8 @@ extern int input_fd; #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_x; 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 @@ make_lispy_event (event) *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 @@ t means double-clicks have no time limit and are detected\n\ 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; -- 2.39.2