diff options
| author | Gerd Moellmann | 2001-03-08 14:03:45 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-03-08 14:03:45 +0000 |
| commit | 129004d3cb4e5f8f2ef7842b0ca2c49c515e3341 (patch) | |
| tree | b642c0a1e3eb873baee9db05d5f04b81aeab0719 /src | |
| parent | 80c8ab8c9b6428b52b014706d8901ee7602378a8 (diff) | |
| download | emacs-129004d3cb4e5f8f2ef7842b0ca2c49c515e3341.tar.gz emacs-129004d3cb4e5f8f2ef7842b0ca2c49c515e3341.zip | |
(make_lispy_event): Avoid generating drag events
if the mouse hasn't actually moved to another buffer position.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/keyboard.c | 49 |
2 files changed, 36 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6eb06971f5d..774e19fe49c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,6 +1,11 @@ | |||
| 1 | 2001-03-08 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * keyboard.c (make_lispy_event): Avoid generating drag events | ||
| 4 | if the mouse hasn't actually moved to another buffer position. | ||
| 5 | |||
| 1 | 2001-03-08 Dave Love <fx@gnu.org> | 6 | 2001-03-08 Dave Love <fx@gnu.org> |
| 2 | 7 | ||
| 3 | * eval.c (syms_of_eval) <debug-on-error>: DOc fix. | 8 | * eval.c (syms_of_eval) <debug-on-error>: Doc fix. |
| 4 | 9 | ||
| 5 | 2001-03-08 Gerd Moellmann <gerd@gnu.org> | 10 | 2001-03-08 Gerd Moellmann <gerd@gnu.org> |
| 6 | 11 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 53e918d30ba..c806bd7265e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -4711,14 +4711,14 @@ make_lispy_event (event) | |||
| 4711 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 4711 | for (i = 0; i < XVECTOR (items)->size; i += 4) |
| 4712 | { | 4712 | { |
| 4713 | Lisp_Object pos, string; | 4713 | Lisp_Object pos, string; |
| 4714 | string = XVECTOR (items)->contents[i + 1]; | 4714 | string = AREF (items, i + 1); |
| 4715 | pos = XVECTOR (items)->contents[i + 3]; | 4715 | pos = AREF (items, i + 3); |
| 4716 | if (NILP (string)) | 4716 | if (NILP (string)) |
| 4717 | break; | 4717 | break; |
| 4718 | if (column >= XINT (pos) | 4718 | if (column >= XINT (pos) |
| 4719 | && column < XINT (pos) + XSTRING (string)->size) | 4719 | && column < XINT (pos) + XSTRING (string)->size) |
| 4720 | { | 4720 | { |
| 4721 | item = XVECTOR (items)->contents[i]; | 4721 | item = AREF (items, i); |
| 4722 | break; | 4722 | break; |
| 4723 | } | 4723 | } |
| 4724 | } | 4724 | } |
| @@ -4810,15 +4810,14 @@ make_lispy_event (event) | |||
| 4810 | } | 4810 | } |
| 4811 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 4811 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 4812 | 4812 | ||
| 4813 | if (button >= XVECTOR (button_down_location)->size) | 4813 | if (button >= ASIZE (button_down_location)) |
| 4814 | { | 4814 | { |
| 4815 | button_down_location = larger_vector (button_down_location, | 4815 | button_down_location = larger_vector (button_down_location, |
| 4816 | button + 1, Qnil); | 4816 | button + 1, Qnil); |
| 4817 | mouse_syms = larger_vector (mouse_syms, button + 1, Qnil); | 4817 | mouse_syms = larger_vector (mouse_syms, button + 1, Qnil); |
| 4818 | } | 4818 | } |
| 4819 | 4819 | ||
| 4820 | start_pos_ptr = &XVECTOR (button_down_location)->contents[button]; | 4820 | start_pos_ptr = &AREF (button_down_location, button); |
| 4821 | |||
| 4822 | start_pos = *start_pos_ptr; | 4821 | start_pos = *start_pos_ptr; |
| 4823 | *start_pos_ptr = Qnil; | 4822 | *start_pos_ptr = Qnil; |
| 4824 | 4823 | ||
| @@ -4855,12 +4854,11 @@ make_lispy_event (event) | |||
| 4855 | see if this was a click or a drag. */ | 4854 | see if this was a click or a drag. */ |
| 4856 | else if (event->modifiers & up_modifier) | 4855 | else if (event->modifiers & up_modifier) |
| 4857 | { | 4856 | { |
| 4858 | /* If we did not see a down before this up, | 4857 | /* If we did not see a down before this up, ignore the up. |
| 4859 | ignore the up. Probably this happened because | 4858 | Probably this happened because the down event chose a |
| 4860 | the down event chose a menu item. | 4859 | menu item. It would be an annoyance to treat the |
| 4861 | It would be an annoyance to treat the release | 4860 | release of the button that chose the menu item as a |
| 4862 | of the button that chose the menu item | 4861 | separate event. */ |
| 4863 | as a separate event. */ | ||
| 4864 | 4862 | ||
| 4865 | if (!CONSP (start_pos)) | 4863 | if (!CONSP (start_pos)) |
| 4866 | return Qnil; | 4864 | return Qnil; |
| @@ -4877,16 +4875,29 @@ make_lispy_event (event) | |||
| 4877 | Lisp_Object down; | 4875 | Lisp_Object down; |
| 4878 | 4876 | ||
| 4879 | down = Fnth (make_number (2), start_pos); | 4877 | down = Fnth (make_number (2), start_pos); |
| 4880 | if (EQ (event->x, XCAR (down)) | 4878 | if (EQ (event->x, XCAR (down)) && EQ (event->y, XCDR (down))) |
| 4881 | && EQ (event->y, XCDR (down))) | 4879 | /* Mouse hasn't moved. */ |
| 4882 | { | 4880 | event->modifiers |= click_modifier; |
| 4883 | event->modifiers |= click_modifier; | ||
| 4884 | } | ||
| 4885 | else | 4881 | else |
| 4886 | { | 4882 | { |
| 4887 | button_down_time = 0; | 4883 | Lisp_Object window1, window2, posn1, posn2; |
| 4888 | event->modifiers |= drag_modifier; | 4884 | |
| 4885 | /* Avoid generating a drag event if the mouse | ||
| 4886 | hasn't actually moved off the buffer position. */ | ||
| 4887 | window1 = Fnth (make_number (0), position); | ||
| 4888 | posn1 = Fnth (make_number (1), position); | ||
| 4889 | window2 = Fnth (make_number (0), start_pos); | ||
| 4890 | posn2 = Fnth (make_number (1), start_pos); | ||
| 4891 | |||
| 4892 | if (EQ (window1, window2) && EQ (posn1, posn2)) | ||
| 4893 | event->modifiers |= click_modifier; | ||
| 4894 | else | ||
| 4895 | { | ||
| 4896 | button_down_time = 0; | ||
| 4897 | event->modifiers |= drag_modifier; | ||
| 4898 | } | ||
| 4889 | } | 4899 | } |
| 4900 | |||
| 4890 | /* Don't check is_double; treat this as multiple | 4901 | /* Don't check is_double; treat this as multiple |
| 4891 | if the down-event was multiple. */ | 4902 | if the down-event was multiple. */ |
| 4892 | if (double_click_count > 1) | 4903 | if (double_click_count > 1) |