comparison lisp/mouse.el @ 2070:95996f2ad1c6

(posn-timestamp, posn-col-row, posn-point, posn-window): (event-end, event-start, mouse-movement-p): Moved to subr.el.
author Richard M. Stallman <rms@gnu.org>
date Mon, 08 Mar 1993 08:09:54 +0000
parents 263033210413
children 4f9d60f7de9d
comparison
equal deleted inserted replaced
2069:2859675b5e11 2070:95996f2ad1c6
1 ;;; mouse.el --- window system-independent mouse support. 1 ;;; mouse.el --- window system-independent mouse support.
2 2
3 ;;; Copyright (C) 1988, 1992, 1993 Free Software Foundation, Inc. 3 ;;; Copyright (C) 1993 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 ;; Keywords: hardware 6 ;; Keywords: hardware
7 7
8 ;;; This file is part of GNU Emacs. 8 ;;; This file is part of GNU Emacs.
19 19
20 ;;; You should have received a copy of the GNU General Public License 20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Emacs; see the file COPYING. If not, write to 21 ;;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 22 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 23
24
25 ;;; Utility functions. 24 ;;; Utility functions.
26
27 (defsubst mouse-movement-p (object)
28 "Return non-nil if OBJECT is a mouse movement event."
29 (and (consp object)
30 (eq (car object) 'mouse-movement)))
31
32 (defsubst event-start (event)
33 "Return the starting position of EVENT.
34 If EVENT is a mouse press or a mouse click, this returns the location
35 of the event.
36 If EVENT is a drag, this returns the drag's starting position.
37 The return value is of the form
38 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
39 The `posn-' functions access elements of such lists."
40 (nth 1 event))
41
42 (defsubst event-end (event)
43 "Return the ending location of EVENT. EVENT should be a click or drag event.
44 If EVENT is a click event, this function is the same as `event-start'.
45 The return value is of the form
46 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
47 The `posn-' functions access elements of such lists."
48 (nth (1- (length event)) event))
49
50 (defsubst posn-window (position)
51 "Return the window in POSITION.
52 POSITION should be a list of the form
53 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
54 as returned by the `event-start' and `event-end' functions."
55 (nth 0 position))
56
57 (defsubst posn-point (position)
58 "Return the buffer location in POSITION.
59 POSITION should be a list of the form
60 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
61 as returned by the `event-start' and `event-end' functions."
62 (nth 1 position))
63
64 (defsubst posn-col-row (position)
65 "Return the row and column in POSITION.
66 POSITION should be a list of the form
67 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
68 as returned by the `event-start' and `event-end' functions."
69 (nth 2 position))
70
71 (defsubst posn-timestamp (position)
72 "Return the timestamp of POSITION.
73 POSITION should be a list of the form
74 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
75 nas returned by the `event-start' and `event-end' functions."
76 (nth 3 position))
77 25
78 ;;; Indent track-mouse like progn. 26 ;;; Indent track-mouse like progn.
79 (put 'track-mouse 'lisp-indent-function 0) 27 (put 'track-mouse 'lisp-indent-function 0)
80 28
81 29