X11R4 patch for SCO XENIX (part04)

Chain Lee chain at paul.rutgers.edu
Mon Jan 7 13:23:56 AEST 1991


*** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixIo.c	Sun Jan  6 01:03:22 1991
--- X11R4/mit/server/ddx/xenix/vga/xenixIo.c	Mon Dec 10 00:28:26 1990
***************
*** 0 ****
--- 1,321 ----
+ /*
+  * xenixIo.c			Modified for Xenix by Chain Lee 08/90
+  */
+ 
+ /*-
+  *
+  * Copyright (c) 1987 by the Regents of the University of California
+  *
+  * Permission to use, copy, modify, and distribute this
+  * software and its documentation for any purpose and without
+  * fee is hereby granted, provided that the above copyright
+  * notice appear in all copies.  The University of California
+  * makes no representations about the suitability of this
+  * software for any purpose.  It is provided "as is" without
+  * express or implied warranty.
+  *
+  *
+  */
+ 
+ /************************************************************
+ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+ 
+                     All Rights Reserved
+ 
+ Permission  to  use,  copy,  modify,  and  distribute   this
+ software  and  its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright no-
+ tice  appear  in all copies and that both that copyright no-
+ tice and this permission notice appear in  supporting  docu-
+ mentation,  and  that the names of Sun or MIT not be used in
+ advertising or publicity pertaining to distribution  of  the
+ software  without specific prior written permission. Sun and
+ M.I.T. make no representations about the suitability of this
+ software for any purpose. It is provided "as is" without any
+ express or implied warranty.
+ 
+ SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+ NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
+ ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
+ PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ 
+ ********************************************************/
+ 
+ #include    "xenix.h"
+ #include    "opaque.h"
+ 
+ extern void
+ xenixSwitchConsoleMode();
+ 
+ int	    	lastEventTime = 0;
+ extern int	xenixSigIO;
+ extern int      screenIsSaved;
+ extern void	SaveScreens();
+ 
+ extern CARD8	ibmAT101SecondaryMap[];
+ extern CARD8	keyCodePrefix1, keyCodePrefix2, keyCodeCapsLock;
+ 
+ int	xenixEventPending;
+ 
+ int	xenixIgnoreEvent = TRUE;
+ 
+ void
+ xenixSuspendX()
+ {
+     EVENT *evp;
+     int i, n, done;
+ 
+     xenixSwitchConsoleMode();
+ 
+     done = 0;
+     while (!done) {
+     	nap(20);
+     	n = ev_count();
+     	if (n <= 0)
+     	    continue;
+     	for (i=0; i<n; i++) {
+     	    evp = ev_read();
+     	    if (EV_TAG(*evp) & T_BUTTON)
+     		if (EV_BUTTONS(*evp) != 7) {
+     		    done = 1;
+     		    break;
+     		}
+ 	    ev_pop();
+     	}
+     }
+ 
+     done = 0;
+     while (!done) {
+     	nap(20);
+     	n = ev_count();
+     	if (n <= 0)
+     	    continue;
+     	for (i=0; i<n; i++) {
+     	    evp = ev_read();
+     	    if (EV_TAG(*evp) & T_BUTTON)
+     		if (EV_BUTTONS(*evp) == 7) {
+     		    done = 1;
+     		    break;
+     		}
+ 	    ev_pop();
+     	}
+     }
+ 
+    xenixSwitchConsoleMode();
+ }    
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * TimeSinceLastInputEvent --
+  *	Function used for screensaver purposes by the os module.
+  *
+  * Results:
+  *	The time in milliseconds since there last was any
+  *	input.
+  *
+  * Side Effects:
+  *	None.
+  *
+  *-----------------------------------------------------------------------
+  */
+ int
+ TimeSinceLastInputEvent()
+ {
+     struct timeval	now;
+ 
+     gettimeofday (&now, (struct timezone *)0);
+ 
+     if (lastEventTime == 0) {
+ 	lastEventTime = TVTOMILLI(now);
+     }
+     return TVTOMILLI(now) - lastEventTime;
+ }
+ 
+ int
+ xenixCheckEvent()
+ {
+     int	n = ev_count();
+ 
+     return (n > 0);
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * ProcessInputEvents --
+  *	Retrieve all waiting input events and pass them to DIX in their
+  *	correct chronological order. Only reads from the system pointer
+  *	and keyboard.
+  *
+  * Results:
+  *	None.
+  *
+  * Side Effects:
+  *	Events are passed to the DIX layer.
+  *
+  *-----------------------------------------------------------------------
+  */
+ void
+ ProcessInputEvents ()
+ {
+ 
+ 	EVENT		*evp;
+ 	int		i, n;
+ 	int		evType;
+ 	DevicePtr	pPointer;
+ 	DevicePtr	pKeyboard;
+ 
+ 	xenixEventPending = 0;
+ 	pPointer = LookupPointerDevice();
+ 	pKeyboard = LookupKeyboardDevice();
+ 
+ 	n = ev_count();
+ 
+ 	if (n < 0) {
+ 	    ErrorF("ProcessInputEvent: cannot get event count\n");
+ 	    return;
+ 	}
+ 
+ #if OK
+ 	if (autoRepeatKeyDown && autoRepeatReady && n <= 0) {
+ 		/* fake a xenixwindows kbd event */
+ 		n = sizeof(struct inputevent);
+ 		se->ie_code = AUTOREPEAT_EVENTID;
+ 		tvplus(event_time(se), autoRepeatLastKeyDownTv,
+ 							autoRepeatDeltaTv);
+ 		if (autoRepeatDebug)
+ 		    ErrorF("ProcessInputEvents: sw auto event\n");
+ 	}
+ #endif
+ 	for (i=0; i<n; i++) {
+ 	    if ( (evp=ev_read()) == (EVENT *) NULL)
+ 		break;
+ 
+ 	    if (screenIsSaved == SCREEN_SAVER_ON)
+ 		SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ 	    lastEventTime = EV_TIME(*evp);
+ /*
+ 	    if (xenixIgnoreEvent) {
+ 	    	ev_pop();
+ 		continue;
+ 	    }
+ */
+ 	    /*
+ 	     * Figure out the X device this event should be reported on.
+ 	     */
+ 
+ 	    evType = EV_TAG(*evp);
+ 
+ 	    if (!(EV_TAG(*evp) & T_STRING)) {
+ 		xenixMouseProcessEvent(pPointer,evp);
+ 	    }
+ 	    else
+ 	    {
+ 	    	CARD8	key;
+ 		/* see if the key is a secondary key */
+ 		key = EV_BUF(*evp)[0];
+ 		if (key == keyCodePrefix1 || key == keyCodePrefix2) {
+ 		    ev_pop();
+ 		    if (++i, (evp=ev_read()) == (EVENT *) NULL) {
+ 			continue;
+ 		    }
+ 		    key = EV_BUF(*evp)[0];
+ 		    key = ibmAT101SecondaryMap[key & 0x7f];
+ 		    EV_BUF(*evp)[0] = key | EV_BUF(*evp)[0] & 0x80;
+ 		}
+ 		
+ 		xenixKbdProcessEvent(pKeyboard,evp);
+ 	    }
+ 	    ev_pop();
+ 	}
+ #if OK	
+ 	(* kbdPriv->DoneEvents) (pKeyboard, TRUE);
+ 	(* ptrPriv->DoneEvents) (pPointer, TRUE);
+ #endif
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * SetTimeSinceLastInputEvent --
+  *	Set the lastEventTime to now.
+  *
+  * Results:
+  *	None.
+  *
+  * Side Effects:
+  *	lastEventTime is altered.
+  *
+  *-----------------------------------------------------------------------
+  */
+ void
+ SetTimeSinceLastInputEvent()
+ {
+     struct timeval now;
+ 
+     gettimeofday (&now, (struct timezone *)0);
+     lastEventTime = TVTOMILLI(now);
+ }
+ 
+ /*
+  * DDX - specific abort routine.  Called by AbortServer().
+  */
+ void
+ AbortDDX()
+ {
+ }
+ 
+ /* Called by GiveUp(). */
+ void
+ ddxGiveUp()
+ {
+ }
+ 
+ int
+ ddxProcessArgument (argc, argv, i)
+     int	argc;
+     char *argv[];
+     int	i;
+ {
+     extern void UseMsg();
+     extern Bool ActiveZaphod;
+ 
+     if (strcmp (argv[i], "-ar1") == 0) {	/* -ar1 int */
+ 	if (++i >= argc) UseMsg ();
+ 	autoRepeatInitiate = 1000 * (long)atoi(argv[i]);
+ 	return 2;
+     }
+     if (strcmp (argv[i], "-ar2") == 0) {	/* -ar2 int */
+ 	if (++i >= argc) UseMsg ();
+ 	autoRepeatDelay = 1000 * (long)atoi(argv[i]);
+ 	return 2;
+     }
+     if (strcmp (argv[i], "-debug") == 0) {	/* -debug */
+ 	return 1;
+     }
+     if (strcmp (argv[i], "-dev") == 0) {	/* -dev /dev/mumble */
+ 	if (++i >= argc) UseMsg ();
+ 	return 2;
+     }
+     if (strcmp (argv[i], "-mono") == 0) {	/* -mono */
+ 	return 1;
+     }
+     if (strcmp (argv[i], "-zaphod") == 0) {	/* -zaphod */
+ 	ActiveZaphod = FALSE;
+ 	return 1;
+     }
+     return 0;
+ }
+ 
+ void
+ ddxUseMsg()
+ {
+     ErrorF("-ar1 int               set autorepeat initiate time\n");
+     ErrorF("-ar2 int               set autorepeat interval time\n");
+     ErrorF("-debug                 disable non-blocking console mode\n");
+     ErrorF("-dev filename          name of device to open\n");
+     ErrorF("-mono                  force monochrome-only screen\n");
+     ErrorF("-zaphod                disable active Zaphod mode\n");
+ }
*** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixKeyMap.c	Sun Jan  6 01:03:25 1991
--- X11R4/mit/server/ddx/xenix/vga/xenixKeyMap.c	Sun Dec  9 18:54:53 1990
***************
*** 0 ****
--- 1,249 ----
+ /*
+  * xenixKeyMap.c		Modified for Xenix by Chain Lee 08/90
+  */
+ 
+ /************************************************************
+ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+ 
+                     All Rights Reserved
+ 
+ Permission  to  use,  copy,  modify,  and  distribute   this
+ software  and  its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright no-
+ tice  appear  in all copies and that both that copyright no-
+ tice and this permission notice appear in  supporting  docu-
+ mentation,  and  that the names of Sun or MIT not be used in
+ advertising or publicity pertaining to distribution  of  the
+ software  without specific prior written permission. Sun and
+ M.I.T. make no representations about the suitability of this
+ software for any purpose. It is provided "as is" without any
+ express or implied warranty.
+ 
+ SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+ NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
+ ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
+ PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ 
+ ********************************************************/
+ 
+ #include "xenix.h"
+ #include "keysym.h"
+ 
+ CARD8	keyCodePrefix1 = 0xe0;
+ CARD8	keyCodePrefix2 = 0xe1;
+ CARD8	keyCodeCapsLock = 0x3a;
+ CARD8	keyCodeCrtlLeft = 0x1d;
+ 
+ static KeySym ibmAT101Map[] = {
+ 	NoSymbol,	NoSymbol,		/* 0x00 */
+ 	XK_Escape,	NoSymbol,		/* 0x01 */
+ 	XK_1,		XK_exclam,		/* 0x02 */
+ 	XK_2,		XK_at,			/* 0x03 */
+ 	XK_3,		XK_numbersign,		/* 0x04 */
+ 	XK_4,		XK_dollar,		/* 0x05 */
+ 	XK_5,		XK_percent,		/* 0x06 */
+ 	XK_6,		XK_asciicircum,		/* 0x07 */
+ 	XK_7,		XK_ampersand,		/* 0x08 */
+ 	XK_8,		XK_asterisk,		/* 0x09 */
+ 	XK_9,		XK_parenleft,		/* 0x0a */
+ 	XK_0,		XK_parenright,		/* 0x0b */
+ 	XK_minus,	XK_underscore,		/* 0x0c */
+ 	XK_equal,	XK_plus,		/* 0x0d */
+ 	XK_BackSpace,	NoSymbol,		/* 0x0e */
+ 	XK_Tab,		NoSymbol,		/* 0x0f */
+ 	XK_Q,		NoSymbol,		/* 0x10 */
+ 	XK_W,		NoSymbol,		/* 0x11 */
+ 	XK_E,		NoSymbol,		/* 0x12 */
+ 	XK_R,		NoSymbol,		/* 0x13 */
+ 	XK_T,		NoSymbol,		/* 0x14 */
+ 	XK_Y,		NoSymbol,		/* 0x15 */
+ 	XK_U,		NoSymbol,		/* 0x16 */
+ 	XK_I,		NoSymbol,		/* 0x17 */
+ 	XK_O,		NoSymbol,		/* 0x18 */
+ 	XK_P,		NoSymbol,		/* 0x19 */
+ 	XK_bracketleft,	XK_braceleft,		/* 0x1a */
+ 	XK_bracketright,XK_braceright,		/* 0x1b */
+ 	XK_Return,	NoSymbol,		/* 0x1c */
+ 	XK_Control_L,	NoSymbol,		/* 0x1d */
+ 	XK_A,		NoSymbol,		/* 0x1e */
+ 	XK_S,		NoSymbol,		/* 0x1f */
+ 	XK_D,		NoSymbol,		/* 0x20 */
+ 	XK_F,		NoSymbol,		/* 0x21 */
+ 	XK_G,		NoSymbol,		/* 0x22 */
+ 	XK_H,		NoSymbol,		/* 0x23 */
+ 	XK_J,		NoSymbol,		/* 0x24 */
+ 	XK_K,		NoSymbol,		/* 0x25 */
+ 	XK_L,		NoSymbol,		/* 0x26 */
+ 	XK_semicolon,	XK_colon,		/* 0x27 */	
+ 	XK_quoteright,	XK_quotedbl,		/* 0x28 */
+ 	XK_quoteleft,	XK_asciitilde,		/* 0x29 */
+ 	XK_Shift_L,	NoSymbol,		/* 0x2a */
+ 	XK_backslash,	XK_bar,			/* 0x2b */
+ 	XK_Z,		NoSymbol,		/* 0x2c */
+ 	XK_X,		NoSymbol,		/* 0x2d */
+ 	XK_C,		NoSymbol,		/* 0x2e */
+ 	XK_V,		NoSymbol,		/* 0x2f */
+ 	XK_B,		NoSymbol,		/* 0x30 */
+ 	XK_N,		NoSymbol,		/* 0x31 */
+ 	XK_M,		NoSymbol,		/* 0x32 */
+ 	XK_comma,	XK_less,		/* 0x33 */
+ 	XK_period,	XK_greater,		/* 0x34 */
+ 	XK_slash,	XK_question,		/* 0x35 */
+ 	XK_Shift_R,	NoSymbol,		/* 0x36 */
+ 	XK_asterisk,	NoSymbol,		/* 0x37 */
+ 	XK_Alt_L,	NoSymbol,		/* 0x38 */
+ 	XK_space,	NoSymbol,		/* 0x39 */
+ 	XK_Caps_Lock,	NoSymbol,		/* 0x3a */
+ 	XK_F1,		NoSymbol,		/* 0x3b */
+ 	XK_F2,		NoSymbol,		/* 0x3c */
+ 	XK_F3,		NoSymbol,		/* 0x3d */
+ 	XK_F4,		NoSymbol,		/* 0x3e */
+ 	XK_F5,		NoSymbol,		/* 0x3f */
+ 	XK_F6,		NoSymbol,		/* 0x40 */
+ 	XK_F7,		NoSymbol,		/* 0x41 */
+ 	XK_F8,		NoSymbol,		/* 0x42 */
+ 	XK_F9,		NoSymbol,		/* 0x43 */
+ 	XK_F10,		NoSymbol,		/* 0x44 */
+ 	XK_Num_Lock,	NoSymbol,		/* 0x45 */
+ 	XK_Scroll_Lock,	NoSymbol,		/* 0x46 */
+ 	XK_Home,	XK_7,			/* 0x47 */
+ 	XK_Up,		XK_8,			/* 0x48 */
+ 	XK_Prior,	XK_9,			/* 0x49 */
+ 	XK_minus,	NoSymbol,		/* 0x4a */
+ 	XK_Left,	XK_4,			/* 0x4b */
+ 	NoSymbol,	XK_5,			/* 0x4c */
+ 	XK_Right,	XK_6,			/* 0x4d */
+ 	XK_plus,	NoSymbol,		/* 0x4e */
+ 	XK_End,		XK_1,			/* 0x4f */
+ 	XK_Down,	XK_2,			/* 0x50 */
+ 	XK_Next,	XK_3,			/* 0x51 */
+ 	XK_Insert,	XK_0,			/* 0x52 */
+ 	XK_Delete,	XK_period,		/* 0x53 */
+ 	NoSymbol,	NoSymbol,		/* 0x54 */
+ 	NoSymbol,	NoSymbol,		/* 0x55 */
+ 	NoSymbol,	XK_colon,		/* 0x56 */
+ 	XK_F11,		NoSymbol,		/* 0x57 */
+ 	XK_F12,		NoSymbol,		/* 0x58 */
+ 	XK_Return,	NoSymbol,		/* 0x59 */
+ 	NoSymbol,	NoSymbol,		/* 0x5a */
+ 	NoSymbol,	NoSymbol,		/* 0x5b */
+ 	NoSymbol,	NoSymbol,		/* 0x5c */
+ 	NoSymbol,	NoSymbol,		/* 0x5d */
+ 	NoSymbol,	NoSymbol,		/* 0x5e */
+ 	NoSymbol,	NoSymbol,		/* 0x5f */
+ 
+ 	/* Secondary key map */
+ 
+ 	NoSymbol,	NoSymbol,		/* 0x60 */
+ 	XK_Alt_R,	NoSymbol,		/* 0x61 */
+ 	XK_Control_R,	NoSymbol,		/* 0x62 */
+ 	NoSymbol,	NoSymbol,		/* 0x63 */
+ 	XK_Insert,	NoSymbol,		/* 0x64 */
+ 	XK_Delete,	NoSymbol,		/* 0x65 */
+ 	XK_Home,	NoSymbol,		/* 0x66 */
+ 	XK_End,		NoSymbol,		/* 0x67 */
+ 	XK_Prior,	NoSymbol,		/* 0x68 */
+ 	XK_Next,	NoSymbol,		/* 0x69 */
+ 	XK_Left,	NoSymbol,		/* 0x6a */
+ 	XK_Up,		NoSymbol,		/* 0x6b */
+ 	XK_Down,	NoSymbol,		/* 0x6c */
+ 	XK_Right,	NoSymbol,		/* 0x6d */
+ 	XK_slash,	NoSymbol,		/* 0x6e */
+ 	XK_asterisk,	NoSymbol,		/* 0x6f */
+ 	NoSymbol,	NoSymbol,		/* 0x70 */
+ 	NoSymbol,	NoSymbol,		/* 0x71 */
+ 	NoSymbol,	NoSymbol,		/* 0x72 */
+ 	NoSymbol,	NoSymbol,		/* 0x73 */
+ 	NoSymbol,	NoSymbol,		/* 0x74 */
+ 	NoSymbol,	NoSymbol,		/* 0x75 */
+ 	NoSymbol,	NoSymbol,		/* 0x76 */
+ 	NoSymbol,	NoSymbol,		/* 0x77 */
+ 	NoSymbol,	NoSymbol,		/* 0x78 */
+ 	NoSymbol,	NoSymbol,		/* 0x79 */
+ 	NoSymbol,	NoSymbol,		/* 0x7a */
+ 	NoSymbol,	NoSymbol,		/* 0x7b */
+ 	NoSymbol,	NoSymbol,		/* 0x7c */
+ 	NoSymbol,	NoSymbol,		/* 0x7d */
+ 	NoSymbol,	NoSymbol,		/* 0x7e */
+ 	NoSymbol,	NoSymbol,		/* 0x7f */
+ };
+ 
+ KeySymsRec xenixKeySyms[] = {
+     /*	map	   minKeyCode	maxKC	width */
+     (KeySym *)NULL,	0,	0,	0,
+     (KeySym *)NULL,	0,	0,	0,
+     ibmAT101Map,	0,	0x70,	2,
+ };
+ 
+ #define	cT	(ControlMask)
+ #define	sH	(ShiftMask)
+ #define	lK	(LockMask)
+ #define	mT	(Mod1Mask)
+ 
+ CARD8 ibmAT101ModMap[MAP_LENGTH + 8] = {
+ /*  0   1   2   3   4   5   6   7   8   9   a   b   c   d   e   f           */
+     0,  0,  0,  0,  0,  0,  0,  0,				   /*buttons*/
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 00-0f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  cT, 0,  0, /* 10-1f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  sH, 0,  0,  0,  0,  0, /* 20-2f */
+     0,  0,  0,  0,  0,  0,  sH, 0,  mT, 0,  lK, 0,  0,  0,  0,  0, /* 30-3f */
+     0,  0,  0,  0,  0,  lK, lK, 0,  0,  0,  0,  0,  0,  0,  0,  0, /* 40-4f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 50-5f */
+     0,  mT, cT, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 60-6f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 70-7f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 80-8f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 90-9f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* a0-af */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* b0-bf */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* c0-cf */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* d0-df */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* e0-ef */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* f0-ff */
+ };
+ 
+ CARD8 *xenixModMap[] = {
+ 	(CARD8 *) NULL,
+ 	(CARD8 *) NULL,
+ 	ibmAT101ModMap,
+ };
+ 
+ #define	AL	0x61
+ #define	CT	0x62
+ #define	IN	0x64	
+ #define	DE	0x65
+ #define	HO	0x66
+ #define	EN	0x67
+ #define	PU	0x68
+ #define PD	0x69
+ #define	LF	0x6a
+ #define	UP	0x6b
+ #define	DN	0x6c
+ #define	RI	0x6d
+ #define	SL	0x6e
+ #define	AS	0x6f
+ #define	CR	0x1c
+ 
+ CARD8 ibmAT101SecondaryMap[MAP_LENGTH] = {
+ /*  0   1   2   3   4   5   6   7   8   9   a   b   c   d   e   f  */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 00-0f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  CR, CT, 0,  0, /* 10-1f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 20-2f */
+     0,  0,  0,  0,  0,  SL, 0,  AS, AL, 0,  0,  0,  0,  0,  0,  0, /* 30-3f */
+     0,  0,  0,  0,  0,  0,  0,  HO, UP, PU, 0,  LF, 0,  RI, 0,  EN,/* 40-4f */
+     DN, PD, IN, DE, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 50-5f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 60-6f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 70-7f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 80-8f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 90-9f */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* a0-af */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* b0-bf */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* c0-cf */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* d0-df */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* e0-ef */
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* f0-ff */
+ };
+ 
*** X11R4.ORIG/mit/server/ddx/xenix/trident/Imakefile	Sun Jan  6 01:03:28 1991
--- X11R4/mit/server/ddx/xenix/trident/Imakefile	Sun Dec  9 12:27:42 1990
***************
*** 0 ****
--- 1,49 ----
+ #include <Server.tmpl>
+ 
+ SRCS1 =	\
+ 	xenixInit.c \
+ 	xenixVGA.c \
+ 	xenixKbd.c \
+ 	xenixMouse.c \
+ 	xenixIo.c \
+ 	xenixTty.c \
+ 	xenixKeyMap.c \
+ 	vgaTrident.c \
+ 	vgaHWCntl.c
+ 
+ SRCS =	$(SRCS1) kbd_mode.c # constype.c 
+ 
+ OFILES = xenixInit.o
+ 
+ OBJS = \
+ 	xenixInit.o \
+ 	xenixVGA.o \
+ 	xenixKbd.o \
+ 	xenixMouse.o \
+ 	xenixIo.o \
+ 	xenixTty.o \
+ 	xenixKeyMap.o \
+ 	vgaTrident.o \
+ 	vgaHWCntl.o
+ 
+    INCLUDES = -I. -I../../mfb -I../../mi -I../../../include -I$(INCLUDESRC)
+    LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/4.2bsd/llib-los.ln \
+ 	      ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln ../../cfb/llib-lcfb.ln
+ 
+ NormalLibraryObjectRule()
+ 
+ all:: $(OFILES) kbd_mode
+ 
+ lintlib:
+ 
+ NormalLibraryTarget(xenix,$(OBJS))
+ NormalLintTarget($(SRCS1))
+ SingleProgramTarget(kbd_mode, kbd_mode.o,,)
+ InstallProgram(kbd_mode,$(BINDIR))
+ InstallManPage(kbd_mode,$(MANDIR))
+ InstallManPage(Xxenix,$(MANDIR))
+ 
+ saber_src:
+ 	#load $(CFLAGS) $(SRCS1)
+ 
+ DependTarget()
*** X11R4.ORIG/mit/server/ddx/xenix/trident/README	Sun Jan  6 01:03:31 1991
--- X11R4/mit/server/ddx/xenix/trident/README	Sun Jan  6 01:00:09 1991
***************
*** 0 ****
--- 1,35 ----
+ #
+ # README						C.LEE 1/5/91
+ #
+ 
+ This directory contains Trident 8800 VGA specific code. The default
+ video mode is set to 1024X600 noninterlaced. If you want another mode,
+ you can edit xenixDevInfo.h, change all 'VGA3's in the first five 
+ definitions to 'VGA2' (for 800X600 noninterlaced) or 'VGA4' (for
+ (1024X768 interlaced). 
+ 
+   * Keyboard LED control is built in for the server.
+   * Keyboard should be in XT mode (kernel default configuration).
+   * Screen can be changed into text mode for multi-screen switching by
+     pressing all three mouse buttons down, similar to what I did for MGR.
+   * kbd_mode program is provided in case the server crashes messing up
+     the keyboard. You can login from another serial terminal and run
+ 
+ 		kbd_mode -a < /dev/tty??
+ 
+     where /dev/tty?? is the multiscreen you started Xxenix.
+     Don't try 'kbd_mode -r' unless you have a serial terminal at hand,
+     otherwise you will have to power down the machine. There is a bug
+     in Xenix preventing you from getting the current keyboard mode.
+   * The Xxenix server uses the Xenix Event Manager. Therefore you may have 
+     problem running Xenix version of MGR window (ported by myself) using
+     bus mouse once Xxenix has been run.
+   * Screen saver blank mode is supported.
+   * Black and white pixel color can be customized by setting environment
+     variable XBACKGROUND and XFOREGROUND to the desired RGB value. Try
+ 
+ 	setenv XBACKGROUND 80:100:150
+ 	setenv XFOREGROUND 240:255:180
+ 
+ Chain Lee
+ chain at paul.rutgers.edu
*** X11R4.ORIG/mit/server/ddx/xenix/trident/kbd_mode.c	Sun Jan  6 01:03:33 1991
--- X11R4/mit/server/ddx/xenix/trident/kbd_mode.c	Sat Jan  5 17:50:28 1991
***************
*** 0 ****
--- 1,107 ----
+ /*
+  * kbd_mode.c			Modified for Xenix by Chain Lee 08/90
+  */
+ 
+ /************************************************************
+ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+ 
+                     All Rights Reserved
+ 
+ Permission  to  use,  copy,  modify,  and  distribute   this
+ software  and  its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright no-
+ tice  appear  in all copies and that both that copyright no-
+ tice and this permission notice appear in  supporting  docu-
+ mentation,  and  that the names of Sun or MIT not be used in
+ advertising or publicity pertaining to distribution  of  the
+ software  without specific prior written permission. Sun and
+ M.I.T. make no representations about the suitability of this
+ software for any purpose. It is provided "as is" without any
+ express or implied warranty.
+ 
+ SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+ NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
+ ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
+ PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ 
+ ********************************************************/
+ 
+ #ifndef lint
+ static  char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13";
+ #endif
+ 
+ /*
+  * Copyright (c) 1986 by Sun Microsystems, Inc.
+  *
+  *      kbd_mode:       set keyboard encoding mode
+  */
+ 
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #include <sys/vtkd.h>
+ #include <stdio.h>
+ 
+ static void	die(), usage();
+ static int	kbd_fd=0;
+ 
+ main(argc, argv)
+ int	argc;
+ char	*argv[];
+ {
+ 	int	code, translate;
+ 
+ 	argc--; 
+ 	argv++;
+ 	if (argc-- && **argv == '-') {
+ 		code = *(++*argv);
+ 	} else {
+ 		usage();
+ 	}
+ 	switch (code) {
+ 	case 'a':
+ 	case 'A':
+ 		translate = K_XLATE;
+ 		break;
+ 	case 'r':
+ 	case 'R':
+ 		translate = K_RAW;
+ 		break;
+ 	default:
+ 		usage();
+ 	}
+ 	if (ioctl(kbd_fd, KDSKBMODE, translate)) {
+ 		die("Couldn't initialize translation to Event");
+ 	}
+ 	exit(0);
+ }
+ 
+ static void
+ die(msg)
+ char	*msg;
+ {
+ 	fprintf(stderr, "%s\n", msg);
+ 	exit(1);
+ }
+ 
+ static void
+ usage()
+ {
+ 	int	translate;
+ #if XENIX_HAS_NO_BUGS
+ 	if ((translate = ioctl(kbd_fd, KDGKBMODE, &translate)) == -1) {
+ 		die("Couldn't inquire current translation");
+ 	}
+ #endif
+ 	fprintf(stderr, "kbd_mode { -a | -r }\n");
+ 	fprintf(stderr, "\tfor ascii, or raw event.\n");
+ 	fprintf(stderr, "Current mode is %s.\n",
+ 	    ( translate == K_XLATE ?    "a (ascii bytes)" :
+ 	    ( translate == K_RAW ? "r (raw events)" : "unknown mode")));
+ 	exit(1);
+ }
+ 
+ 
*** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixKbd.c	Sun Jan  6 01:03:36 1991
--- X11R4/mit/server/ddx/xenix/trident/xenixKbd.c	Sun Dec  9 18:53:17 1990
***************
*** 0 ****
--- 1,500 ----
+ /*
+  * xenixKbd.c			Modified for Xenix by Chain Lee 08/90
+  */
+ 
+ /*-
+  *
+  * Copyright (c) 1987 by the Regents of the University of California
+  *
+  * Permission to use, copy, modify, and distribute this
+  * software and its documentation for any purpose and without
+  * fee is hereby granted, provided that the above copyright
+  * notice appear in all copies.  The University of California
+  * makes no representations about the suitability of this
+  * software for any purpose.  It is provided "as is" without
+  * express or implied warranty.
+  *
+  */
+ 
+ /************************************************************
+ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+ 
+                     All Rights Reserved
+ 
+ Permission  to  use,  copy,  modify,  and  distribute   this
+ software  and  its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright no-
+ tice  appear  in all copies and that both that copyright no-
+ tice and this permission notice appear in  supporting  docu-
+ mentation,  and  that the names of Sun or MIT not be used in
+ advertising or publicity pertaining to distribution  of  the
+ software  without specific prior written permission. Sun and
+ M.I.T. make no representations about the suitability of this
+ software for any purpose. It is provided "as is" without any
+ express or implied warranty.
+ 
+ SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+ NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
+ ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
+ PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ 
+ ********************************************************/
+ 
+ #define NEED_EVENTS
+ #include "xenix.h"
+ #include "Xproto.h"
+ #include "keysym.h"
+ #include "inputstr.h"
+ 
+ typedef struct {
+     int	    	  trans;          	/* Original translation form */
+ } SunKbPrivRec, *SunKbPrivPtr;
+ 
+ extern CARD8 *xenixModMap[];
+ extern CARD8 ibmAT101ModMap[];
+ extern KeySymsRec xenixKeySyms[];
+ 
+ extern CARD8 keyCodePrefix1, keyCodePrefix2, keyCodeCapsLock;
+ 
+ extern void	ProcessInputEvents();
+ extern void	miPointerPosition();
+ 
+ static void 	xenixBell();
+ static void 	xenixKbdCtrl();
+ void	 	xenixKbdProcessEvent();
+ static void 	xenixKbdDoneEvents();
+ 
+ int		click = 0;
+ 
+ int	  	autoRepeatKeyDown = 0;
+ int	  	autoRepeatDebug = 0;
+ int	  	autoRepeatReady;
+ long	  	autoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE;
+ long	  	autoRepeatDelay = 1000 * AUTOREPEAT_DELAY;
+ static int	autoRepeatFirst;
+ struct timeval  autoRepeatLastKeyDownTv;
+ struct timeval  autoRepeatDeltaTv;
+ 
+ static KeybdCtrl sysKbCtrl;
+ 
+ static KbPrivRec	sysKbPriv = {
+     -1,				/* Type	of keyboard */
+     xenixKbdProcessEvent,	/* Function to process an event	*/
+     xenixKbdDoneEvents,		/* Function called when	all events */
+ 				/* have	been handled. */
+     (pointer) NULL,		/* Private to keyboard device */
+     0,				/* offset for device keycodes */
+     &sysKbCtrl,			/* Initial full	duration = .20 sec. */
+ };
+ 
+ static void
+ sigsegv(){
+     reset_tty(0);
+     ev_close();
+     abort();
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixKbdProc --
+  *	Handle the initialization, etc. of a keyboard.
+  *
+  * Results:
+  *	None.
+  *
+  * Side Effects:
+  *
+  * Note:
+  *	When using xenixwindows, all input comes off a single fd, stored in the
+  *	global windowFd.  Therefore, only one device should be enabled and
+  *	disabled, even though the application still sees both mouse and
+  *	keyboard.  We have arbitrarily chosen to enable and disable windowFd
+  *	in the keyboard routine xenixKbdProc rather than in xenixMouseProc.
+  *
+  *-----------------------------------------------------------------------
+  */
+ int
+ xenixKbdProc (pKeyboard, what)
+     DevicePtr	  pKeyboard;	/* Keyboard to manipulate */
+     int	    	  what;	    	/* What to do to it */
+ {
+     int		qfd;
+     dmask_t	dmask =	D_STRING | D_REL | D_BUTTON;
+     static int	kbdFd=0;
+ 
+     switch (what) {
+ 	case DEVICE_INIT:
+ 
+ 	    signal(SIGSEGV, sigsegv);
+ 
+ 	    if (pKeyboard != LookupKeyboardDevice()) {
+ 		ErrorF ("Cannot open non-system keyboard");
+ 		return (!Success);
+ 	    }
+ 	    
+ 	    /*
+ 	     * First open the event manager.
+ 	     */
+ 	    if (ev_init() < 0) {
+ 		ErrorF("xenixKbdProc: cannot init event manager\n");
+ 		return (!Success); 
+ 	    }
+ 	    if ((qfd = ev_open(&dmask)) < 0) {
+ 	    	ErrorF("xenixKbdProc: cannot open event manager\n");
+ 	    	return (!Success);
+ 	    }
+ 	    if (dmask != (D_STRING | D_REL | D_BUTTON)) {
+ 	    	Error("xenixKbdProc: cannot attach mouse and keyboard\n");
+ 	    	return (!Success);
+ 	    }
+ 
+ 	    pKeyboard->devicePrivate = (pointer)&sysKbPriv;
+ 	    pKeyboard->on = FALSE;
+ 	    sysKbCtrl =	defaultKeyboardControl;
+ 	    sysKbPriv.ctrl = &sysKbCtrl;
+ 
+ 	    sysKbPriv.type = KBTYPE_IBMAT;
+ 	    if (xenixKeySyms[sysKbPriv.type].minKeyCode	< MIN_KEYCODE) {
+ 		int offset=MIN_KEYCODE-xenixKeySyms[sysKbPriv.type].minKeyCode;
+ 
+ 		xenixKeySyms[sysKbPriv.type].minKeyCode	+= offset;
+ 		xenixKeySyms[sysKbPriv.type].maxKeyCode	+= offset;
+ 		sysKbPriv.offset = offset;
+ 	    }
+ 
+ 	    /* set up keyboard for raw event generating mode */
+ 	    /* set up tty to raw mode */
+ 	    set_tty(0);
+ 
+ 	    InitKeyboardDeviceStruct(
+ 		    pKeyboard,
+ 		    &(xenixKeySyms[sysKbPriv.type]),
+ 		    (xenixModMap[sysKbPriv.type]),
+ 		    xenixBell,
+ 		    xenixKbdCtrl);
+ 	    break;
+ 
+ 	case DEVICE_ON:
+ /*	    AddEnabledDevice(windowFd);
+ */	    pKeyboard->on = TRUE;
+ 	    break;
+ 
+ 	case DEVICE_OFF:
+ /*	    RemoveEnabledDevice(kbdFd);
+ */	    pKeyboard->on = FALSE;
+ 	    break;
+ 	case DEVICE_CLOSE:
+ /*	    RemoveEnabledDevice(kbdFd);
+ */	    pKeyboard->on = FALSE;
+ 	    reset_tty(0);
+ 	    ev_close();
+ 	    break;
+     }
+     return (Success);
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixBell --
+  *	Ring the terminal/keyboard bell
+  *
+  * Results:
+  *	Ring the keyboard bell for an amount of time proportional to
+  *	"loudness."
+  *
+  * Side Effects:
+  *	None, really...
+  *
+  *-----------------------------------------------------------------------
+  */
+ static void
+ xenixBell (loudness, pKeyboard)
+     int	    	  loudness;	    /* Percentage of full volume */
+     DevicePtr	  pKeyboard;	    /* Keyboard to ring */
+ {
+     static int	bell_fd = -1;
+  
+     if (loudness == 0) {
+  	return;
+     }
+     if (bell_fd < 0)
+     	if ((bell_fd = open("/dev/bell", O_RDWR, 0)) < 0) {
+ 	    ErrorF("xenixBell: cannot \"/dev/bell\"\n");
+ 	    return;
+ 	}
+     write(bell_fd, "\002", 1 );
+     nap(loudness);
+     write(bell_fd,"\003",1);
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixKbdCtrl --
+  *	Alter some of the keyboard control parameters
+  *
+  * Results:
+  *	None.
+  *
+  * Side Effects:
+  *	Some...
+  *
+  *-----------------------------------------------------------------------
+  */
+ static void
+ xenixKbdCtrl (pKeyboard, ctrl)
+     DevicePtr	  pKeyboard;	    /* Keyboard to alter */
+     KeybdCtrl     *ctrl;
+ {
+     /* LEDS */
+     ioctl(0, KDSETLED, ctrl->leds);
+     /* keyboard click */
+     click = ctrl->click;
+ }
+ 
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixKbdProcessEvent --
+  *
+  * Results:
+  *
+  * Side Effects:
+  *
+  * Caveat:
+  *      To reduce duplication of code and logic (and therefore bugs), the
+  *      xenixwindows version of kbd processing (xenixKbdProcessEventSunWin())
+  *      counterfeits a firm event and calls this routine.  This
+  *      couunterfeiting relies on the fact this this routine only looks at the
+  *      id, time, and value fields of the firm event which it is passed.  If
+  *      this ever changes, the xenixKbdProcessEventSunWin will also have to
+  *      change.
+  *
+  *-----------------------------------------------------------------------
+  */
+ void
+ xenixKbdProcessEvent (pKeyboard, evp)
+     DevicePtr	  pKeyboard;
+     EVENT	  *evp;
+ {
+     xEvent		xE;
+     int			delta;
+     static xEvent	autoRepeatEvent;
+     BYTE		key;
+     CARD8		keyModifiers;
+     
+     /* we need to encode three states of the cap lock key */
+     static int		capsLockDown = 0;
+     static int		capsLockOn = 0;
+ 
+ #if OK
+     if (autoRepeatKeyDown && fe->id == AUTOREPEAT_EVENTID) {
+ 	pPriv = (KbPrivPtr) pKeyboard->devicePrivate;
+ 	if (pPriv->ctrl->autoRepeat != AutoRepeatModeOn) {
+ 		autoRepeatKeyDown = 0;
+ 		return;
+ 	}
+ 	/*
+ 	 * Generate auto repeat event.	XXX one for now.
+ 	 * Update time & pointer location of saved KeyPress event.
+ 	 */
+ 	if (autoRepeatDebug)
+ 	    ErrorF("xenixKbdProcessEvent: autoRepeatKeyDown = %d\n",
+ 			autoRepeatKeyDown);
+ 
+ 	delta = TVTOMILLI(autoRepeatDeltaTv);
+ 	autoRepeatFirst = FALSE;
+ 
+ 	/*
+ 	 * Fake a key up event and a key down event
+ 	 * for the last key pressed.
+ 	 */
+ 	autoRepeatEvent.u.keyButtonPointer.time += delta;
+ 	miPointerPosition (screenInfo.screens[0],
+ 			   &autoRepeatEvent.u.keyButtonPointer.rootX,
+ 			   &autoRepeatEvent.u.keyButtonPointer.rootY);
+ 	autoRepeatEvent.u.u.type = KeyRelease;
+ 	(* pKeyboard->processInputProc) (&autoRepeatEvent, pKeyboard, 1);
+ 
+ 	autoRepeatEvent.u.u.type = KeyPress;
+ 	(* pKeyboard->processInputProc) (&autoRepeatEvent, pKeyboard, 1);
+ 
+ 	/* Update time of last key down */
+ 	tvplus(autoRepeatLastKeyDownTv, autoRepeatLastKeyDownTv, 
+ 			autoRepeatDeltaTv);
+ 
+ 	return;
+     }
+ #endif
+ 
+     key = EV_BUF(*evp)[0];
+ 
+     /* caps lock flip flop */
+     if (key == (0x80 | keyCodeCapsLock)) {
+     	capsLockDown = 0;
+ 	return;
+     }
+ 
+     if (key == keyCodeCapsLock) {
+     	if (capsLockDown)
+ 	    return;
+ 	else 
+ 	    capsLockDown = 1;
+  
+ 	if (capsLockOn) {
+ 	    EV_BUF(*evp)[0] |= 0x80;
+ 	    capsLockOn = 0;
+ 	}
+ 	else
+ 	{
+ 	    capsLockOn = 1;
+ 	}
+     }
+ 
+     /* keyboard click */
+     if (!(key & 0x80)) 
+ 	if (click >= 0)
+ 	    xenixBell(click, pKeyboard);
+ 
+     key &= 0x7f;
+ 
+ /*
+     keyModifiers = ((DeviceIntPtr)pKeyboard)->key->modifierMap[key];
+ */
+     keyModifiers = ibmAT101ModMap[key];
+     key += sysKbPriv.offset;
+ 
+         if (autoRepeatKeyDown && (keyModifiers == 0) &&
+ 	(!(EV_BUF(*evp)[0] & 0x80) || (key == autoRepeatEvent.u.u.detail))) {
+ 	/*
+ 	 * Kill AutoRepeater on any real non-modifier key down, or auto key up
+ 	 */
+ 	autoRepeatKeyDown = 0;
+ 	if (autoRepeatDebug)
+ 	    ErrorF("xenixKbdProcessEvent: autoRepeat off\n");
+     }
+ 
+     xE.u.keyButtonPointer.time = EV_TIME(*evp);
+     miPointerPosition (screenInfo.screens[0],
+ 		       &xE.u.keyButtonPointer.rootX,
+ 		       &xE.u.keyButtonPointer.rootY);
+     xE.u.u.type = ((EV_BUF(*evp)[0] & 0x80) ? KeyRelease : KeyPress);
+     xE.u.u.detail = key;
+ 
+ #if OK
+     if (keyModifiers & LockMask) {
+ 	if (xE.u.u.type == KeyRelease)
+ 	    return; /* this assumes autorepeat is not desired */
+ 	if (BitIsOn(((DeviceIntPtr)pKeyboard)->key->down, key))
+ 	    xE.u.u.type = KeyRelease;
+     }
+ 
+     if ((xE.u.u.type == KeyPress) && (keyModifiers == 0)) {
+ 	/* initialize new AutoRepeater event & mark AutoRepeater on */
+ 	if (autoRepeatDebug)
+             ErrorF("xenixKbdProcessEvent: VKEY_DOWN\n");
+ 	autoRepeatEvent = xE;
+ 	autoRepeatFirst = TRUE;
+ 	autoRepeatKeyDown++;
+ 	autoRepeatLastKeyDownTv = EV_TIME(*evp);
+     }
+ #endif
+     (* pKeyboard->processInputProc) (&xE, pKeyboard, 1);
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixDoneEvents --
+  *	Nothing to do, here...
+  *
+  * Results:
+  *
+  * Side Effects:
+  *
+  *-----------------------------------------------------------------------
+  */
+ /*ARGSUSED*/
+ static void
+ xenixKbdDoneEvents (pKeyboard)
+     DevicePtr	  pKeyboard;
+ {
+ 
+ }
+ 
+ /*ARGSUSED*/
+ Bool
+ LegalModifier(key)
+ {
+     return (TRUE);
+ }
+ 
+ static KeybdCtrl *pKbdCtrl = (KeybdCtrl *) 0;
+ 
+ /*ARGSUSED*/
+ void
+ xenixBlockHandler(nscreen, pbdata, pptv, pReadmask)
+     int nscreen;
+     pointer pbdata;
+     struct timeval **pptv;
+     pointer pReadmask;
+ {
+     static struct timeval artv = { 0, 0 };	/* autorepeat timeval */
+ #if OK
+     if (!autoRepeatKeyDown)
+ 	return;
+ 
+     if (pKbdCtrl == (KeybdCtrl *) 0)
+ 	pKbdCtrl = ((KbPrivPtr) LookupKeyboardDevice()->devicePrivate)->ctrl;
+ 
+     if (pKbdCtrl->autoRepeat != AutoRepeatModeOn)
+ 	return;
+ 
+     if (autoRepeatFirst == TRUE)
+ 	artv.tv_usec = autoRepeatInitiate;
+     else
+ 	artv.tv_usec = autoRepeatDelay;
+     *pptv = &artv;
+ 
+     if (autoRepeatDebug)
+ 	ErrorF("xenixBlockHandler(%d,%d): \n", artv.tv_sec, artv.tv_usec);
+ #endif
+ }
+ 
+ /*ARGSUSED*/
+ void
+ xenixWakeupHandler(nscreen, pbdata, err, pReadmask)
+     int nscreen;
+     pointer pbdata;
+     unsigned long err;
+     pointer pReadmask;
+ {
+     struct timeval tv;
+ #if OK
+     if (autoRepeatDebug)
+ 	ErrorF("xenixWakeupHandler(ar=%d, err=%d):\n", autoRepeatKeyDown, err);
+ 
+     if (pKbdCtrl == (KeybdCtrl *) 0)
+ 	pKbdCtrl = ((KbPrivPtr) LookupKeyboardDevice()->devicePrivate)->ctrl;
+ 
+     if (pKbdCtrl->autoRepeat != AutoRepeatModeOn)
+ 	return;
+ 
+     if (autoRepeatKeyDown) {
+ 	gettimeofday(&tv, (struct timezone *) NULL);
+ 	tvminus(autoRepeatDeltaTv, tv, autoRepeatLastKeyDownTv);
+ 	if (autoRepeatDeltaTv.tv_sec > 0 ||
+ 			(!autoRepeatFirst && autoRepeatDeltaTv.tv_usec >
+ 				autoRepeatDelay) ||
+ 			(autoRepeatDeltaTv.tv_usec >
+ 				autoRepeatInitiate))
+ 		autoRepeatReady++;
+     }
+     
+     if (autoRepeatReady)
+ 	ProcessInputEvents();
+     autoRepeatReady = 0;
+ #endif
+ }



More information about the Alt.sources mailing list