Mercurial > emacs
annotate lisp/flow-ctrl.el @ 1717:aa7d6d57504b
* frame.h (struct frame): New fields `can_have_scrollbars' and
`has_vertical_scrollbars'.
(FRAME_CAN_HAVE_SCROLLBARS, FRAME_HAS_VERTICAL_SCROLLBARS): New
accessors, for both the MULTI_FRAME and non-MULTI_FRAME.
(VERTICAL_SCROLLBAR_WIDTH, WINDOW_VERTICAL_SCROLLBAR,
WINDOW_VERTICAL_SCROLLBAR_COLUMN,
WINDOW_VERTICAL_SCROLLBAR_HEIGHT): New macros.
* window.h (struct window): New field `vertical_scrollbar'.
* xterm.h (struct x_display): vertical_scrollbars,
judge_timestamp, vertical_scrollbar_extra: New fields.
(struct scrollbar): New struct.
(VERTICAL_SCROLLBAR_PIXEL_WIDTH, VERTICAL_SCROLLBAR_PIXEL_HEIGHT,
VERTICAL_SCROLLBAR_LEFT_BORDER, VERTICAL_SCROLLBAR_RIGHT_BORDER,
VERTICAL_SCROLLBAR_TOP_BORDER, VERTICAL_SCROLLBAR_BOTTOM_BORDER,
CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH,
PIXEL_TO_CHAR_HEIGHT): New accessors and macros.
* frame.c (make_frame): Initialize the `can_have_scrollbars' and
`has_vertical_scrollbars' fields of the frame.
* term.c (term_init): Note that TERMCAP terminals don't support
scrollbars.
(mouse_position_hook): Document new args.
(set_vertical_scrollbar_hook, condemn_scrollbars_hook,
redeem_scrollbar_hook, judge_scrollbars_hook): New hooks.
* termhooks.h: Declare and document them.
(enum scrollbar_part): New type.
(struct input_event): Describe the new form of the scrollbar_click
event type. Change `part' from a Lisp_Object to an enum
scrollbar_part. Add a new field `scrollbar'.
* keyboard.c (kbd_buffer_get_event): Pass appropriate new
parameters to *mouse_position_hook, and make_lispy_movement.
* xfns.c (x_set_vertical_scrollbar): New function.
(x_figure_window_size): Use new macros to calculate frame size.
(Fx_create_frame): Note that X Windows frames do support scroll
bars. Default to "yes".
* xterm.c: #include <X11/cursorfont.h> and "window.h".
(x_vertical_scrollbar_cursor): New variable.
(x_term_init): Initialize it.
(last_mouse_bar, last_mouse_bar_frame, last_mouse_part,
last_mouse_scroll_range_start, last_mouse_scroll_range_end): New
variables.
(XTmouse_position): Use them to return scrollbar movement events.
Take new arguments, for that purpose.
(x_window_to_scrollbar, x_scrollbar_create,
x_scrollbar_set_handle, x_scrollbar_remove, x_scrollbar_move,
XTset_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar,
XTjudge_scrollbars, x_scrollbar_expose,
x_scrollbar_background_expose, x_scrollbar_handle_click,
x_scrollbar_handle_motion): New functions to implement scrollbars.
(x_term_init): Set the termhooks.h hooks to point to them.
(x_set_window_size): Use new macros to calculate frame size. Set
vertical_scrollbar_extra field.
(x_make_frame_visible): Use the frame accessor
FRAME_HAS_VERTICAL_SCROLLBARS to decide if we need to map the
frame's subwindows as well.
(XTread_socket): Use new size-calculation macros from xterm.h when
processing ConfigureNotify events.
(x_wm_set_size_hint): Use PIXEL_TO_CHAR_WIDTH and
PIXEL_TO_CHAR_HEIGHT macros.
* ymakefile (xdisp.o): This now depends on termhooks.h.
(xterm.o): This now depends on window.h.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Thu, 24 Dec 1992 06:17:18 +0000 |
| parents | 583035084779 |
| children | 94f7516ccdc1 |
| rev | line source |
|---|---|
|
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
1 ;;; flow-ctrl.el --- help for lusers on cu(1) or ttys with wired-in ^S/^Q flow control |
|
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
2 |
|
844
bf829a2d63b4
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
3 ;;; Copyright (C) 1990 Free Software Foundation, Inc. |
|
bf829a2d63b4
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
4 ;;; Copyright (C) 1991 Kevin Gallagher |
|
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
844
diff
changeset
|
5 |
|
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
6 ;; Author Kevin Gallagher |
|
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
7 ;; Maintainer: FSF |
|
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
8 ;; Adapted-By: ESR |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
793
diff
changeset
|
9 ;; Keywords: hardware |
|
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
10 |
|
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
844
diff
changeset
|
11 ;;; This file is part of GNU Emacs. |
| 541 | 12 ;;; |
| 13 ;;; GNU Emacs is distributed in the hope that it will be useful, but | |
| 14 ;;; WITHOUT ANY WARRANTY. No author or distributor accepts | |
| 15 ;;; RESPONSIBILITY TO anyone for the consequences of using it or for | |
| 16 ;;; whether it serves any particular purpose or works at all, unless | |
| 17 ;;; he says so in writing. Refer to the GNU Emacs General Public | |
| 18 ;;; License for full details. | |
| 19 ;;; | |
| 20 ;;; Everyone is granted permission to copy, modify and redistribute | |
| 21 ;;; GNU Emacs, but only under the conditions described in the GNU | |
| 22 ;;; Emacs General Public License. A copy of this license is supposed | |
| 23 ;;; to have been given to you along with GNU Emacs so you can know | |
| 24 ;;; your rights and responsibilities. It should be in a file named | |
| 25 ;;; COPYING. Among other things, the Copyright notice and this notice | |
| 26 ;;; must be preserved on all copies. | |
|
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
27 |
|
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
28 ;;; Commentary: |
| 541 | 29 |
| 30 ;;;; Terminals that use XON/XOFF flow control can cause problems with | |
|
792
45d748a65f24
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
677
diff
changeset
|
31 ;;;; GNU Emacs users. This file contains Emacs Lisp code that makes it |
| 541 | 32 ;;;; easy for a user to deal with this problem, when using such a |
| 33 ;;;; terminal. | |
| 34 ;;;; | |
| 35 ;;;; To invoke these adjustments, a user need only invoke the function | |
| 36 ;;;; evade-flow-control-on with a list of terminal types in his/her own | |
| 37 ;;;; .emacs file. As arguments, give it the names of one or more terminal | |
| 38 ;;;; types in use by that user which require flow control adjustments. | |
| 39 ;;;; Here's an example: | |
| 40 ;;;; | |
| 41 ;;;; (evade-flow-control-on "vt200" "vt300" "vt101" "vt131") | |
| 42 | |
| 43 ;;; Portability note: This uses (getenv "TERM"), and therefore probably | |
| 44 ;;; won't work outside of UNIX-like environments. | |
| 45 | |
|
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
46 ;;; Code: |
|
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
792
diff
changeset
|
47 |
| 541 | 48 (defun evade-flow-control () |
|
669
4c64c671426f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
49 "Enable use of flow control; let user type C-s as C-\ and C-q as C-^." |
| 541 | 50 (interactive) |
| 51 ;; Tell emacs to pass C-s and C-q to OS. | |
| 856 | 52 (set-input-mode nil t nil) |
| 541 | 53 ;; Initialize translate table, saving previous mappings, if any. |
| 54 (let ((the-table (make-string 128 0))) | |
| 55 (let ((i 0) | |
| 56 (j (length keyboard-translate-table))) | |
| 57 (while (< i j) | |
| 58 (aset the-table i (elt keyboard-translate-table i)) | |
| 59 (setq i (1+ i))) | |
| 60 (while (< i 128) | |
| 61 (aset the-table i i) | |
| 62 (setq i (1+ i)))) | |
| 63 (setq keyboard-translate-table the-table)) | |
| 64 ;; Swap C-s and C-\ | |
| 65 (aset keyboard-translate-table ?\034 ?\^s) | |
| 66 (aset keyboard-translate-table ?\^s ?\034) | |
| 67 ;; Swap C-q and C-^ | |
| 68 (aset keyboard-translate-table ?\036 ?\^q) | |
| 69 (aset keyboard-translate-table ?\^q ?\036) | |
| 70 (message (concat | |
| 71 "XON/XOFF adjustment for " | |
| 72 (getenv "TERM") | |
| 73 ": use C-\\ for C-s and use C-^ for C-q.")) | |
| 74 (sleep-for 2)) ; Give user a chance to see message. | |
| 75 | |
|
669
4c64c671426f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
76 (defun evade-flow-control-memstr= (e s) |
| 541 | 77 (cond ((null s) nil) |
| 78 ((string= e (car s)) t) | |
|
669
4c64c671426f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
79 (t (evade-flow-control-memstr= e (cdr s))))) |
| 541 | 80 |
| 81 ;;;###autoload | |
| 82 (defun evade-flow-control-on (&rest losing-terminal-types) | |
|
669
4c64c671426f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
83 "Enable flow control if using one of a specified set of terminal types. |
|
677
7a9b4ea68565
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
669
diff
changeset
|
84 Use `(evade-flow-control-on \"vt100\" \"h19\")' to enable flow control |
|
669
4c64c671426f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
85 on VT-100 and H19 terminals. When flow control is enabled, |
|
677
7a9b4ea68565
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
669
diff
changeset
|
86 you must type C-\\ to get the effect of a C-s, and type C-^ |
|
669
4c64c671426f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
87 to get the effect of a C-q." |
| 541 | 88 (let ((term (getenv "TERM")) |
| 89 hyphend) | |
| 90 ;; Strip off hyphen and what follows | |
| 91 (while (setq hyphend (string-match "[-_][^-_]+$" term)) | |
| 92 (setq term (substring term 0 hyphend))) | |
|
669
4c64c671426f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
93 (and (evade-flow-control-memstr= term losing-terminal-types) (evade-flow-control))) |
| 541 | 94 ) |
| 95 | |
| 96 (provide 'flow-ctrl) | |
| 97 | |
|
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
98 ;;; flow-ctrl.el ends here |
