aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2010-11-26 20:15:09 +0200
committerEli Zaretskii2010-11-26 20:15:09 +0200
commit8547874a7cfa4e353f0307c8b614e802d8abfc21 (patch)
tree2327dcba0c8f1442a6f94802d0c8bfa726b9e11e
parentf5462bae4eed999b82c24bbaf17373ddedbf06fd (diff)
downloademacs-8547874a7cfa4e353f0307c8b614e802d8abfc21.tar.gz
emacs-8547874a7cfa4e353f0307c8b614e802d8abfc21.zip
Fix and document components of mouse event position.
src/keyboard.c (make_lispy_position): Put a meaningful value in yret when the click is on the header or mode line. doc/lispref/commands.texi (Click Events): Document the values of X, Y and COL, ROW in the event's position, when the click is on the header or mode line, on the fringes, or in the margins.
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/commands.texi17
-rw-r--r--src/ChangeLog5
-rw-r--r--src/keyboard.c7
4 files changed, 28 insertions, 7 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 8f57bc45da5..d1c2d861eb7 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12010-11-26 Eli Zaretskii <eliz@gnu.org>
2
3 * commands.texi (Click Events): Document the values of X, Y and
4 COL, ROW in the event's position, when the click is on the header
5 or mode line, on the fringes, or in the margins.
6
12010-11-17 Eli Zaretskii <eliz@gnu.org> 72010-11-17 Eli Zaretskii <eliz@gnu.org>
2 8
3 * customize.texi (Composite Types): Lower-case index entry. 9 * customize.texi (Composite Types): Lower-case index entry.
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 17cfcc0def8..d83396750ca 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1285,8 +1285,12 @@ input stream. @xref{Key Sequence Input}.
1285@item @var{x}, @var{y} 1285@item @var{x}, @var{y}
1286These are the pixel coordinates of the click, relative to 1286These are the pixel coordinates of the click, relative to
1287the top left corner of @var{window}, which is @code{(0 . 0)}. 1287the top left corner of @var{window}, which is @code{(0 . 0)}.
1288For the mode or header line, @var{y} does not have meaningful data. 1288For a click on text, these are relative to the top left corner of
1289For the vertical line, @var{x} does not have meaningful data. 1289the window's text area. For the mode or header line, they are
1290relative to the top left window edge. For fringes, margins, and the
1291vertical border, @var{x} does not have meaningful data. For fringes
1292and margins, @var{y} is relative to the bottom edge of the header
1293line.
1290 1294
1291@item @var{timestamp} 1295@item @var{timestamp}
1292This is the time at which the event occurred, in milliseconds. 1296This is the time at which the event occurred, in milliseconds.
@@ -1316,7 +1320,12 @@ the window.
1316@item @var{col}, @var{row} 1320@item @var{col}, @var{row}
1317These are the actual coordinates of the glyph under the @var{x}, 1321These are the actual coordinates of the glyph under the @var{x},
1318@var{y} position, possibly padded with default character width 1322@var{y} position, possibly padded with default character width
1319glyphs if @var{x} is beyond the last glyph on the line. 1323glyphs if @var{x} is beyond the last glyph on the line. For clicks on
1324the header or mode line, these are measured from the top left edge of
1325the header or mode line. For clicks on the fringes and on the
1326vertical border, these have no meaningful data. For clicks on the
1327margins, @var{col} is measured from the left edge of the margin area
1328and @var{row} is measured from the top of the margin area.
1320 1329
1321@item @var{image} 1330@item @var{image}
1322This is the image object on which the click occurred. It is either 1331This is the image object on which the click occurred. It is either
@@ -1333,7 +1342,7 @@ left corner of the character glyph clicked on.
1333These are the pixel width and height of @var{object} or, if this is 1342These are the pixel width and height of @var{object} or, if this is
1334@code{nil}, those of the character glyph clicked on. 1343@code{nil}, those of the character glyph clicked on.
1335@end table 1344@end table
1336 1345
1337@sp 1 1346@sp 1
1338For mouse clicks on a scroll-bar, @var{position} has this form: 1347For mouse clicks on a scroll-bar, @var{position} has this form:
1339 1348
diff --git a/src/ChangeLog b/src/ChangeLog
index 61ef9a202a8..eac550a7334 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12010-11-26 Eli Zaretskii <eliz@gnu.org>
2
3 * keyboard.c (make_lispy_position): Put a meaningful value in yret
4 when the click is on the header or mode line.
5
12010-11-25 Eli Zaretskii <eliz@gnu.org> 62010-11-25 Eli Zaretskii <eliz@gnu.org>
2 7
3 * xdisp.c (set_cursor_from_row): Don't forget to consider the 8 * xdisp.c (set_cursor_from_row): Don't forget to consider the
diff --git a/src/keyboard.c b/src/keyboard.c
index e96d0167fd4..923ac1ad1d9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5283,9 +5283,9 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5283 xret = XINT (x) - window_box_left (w, TEXT_AREA); 5283 xret = XINT (x) - window_box_left (w, TEXT_AREA);
5284 yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); 5284 yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5285 } 5285 }
5286 /* For mode line and header line clicks, return X relative to 5286 /* For mode line and header line clicks, return X, Y relative to
5287 the left window edge; ignore Y. Use mode_line_string to look 5287 the left window edge. Use mode_line_string to look for a
5288 for a string on the click position. */ 5288 string on the click position. */
5289 else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) 5289 else if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
5290 { 5290 {
5291 Lisp_Object string; 5291 Lisp_Object string;
@@ -5305,6 +5305,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5305 ? PT : XMARKER (w->pointm)->charpos; 5305 ? PT : XMARKER (w->pointm)->charpos;
5306 5306
5307 xret = wx; 5307 xret = wx;
5308 yret = wy;
5308 } 5309 }
5309 /* For fringes and margins, Y is relative to the area's (and the 5310 /* For fringes and margins, Y is relative to the area's (and the
5310 window's) top edge, while X is meaningless. */ 5311 window's) top edge, while X is meaningless. */