• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching defs:mouse

1 ;;; t-mouse.el --- mouse support within the text terminal
5 ;; Keywords: mouse gpm linux
28 ;; This package provides access to mouse event as reported by the
29 ;; gpm-Linux package. It uses the program "mev" to get mouse events.
37 (defvar t-mouse-process nil
38 "Embeds the process which passes mouse events to Emacs.
39 It is used by the program t-mouse.")
41 (defvar t-mouse-filter-accumulator ""
42 "Accumulates input from the mouse reporting process.")
44 (defvar t-mouse-debug-buffer nil
46 See `t-mouse-start-debug'.")
48 (defvar t-mouse-current-xy '(0 . 0)
49 "Stores the last mouse position t-mouse has been told about.")
51 (defvar t-mouse-drag-start nil
58 (defvar t-mouse-prev-set-selection-function 'x-set-selection)
59 (defvar t-mouse-prev-get-selection-function 'x-get-selection)
61 (defvar t-mouse-swap-alt-keys nil
62 "When set, Emacs will handle mouse events with the right Alt
66 (defvar t-mouse-fix-21 nil
75 (defun t-mouse-tty ()
95 ;; (read_key_sequence) mouse clicks on funny parts of windows generate
97 ;; That's why Per Abrahamsen's code in xt-mouse.el doesn't work for
103 ;; 'C-S-double-mouse-2) must have an 'event-kind property, set to
104 ;; 'mouse-click. Since events from unread-command-events do not pass
107 ;; hackers to do things similar to t-mouse to lose.
113 (defun t-mouse-powerset (l)
115 (let ((l1 (t-mouse-powerset (cdr l)))
121 (defun t-mouse-cartesian (l1 l2)
124 (t-mouse-cartesian (cdr l1) l2))))
126 (let* ((modifier-sets (t-mouse-powerset '(control meta shift)))
127 (typed-sets (t-mouse-cartesian '((down) (drag))
128 '((mouse-1) (mouse-2) (mouse-3))))
129 (multipled-sets (t-mouse-cartesian '((double) (triple)) typed-sets))
130 (all-sets (t-mouse-cartesian modifier-sets multipled-sets)))
134 (put event-sym 'event-kind 'mouse-click)))
137 (defun t-mouse-make-event-element (x-dot-y-avec-time)
154 (defun t-mouse-make-event ()
155 "Make a Lisp style event from the contents of mouse input accumulator.
161 t-mouse-filter-accumulator)
162 (setq t-mouse-filter-accumulator
164 t-mouse-filter-accumulator (match-end 0))))
165 (read-from-string t-mouse-filter-accumulator))
172 (error "Can't open mouse connection"))
173 (setq t-mouse-filter-accumulator
174 (substring t-mouse-filter-accumulator (cdr ob-pos)))
181 (if t-mouse-fix-21
203 ;;store current position for mouse-position
205 (setq t-mouse-current-xy (nth 0 current-xy-avec-time))
213 (or t-mouse-drag-start
214 (t-mouse-make-event-element (nth 3 ob))))
216 (t-mouse-make-event-element current-xy-avec-time)))
217 (setq t-mouse-drag-start nil)
222 (t-mouse-make-event-element current-xy-avec-time)))
223 (if (and (not t-mouse-drag-start)
226 (setq t-mouse-drag-start (copy-sequence element))
227 (setq t-mouse-drag-start nil))
231 (nth 1 t-mouse-drag-start)) 'scroll-bar-movement
232 'mouse-movement)
233 (t-mouse-make-event-element current-xy-avec-time))))))))
235 (defun t-mouse-process-filter (proc string)
236 (setq t-mouse-filter-accumulator
237 (concat t-mouse-filter-accumulator string))
238 (let ((event (t-mouse-make-event)))
240 (if (or track-mouse
241 (not (eq 'mouse-movement (event-basic-type event))))
244 (if t-mouse-debug-buffer
245 (print unread-command-events t-mouse-debug-buffer))
246 (setq event (t-mouse-make-event)))))
248 (defun t-mouse-mouse-position-function (pos)
249 "Return the t-mouse-position unless running with a window system.
251 (setcdr pos t-mouse-current-xy)
262 (and t-mouse-process
263 ;(stop-process t-mouse-process)
265 t-mouse-process "push -enone -dall -Mnone\n")))))
269 (and t-mouse-process
270 ;(continue-process t-mouse-process)
271 (process-send-string t-mouse-process "pop\n")))))
274 (define-minor-mode t-mouse-mode
275 "Toggle t-mouse mode to use the mouse in Linux consoles.
276 With prefix arg, turn t-mouse mode on iff arg is positive.
278 This allows the use of the mouse when operating on a Linux console, in the
279 same way as you can use the mouse under X11.
282 (if t-mouse-mode
285 ;; Starts getting a stream of mouse events from an asynchronous process.
288 (setq mouse-position-function #'t-mouse-mouse-position-function)
289 (let ((tty (t-mouse-tty))
293 (setq t-mouse-process
294 (start-process "t-mouse" nil
296 (if t-mouse-swap-alt-keys
301 (setq t-mouse-filter-accumulator "")
302 (set-process-filter t-mouse-process 't-mouse-process-filter)
303 (set-process-query-on-exit-flag t-mouse-process nil)))
305 (setq mouse-position-function nil)
306 (delete-process t-mouse-process)
307 (setq t-mouse-process nil)))
309 (provide 't-mouse)
312 ;;; t-mouse.el ends here