diff --git a/src/keyboard.c b/src/keyboard.c index a99d14cb4c..d24a0ffe07 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11374,7 +11374,9 @@ DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0, XSETINT (x, (XFIXNUM (x) + WINDOW_LEFT_EDGE_X (w) - + (NILP (whole) + + ((NILP (whole) + && XFIXNUM (y) >= WINDOW_BOX_TOP_PIXEL_EDGE (w) + && XFIXNUM (y) < WINDOW_BOX_HEIGHT_NO_MODE_LINE (w)) ? window_box_left_offset (w, TEXT_AREA) : 0))); XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XFIXNUM (y))); diff --git a/src/window.h b/src/window.h index 2400c422c1..6420706b5f 100644 --- a/src/window.h +++ b/src/window.h @@ -800,6 +800,12 @@ #define WINDOW_BOX_RIGHT_PIXEL_EDGE(W) \ - WINDOW_RIGHT_DIVIDER_WIDTH (W) \ - WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (W)) +/* Return the pixel value where the text in window W starts. */ +#define WINDOW_BOX_TOP_PIXEL_EDGE(W) \ + (WINDOW_TOP_PIXEL_EDGE (W) \ + + WINDOW_HEADER_LINE_HEIGHT (W) \ + + WINDOW_TAB_LINE_HEIGHT (W)) + /* Return the frame x-position at which the text (or left fringe) in window W starts. This does not include a left-hand scroll bar if any. */