Mercurial > emacs
changeset 38602:8c9cec90d787
(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.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 30 Jul 2001 13:58:38 +0000 |
parents | 1b4bd3eb0f27 |
children | 13029a808e20 |
files | src/keyboard.c |
diffstat | 1 files changed, 21 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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;