aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-06-24 20:11:31 +0000
committerRichard M. Stallman2004-06-24 20:11:31 +0000
commit6e41ce9c47ae6e4900682e07e09c70da924c3263 (patch)
tree89d300130e398edb2ab4469fa79f7c49008a0904
parenteb8f5dabec503e90e6eca2d0381ba4ee1da5db9b (diff)
downloademacs-6e41ce9c47ae6e4900682e07e09c70da924c3263.tar.gz
emacs-6e41ce9c47ae6e4900682e07e09c70da924c3263.zip
(Accessing Events): Clarify posn-col-row and posn-actual-col-row.
(Accessing Events): New functions posn-at-point and posn-at-x-y. Add example to posn-x-y.
-rw-r--r--lispref/commands.texi55
1 files changed, 45 insertions, 10 deletions
diff --git a/lispref/commands.texi b/lispref/commands.texi
index 5a38179996f..44f0807ea02 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -1695,7 +1695,7 @@ position such events have.
1695@end defun 1695@end defun
1696 1696
1697@cindex mouse position list, accessing 1697@cindex mouse position list, accessing
1698 These seven functions take a position list as described above, and 1698 These functions take a position list as described above, and
1699return various parts of it. 1699return various parts of it.
1700 1700
1701@defun posn-window position 1701@defun posn-window position
@@ -1716,23 +1716,37 @@ is undefined.
1716@end defun 1716@end defun
1717 1717
1718@defun posn-x-y position 1718@defun posn-x-y position
1719Return the pixel-based x and y coordinates in @var{position}, as a cons 1719Return the pixel-based x and y coordinates in @var{position}, as a
1720cell @code{(@var{x} . @var{y})}. 1720cons cell @code{(@var{x} . @var{y})}. These coordinates are relative
1721to the window given by @code{posn-window}.
1722
1723This example shows how to convert these window-relative coordinates
1724into frame-relative coordinates:
1725
1726@example
1727(defun frame-relative-coordinates (position)
1728 "Return frame-relative coordinates from POSITION."
1729 (let* ((x-y (posn-x-y position))
1730 (window (posn-window position))
1731 (edges (window-inside-pixel-edges window)))
1732 (cons (+ (car x-y) (car edges))
1733 (+ (cdr x-y) (cadr edges)))))
1734@end example
1721@end defun 1735@end defun
1722 1736
1723@defun posn-col-row position 1737@defun posn-col-row position
1724Return the row and column (in units of frame default characters) of 1738Return the row and column (in units of the frame's default character
1725@var{position}, as a cons cell @code{(@var{col} . @var{row})}. These 1739height and width) of @var{position}, as a cons cell @code{(@var{col} .
1726are computed from the @var{x} and @var{y} values actually found in 1740@var{row})}. These are computed from the @var{x} and @var{y} values
1727@var{position}. 1741actually found in @var{position}.
1728@end defun 1742@end defun
1729 1743
1730@defun posn-actual-col-row position 1744@defun posn-actual-col-row position
1731Return the actual row and column in @var{position}, as a cons cell 1745Return the actual row and column in @var{position}, as a cons cell
1732@code{(@var{col} . @var{row})}. The values are the actual row number 1746@code{(@var{col} . @var{row})}. The values are the actual row number
1733in the window, and the actual character number in that row. Return 1747in the window, and the actual character number in that row. It returns
1734@code{nil} if @var{position} does not include the actual positions; in that 1748@code{nil} if @var{position} does not include actual positions values.
1735case, @code{posn-col-row} can be used to get approximate values. 1749You can use @code{posn-col-row} to get approximate values.
1736@end defun 1750@end defun
1737 1751
1738@defun posn-string position 1752@defun posn-string position
@@ -1771,6 +1785,27 @@ Return the timestamp in @var{position}. This is the time at which the
1771event occurred, in milliseconds. 1785event occurred, in milliseconds.
1772@end defun 1786@end defun
1773 1787
1788 These functions compute a position list given particular buffer
1789position or screen position. You can access the data in this position
1790list with the functions described above.
1791
1792@defun posn-at-point &optional pos window
1793This function returns a position list for position @var{pos} in
1794@var{window}. @var{pos} defaults to point in @var{window};
1795@var{window} defaults to the selected window.
1796
1797@code{posn-at-point} returns @code{nil} if @var{pos} is not visible in
1798@var{window}.
1799@end defun
1800
1801@defun posn-at-x-y x y &optional frame-or-window
1802This function returns position information corresponding to pixel
1803coordinates @var{x} and @var{y} in a specified frame or window,
1804@var{frame-or-window}, which defaults to the selected window.
1805The coordinates @var{x} and @var{y} are relative to the
1806frame or window used.
1807@end defun
1808
1774 These functions are useful for decoding scroll bar events. 1809 These functions are useful for decoding scroll bar events.
1775 1810
1776@defun scroll-bar-event-ratio event 1811@defun scroll-bar-event-ratio event