view lisp/term/tvi970.el @ 1776:20c6f4aa5843

Make scrollbar structures into lisp objects, so that they can be GC'd; this allows windows and scrollbars can refer to each other without worrying about dangling pointers. * xterm.h (struct x_display): vertical_scrollbars and judge_timestamp members deleted. (struct scrollbar): Redesigned to be a template for a Lisp_Vector. (SCROLLBAR_VEC_SIZE, XSCROLLBAR, SCROLLBAR_PACK, SCROLLBAR_UNPACK, SCROLLBAR_X_WINDOW, SET_SCROLLBAR_X_WINDOW, VERTICAL_SCROLLBAR_INSIDE_WIDTH, VERTICAL_SCROLLBAR_TOP_RANGE, VERTICAL_SCROLLBAR_INSIDE_HEIGHT, VERTICAL_SCROLLBAR_MIN_HANDLE): New macros, to help deal with the lispy structures, and deal with the graphics. * frame.h (WINDOW_VERTICAL_SCROLLBAR): Macro deleted. (struct frame): New fields `scrollbars' and `condemned_scrollbars', for use by the scrollbar implementation. [MULTI_FRAME and not MULTI_FRAME] (FRAME_SCROLLBARS, FRAME_CONDEMNED_SCROLLBARS): Accessors for the new field. * window.h (struct window): Doc fix for vertical_scrollbar field. * frame.c (make_frame): Initialize the `scrollbars' and `condemned_scrollbars' fields of the new frame. * alloc.c (mark_object): Mark the `scrollbars' and `condemned_scrollbars' slots of frames. * xterm.c (x_window_to_scrollbar): Scrollbars are chained on frames' scrollbar field, not their x.display->vertical_scrollbars field. (x_scrollbar_create, x_scrollbar_set_handle, x_scrollbar_move, x_scrollbar_remove, XTset_vertical_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar, XTjudge_scrollbars, x_scrollbar_expose, x_scrollbar_handle_click, x_scrollbar_handle_motion): Substantially rewritten to correct typos and brainos, and to accomodate the lispy structures. * frame.h (FRAME_SAMPLE_VISIBILITY): Make sure frame is marked as garbaged whenever it goes from invisible to visible. * dispextern.h (frame_garbaged): Move extern declaration from here... * frame.h (frame_garbaged): ... to here. The FRAME_SAMPLE_VISIBILITY macro uses it now, and this seems to be just as modular. Make a new page, just for this and message_buf_print. (struct frame): Doc fix for the `visible' field. * process.c: #include "frame.h" instead of "dispextern.h"; the only thing we care about from it is the frame_garbaged declaration. * ymakefile: Note dependency change.
author Jim Blandy <jimb@redhat.com>
date Thu, 14 Jan 1993 15:09:51 +0000
parents 86f90c43ef3e
children 9bc89a98c002
line wrap: on
line source

;;; Terminal support for the Televideo 970.
;;; Jim Blandy <jimb@occs.cs.oberlin.edu>, January 1992


;;; Define the escape codes sent by the function keys.
(or (lookup-key function-key-map "\e[")
    (define-key function-key-map "\e[" (make-keymap)))
(or (lookup-key function-key-map "\eO")
    (define-key function-key-map "\eO" (make-keymap)))

;; Miscellaneous keys
(mapcar (function (lambda (key-binding)
		    (define-key function-key-map
		      (car key-binding) (nth 1 key-binding))))
	'(("\e[H" [home])
	  ("\e[Z" [backtab])
	  ("\e[i" [print])
	  ("\e[2J" [clear])
	  ("\e[@" [insert])
	  ("\e[P" [delete])
	  ("\e[L" [insertline])
	  ("\e[M" [deleteline])
	  ("\e[K" [eraseline])
	  ("\e[J" [erasepage])
	  ("\e[U" [page])
	  ("\e[g" [S-tab])
	  ("\e[2N" [clearentry])
	  ("\e[2K" [S-clearentry])
	  ("\e[E" [?\C-j])
	  ("\e[g" [S-backtab])
	  ("\e[?1i" [S-print])
	  ("\e[4h" [S-insert])
	  ("\e[4l" [S-delete])
	  ("\e[Q"  [S-insertline])
	  ("\e[1Q" [S-deleteline])
	  ("\e[19l" [S-eraseline])
	  ("\e[19h" [S-erasepage])
	  ("\e[V" [S-page])
	  ("\eS" [send])
	  ("\e5" [S-send])
	  ("\eOm" [kp-subtract])
	  ("\eOl" [kp-separator])
	  ("\eOn" [kp-decimal])
	  ("\eOM" [enter])
	  ("\eOP" [kp-f1])
	  ("\eOQ" [kp-f2])
	  ("\eOR" [kp-f3])
	  ("\eOS" [kp-f4])))
;; The numeric keypad keys.
(let ((i 0))
  (while (< i 10)
    (define-key function-key-map
      (format "\eO%c" (+ i ?p))
      (vector (intern (format "kp-%d" i))))
    (setq i (1+ i))))
;; The numbered function keys.
(let ((i 0))
  (while (< i 16)
    (define-key function-key-map
      (format "\e?%c" (+ i ?a))
      (vector (intern (format "f%d" (1+ i)))))
    (define-key function-key-map
      (format "\e?%c" (+ i ?A))
      (vector (intern (format "S-f%d" (1+ i)))))
    (setq i (1+ i))))


;;; Should keypad numbers send ordinary digits or distinct escape sequences?
(defvar tvi970-keypad-numeric nil
  "The terminal should be in numeric keypad mode iff this variable is non-nil.
Do not set this variable!  Call the function ``tvi970-set-keypad-mode''.")

(defun tvi970-set-keypad-mode (&optional arg)
  "Set the current mode of the TVI 970 numeric keypad.
In ``numeric keypad mode'', the number keys on the keypad act as
ordinary digits.  In ``alternate keypad mode'', the keys send distinct
escape sequences, meaning that they can have their own bindings,
independent of the normal number keys.
With no argument, toggle between the two possible modes.
With a positive argument, select alternate keypad mode.
With a negative argument, select numeric keypad mode."
  (interactive "P")
  (setq tvi970-keypad-numeric 
	(if (null arg)
	    (not tvi970-keypad-numeric)
	  (> (prefix-numeric-value arg) 0)))
  (send-string-to-terminal (if tvi970-keypad-numeric "\e=" "\e>")))

(tvi970-set-keypad-mode 1)