
$!  DECwindows login procedure (tailored for PC DECwindows)
$!  Author:      Hunter Goatley  (Bitnet: GOATHUNTER@WKUVX1)
$!  Date:        31-OCT-1990 13:39
$!
$!  Functional description:
$!
$!      This command file is executed by the PC DECwindows display facility.
$!      It starts the DECwindows Session Manager (DECW$SESSION), waits for
$!      it to get started, and then starts the DECwindows Window Manager
$!      (DECW$WINMGR).
$!
$!      Various combinations of auto-starting from the PC DECwindows facility
$!      failed miserably (the winmgr would start but the session wouldn't,
$!      etc.), but placing everything in here works.  The Window Manager
$!      is started last to take advantage of the color parameters defined by
$!      the Session Manager.
$!
$!      Note: spawning keeps them all in the same job, eliminating potential
$!      display headaches.
$!
$ spn := spawn/nowait/input=NL:/output=NL:
$ wsquota = f$getjpi("","WSQUOTA")          !Get working set limits for
$ wsextent = f$getjpi("","WSEXTENT")                 !... later
$!
$!  Now start the DECwindows Session Manager.  It must be started before the
$!  Window Manager so that the colors that are set by the Session Manager are
$!  used.
$!
$!  Note: DECW$SESSION and DECW$WINMGR have been known to cause minor
$!  problems with some brands of PC's.  If they give you problems, don't
$!  use them, only use PCX$WINMGR which is the only officially supported
$!  PC window manager.
$!
$ spn/proc="DECW Session" run sys$system:decw$session.exe
$!
$!  Wait for the DECwindows session manager to start, then start the
$!  other DECwindows applications.
$!
$ call Wait_For_DECW_Session
$!
$!  Start the DECwindows clock.  Don't give it much memory to work with.
$!
$ set work/quota=300/extent=300                      !Set the working set low
$ spn/process="DECW Clock" run sys$system:decw$clock.exe
$ set work/quota='wsquota'/extent='wsextent'         !Restore the working set
$!
$!  Now create a couple of terminal windows, positioning them for the PC
$!  screen.
$!
$! Note : if you are running a version of VMS prior to 5.3, then
$!        the commands to start decterm windows may be different.  
$!        Use SYS$SYSTEM:PCX$CLIENT.COM for a source for obsolete
$!        commands.
$ create/terminal/detach/window_attributes=(x=2,y=93)
$ create/terminal/detach/window_attributes=(x=128,y=133,init=icon)
$ set proc/name="DECW WinMgr"
$!
$!  Now let's run the Window Manager, instead of creating it as a detached
$!  process.  This way, no Network server process is left dangling for awhile.
$!
$ run sys$system:decw$winmgr.exe
$ exit
$    
$!------------------
$!
$!  Wait_For_DECW_Session
$!
$!      This subroutine waits for the DECwindows session manager to start
$!      running before returning to the caller.
$!
$ Wait_For_DECW_Session: SUBROUTINE
$ user = f$edit(f$getjpi("","username"),"TRIM")
$restart:
$ context = ""
$loop:
$ pid = f$pid(context)
$ if pid .eqs. "" then goto pause
$ if f$parse(f$getjpi(pid,"imagname"),,,"name") .eqs. "DECW$SESSION"
$ then
$  if f$edit(f$getjpi(pid,"username"),"TRIM") .nes. user then goto loop
$  if f$getjpi(pid,"terminal") .eqs. "" then goto pause
$  exit
$ endif
$ goto loop
$pause:
$ wait 00:00:05
$ goto restart
$ ENDSUBROUTINE

==

[figure 5]

$!
$!  Hack for getting around PC DECwindows bug/feature.  Prints a string from
$!  all terminal fonts at login to avoid "file read errors" later.
$!
$!  Hunter Goatley, GOATHUNTER@WKUVX1.bitnet
$!  January 16, 1991
$!
$ say := write sys$output
$ esc[0,7] = 27
$!
$!  Don't display if terminal is not a PC DECwindows DECterm
$!
$ if f$trnlnm("DECW$DISPLAY","LNM$JOB") .eqs. "" then exit
$!
$!  First normal bold
$!
$ say esc,"[1mPC DECwindows"
$!
$!  Now double-wide bold and normal
$!
$ say esc,"#6PC DECwindows",esc,"[m  PC DECwindows"
$!
$!  Now double-wide, double-high normal and bold
$!
$ say esc,"#3PC DECwindows",esc,"[1m  PC DECwindows",esc,"[m"
$ say esc,"#4PC DECwindows",esc,"[1m  PC DECwindows",esc,"[m"
$!
$ LCK
$!
$ exit


==

[figure 6]

;
;  IS101US KeySym Text File - For PC DECwindows
;
;  Modified by Hunter Goatley, WKU, 31-OCT-1990 08:31
;
;  Make sure Num Lock is off!!!
;  IBM-keyboard keys F1-F4 are LK201 PF1-PF4 keys (unshifted), F17-F20 (shifted)
;  LK201 KP keys accessible via SHIFT.
;  It's a pain, but it's better than nothing and cheaper than a new keyboard.
;
;-------------------------------------------------------------------------------
;
;  To build:
;
;       C> DWKEYSYM HG101US.TXT HG101US.TXT
;
;  To use, add the following line to your DWDOS.INI:
;
;       keysym_file = drv:\path\HG101US.XKS
;
;-------------------------------------------------------------------------------
Description "Industry Standard Enhanced U.S. Keyboard KeySym File"
;
0x01    unshifted         XK_F1             ; Escape key is now Hold Screen
;
0x3B    unshifted         XK_KP_F1          ; F1 key
0x3B    shifted           XK_F17            ; F1 key
0x3C    unshifted         XK_KP_F2          ; F2 key
0x3C    shifted           XK_F18            ; F2 key
0x3D    unshifted         XK_KP_F3          ; F3 key
0x3D    shifted           XK_F19            ; F3 key
0x3E    unshifted         XK_KP_F4          ; F4 key
0x3E    shifted           XK_F20            ; F4 key
0x3F    unshifted         XK_F7             ; F5 key
0x40    unshifted         XK_F8             ; F6 key
0x41    unshifted         XK_F9             ; F7 key
0x42    unshifted         XK_F10            ; F8 key
0x43    unshifted         XK_F11            ; F9 key
0x44    unshifted         XK_F12            ; F10 key
0x57    unshifted         XK_F13            ; F11 key
0x58    unshifted         XK_F14            ; F12 key
;
        .
        .
        .
; bottom row, main keyboard
;
0x2C    unshifted         XK_Z
0x2D    unshifted         XK_X
0x2E    unshifted         XK_C
0x2F    unshifted         XK_V
0x30    unshifted         XK_B
0x31    unshifted         XK_N
0x32    unshifted         XK_M
;
0x33    unshifted         XK_comma
0x33    shifted          XK_less
;
0x34    unshifted         XK_period
0x34    shifted          XK_greater
;
0x35    unshifted         XK_slash   
0x35    shifted          XK_question
;
;
0x39    unshifted         XK_space
;

==


;
;  IS101US KeySym Text File - For PC DECwindows
;
;  Modified by Hunter Goatley, WKU, 31-OCT-1990 08:31
;
;  Make sure Num Lock is off!!!
;  IBM-keyboard keys F1-F4 are LK201 PF1-PF4 keys (unshifted), F17-F20 (shifted)
;  LK201 KP keys accessible via SHIFT.
;  It's a pain, but it's better than nothing and cheaper than a new keyboard.
;
;-------------------------------------------------------------------------------
;
;  To build:
;
;	C> DWKEYSYM HG101US.TXT HG101US.TXT
;
;  To use, add the following line to your DWDOS.INI:
;
;	keysym_file = drv:\path\HG101US.XKS
;
;-------------------------------------------------------------------------------
Description "Industry Standard Enhanced U.S. Keyboard KeySym File"
;
0x01    unshifted	XK_F1		; Escape key is now Hold Screen
;
0x3B    unshifted	XK_KP_F1	; F1 key
0x3B    shifted		XK_F17		; F1 key
0x3C    unshifted	XK_KP_F2	; F2 key
0x3C    shifted		XK_F18		; F2 key
0x3D    unshifted	XK_KP_F3	; F3 key
0x3D    shifted		XK_F19		; F3 key
0x3E    unshifted	XK_KP_F4	; F4 key
0x3E    shifted		XK_F20		; F4 key
0x3F    unshifted	XK_F7		; F5 key
0x40    unshifted	XK_F8		; F6 key
0x41    unshifted	XK_F9		; F7 key
0x42    unshifted	XK_F10		; F8 key
0x43    unshifted	XK_F11		; F9 key
0x44    unshifted	XK_F12		; F10 key
0x57    unshifted	XK_F13		; F11 key
0x58    unshifted	XK_F14		; F12 key
;
; The print screen key issues the sequence: 0xE0, 0x2A, 0x37.  This sequence 
; is intercepted by the DWDOS keyboard driver to produce a local printscreen,
; and no XK_Print is issued.
;
0x46    unshifted	        XK_Help      ;  Scroll Lock key - it is
;                                               a bug in the x protocol
;                                               that there is no XK_Scroll_
;                                               Lock symbol - next rev?
;
; The pause key (below) issues the sequence 0xE1, 0x1D (control), 0x45 
; (numlock), 0xE1, 0x9D, 0xC5. The DWDOS keyboard driver intercepts these 
; codes and sends 0x77 (down and up), which is mapped to XK_Pause in the 
; unshifted state, XK_Break in the shifted state. 
;
0x77    unshifted	        XK_Menu      ;  Pause key -> DO key
0x77    shifted	                XK_Break     
;
;  arrow keypad 
;
0x52    unshifted	XK_Find			; Insert key
0x47    unshifted	XK_Insert 		; Home key
0x49    unshifted	DXK_Remove 		; Page Up key
0x53    unshifted	XK_Select 		; Delete key
0x4F    unshifted	XK_Prior		; End key
0x51    unshifted	XK_Next 		; Page Down key
;
0x48    unshifted	XK_Up
0x4B	unshifted	XK_Left
0x50    unshifted	XK_Down
0x4D    unshifted	XK_Right
;
;
;
;  numeric keypad with numlock off and numlock on
;  Normal keypad is accessible via SHIFT, regardless of numlock state.
;
; 0x52    unshifted	XK_Insert  - duplicate with cursor keypad   
0x52    shifted	        XK_KP_0
0x52    altshifted      XK_KP_0
;
; 0x53    unshifted	XK_Delete - duplicate with cursor keypad 
0x53    shifted	        XK_KP_Decimal
0x53    altshifted      XK_KP_Decimal
;                       
; Numeric keypad enter key, same scancode as main array enter key - call
; them both Return
;
0x1C    unshifted	XK_Return		; Unshifted states = Return
0x1C    altunshifted	XK_Return		; ...
0x1C    shifted	        XK_KP_Enter		; Shifted states = KP Enter
0x1C    altshifted      XK_KP_Enter		; ...
;
; 0x4F    unshifted	XK_End - duplicate with cursor keypad 
0x4F    shifted	        XK_KP_1
0x4F    altshifted      XK_KP_1
;
; 0x50    unshifted	XK_Down - duplicate with cursor keypad 
0x50    shifted	        XK_KP_2
0x50    altshifted      XK_KP_2
0x50    altunshifted	XK_Down
;
; 0x51    unshifted	XK_Next - duplicate with cursor keypad 
0x51    shifted	        XK_KP_3
0x51    altshifted      XK_KP_3
;
; 0x4B    unshifted	XK_Left - duplicate with cursor keypad 
0x4B    shifted	        XK_KP_4
0x4B    altshifted      XK_KP_4
0x4B    altunshifted	XK_Left
;
0x4C    shifted	        XK_KP_5    ;  no unshifted keysym 
0x4C    altshifted      XK_KP_5    ;  no unshifted keysym 
;
; 0x4D    unshifted	XK_Right - duplicate with cursor keypad 
0x4D    shifted	        XK_KP_6
0x4D    altshifted      XK_KP_6
0x4D    altunshifted	XK_Right
;
0x4E    unshifted	XK_KP_Separator
0x4E    shifted	        XK_KP_Subtract
0x4E    altshifted      XK_KP_Subtract
;
; 0x47    unshifted	XK_Home - duplicate with cursor keypad 
0x47    shifted	        XK_KP_7
0x47    altshifted      XK_KP_7
;
; 0x48    unshifted	XK_Up - duplicate with cursor keypad 
0x48    shifted	        XK_KP_8
0x48    altshifted      XK_KP_8
0x48    altunshifted	XK_Up
;
; 0x49    unshifted	XK_Prior - duplicate with cursor keypad 
0x49    shifted	        XK_KP_9
0x49    altshifted      XK_KP_9
;
;  Make "Num Lock" key always be PF1 (KP_F1)
;
;0x45	shifted		XK_KP_F1
;0x45	altshifted	XK_KP_F1
;0x45	altunshifted	XK_KP_F1
0x45    unshifted	XK_Num_Lock
;
; The numeric keypad divide key (below) issues the sequence 0xE0, 0x35. This 
; sequence is intercepted by the DWDOS keyboard driver and mapped to 0x78, to 
; distinguish it from the 0x35 key on the main keypad, which is mapped to 
; XK_Slash on some keyboards, and XK_minus, etc. on others.
;
0x78    shifted         XK_KP_F2
0x78    unshifted       XK_KP_F2
0x78    altshifted      XK_KP_F2
0x78    altunshifted    XK_KP_F2
;
0x37    unshifted	XK_KP_F3
0x37    shifted		XK_KP_F3
0x37    altunshifted	XK_KP_F3
0x37    altshifted	XK_KP_F3
;
0x4A    shifted		XK_KP_F4
0x4A    unshifted	XK_KP_F4
0x4A    altunshifted	XK_KP_F4
0x4A    altshifted	XK_KP_F4
;
;
;  main keypad 
;
0x2A    unshifted	XK_Shift_L
0x36    unshifted	XK_Shift_R
;
0x1D    unshifted	XK_Control_L
; 0x1D    unshifted	XK_Control_R - not mapped, no distinct scancode
;
0x38    unshifted	XK_Alt_L
; 0x38    unshifted	XK_Alt_R  - not mapped, no distinct scancode
;
0x3A    unshifted	XK_Caps_Lock 
; 0x3A  unshifted	XK_Shift_Lock	- not mapped, one or the other
;
0x0E    unshifted	XK_Delete
;
; main array enter, same scancode as keypad enter - no duplicate scancodes
; for compiler.
;
; 0x1C	unshifted	XK_Return 
;
0x0F    unshifted	XK_Tab
;
;
; numeric row
;
0x29    unshifted	XK_quoteleft
0x29    shifted	        XK_asciitilde
;
0x02    unshifted	XK_1                 
0x02    shifted	        XK_exclam
;
0x03    unshifted	XK_2
0x03    shifted	        XK_at
;
0x04    unshifted	XK_3
0x04	shifted	        XK_numbersign
;
0x05    unshifted	XK_4
0x05    shifted	        XK_dollar
;
0x06    unshifted	XK_5
0x06    shifted	        XK_percent
;
0x07    unshifted	XK_6
0x07    shifted	        XK_asciicircum
;
0x08    unshifted	XK_7
0x08    shifted	        XK_ampersand
;
0x09    unshifted	XK_8
0x09    shifted	        XK_asterisk
;
0x0A    unshifted	XK_9
0x0A    shifted	        XK_parenleft
;
0x0B    unshifted	XK_0
0x0B    shifted	        XK_parenright
;
0x0C    unshifted	XK_minus
0x0C    shifted	        XK_underscore
;
0x0D    unshifted	XK_equal
0x0D    shifted	        XK_plus
;
;
; top row alpha
;
0x10    unshifted	XK_Q
0x11    unshifted	XK_W
0x12    unshifted	XK_E
0x13    unshifted	XK_R
0x14    unshifted	XK_T
0x15    unshifted	XK_Y
0x16    unshifted	XK_U
0x17    unshifted	XK_I
0x18    unshifted	XK_O
0x19    unshifted	XK_P
;
0x1A    unshifted	XK_bracketleft
0x1A    shifted	        XK_braceleft
;
0x1B    unshifted	XK_bracketright
0x1B    shifted	        XK_braceright
;
0x2B    unshifted	XK_backslash
0x2B    shifted	        XK_bar
;
; second row alpha
;
0x1E	unshifted	XK_A
0x1F    unshifted	XK_S
0x20    unshifted	XK_D
0x21    unshifted	XK_F
0x22    unshifted	XK_G
0x23    unshifted	XK_H
0x24    unshifted	XK_J
0x25    unshifted	XK_K
0x26    unshifted	XK_L
;
0x27    unshifted	XK_semicolon
0x27    shifted	        XK_colon
;
0x28    unshifted	XK_quoteright
0x28    shifted	        XK_quotedbl
;
; bottom row, main keyboard
;
0x2C    unshifted	XK_Z
0x2D    unshifted	XK_X
0x2E    unshifted	XK_C
0x2F    unshifted	XK_V
0x30    unshifted	XK_B
0x31    unshifted	XK_N
0x32    unshifted	XK_M
;
0x33	unshifted	XK_comma
0x33    shifted	        XK_less
;
0x34    unshifted	XK_period
0x34    shifted	        XK_greater
;
0x35    unshifted	XK_slash   
0x35    shifted	        XK_question
;
;
0x39    unshifted	XK_space
;

