Mercurial > emacs
comparison src/keyboard.c @ 40736:d6395595f8ac
(read_char): Use Fcar and Fcdr, not Fnth.
(record_char): Likewise.
(make_lispy_event): Don't insist a drag event must move to a different
buffer position. Instead, check for moving at least double_click_fuzz.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 05 Nov 2001 04:19:56 +0000 |
parents | 2b78c1af4afa |
children | 2b25276add88 |
comparison
equal
deleted
inserted
replaced
40735:d3065bec433f | 40736:d6395595f8ac |
---|---|
2845 | 2845 |
2846 /* Display help if not echoing. */ | 2846 /* Display help if not echoing. */ |
2847 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) | 2847 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) |
2848 { | 2848 { |
2849 /* (help-echo FRAME HELP WINDOW OBJECT POS). */ | 2849 /* (help-echo FRAME HELP WINDOW OBJECT POS). */ |
2850 Lisp_Object help, object, position, window; | 2850 Lisp_Object help, object, position, window, tem; |
2851 help = Fnth (make_number (2), c); | 2851 |
2852 window = Fnth (make_number (3), c); | 2852 tem = Fcdr (XCDR (c)); |
2853 object = Fnth (make_number (4), c); | 2853 help = Fcar (tem); |
2854 position = Fnth (make_number (5), c); | 2854 tem = Fcdr (tem); |
2855 window = Fcar (tem); | |
2856 tem = Fcdr (tem); | |
2857 object = Fcar (tem); | |
2858 tem = Fcdr (tem); | |
2859 position = Fcar (tem); | |
2860 | |
2855 show_help_echo (help, window, object, position, 0); | 2861 show_help_echo (help, window, object, position, 0); |
2856 | 2862 |
2857 /* We stopped being idle for this event; undo that. */ | 2863 /* We stopped being idle for this event; undo that. */ |
2858 timer_idleness_start_time = last_idle_start; | 2864 timer_idleness_start_time = last_idle_start; |
2859 goto retry; | 2865 goto retry; |
2981 event. */ | 2987 event. */ |
2982 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) | 2988 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) |
2983 { | 2989 { |
2984 Lisp_Object help; | 2990 Lisp_Object help; |
2985 | 2991 |
2986 help = Fnth (make_number (2), c); | 2992 help = Fcar (Fcdr (XCDR (c))); |
2987 if (STRINGP (help)) | 2993 if (STRINGP (help)) |
2988 { | 2994 { |
2989 int last_idx; | 2995 int last_idx; |
2990 Lisp_Object last_c, last_help; | 2996 Lisp_Object last_c, last_help; |
2991 | 2997 |
2994 last_idx = NUM_RECENT_KEYS - 1; | 3000 last_idx = NUM_RECENT_KEYS - 1; |
2995 last_c = AREF (recent_keys, last_idx); | 3001 last_c = AREF (recent_keys, last_idx); |
2996 | 3002 |
2997 if (!CONSP (last_c) | 3003 if (!CONSP (last_c) |
2998 || !EQ (XCAR (last_c), Qhelp_echo) | 3004 || !EQ (XCAR (last_c), Qhelp_echo) |
2999 || (last_help = Fnth (make_number (2), last_c), | 3005 || (last_help = Fcar (Fcdr (XCDR (last_c))), |
3000 !EQ (last_help, help))) | 3006 !EQ (last_help, help))) |
3001 { | 3007 { |
3002 total_keys++; | 3008 total_keys++; |
3003 ASET (recent_keys, recent_keys_index, c); | 3009 ASET (recent_keys, recent_keys_index, c); |
3004 if (++recent_keys_index >= NUM_RECENT_KEYS) | 3010 if (++recent_keys_index >= NUM_RECENT_KEYS) |
4982 if (!CONSP (start_pos)) | 4988 if (!CONSP (start_pos)) |
4983 event->modifiers |= click_modifier; | 4989 event->modifiers |= click_modifier; |
4984 else | 4990 else |
4985 #endif | 4991 #endif |
4986 { | 4992 { |
4987 /* The third element of every position should be the (x,y) | |
4988 pair. */ | |
4989 Lisp_Object down; | 4993 Lisp_Object down; |
4990 | 4994 EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz; |
4991 down = Fnth (make_number (2), start_pos); | 4995 |
4992 if (EQ (event->x, XCAR (down)) && EQ (event->y, XCDR (down))) | 4996 /* The third element of every position |
4993 /* Mouse hasn't moved. */ | 4997 should be the (x,y) pair. */ |
4998 down = Fcar (Fcdr (Fcdr (start_pos))); | |
4999 if (CONSP (down)) | |
5000 { | |
5001 xdiff = event->x - XCAR (down); | |
5002 ydiff = event->y - XCDR (down); | |
5003 } | |
5004 | |
5005 if (xdiff < double_click_fuzz && xdiff > - double_click_fuzz | |
5006 && ydiff < double_click_fuzz | |
5007 && ydiff > - double_click_fuzz) | |
5008 /* Mouse hasn't moved (much). */ | |
4994 event->modifiers |= click_modifier; | 5009 event->modifiers |= click_modifier; |
4995 else | 5010 else |
4996 { | 5011 { |
4997 Lisp_Object window1, window2, posn1, posn2; | 5012 button_down_time = 0; |
4998 | 5013 event->modifiers |= drag_modifier; |
4999 /* Avoid generating a drag event if the mouse | |
5000 hasn't actually moved off the buffer position. */ | |
5001 window1 = Fnth (make_number (0), position); | |
5002 posn1 = Fnth (make_number (1), position); | |
5003 window2 = Fnth (make_number (0), start_pos); | |
5004 posn2 = Fnth (make_number (1), start_pos); | |
5005 | |
5006 if (EQ (window1, window2) && EQ (posn1, posn2)) | |
5007 event->modifiers |= click_modifier; | |
5008 else | |
5009 { | |
5010 button_down_time = 0; | |
5011 event->modifiers |= drag_modifier; | |
5012 } | |
5013 } | 5014 } |
5014 | 5015 |
5015 /* Don't check is_double; treat this as multiple | 5016 /* Don't check is_double; treat this as multiple |
5016 if the down-event was multiple. */ | 5017 if the down-event was multiple. */ |
5017 if (double_click_count > 1) | 5018 if (double_click_count > 1) |