diff options
| author | Kim F. Storm | 2004-01-06 23:04:44 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-01-06 23:04:44 +0000 |
| commit | 4385264a7d76a470557075c8bc283079c9e28ab6 (patch) | |
| tree | a6fa4f6f953a11c0e1be180c82f393fd296d093e /lisp | |
| parent | 349c653ee57a17fed33bf359e2ef965f58d03a4c (diff) | |
| download | emacs-4385264a7d76a470557075c8bc283079c9e28ab6.tar.gz emacs-4385264a7d76a470557075c8bc283079c9e28ab6.zip | |
(event-start, event-end): Doc fix.
(posn-string, posn-image): New defuns.
(posn-object): Return either image or string object.
(posn-object-x-y): Return 8th element of position.
(posn-object-width-height): New defun.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/subr.el | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index b251ab6573a..cd3eefe2520 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -665,7 +665,8 @@ If EVENT is a mouse press or a mouse click, this returns the location | |||
| 665 | of the event. | 665 | of the event. |
| 666 | If EVENT is a drag, this returns the drag's starting position. | 666 | If EVENT is a drag, this returns the drag's starting position. |
| 667 | The return value is of the form | 667 | The return value is of the form |
| 668 | (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)) | 668 | (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) |
| 669 | IMAGE (DX . DY) (WIDTH . HEIGHT)) | ||
| 669 | The `posn-' functions access elements of such lists." | 670 | The `posn-' functions access elements of such lists." |
| 670 | (if (consp event) (nth 1 event) | 671 | (if (consp event) (nth 1 event) |
| 671 | (list (selected-window) (point) '(0 . 0) 0))) | 672 | (list (selected-window) (point) '(0 . 0) 0))) |
| @@ -674,7 +675,8 @@ The `posn-' functions access elements of such lists." | |||
| 674 | "Return the ending location of EVENT. EVENT should be a click or drag event. | 675 | "Return the ending location of EVENT. EVENT should be a click or drag event. |
| 675 | If EVENT is a click event, this function is the same as `event-start'. | 676 | If EVENT is a click event, this function is the same as `event-start'. |
| 676 | The return value is of the form | 677 | The return value is of the form |
| 677 | (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)) | 678 | (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) |
| 679 | IMAGE (DX . DY) (WIDTH . HEIGHT)) | ||
| 678 | The `posn-' functions access elements of such lists." | 680 | The `posn-' functions access elements of such lists." |
| 679 | (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) | 681 | (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) |
| 680 | (list (selected-window) (point) '(0 . 0) 0))) | 682 | (list (selected-window) (point) '(0 . 0) 0))) |
| @@ -757,17 +759,35 @@ POSITION should be a list of the form returned by the `event-start' | |||
| 757 | and `event-end' functions." | 759 | and `event-end' functions." |
| 758 | (nth 3 position)) | 760 | (nth 3 position)) |
| 759 | 761 | ||
| 760 | (defsubst posn-object (position) | 762 | (defsubst posn-string (position) |
| 761 | "Return the object of POSITION. | 763 | "Return the string object of POSITION, or nil if a buffer position. |
| 762 | POSITION should be a list of the form returned by the `event-start' | 764 | POSITION should be a list of the form returned by the `event-start' |
| 763 | and `event-end' functions." | 765 | and `event-end' functions." |
| 764 | (nth 4 position)) | 766 | (nth 4 position)) |
| 765 | 767 | ||
| 768 | (defsubst posn-image (position) | ||
| 769 | "Return the image object of POSITION, or nil if a not an image. | ||
| 770 | POSITION should be a list of the form returned by the `event-start' | ||
| 771 | and `event-end' functions." | ||
| 772 | (nth 7 position)) | ||
| 773 | |||
| 774 | (defsubst posn-object (position) | ||
| 775 | "Return the object (image or string) of POSITION. | ||
| 776 | POSITION should be a list of the form returned by the `event-start' | ||
| 777 | and `event-end' functions." | ||
| 778 | (or (posn-image position) (posn-string position))) | ||
| 779 | |||
| 766 | (defsubst posn-object-x-y (position) | 780 | (defsubst posn-object-x-y (position) |
| 767 | "Return the x and y coordinates relative to the object of POSITION. | 781 | "Return the x and y coordinates relative to the object of POSITION. |
| 768 | POSITION should be a list of the form returned by the `event-start' | 782 | POSITION should be a list of the form returned by the `event-start' |
| 769 | and `event-end' functions." | 783 | and `event-end' functions." |
| 770 | (nth 7 position)) | 784 | (nth 8 position)) |
| 785 | |||
| 786 | (defsubst posn-object-width-height (position) | ||
| 787 | "Return the pixel width and height of the object of POSITION. | ||
| 788 | POSITION should be a list of the form returned by the `event-start' | ||
| 789 | and `event-end' functions." | ||
| 790 | (nth 9 position)) | ||
| 771 | 791 | ||
| 772 | 792 | ||
| 773 | ;;;; Obsolescent names for functions. | 793 | ;;;; Obsolescent names for functions. |