diff options
| author | Gerd Moellmann | 2001-07-30 13:58:38 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-07-30 13:58:38 +0000 |
| commit | 222d557c865a25d504f41b704e56ddf4e36ab184 (patch) | |
| tree | d119c65311f9ad520294011de0778d848d064e69 | |
| parent | 21f7951223991bedb8d1e5fbfdf2c1ce0ebac99d (diff) | |
| download | emacs-222d557c865a25d504f41b704e56ddf4e36ab184.tar.gz emacs-222d557c865a25d504f41b704e56ddf4e36ab184.zip | |
(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.
| -rw-r--r-- | src/keyboard.c | 26 |
1 files 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; | |||
| 106 | #define KBD_BUFFER_SIZE 4096 | 106 | #define KBD_BUFFER_SIZE 4096 |
| 107 | #endif /* No X-windows */ | 107 | #endif /* No X-windows */ |
| 108 | 108 | ||
| 109 | #define abs(x) ((x) >= 0 ? (x) : -(x)) | ||
| 110 | |||
| 109 | /* Following definition copied from eval.c */ | 111 | /* Following definition copied from eval.c */ |
| 110 | 112 | ||
| 111 | struct backtrace | 113 | struct backtrace |
| @@ -4543,11 +4545,16 @@ static int last_mouse_x; | |||
| 4543 | static int last_mouse_y; | 4545 | static int last_mouse_y; |
| 4544 | static unsigned long button_down_time; | 4546 | static unsigned long button_down_time; |
| 4545 | 4547 | ||
| 4546 | /* The maximum time between clicks to make a double-click, | 4548 | /* The maximum time between clicks to make a double-click, or Qnil to |
| 4547 | or Qnil to disable double-click detection, | 4549 | disable double-click detection, or Qt for no time limit. */ |
| 4548 | or Qt for no time limit. */ | 4550 | |
| 4549 | Lisp_Object Vdouble_click_time; | 4551 | Lisp_Object Vdouble_click_time; |
| 4550 | 4552 | ||
| 4553 | /* Maximum number of pixels the mouse may be moved between clicks | ||
| 4554 | to make a double-click. */ | ||
| 4555 | |||
| 4556 | int double_click_fuzz; | ||
| 4557 | |||
| 4551 | /* The number of clicks in this multiple-click. */ | 4558 | /* The number of clicks in this multiple-click. */ |
| 4552 | 4559 | ||
| 4553 | int double_click_count; | 4560 | int double_click_count; |
| @@ -4846,13 +4853,16 @@ make_lispy_event (event) | |||
| 4846 | *start_pos_ptr = Qnil; | 4853 | *start_pos_ptr = Qnil; |
| 4847 | 4854 | ||
| 4848 | is_double = (button == last_mouse_button | 4855 | is_double = (button == last_mouse_button |
| 4849 | && XINT (event->x) == last_mouse_x | 4856 | && (abs (XINT (event->x) - last_mouse_x) |
| 4850 | && XINT (event->y) == last_mouse_y | 4857 | <= double_click_fuzz) |
| 4858 | && (abs (XINT (event->y) - last_mouse_y) | ||
| 4859 | <= double_click_fuzz) | ||
| 4851 | && button_down_time != 0 | 4860 | && button_down_time != 0 |
| 4852 | && (EQ (Vdouble_click_time, Qt) | 4861 | && (EQ (Vdouble_click_time, Qt) |
| 4853 | || (INTEGERP (Vdouble_click_time) | 4862 | || (INTEGERP (Vdouble_click_time) |
| 4854 | && ((int)(event->timestamp - button_down_time) | 4863 | && ((int)(event->timestamp - button_down_time) |
| 4855 | < XINT (Vdouble_click_time))))); | 4864 | < XINT (Vdouble_click_time))))); |
| 4865 | |||
| 4856 | last_mouse_button = button; | 4866 | last_mouse_button = button; |
| 4857 | last_mouse_x = XINT (event->x); | 4867 | last_mouse_x = XINT (event->x); |
| 4858 | last_mouse_y = XINT (event->y); | 4868 | last_mouse_y = XINT (event->y); |
| @@ -10514,6 +10524,12 @@ t means double-clicks have no time limit and are detected\n\ | |||
| 10514 | by position only."); | 10524 | by position only."); |
| 10515 | Vdouble_click_time = make_number (500); | 10525 | Vdouble_click_time = make_number (500); |
| 10516 | 10526 | ||
| 10527 | DEFVAR_INT ("double-click-fuzz", &double_click_fuzz, | ||
| 10528 | "*Maximum mouse movement between clicks to make a double-click.\n\ | ||
| 10529 | Value is the number of pixels the mouse may ha moved horizontally or\n\ | ||
| 10530 | vertically between two clicks to make a double-click."); | ||
| 10531 | double_click_fuzz = 3; | ||
| 10532 | |||
| 10517 | DEFVAR_BOOL ("inhibit-local-menu-bar-menus", &inhibit_local_menu_bar_menus, | 10533 | DEFVAR_BOOL ("inhibit-local-menu-bar-menus", &inhibit_local_menu_bar_menus, |
| 10518 | "*Non-nil means inhibit local map menu bar menus."); | 10534 | "*Non-nil means inhibit local map menu bar menus."); |
| 10519 | inhibit_local_menu_bar_menus = 0; | 10535 | inhibit_local_menu_bar_menus = 0; |