aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorKim F. Storm2003-11-27 21:16:26 +0000
committerKim F. Storm2003-11-27 21:16:26 +0000
commit45de137aed5987e2fc90ccc0fe498360e40e6119 (patch)
treed3dfe4c7a072b328b6631a198eb40d4b67ed6f05 /src/keyboard.c
parent8cef763f8c27674962228668c8122406a9269498 (diff)
downloademacs-45de137aed5987e2fc90ccc0fe498360e40e6119.tar.gz
emacs-45de137aed5987e2fc90ccc0fe498360e40e6119.zip
(make_lispy_position): Add x and y coordinates
relative to the current glyph as 7th element of position. If glyph is an image, return it in the object element. (read_key_sequence): Skip checks for keymap property in cases where POSN_STRING is not a string (e.g. an image).
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index b33392e5dd6..6148a2510b8 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -587,6 +587,7 @@ Lisp_Object Qvertical_scroll_bar;
587Lisp_Object Qmenu_bar; 587Lisp_Object Qmenu_bar;
588extern Lisp_Object Qleft_margin, Qright_margin; 588extern Lisp_Object Qleft_margin, Qright_margin;
589extern Lisp_Object Qleft_fringe, Qright_fringe; 589extern Lisp_Object Qleft_fringe, Qright_fringe;
590extern Lisp_Object Qimage;
590 591
591Lisp_Object recursive_edit_unwind (), command_loop (); 592Lisp_Object recursive_edit_unwind (), command_loop ();
592Lisp_Object Fthis_command_keys (); 593Lisp_Object Fthis_command_keys ();
@@ -4983,6 +4984,7 @@ make_lispy_position (f, x, y, time)
4983 struct window *w = XWINDOW (window); 4984 struct window *w = XWINDOW (window);
4984 Lisp_Object object = Qnil; 4985 Lisp_Object object = Qnil;
4985 int textpos = -1, rx = -1, ry = -1; 4986 int textpos = -1, rx = -1, ry = -1;
4987 int dx = -1, dy = -1;
4986 4988
4987 /* Set event coordinates to window-relative coordinates 4989 /* Set event coordinates to window-relative coordinates
4988 for constructing the Lisp event below. */ 4990 for constructing the Lisp event below. */
@@ -4998,7 +5000,7 @@ make_lispy_position (f, x, y, time)
4998 5000
4999 posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; 5001 posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line;
5000 rx = wx, ry = wy; 5002 rx = wx, ry = wy;
5001 string = mode_line_string (w, &rx, &ry, part, &charpos); 5003 string = mode_line_string (w, &rx, &ry, &dx, &dy, part, &charpos);
5002 if (STRINGP (string)) 5004 if (STRINGP (string))
5003 object = Fcons (string, make_number (charpos)); 5005 object = Fcons (string, make_number (charpos));
5004 if (w == XWINDOW (selected_window)) 5006 if (w == XWINDOW (selected_window))
@@ -5010,6 +5012,7 @@ make_lispy_position (f, x, y, time)
5010 { 5012 {
5011 posn = Qvertical_line; 5013 posn = Qvertical_line;
5012 wx = -1; 5014 wx = -1;
5015 dx = 0;
5013 } 5016 }
5014 else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) 5017 else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
5015 { 5018 {
@@ -5018,7 +5021,7 @@ make_lispy_position (f, x, y, time)
5018 5021
5019 posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; 5022 posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin;
5020 rx = wx, ry = wy; 5023 rx = wx, ry = wy;
5021 string = marginal_area_string (w, &rx, &ry, part, &charpos); 5024 string = marginal_area_string (w, &rx, &ry, &dx, &dy, part, &charpos);
5022 if (STRINGP (string)) 5025 if (STRINGP (string))
5023 object = Fcons (string, make_number (charpos)); 5026 object = Fcons (string, make_number (charpos));
5024 } 5027 }
@@ -5026,19 +5029,29 @@ make_lispy_position (f, x, y, time)
5026 { 5029 {
5027 posn = (part == ON_LEFT_FRINGE) ? Qleft_fringe : Qright_fringe; 5030 posn = (part == ON_LEFT_FRINGE) ? Qleft_fringe : Qright_fringe;
5028 rx = 0; 5031 rx = 0;
5032 dx = wx;
5033 if (part == ON_RIGHT_FRINGE)
5034 dx -= (window_box_width (w, LEFT_MARGIN_AREA)
5035 + window_box_width (w, TEXT_AREA)
5036 + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5037 ? window_box_width (w, RIGHT_MARGIN_AREA)
5038 : 0));
5039 else if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
5040 dx -= window_box_width (w, LEFT_MARGIN_AREA);
5029 } 5041 }
5030 5042
5031 if (textpos < 0) 5043 if (textpos < 0)
5032 { 5044 {
5033 Lisp_Object string; 5045 Lisp_Object string;
5034 struct display_pos p; 5046 struct display_pos p;
5047 int dx2, dy2;
5035 wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); 5048 wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx);
5036 buffer_posn_from_coords (w, &wx, &wy, &string, &p); 5049 buffer_posn_from_coords (w, &wx, &wy, &dx2, &dy2, &string, &p);
5037 textpos = CHARPOS (p.pos); 5050 textpos = CHARPOS (p.pos);
5038 if (rx < 0) 5051 if (rx < 0) rx = wx;
5039 rx = wx; 5052 if (ry < 0) ry = wy;
5040 if (ry < 0) 5053 if (dx < 0) dx = dx2;
5041 ry = wy; 5054 if (dy < 0) dy = dy2;
5042 5055
5043 if (NILP (posn)) 5056 if (NILP (posn))
5044 { 5057 {
@@ -5046,6 +5059,8 @@ make_lispy_position (f, x, y, time)
5046 if (STRINGP (string)) 5059 if (STRINGP (string))
5047 object = Fcons (string, 5060 object = Fcons (string,
5048 make_number (CHARPOS (p.string_pos))); 5061 make_number (CHARPOS (p.string_pos)));
5062 else if (CONSP (string) && EQ (XCAR (string), Qimage))
5063 object = string;
5049 } 5064 }
5050 } 5065 }
5051 5066
@@ -5053,7 +5068,9 @@ make_lispy_position (f, x, y, time)
5053 Fcons (make_number (textpos), 5068 Fcons (make_number (textpos),
5054 Fcons (Fcons (make_number (rx), 5069 Fcons (Fcons (make_number (rx),
5055 make_number (ry)), 5070 make_number (ry)),
5056 Qnil))); 5071 Fcons (Fcons (make_number (dx),
5072 make_number (dy)),
5073 Qnil))));
5057 } 5074 }
5058 else if (f != 0) 5075 else if (f != 0)
5059 { 5076 {
@@ -8813,6 +8830,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8813 if (EVENT_HAS_PARAMETERS (key)) 8830 if (EVENT_HAS_PARAMETERS (key))
8814 { 8831 {
8815 Lisp_Object kind; 8832 Lisp_Object kind;
8833 Lisp_Object string;
8816 8834
8817 kind = EVENT_HEAD_KIND (EVENT_HEAD (key)); 8835 kind = EVENT_HEAD_KIND (EVENT_HEAD (key));
8818 if (EQ (kind, Qmouse_click)) 8836 if (EQ (kind, Qmouse_click))
@@ -8929,11 +8947,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8929 8947
8930 /* If on a mode line string with a local keymap, 8948 /* If on a mode line string with a local keymap,
8931 reconsider the key sequence with that keymap. */ 8949 reconsider the key sequence with that keymap. */
8932 if (CONSP (POSN_STRING (EVENT_START (key)))) 8950 if (string = POSN_STRING (EVENT_START (key)),
8951 (CONSP (string) && STRINGP (XCAR (string))))
8933 { 8952 {
8934 Lisp_Object string, pos, map, map2; 8953 Lisp_Object pos, map, map2;
8935 8954
8936 string = POSN_STRING (EVENT_START (key));
8937 pos = XCDR (string); 8955 pos = XCDR (string);
8938 string = XCAR (string); 8956 string = XCAR (string);
8939 if (XINT (pos) >= 0 8957 if (XINT (pos) >= 0
@@ -8952,16 +8970,16 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8952 8970
8953 goto replay_key; 8971 goto replay_key;
8954 } 8972 }
8955 else if (CONSP (POSN_STRING (EVENT_START (key))) 8973 else if (NILP (from_string)
8956 && NILP (from_string)) 8974 && (string = POSN_STRING (EVENT_START (key)),
8975 (CONSP (string) && STRINGP (XCAR (string)))))
8957 { 8976 {
8958 /* For a click on a string, i.e. overlay string or a 8977 /* For a click on a string, i.e. overlay string or a
8959 string displayed via the `display' property, 8978 string displayed via the `display' property,
8960 consider `local-map' and `keymap' properties of 8979 consider `local-map' and `keymap' properties of
8961 that string. */ 8980 that string. */
8962 Lisp_Object string, pos, map, map2; 8981 Lisp_Object pos, map, map2;
8963 8982
8964 string = POSN_STRING (EVENT_START (key));
8965 pos = XCDR (string); 8983 pos = XCDR (string);
8966 string = XCAR (string); 8984 string = XCAR (string);
8967 if (XINT (pos) >= 0 8985 if (XINT (pos) >= 0