Mercurial > emacs
view lisp/term/sup-mouse.el @ 20892:18f3cb26243f before-miles-orphaned-changes gcc-2_8_1-980401 gcc-2_8_1-980407 gcc-2_8_1-980412 gcc-2_8_1-980413 gcc-2_8_1-RELEASE gcc_2_8_1-980315 libc-980214 libc-980215 libc-980216 libc-980217 libc-980218 libc-980219 libc-980220 libc-980221 libc-980222 libc-980223 libc-980224 libc-980225 libc-980226 libc-980227 libc-980228 libc-980301 libc-980302 libc-980303 libc-980304 libc-980306 libc-980307 libc-980308 libc-980309 libc-980310 libc-980311 libc-980312 libc-980313 libc-980314 libc-980315 libc-980316 libc-980317 libc-980318 libc-980319 libc-980320 libc-980321 libc-980322 libc-980323 libc-980324 libc-980325 libc-980326 libc-980327 libc-980328 libc-980329 libc-980330 libc-980331 libc-980401 libc-980402 libc-980403 libc-980404 libc-980405 libc-980406 libc-980407 libc-980408 libc-980409 libc-980410 libc-980411 libc-980412 libc-980413 libc-980414 libc-980428 libc-980429 libc-980430 libc-980501 libc-980502 libc-980503 libc-980504 libc-980505 libc-980506 libc-980507 libc-980508 libc-980509 libc-980510 libc-980512 libc-980513 libc-980514 libc-980515 libc-980516 libc-980517 libc-980518 libc-980519 libc-980520 libc-980521 libc-980522 libc-980523 libc-980524 libc-980525 libc-980526 libc-980527 libc-980528 libc-980529 libc-980530 libc-980531 libc-980601 libc-980602 libc-980603 libc-980604 libc-980605 libc-980606 libc-980607 libc-980608 libc-980609 libc-980610 libc-980611 libc-980612 libc-980613
Add PentiumII (i786). Add '7' to all i[3456] entries.
Add AMD and Cyrix names for P5 and P6.
author | Richard Kenner <kenner@gnu.org> |
---|---|
date | Fri, 13 Feb 1998 12:16:46 +0000 |
parents | 23cc3f54e536 |
children | 275ab94028be |
line wrap: on
line source
;;; sup-mouse.el --- supdup mouse support for lisp machines ;; Copyright (C) Free Software Foundation 1985, 1986 ;; Author: Wolfgang Rupprecht ;; Maintainer: FSF ;; Created: 21 Nov 1986 ;; Keywords: hardware ;; (from code originally written by John Robinson@bbn for the bitgraph) ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: ;;; User customization option: (defvar sup-mouse-fast-select-window nil "*Non-nil for mouse hits to select new window, then execute; else just select.") (defconst mouse-left 0) (defconst mouse-center 1) (defconst mouse-right 2) (defconst mouse-2left 4) (defconst mouse-2center 5) (defconst mouse-2right 6) (defconst mouse-3left 8) (defconst mouse-3center 9) (defconst mouse-3right 10) ;;; Defuns: (defun sup-mouse-report () "This function is called directly by the mouse, it parses and executes the mouse commands. L move point * |---- These apply for mouse click in a window. 2L delete word | 3L copy word | If sup-mouse-fast-select-window is nil, C move point and yank * | just selects that window. 2C yank pop | R set mark * | 2R delete region | 3R copy region | on modeline on \"scroll bar\" in minibuffer L scroll-up line to top execute-extended-command C proportional goto-char line to middle mouse-help R scroll-down line to bottom eval-expression" (interactive) (let* ;; expect a string of <esc>:<buttons>;<x-pos>;<y-pos>c ((buttons (sup-get-tty-num ?\;)) (x (sup-get-tty-num ?\;)) (y (sup-get-tty-num ?c)) (window (sup-pos-to-window x y)) (edges (window-edges window)) (old-window (selected-window)) (in-minibuf-p (eq y (1- (frame-height)))) (same-window-p (and (not in-minibuf-p) (eq window old-window))) (in-modeline-p (eq y (1- (nth 3 edges)))) (in-scrollbar-p (>= x (1- (nth 2 edges))))) (setq x (- x (nth 0 edges))) (setq y (- y (nth 1 edges))) ; (error "mouse-hit %d %d %d" buttons x y) ;;;; debug (cond (in-modeline-p (select-window window) (cond ((= buttons mouse-left) (scroll-up)) ((= buttons mouse-right) (scroll-down)) ((= buttons mouse-center) (goto-char (/ (* x (- (point-max) (point-min))) (1- (window-width)))) (beginning-of-line) (what-cursor-position))) (select-window old-window)) (in-scrollbar-p (select-window window) (scroll-up (cond ((= buttons mouse-left) y) ((= buttons mouse-right) (+ y (- 2 (window-height)))) ((= buttons mouse-center) (/ (+ 2 y y (- (window-height))) 2)) (t 0))) (select-window old-window)) (same-window-p (cond ((= buttons mouse-left) (sup-move-point-to-x-y x y)) ((= buttons mouse-2left) (sup-move-point-to-x-y x y) (kill-word 1)) ((= buttons mouse-3left) (sup-move-point-to-x-y x y) (save-excursion (copy-region-as-kill (point) (progn (forward-word 1) (point)))) (setq this-command 'yank) ) ((= buttons mouse-right) (push-mark) (sup-move-point-to-x-y x y) (exchange-point-and-mark)) ((= buttons mouse-2right) (push-mark) (sup-move-point-to-x-y x y) (kill-region (mark) (point))) ((= buttons mouse-3right) (push-mark) (sup-move-point-to-x-y x y) (copy-region-as-kill (mark) (point)) (setq this-command 'yank)) ((= buttons mouse-center) (sup-move-point-to-x-y x y) (setq this-command 'yank) (yank)) ((= buttons mouse-2center) (yank-pop 1)) ) ) (in-minibuf-p (cond ((= buttons mouse-right) (call-interactively 'eval-expression)) ((= buttons mouse-left) (call-interactively 'execute-extended-command)) ((= buttons mouse-center) (describe-function 'sup-mouse-report)); silly self help )) (t ;in another window (select-window window) (cond ((not sup-mouse-fast-select-window)) ((= buttons mouse-left) (sup-move-point-to-x-y x y)) ((= buttons mouse-right) (push-mark) (sup-move-point-to-x-y x y) (exchange-point-and-mark)) ((= buttons mouse-center) (sup-move-point-to-x-y x y) (setq this-command 'yank) (yank)) )) ))) (defun sup-get-tty-num (term-char) "Read from terminal until TERM-CHAR is read, and return intervening number. Upon non-numeric not matching TERM-CHAR signal an error." (let ((num 0) (char (read-char))) (while (and (>= char ?0) (<= char ?9)) (setq num (+ (* num 10) (- char ?0))) (setq char (read-char))) (or (eq term-char char) (error "Invalid data format in mouse command")) num)) (defun sup-move-point-to-x-y (x y) "Position cursor in window coordinates. X and Y are 0-based character positions in the window." (move-to-window-line y) (move-to-column x) ) (defun sup-pos-to-window (x y) "Find window corresponding to frame coordinates. X and Y are 0-based character positions on the frame." (let ((edges (window-edges)) (window nil)) (while (and (not (eq window (selected-window))) (or (< y (nth 1 edges)) (>= y (nth 3 edges)) (< x (nth 0 edges)) (>= x (nth 2 edges)))) (setq window (next-window window)) (setq edges (window-edges window)) ) (or window (selected-window)) ) ) ;;; sup-mouse.el ends here