/[emacs]/emacs/lisp/term/sun-mouse.el
ViewVC logotype

Diff of /emacs/lisp/term/sun-mouse.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by pj, Sun Jan 13 10:07:32 2002 UTC revision 1.22.4.1 by miles, Fri Apr 4 06:20:37 2003 UTC
# Line 31  Line 31 
31  ;;     Modeled after the GNUEMACS keymap interface.  ;;     Modeled after the GNUEMACS keymap interface.
32  ;;  ;;
33  ;; User Functions:  ;; User Functions:
34  ;;   make-mousemap, copy-mousemap,  ;;   make-mousemap, copy-mousemap,
35  ;;   define-mouse, global-set-mouse, local-set-mouse,  ;;   define-mouse, global-set-mouse, local-set-mouse,
36  ;;   use-global-mousemap, use-local-mousemap,  ;;   use-global-mousemap, use-local-mousemap,
37  ;;   mouse-lookup, describe-mouse-bindings  ;;   mouse-lookup, describe-mouse-bindings
# Line 197  Just like the Common Lisp function of th Line 197  Just like the Common Lisp function of th
197  YESMINI says to include the minibuffer as a window.  YESMINI says to include the minibuffer as a window.
198  This is a macro, and does not evaluate its arguments."  This is a macro, and does not evaluate its arguments."
199    `(let ((OriginallySelectedWindow (selected-window)))    `(let ((OriginallySelectedWindow (selected-window)))
200      (unwind-protect      (unwind-protect
201           (while (progn           (while (progn
202                    ,form                    ,form
203                    (not (eq OriginallySelectedWindow                    (not (eq OriginallySelectedWindow
# Line 232  Handles wrapped and horizontally scrolle Line 232  Handles wrapped and horizontally scrolle
232    
233  (defun sun-mouse-handler (&optional hit)  (defun sun-mouse-handler (&optional hit)
234    "Evaluates the function or list associated with a mouse hit.    "Evaluates the function or list associated with a mouse hit.
235  Expecting to read a hit, which is a list: (button x y delta).    Expecting to read a hit, which is a list: (button x y delta).
236  A form bound to button by define-mouse is found by mouse-lookup.  A form bound to button by define-mouse is found by mouse-lookup.
237  The variables: *mouse-window*, *mouse-x*, *mouse-y* are bound.    The variables: *mouse-window*, *mouse-x*, *mouse-y* are bound.
238  If the form is a symbol (symbolp), it is funcall'ed with *mouse-window*,  If the form is a symbol (symbolp), it is funcall'ed with *mouse-window*,
239  *mouse-x*, and *mouse-y* as arguments; if the form is a list (listp),  *mouse-x*, and *mouse-y* as arguments; if the form is a list (listp),
240  the form is eval'ed; if the form is neither of these, it is an error.  the form is eval'ed; if the form is neither of these, it is an error.
# Line 250  Returns nil." Line 250  Returns nil."
250                      (mouse-lookup mouse-code))))                      (mouse-lookup mouse-code))))
251          (cond ((null form)          (cond ((null form)
252                 (if (not (sm::hit-up-p hit))     ; undefined up hits are ok.                 (if (not (sm::hit-up-p hit))     ; undefined up hits are ok.
253                     (error "Undefined mouse event: %s"                     (error "Undefined mouse event: %s"
254                            (prin1-to-string                            (prin1-to-string
255                             (mouse-code-to-mouse-list mouse-code)))))                             (mouse-code-to-mouse-list mouse-code)))))
256                ((symbolp form)                ((symbolp form)
257                 (setq this-command form)                 (setq this-command form)
# Line 276  Returns nil." Line 276  Returns nil."
276          (let ((hit2 (mouse-second-hit extra-click-wait)))          (let ((hit2 (mouse-second-hit extra-click-wait)))
277            (if hit2      ; we cons'd it, we can smash it.            (if hit2      ; we cons'd it, we can smash it.
278                ; (setf (sm::hit-code hit1) (logior (sm::hit-code hit1) ...))                ; (setf (sm::hit-code hit1) (logior (sm::hit-code hit1) ...))
279                (setcar hit1 (logior (sm::hit-code hit1)                (setcar hit1 (logior (sm::hit-code hit1)
280                                     (sm::hit-code hit2)                                     (sm::hit-code hit2)
281                                     (if (= (sm::hit-button hit1)                                     (if (= (sm::hit-button hit1)
282                                            (sm::hit-button hit2))                                            (sm::hit-button hit2))
283                                         sm::DoubleBits 0))))))                                         sm::DoubleBits 0))))))
284      hit1))      hit1))
# Line 288  Returns nil." Line 288  Returns nil."
288  but that uses minibuffer, and mucks up last-command."  but that uses minibuffer, and mucks up last-command."
289    (let ((char-list nil) (char nil))    (let ((char-list nil) (char nil))
290      (while (not (equal 13               ; Carriage return.      (while (not (equal 13               ; Carriage return.
291                         (prog1 (setq char (read-char))                         (prog1 (setq char (read-char))
292                           (setq char-list (cons char char-list))))))                           (setq char-list (cons char char-list))))))
293      (read (mapconcat 'char-to-string (nreverse char-list) ""))      (read (mapconcat 'char-to-string (nreverse char-list) ""))
294      ))      ))
# Line 339  but that uses minibuffer, and mucks up l Line 339  but that uses minibuffer, and mucks up l
339  Returns list (window x y) where x and y are relative to window."  Returns list (window x y) where x and y are relative to window."
340    (or    (or
341     (catch 'found     (catch 'found
342       (eval-in-windows       (eval-in-windows
343        (let ((we (window-edges (selected-window))))        (let ((we (window-edges (selected-window))))
344          (let ((le (nth 0 we))          (let ((le (nth 0 we))
345                (te (nth 1 we))                (te (nth 1 we))
# Line 355  Returns list (window x y) where x and y Line 355  Returns list (window x y) where x and y
355    
356            (if (and (>= x le) (< x re)            (if (and (>= x le) (< x re)
357                     (>= y te) (< y be))                     (>= y te) (< y be))
358                (throw 'found                (throw 'found
359                       (list (selected-window) (- x le) (- y te))))))                       (list (selected-window) (- x le) (- y te))))))
360        t))                               ; include minibuffer in eval-in-windows        t))                               ; include minibuffer in eval-in-windows
361     ;;If x,y from a real mouse click, we shouldn't get here.     ;;If x,y from a real mouse click, we shouldn't get here.
# Line 390  Returns one of (text scrollbar modeline Line 390  Returns one of (text scrollbar modeline
390  ;;; The encoding of mouse events into a mousemap.  ;;; The encoding of mouse events into a mousemap.
391  ;;; These values must agree with coding in emacstool:  ;;; These values must agree with coding in emacstool:
392  ;;;  ;;;
393  (defconst sm::keyword-alist  (defconst sm::keyword-alist
394    '((left . 1) (middle . 2) (right . 4)    '((left . 1) (middle . 2) (right . 4)
395      (shift . 8) (control . 16) (meta . 32) (double . 64) (up . 128)      (shift . 8) (control . 16) (meta . 32) (double . 64) (up . 128)
396      (text . 256) (scrollbar . 512) (modeline . 1024) (minibuffer . 2048)      (text . 256) (scrollbar . 512) (modeline . 1024) (minibuffer . 2048)
# Line 592  of MENU.  MENU (or its symbol-value) sho Line 592  of MENU.  MENU (or its symbol-value) sho
592  the FORM associated with the selected STRING is evaluated,  the FORM associated with the selected STRING is evaluated,
593  and the resulting value is returned.  Generally these FORMs are  and the resulting value is returned.  Generally these FORMs are
594  evaluated for their side-effects rather than their values.  evaluated for their side-effects rather than their values.
595    If the selected form is a menu or a symbol whose value is a menu,    If the selected form is a menu or a symbol whose value is a menu,
596  then it is displayed and evaluated as a pullright menu item.  then it is displayed and evaluated as a pullright menu item.
597    If the FORM of the first ITEM is nil, the STRING of the item    If the FORM of the first ITEM is nil, the STRING of the item
598  is used as a label for the menu, i.e. it's inverted and not selectable."  is used as a label for the menu, i.e. it's inverted and not selectable."
# Line 603  is used as a label for the menu, i.e. it Line 603  is used as a label for the menu, i.e. it
603  (defun sun-get-frame-data (code)  (defun sun-get-frame-data (code)
604    "Sends the tty-sub-window escape sequence CODE to terminal,    "Sends the tty-sub-window escape sequence CODE to terminal,
605  and returns a cons of the two numbers in returned escape sequence.  and returns a cons of the two numbers in returned escape sequence.
606  That is it returns (cons <car> <cdr>) from \"\\E[n;<car>;<cdr>t\".  That is it returns (cons <car> <cdr>) from \"\\E[n;<car>;<cdr>t\".
607  CODE values: 13 = Tool-Position, 14 = Size-in-Pixels, 18 = Size-in-Chars."  CODE values: 13 = Tool-Position, 14 = Size-in-Pixels, 18 = Size-in-Chars."
608    (send-string-to-terminal (concat "\033[" (int-to-string code) "t"))    (send-string-to-terminal (concat "\033[" (int-to-string code) "t"))
609    (let (char str x y)    (let (char str x y)
# Line 623  CODE values: 13 = Tool-Position, 14 = Si Line 623  CODE values: 13 = Tool-Position, 14 = Si
623          (chr (sun-get-frame-data 18)))  ; returns size in chars          (chr (sun-get-frame-data 18)))  ; returns size in chars
624      (cons (/ (car pix) (car chr)) (/ (cdr pix) (cdr chr)))))      (cons (/ (car pix) (car chr)) (/ (cdr pix) (cdr chr)))))
625    
626  (defvar sm::menu-kludge-x nil  (defvar sm::menu-kludge-x nil
627    "Cached frame-to-window X-Offset for sm::menu-kludge")    "Cached frame-to-window X-Offset for sm::menu-kludge")
628  (defvar sm::menu-kludge-y nil  (defvar sm::menu-kludge-y nil
629    "Cached frame-to-window Y-Offset for sm::menu-kludge")    "Cached frame-to-window Y-Offset for sm::menu-kludge")
630    
631  (defun sm::menu-kludge ()  (defun sm::menu-kludge ()
# Line 661  Insert contents into the current buffer Line 661  Insert contents into the current buffer
661  (defun suspend-emacstool (&optional stuffstring)  (defun suspend-emacstool (&optional stuffstring)
662    "Suspend emacstool.    "Suspend emacstool.
663  If running under as a detached process emacstool,  If running under as a detached process emacstool,
664  you don't want to suspend  (there is no way to resume),  you don't want to suspend  (there is no way to resume),
665  just close the window, and wait for reopening."  just close the window, and wait for reopening."
666    (interactive)    (interactive)
667    (run-hooks 'suspend-hook)    (run-hooks 'suspend-hook)

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.22.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26