;;; -*- Mode: Common-Lisp; Package: User; Base: 10.; Patch-File: T -*-
;;; Patch file for TV version 5.27
;;; Reason: Make TERM ctrl-S work on the mX.
;;; Written 02/10/89 14:00:13 by GRENINGER,
;;; while running on MX23 from band TEST
;;; With SYSTEM 5.27, GC 5.4, VIRTUAL-MEMORY 5.5, MICRONET 5.6, MICRONET-COMM 5.13,
;;;  DISK-IO 5.9, BASIC-PATHNAME 5.4, MAC-PATHNAME 5.1, NETWORK-SUPPORT-COLD 5.1,
;;;  BASIC-NAMESPACE 5.8, BASIC-FILE 5.5, RPC 5.6, NFS 5.16, EH 5.3, MAKE-SYSTEM 5.3,
;;;  MEMORY-AUX 5.1, MACTOOLBOX 1.35, COMPILER 5.3, Inconsistent TV 5.25, NVRAM 5.1,
;;;  UCL 5.0, INPUT-EDITOR 5.0, METER 5.1, ZWEI 5.12, DEBUG-TOOLS 5.1, Inconsistent WINDOW-MX 5.34,
;;;  PRINTER 5.12, MAC-PRINTER-TYPES 5.4, Experimental NETWORK-PATHNAME 5.1, NETWORK-NAMESPACE 5.0,
;;;  DATALINK 5.7, CHAOSNET 5.6, Experimental NETWORK-SUPPORT 5.1, Experimental NETWORK-SERVICE 5.1,
;;;  DATALINK-DISPLAYS 5.0, NAMESPACE-EDITOR 5.1, IP 3.41, NFS-SERVER 5.3, PRINTER-TYPES 5.5,
;;;  IMAGEN 5.3, MAIL-DAEMON 5.6, MAIL-READER 5.6, TELNET 5.2, VT100 5.1, STREAMER-TAPE 5.7,
;;;  DECNET 1.49, VISIDOC 5.4, PROFILE 5.1, DISK-LABEL 5.1, Experimental MX-SERIAL 1.1,
;;;   microcode 96, Band Name: NB22+1/8 patches

#!C
; From file SCREENS.LISP#> WINDOW; SYS:
#10R TV#:
(COMPILER-LET ((*PACKAGE* (FIND-PACKAGE "TV"))
                          (SI:*LISP-MODE* :COMMON-LISP)
                          (*READTABLE* COMMON-LISP-READTABLE)
                          (SI:*READER-SYMBOL-SUBSTITUTIONS* SYS::*COMMON-LISP-SYMBOL-SUBSTITUTIONS*))
  (COMPILER#:PATCH-SOURCE-FILE "SYS: WINDOW; SCREENS.#"


(DEFUN kbd-switch-screens (arg &aux tem)	   ;TERM-CTRL-S
  "Select a screen to switch to.  Functions like TERM-S for windows.
Press TERM-HELP for more documentation."
  ;; TERM n S rotates the n most recently selected screens, selecting the nth
  ;; TERM S = TERM 2 S
  ;; TERM 1 S selects the next most recent screen but rotates all the screens
  ;; TERM -n S rotates the same set of screens in the other direction
  (OR arg (SETQ arg 2))
  ;; If there are none yet, don't try to switch.
  (WHEN (AREF *previously-selected-screens* 0)
    ;; Put current screen on front of array.
    (add-to-previously-selected-screens default-screen)
    (WITHOUT-INTERRUPTS			   ;Get rid of any non-exposable ones
      (DOTIMES (i (ARRAY-TOTAL-SIZE *previously-selected-screens*))
	(OR (SETQ tem (AREF *previously-selected-screens* i)) (RETURN))
	(COND ((NOT (w:screen-exposable-p tem))
	       (remove-from-previously-selected-screens tem)
	       (SETQ i (1- i)))))
      (rotate-top-of-array *previously-selected-screens* arg))
    (WHEN (SETQ tem (AREF *previously-selected-screens* 0))
      (IF (mac-screen-p tem)
	  (select-a-screen tem)
	(SEND tem :expose))
           ;; Make it DEFAULT-SCREEN in addition to exposing it.  It may already be exposed.  CJJ 06/15/88.
           ;;; Added by KJF on 08/20/88 for CJJ during addition of Multiple Monitor (MMON) support.
      (SEND tem :send-if-handles :make-default-screen)))
  tem)

))
