From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 22-SEP-1990 09:12:57.03
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Re: Changing the name of a DECterm window

Received:  by crdgw1.ge.com (5.57/GE 1.73)
	 id AA23791; Sat, 22 Sep 90 08:51:13 EDT
Received: From VENUS.YCC.YALE.EDU by CRVAX.SRI.COM with TCP; Sat, 22 SEP 90 05:44:51 PDT
Received: from BULLDOG.CS.YALE.EDU by Venus.YCC.Yale.Edu; Sat, 22 Sep 90 08:40
 EDT
Received: from lrw.UUCP by BULLDOG.CS.YALE.EDU via UUCP; Sat, 22 Sep 90
 08:32:04 EDT
Received: by lrw.UUCP (DECUS UUCP w/Smail); Sat, 22 Sep 90 07:49:30 EDT
Date: Sat, 22 Sep 90 07:49:30 EDT
From: Jerry Leichter <leichter@LRW.COM>
Subject: Re: Changing the name of a DECterm window
To: INFO-VAX@KL.SRI.COM
Message-Id: <9009221232.AA13287@BULLDOG.CS.YALE.EDU>
X-Vms-Mail-To: INFOVAX
X-Envelope-To: info-vax@kl.sri.COM

	[Zack C. Sessions <Sessions@Sparev.dnet.ge.com> posted some DCL:]

	>  $ OSC[0,8] = 157
	>  $ ST[0,8] = 156
	>  $ write sys$output OSC,"2L;New Icon Name",ST
	>  $ write sys$output OSC,"21;New Window Bar Name",ST

	[To which Bob Techentin wrote:]
	That's really neat!  It is also about 10 times faster than invoking 
	the X program posted here about a year ago.  (DECW$CHANGE_TITLE.C)

	But, what does it do?  And how did you come across it, anyway?

The ANSI terminal spec (X3.24 or something like that) defines the syntax for a
wide variety of control functions.  Everyone is familiar with escape (and con-
trol) sequences.  ANSI also defines a series of analogous "Operating System
Control" (OSC) sequences.  They have a lead-in of ESC ] or the OSC character
(which is 128 + ']'); the usual control sequences have a leading of ESC [
(or CSI, which is 128 + '[').  There are also DCS's (Device Control Sequences)
which start with ESC P - they are used for "long" sequences (like ReGIS or
sixel code) and are terminated by ESC \ (ST in 8-bit, String Terminator).
ANSI provided no definitions that I know of for any OSC sequences.

DEC has used "private" (there aren't any others!) OSC's for a number of years.
There are a couple that can be included in text sent to the print symbiont; I
can't now remember what they do.

The VWS terminal emulator defined a large variety of OSC's to enable programs
to do various window-related things - e.g., change the banner on a window.
VWS actually has both incoming and outgoing OSC's:  It is possible to get the
VWS terminal emulator to insert an appropriate OSC into the data stream when
certain "interesting events" (like the change of the size of the window) take
place.

The DECterm emulator borrowed most of its code from the VWS terminal emulator.
However, for various (I always thought silly) reasons, all the OSC code was
disabled.  Apparently it's been re-enabled.

The following is a command file (well, the "source" for such a file - it has
to be pre-processed into straight DCL) I use under VWS to send various OSC's.
I think it includes all the OSC's that VWS can be sent.  How many of these
work on DECWindows, I have no idea.  The window banner one seems to have been
retained.  In VWS, you can set the icon banner only as part of setting the
icon position (though I think you can omit the position to change just the
banner).  The actual values used for [X,Y] coordinates must be different - VWS
uses floats representing centimeters from the upper left hand corner of the
screen, if I remember right.  It's not clear they can be provided at all.

							-- Jerry

$!
$! Generate OSC sequences to control an emulator window
$! Parameters are separated by ";".  Positions are [x,y], brackets
$! required, x,y decimal cm from top left.
$!
$ verify = 'f$verify(0)'
$ resize = 0
$ on error then goto fin
$ on control_y then goto fin
$ osc = ""
$ osc[0,31]=157
$ st = ""
$ st[0,31]=156
$ prefix = osc + "2"
$!
$ b*anner = prefix + "1"		!text
$ s*hrink = prefix + "2"		!icon-pos;icon-banner-text
$ ex*pand = prefix + "3"		!win-pos;win-banner-text
$ m*ove_window = prefix + "4"		!pos
$ i*move_icon = prefix + "5"		!pos
$ disc*onnect_kb = prefix + "6"	
$ disa*ble_kb = prefix + "7"
$ e*nable_kb = prefix + "8"
$ pu*sh_window = prefix + "9"
$ po*p_window = prefix + "A"
$ md*isable_menu = prefix + "B"		!opt (1:delete; 2:change-size
$ me*nable_menu = prefix + "C"		!     4:shrink; 8:additional-opt
$ fo*nt_select = prefix + "f"		!point;pitch;family-name
$ if p1 .eqs. "F"							-
{	$ f = f$extract(0,1,p2)
	$ if f .eqs. "T"						-
	{	$ write SYS$OUTPUT prefix,"f;11;7;DVWSVT0",st	}
	else { if f .eqs. "8"						-
	{	$ write SYS$OUTPUT prefix,"f;14;9;DTABER0",st	}
	else { if f .eqs. "1"						-
	{	$ write SYS$OUTPUT prefix,"f;12;7;DTABER0",st	}
	else { if f .eqs. "B"						-
	{	$ write SYS$OUTPUT prefix,"f;24;13;DTABER0",st	}
	else { if f .eqs. "S"						-
	{	$ write SYS$OUTPUT prefix,"f;12;13;DTABER0",st	}
	else { if f .eqs. "I"						-
	{	$ write SYS$OUTPUT prefix,"f;19;11;DVWSVT0",st	}
	else { if f .eqs. "J"						-
	{	$ write SYS$OUTPUT prefix,"f;19;7;DVWSVT0",st	}
	else
	{	$ write SYS$ERROR					-
	"Pick one of Tiny, 80, 132, Big, Shrunken, Intermediate, Jntermediate"
		$ resize = 0
	}
		}}}}}}
	$ @TOOLS:u S			!Reset to default, RESIZE is implicit
	$ goto fin
}
$ if (p1 .eqs. "P") .or. (p1 .eqs. "PI")				-
{	$ p = f$extract(0,2,p2)
	$ coord = ""
	$ if p .eqs. "LL" then coord = "[0,0]"
	$ if p .eqs. "UL" then coord = "[0,9999]"
	$ if p .eqs. "UR" then coord = "[9999,9999]"
	$ if p .eqs. "LR" then coord = "[9999,0]"
	$ if p .eqs. "LC" then coord = "[6.57,0]"
	$ if p .eqs. "UC" then coord = "[6.57,9999]"
	$ if coord .eqs. ""						-
	{	$ write SYS$ERROR "Choose one of LL UL UR LR UC LC"
	}
	else
	{	$ if p1 .eqs. "P"					-
		{	$ cmd = "4"		}
		else
		{	$ cmd = "5"		}
		$ write SYS$OUTPUT prefix,cmd,";",coord,st
	}
	$ goto fin
}	
$ if p3 .eqs. "" then write SYS$OUTPUT 'p1',";",p2,st
$ if p3 .nes. "" then write SYS$OUTPUT 'p1',";",p2,";",p3,st
$fin:
$ if resize								-
 .and. f$extr(0,3,f$getd("SYS$COMMAND","TT_PHYDEVNAM")) .eqs. "_LT"	-
then	run TOOLS:settype
$ verify = f$verify(verify)

