diff options
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 64 |
1 files changed, 48 insertions, 16 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 97d4509eeb6..5467d5ff903 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -5053,7 +5053,11 @@ make_lispy_position (f, x, y, time) | |||
| 5053 | XSETINT (*x, wx); | 5053 | XSETINT (*x, wx); |
| 5054 | XSETINT (*y, wy); | 5054 | XSETINT (*y, wy); |
| 5055 | 5055 | ||
| 5056 | if (part == ON_MODE_LINE || part == ON_HEADER_LINE) | 5056 | if (part == ON_TEXT) |
| 5057 | { | ||
| 5058 | wx += WINDOW_LEFT_MARGIN_WIDTH (w); | ||
| 5059 | } | ||
| 5060 | else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) | ||
| 5057 | { | 5061 | { |
| 5058 | /* Mode line or header line. Look for a string under | 5062 | /* Mode line or header line. Look for a string under |
| 5059 | the mouse that may have a `local-map' property. */ | 5063 | the mouse that may have a `local-map' property. */ |
| @@ -5089,20 +5093,37 @@ make_lispy_position (f, x, y, time) | |||
| 5089 | &object, &dx, &dy, &width, &height); | 5093 | &object, &dx, &dy, &width, &height); |
| 5090 | if (STRINGP (string)) | 5094 | if (STRINGP (string)) |
| 5091 | string_info = Fcons (string, make_number (charpos)); | 5095 | string_info = Fcons (string, make_number (charpos)); |
| 5096 | if (part == ON_LEFT_MARGIN) | ||
| 5097 | wx = 0; | ||
| 5098 | else | ||
| 5099 | wx = window_box_right_offset (w, TEXT_AREA) - 1; | ||
| 5092 | } | 5100 | } |
| 5093 | else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE) | 5101 | else if (part == ON_LEFT_FRINGE) |
| 5094 | { | 5102 | { |
| 5095 | posn = (part == ON_LEFT_FRINGE) ? Qleft_fringe : Qright_fringe; | 5103 | posn = Qleft_fringe; |
| 5096 | rx = 0; | 5104 | rx = 0; |
| 5097 | dx = wx; | 5105 | dx = wx; |
| 5098 | if (part == ON_RIGHT_FRINGE) | 5106 | wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
| 5099 | dx -= (window_box_width (w, LEFT_MARGIN_AREA) | 5107 | ? 0 |
| 5100 | + window_box_width (w, TEXT_AREA) | 5108 | : window_box_width (w, LEFT_MARGIN_AREA)); |
| 5101 | + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | 5109 | dx -= wx; |
| 5102 | ? window_box_width (w, RIGHT_MARGIN_AREA) | 5110 | } |
| 5103 | : 0)); | 5111 | else if (part == ON_RIGHT_FRINGE) |
| 5104 | else if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) | 5112 | { |
| 5105 | dx -= window_box_width (w, LEFT_MARGIN_AREA); | 5113 | posn = Qright_fringe; |
| 5114 | rx = 0; | ||
| 5115 | dx = wx; | ||
| 5116 | wx = (window_box_width (w, LEFT_MARGIN_AREA) | ||
| 5117 | + window_box_width (w, TEXT_AREA) | ||
| 5118 | + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 5119 | ? window_box_width (w, RIGHT_MARGIN_AREA) | ||
| 5120 | : 0)); | ||
| 5121 | dx -= wx; | ||
| 5122 | } | ||
| 5123 | else | ||
| 5124 | { | ||
| 5125 | /* Note: We have no special posn for part == ON_SCROLL_BAR. */ | ||
| 5126 | wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); | ||
| 5106 | } | 5127 | } |
| 5107 | 5128 | ||
| 5108 | if (textpos < 0) | 5129 | if (textpos < 0) |
| @@ -5111,7 +5132,6 @@ make_lispy_position (f, x, y, time) | |||
| 5111 | struct display_pos p; | 5132 | struct display_pos p; |
| 5112 | int dx2, dy2; | 5133 | int dx2, dy2; |
| 5113 | int width2, height2; | 5134 | int width2, height2; |
| 5114 | wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); | ||
| 5115 | string2 = buffer_posn_from_coords (w, &wx, &wy, &p, | 5135 | string2 = buffer_posn_from_coords (w, &wx, &wy, &p, |
| 5116 | &object2, &dx2, &dy2, | 5136 | &object2, &dx2, &dy2, |
| 5117 | &width2, &height2); | 5137 | &width2, &height2); |
| @@ -10574,11 +10594,11 @@ The `posn-' functions access elements of such lists. */) | |||
| 10574 | CHECK_LIVE_WINDOW (frame_or_window); | 10594 | CHECK_LIVE_WINDOW (frame_or_window); |
| 10575 | 10595 | ||
| 10576 | w = XWINDOW (frame_or_window); | 10596 | w = XWINDOW (frame_or_window); |
| 10577 | XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x)) | 10597 | XSETINT (x, (XINT (x) |
| 10598 | + WINDOW_LEFT_EDGE_X (w) | ||
| 10578 | + (NILP (whole) | 10599 | + (NILP (whole) |
| 10579 | ? window_box_left_offset (w, TEXT_AREA) | 10600 | ? window_box_left_offset (w, TEXT_AREA) |
| 10580 | : - (WINDOW_LEFT_SCROLL_BAR_COLS (w) | 10601 | : 0))); |
| 10581 | * WINDOW_FRAME_COLUMN_WIDTH (w))))); | ||
| 10582 | XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y))); | 10602 | XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y))); |
| 10583 | frame_or_window = w->frame; | 10603 | frame_or_window = w->frame; |
| 10584 | } | 10604 | } |
| @@ -10604,9 +10624,21 @@ The `posn-' functions access elements of such lists. */) | |||
| 10604 | { | 10624 | { |
| 10605 | Lisp_Object tem; | 10625 | Lisp_Object tem; |
| 10606 | 10626 | ||
| 10627 | if (NILP (window)) | ||
| 10628 | window = selected_window; | ||
| 10629 | |||
| 10607 | tem = Fpos_visible_in_window_p (pos, window, Qt); | 10630 | tem = Fpos_visible_in_window_p (pos, window, Qt); |
| 10608 | if (!NILP (tem)) | 10631 | if (!NILP (tem)) |
| 10609 | tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window, Qnil); | 10632 | { |
| 10633 | Lisp_Object x = XCAR (tem); | ||
| 10634 | Lisp_Object y = XCAR (XCDR (tem)); | ||
| 10635 | |||
| 10636 | /* Point invisible due to hscrolling? */ | ||
| 10637 | if (XINT (x) < 0) | ||
| 10638 | return Qnil; | ||
| 10639 | tem = Fposn_at_x_y (x, y, window, Qnil); | ||
| 10640 | } | ||
| 10641 | |||
| 10610 | return tem; | 10642 | return tem; |
| 10611 | } | 10643 | } |
| 10612 | 10644 | ||