Mercurial > emacs
comparison src/keyboard.c @ 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 | 005ef8b3f8a7 |
children | 96fc00b78011 |
comparison
equal
deleted
inserted
replaced
38791:a670b4af3cb4 | 38792:c9b9238088f3 |
---|---|
4688 int button = event->code; | 4688 int button = event->code; |
4689 int is_double; | 4689 int is_double; |
4690 Lisp_Object position; | 4690 Lisp_Object position; |
4691 Lisp_Object *start_pos_ptr; | 4691 Lisp_Object *start_pos_ptr; |
4692 Lisp_Object start_pos; | 4692 Lisp_Object start_pos; |
4693 Lisp_Object window; | |
4693 | 4694 |
4694 position = Qnil; | 4695 position = Qnil; |
4695 | 4696 |
4696 /* Build the position as appropriate for this mouse click. */ | 4697 /* Build the position as appropriate for this mouse click. */ |
4697 if (event->kind == mouse_click) | 4698 if (event->kind == mouse_click) |
4698 { | 4699 { |
4699 int part; | 4700 int part; |
4700 FRAME_PTR f = XFRAME (event->frame_or_window); | 4701 struct frame *f = XFRAME (event->frame_or_window); |
4701 Lisp_Object window; | |
4702 Lisp_Object posn; | 4702 Lisp_Object posn; |
4703 Lisp_Object string_info = Qnil; | 4703 Lisp_Object string_info = Qnil; |
4704 int row, column; | 4704 int row, column; |
4705 | 4705 |
4706 /* Ignore mouse events that were made on frame that | 4706 /* Ignore mouse events that were made on frame that |
4834 } | 4834 } |
4835 #ifndef USE_TOOLKIT_SCROLL_BARS | 4835 #ifndef USE_TOOLKIT_SCROLL_BARS |
4836 else | 4836 else |
4837 { | 4837 { |
4838 /* It's a scrollbar click. */ | 4838 /* It's a scrollbar click. */ |
4839 Lisp_Object window; | |
4840 Lisp_Object portion_whole; | 4839 Lisp_Object portion_whole; |
4841 Lisp_Object part; | 4840 Lisp_Object part; |
4842 | 4841 |
4843 window = event->frame_or_window; | 4842 window = event->frame_or_window; |
4844 portion_whole = Fcons (event->x, event->y); | 4843 portion_whole = Fcons (event->x, event->y); |
4862 | 4861 |
4863 start_pos_ptr = &AREF (button_down_location, button); | 4862 start_pos_ptr = &AREF (button_down_location, button); |
4864 start_pos = *start_pos_ptr; | 4863 start_pos = *start_pos_ptr; |
4865 *start_pos_ptr = Qnil; | 4864 *start_pos_ptr = Qnil; |
4866 | 4865 |
4867 is_double = (button == last_mouse_button | 4866 { |
4868 && (abs (XINT (event->x) - last_mouse_x) | 4867 /* On window-system frames, use the value of |
4869 <= double_click_fuzz) | 4868 double-click-fuzz as is. On other frames, interpret it |
4870 && (abs (XINT (event->y) - last_mouse_y) | 4869 as a multiple of 1/8 characters. */ |
4871 <= double_click_fuzz) | 4870 struct frame *f; |
4872 && button_down_time != 0 | 4871 int fuzz; |
4873 && (EQ (Vdouble_click_time, Qt) | 4872 |
4874 || (INTEGERP (Vdouble_click_time) | 4873 if (WINDOWP (event->frame_or_window)) |
4875 && ((int)(event->timestamp - button_down_time) | 4874 f = XFRAME (XWINDOW (event->frame_or_window)->frame); |
4876 < XINT (Vdouble_click_time))))); | 4875 else if (FRAMEP (event->frame_or_window)) |
4876 f = XFRAME (event->frame_or_window); | |
4877 else | |
4878 abort (); | |
4879 | |
4880 if (FRAME_WINDOW_P (f)) | |
4881 fuzz = double_click_fuzz; | |
4882 else | |
4883 fuzz = double_click_fuzz / 8; | |
4884 | |
4885 is_double = (button == last_mouse_button | |
4886 && (abs (XINT (event->x) - last_mouse_x) <= fuzz) | |
4887 && (abs (XINT (event->y) - last_mouse_y) <= fuzz) | |
4888 && button_down_time != 0 | |
4889 && (EQ (Vdouble_click_time, Qt) | |
4890 || (INTEGERP (Vdouble_click_time) | |
4891 && ((int)(event->timestamp - button_down_time) | |
4892 < XINT (Vdouble_click_time))))); | |
4893 } | |
4877 | 4894 |
4878 last_mouse_button = button; | 4895 last_mouse_button = button; |
4879 last_mouse_x = XINT (event->x); | 4896 last_mouse_x = XINT (event->x); |
4880 last_mouse_y = XINT (event->y); | 4897 last_mouse_y = XINT (event->y); |
4881 | 4898 |
10539 by position only."); | 10556 by position only."); |
10540 Vdouble_click_time = make_number (500); | 10557 Vdouble_click_time = make_number (500); |
10541 | 10558 |
10542 DEFVAR_INT ("double-click-fuzz", &double_click_fuzz, | 10559 DEFVAR_INT ("double-click-fuzz", &double_click_fuzz, |
10543 "*Maximum mouse movement between clicks to make a double-click.\n\ | 10560 "*Maximum mouse movement between clicks to make a double-click.\n\ |
10544 Value is the number of pixels the mouse may have moved horizontally or\n\ | 10561 On window-system frames, value is the number of pixels the mouse may have\n\ |
10545 vertically between two clicks to make a double-click."); | 10562 moved horizontally or vertically between two clicks to make a double-click.\n\ |
10563 On non window-system frames, value is interpreted in units of 1/8 characters\n\ | |
10564 instead of pixels."); | |
10546 double_click_fuzz = 3; | 10565 double_click_fuzz = 3; |
10547 | 10566 |
10548 DEFVAR_BOOL ("inhibit-local-menu-bar-menus", &inhibit_local_menu_bar_menus, | 10567 DEFVAR_BOOL ("inhibit-local-menu-bar-menus", &inhibit_local_menu_bar_menus, |
10549 "*Non-nil means inhibit local map menu bar menus."); | 10568 "*Non-nil means inhibit local map menu bar menus."); |
10550 inhibit_local_menu_bar_menus = 0; | 10569 inhibit_local_menu_bar_menus = 0; |