12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- (declare-function gpm-mouse-start "term.c" ())
- (defun gpm-mouse-enable ()
- "Try to enable gpm mouse support on the current terminal."
- (let ((activated nil))
- (unwind-protect
- (progn
- (unless (fboundp 'gpm-mouse-start)
- (error "Emacs must be built with Gpm to use this mode"))
- (when gpm-mouse-mode
- (gpm-mouse-start)
- (set-terminal-parameter nil 'gpm-mouse-active t)
- (setq activated t)))
-
-
- (unless activated (gpm-mouse-disable)))))
- (defun gpm-mouse-disable ()
- "Try to disable gpm mouse support on the current terminal."
- (when (fboundp 'gpm-mouse-stop)
- (gpm-mouse-stop))
- (set-terminal-parameter nil 'gpm-mouse-active nil))
- (define-obsolete-function-alias 't-mouse-mode 'gpm-mouse-mode "23.1")
- (define-minor-mode gpm-mouse-mode
- "Toggle mouse support in GNU/Linux consoles (GPM Mouse mode).
- With a prefix argument ARG, enable GPM Mouse mode if ARG is
- positive, and disable it otherwise. If called from Lisp, enable
- the mode if ARG is omitted or nil.
- This allows the use of the mouse when operating on a GNU/Linux console,
- in the same way as you can use the mouse under X11.
- It relies on the `gpm' daemon being activated."
- :global t :group 'mouse :init-value t
- (dolist (terminal (terminal-list))
- (when (and (eq t (terminal-live-p terminal))
- (not (eq gpm-mouse-mode
- (terminal-parameter terminal 'gpm-mouse-active))))
-
- (with-selected-frame (car (frames-on-display-list terminal))
- (if gpm-mouse-mode (gpm-mouse-enable) (gpm-mouse-disable))))))
- (provide 't-mouse)
|