1695 |
@end defun |
@end defun |
1696 |
|
|
1697 |
@cindex mouse position list, accessing |
@cindex mouse position list, accessing |
1698 |
These seven functions take a position list as described above, and |
These functions take a position list as described above, and |
1699 |
return various parts of it. |
return various parts of it. |
1700 |
|
|
1701 |
@defun posn-window position |
@defun posn-window position |
1716 |
@end defun |
@end defun |
1717 |
|
|
1718 |
@defun posn-x-y position |
@defun posn-x-y position |
1719 |
Return the pixel-based x and y coordinates in @var{position}, as a cons |
Return the pixel-based x and y coordinates in @var{position}, as a |
1720 |
cell @code{(@var{x} . @var{y})}. |
cons cell @code{(@var{x} . @var{y})}. These coordinates are relative |
1721 |
|
to the window given by @code{posn-window}. |
1722 |
|
|
1723 |
|
This example shows how to convert these window-relative coordinates |
1724 |
|
into 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 |
1735 |
@end defun |
@end defun |
1736 |
|
|
1737 |
@defun posn-col-row position |
@defun posn-col-row position |
1738 |
Return the row and column (in units of frame default characters) of |
Return the row and column (in units of the frame's default character |
1739 |
@var{position}, as a cons cell @code{(@var{col} . @var{row})}. These |
height and width) of @var{position}, as a cons cell @code{(@var{col} . |
1740 |
are computed from the @var{x} and @var{y} values actually found in |
@var{row})}. These are computed from the @var{x} and @var{y} values |
1741 |
@var{position}. |
actually found in @var{position}. |
1742 |
@end defun |
@end defun |
1743 |
|
|
1744 |
@defun posn-actual-col-row position |
@defun posn-actual-col-row position |
1745 |
Return the actual row and column in @var{position}, as a cons cell |
Return the actual row and column in @var{position}, as a cons cell |
1746 |
@code{(@var{col} . @var{row})}. The values are the actual row number |
@code{(@var{col} . @var{row})}. The values are the actual row number |
1747 |
in the window, and the actual character number in that row. Return |
in the window, and the actual character number in that row. It returns |
1748 |
@code{nil} if @var{position} does not include the actual positions; in that |
@code{nil} if @var{position} does not include actual positions values. |
1749 |
case, @code{posn-col-row} can be used to get approximate values. |
You can use @code{posn-col-row} to get approximate values. |
1750 |
@end defun |
@end defun |
1751 |
|
|
1752 |
@defun posn-string position |
@defun posn-string position |
1785 |
event occurred, in milliseconds. |
event occurred, in milliseconds. |
1786 |
@end defun |
@end defun |
1787 |
|
|
1788 |
|
These functions compute a position list given particular buffer |
1789 |
|
position or screen position. You can access the data in this position |
1790 |
|
list with the functions described above. |
1791 |
|
|
1792 |
|
@defun posn-at-point &optional pos window |
1793 |
|
This 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 |
1802 |
|
This function returns position information corresponding to pixel |
1803 |
|
coordinates @var{x} and @var{y} in a specified frame or window, |
1804 |
|
@var{frame-or-window}, which defaults to the selected window. |
1805 |
|
The coordinates @var{x} and @var{y} are relative to the |
1806 |
|
frame or window used. |
1807 |
|
@end defun |
1808 |
|
|
1809 |
These functions are useful for decoding scroll bar events. |
These functions are useful for decoding scroll bar events. |
1810 |
|
|
1811 |
@defun scroll-bar-event-ratio event |
@defun scroll-bar-event-ratio event |