X11R4 patch for SCO XENIX (part06)

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


*** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixDevInfo.h	Sun Jan  6 01:03:51 1991
--- X11R4/mit/server/ddx/xenix/trident/xenixDevInfo.h	Sun Jan  6 00:45:47 1991
***************
*** 0 ****
--- 1,67 ----
+ /*
+  * xenixDevInfo.h				By Chain Lee 08/90
+  */
+ 
+ /************************************************************************\
+  *	 Set following definitions to the mode you desire		*
+  *	 Note that only VGA[2,3,4] are actually supported here		*
+ \************************************************************************/
+ 
+ #define FBTYPE			FBTYPE_VGA3
+ #define	FBWIDTH			VGA3_FBWIDTH
+ #define	FBHEIGHT		VGA3_FBHEIGHT
+ #define	FBSIZE			VGA3_FBSIZE
+ #define	SETMODE			VGA3_SETMODE
+ 
+ /************************************************************************\
+  *	Do not change following definitions				*
+ \************************************************************************/
+ 
+ /*
+  * to be for multiscreen support
+  */
+ 
+ #define	FBTYPE_HERCULES		1		/* 720 x 348 */
+ #define	FBTYPE_CGA		2		/* 640 x 200 */
+ #define	FBTYPE_EGA		3		/* 640 x 350 */
+ #define	FBTYPE_VGA		4		/* 640 x 480 */
+ #define	FBTYPE_VGA1		4		/* 640 x 480 */
+ #define	FBTYPE_VGA2		5		/* 800 x 600 */
+ #define	FBTYPE_VGA3		6		/* 1024 x 600 */
+ #define	FBTYPE_VGA4		7		/* 1024 x 768 interlaced */
+ #define	FBTYPE_VGA5		8		/* 640 x 480 color */
+ 
+ #define	HERCULES_FBWIDTH	720
+ #define	HERCULES_FBHEIGHT	348
+ #define	HERCULES_FBSIZE		(1024 * 32)
+ 
+ #define	VGA1_FBWIDTH		640
+ #define	VGA1_FBHEIGHT		480
+ #define	VGA1_FBSIZE		((640 * 480) >> 3)
+ #define	VGA1_SETMODE		trident_vga1
+ 
+ #define	VGA2_FBWIDTH		800
+ #define	VGA2_FBHEIGHT		600
+ #define	VGA2_FBSIZE		((800 * 600) >> 3)
+ #define	VGA2_SETMODE		trident_vga2
+ 
+ #define	VGA3_FBWIDTH		1024
+ #define	VGA3_FBHEIGHT		600
+ #define	VGA3_FBSIZE		((1024 * 600) >> 3)
+ #define	VGA3_SETMODE		trident_vga3
+ 
+ #define	VGA4_FBWIDTH		1024
+ #define	VGA4_FBHEIGHT		768
+ #define	VGA4_FBSIZE		((1024 * 768) >> 3)
+ #define	VGA4_SETMODE		trident_vga4
+ 
+ #define	VGA5_FBWIDTH		640
+ #define	VGA5_FBHEIGHT		480
+ #define	VGA5_FBSIZE		(640 * 480)
+ #define	VGA5_SETMODE		trident_vga5
+ 
+ /****************************************************************************/
+ 
+ #define	KBTYPE_IBMAT		2
+ 
+ #include "vgaSave.h"
*** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixVGA.c	Sun Jan  6 01:03:53 1991
--- X11R4/mit/server/ddx/xenix/trident/xenixVGA.c	Fri Dec 14 00:18:59 1990
***************
*** 0 ****
--- 1,380 ----
+ /*
+  * xenixVGA.c			Modified for Xenix by Chain Lee 80/90
+  */
+ 
+ /*-
+  * sunBW2.c --
+  *	Functions for handling the sun BWTWO board.
+  *
+  * Copyright (c) 1987 by the Regents of the University of California
+  * Copyright (c) 1987 by Adam de Boor, UC Berkeley
+  *
+  * 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    "resource.h"
+ 
+ typedef struct vga {
+     uchar_t	image[FBSIZE];          /* Pixel buffer */
+ } VGARec, *VGAPtr;
+ 
+ static int	xenixVGAScreenIndex;
+ int		xenixVGAFd;
+ caddr_t		xenixVGAFb;
+ static	VGARec	VGASaveFb;
+ 
+ unsigned fg_red=255, fg_green=255, fg_blue=255;
+ unsigned bg_red=0, bg_green=0, bg_blue=0;
+ 
+ static struct vga_video_hardware_state	*VS;
+ static int fg_color = 15; bg_color = 1;
+ 
+ static void	xenixInitSwitcher();
+ static int	xenixInitVGAScreen();
+ static void	xenixVGASetScreen(), xenixVGAResetScreen();
+ static void	xenixVGASetcolor(), xenixVGAResetColor();
+ static int	xenixConsoleXMode;
+ static void	xenixVGASaveFb(), xenixVGARestoreFb();
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixVGASaveScreen --
+  *	Disable the video on the frame buffer to save the screen.
+  *
+  * Results:
+  *	None.
+  *
+  * Side Effects:
+  *	Video enable state changes.
+  *
+  *-----------------------------------------------------------------------
+  */
+ static Bool
+ xenixVGASaveScreen (pScreen, on)
+     ScreenPtr	  pScreen;
+     Bool    	  on;
+ {
+     int         state = on;
+     int		i;
+ 
+     if (on != SCREEN_SAVER_ON) {
+ 	SetTimeSinceLastInputEvent();
+ 	state = 1;
+ 	/* in case server reset and interlace turned off */
+ 	outb(0x3d4, 0x1e);
+ #if FBTYPE == FBTYPE_VGA4
+ 	outb(0x3d5, 0x04);
+ #else
+ 	outb(0x3d5, 0x00);
+ #endif
+ 	vgaSetColor(0, 0, 0, 0);
+ 	vgaSetColor(1, bg_red, bg_green, bg_blue);
+ 	vgaSetColor(63, fg_red, fg_green, fg_blue);
+     } else {
+ 	state = 0;
+ 	vgaSetColor(0, 0, 0, 0);
+ 	vgaSetColor(1, 0, 0, 0);
+ 	vgaSetColor(63, 0, 0, 0);
+     }
+     return TRUE;
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixVGACloseScreen --
+  *	called to ensure video is enabled when server exits.
+  *
+  * Results:
+  *	Screen is unsaved.
+  *
+  * Side Effects:
+  *	None
+  *
+  *-----------------------------------------------------------------------
+  */
+ /*ARGSUSED*/
+ static Bool
+ xenixVGACloseScreen(i, pScreen)
+     int		i;
+     ScreenPtr	pScreen;
+ {
+     Bool    ret;
+ 
+     pScreen->CloseScreen = (Bool (*)()) pScreen->devPrivates[xenixVGAScreenIndex].ptr;
+     ret = (*pScreen->CloseScreen) (i, pScreen);
+     (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
+ 
+     /* Turn off interlaced mode */
+     outb(0x3d4, 0x1e);
+     outb(0x3d5, 0x00);
+     
+     return ret;
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixVGAInit --
+  *	Attempt to find and initialize a VGA framebuffer
+  *
+  * Results:
+  *	None
+  *
+  * Side Effects:
+  *	Most of the elements of the ScreenRec are filled in.  The
+  *	video is enabled for the frame buffer...
+  *
+  *-----------------------------------------------------------------------
+  */
+ /*ARGSUSED*/
+ static Bool
+ xenixVGAInit (index, pScreen, argc, argv)
+     int	    	  index;    	/* The index of pScreen in the ScreenInfo */
+     ScreenPtr	  pScreen;  	/* The Screen to initialize */
+     int	    	  argc;	    	/* The number of the Server's arguments. */
+     char    	  **argv;   	/* The arguments themselves. Don't change! */
+ {
+     if (!mfbScreenInit(pScreen,
+ 		       xenixFbs[index].fb,
+ 		       xenixFbs[index].fb_width,
+ 		       xenixFbs[index].fb_height,
+ 		       monitorResolution, monitorResolution,
+ 		       xenixFbs[index].fb_width))
+ 	return (FALSE);
+ 
+     pScreen->devPrivates[xenixVGAScreenIndex].ptr = (pointer) pScreen->CloseScreen;
+ 
+     pScreen->CloseScreen = xenixVGACloseScreen;
+     pScreen->SaveScreen = xenixVGASaveScreen;
+     pScreen->blackPixel = 0;
+     pScreen->whitePixel = 1;
+ 
+     /*
+      * Enable video output...? 
+      */
+     (void) xenixVGASaveScreen(pScreen, SCREEN_SAVER_FORCER);
+ 
+     return (xenixScreenInit(pScreen) && mfbCreateDefColormap(pScreen));
+ }
+ 
+ /*-
+  *-----------------------------------------------------------------------
+  * xenixVGAProbe --
+  *	Attempt to find and initialize a VGA framebuffer
+  *
+  * Results:
+  *	None
+  *
+  * Side Effects:
+  *	Memory is allocated for the frame buffer and the buffer is mapped. 
+  *
+  *-----------------------------------------------------------------------
+  */
+ 
+ /*ARGSUSED*/
+ Bool
+ xenixVGAProbe(pScreenInfo, index, fbNum, argc, argv)
+     ScreenInfo	  *pScreenInfo;	/* The screenInfo struct */
+     int	    	  index;    	/* The index of pScreen in the ScreenInfo */
+     int	    	  fbNum;    	/* Index into the xenixFbData array */
+     int	    	  argc;	    	/* The number of the Server's arguments. */
+     char    	  **argv;   	/* The arguments themselves. Don't change! */
+ {
+     int         fd;
+     caddr_t	mapaddr;
+ 
+     if ((fd = xenixOpenFrameBuffer(0, index, fbNum, argc, argv)) < 0)
+ 	return FALSE;
+ 
+     if ((xenixVGAFd = open("/dev/vga", 0)) < 0)
+ 	return FALSE;
+ 
+     if ((mapaddr = (caddr_t) xenixInitVGAScreen(fd)) < 0)
+     	ErrorF("xenixVGAProbe: cannot open VGA screen\n");
+ 
+     xenixInitSwitcher();
+ 
+     xenixFbs[index].fb = (pointer)mapaddr;
+     xenixFbs[index].fd = fd;
+     xenixFbs[index].fb_width = FBWIDTH;
+     xenixFbs[index].fb_height = FBHEIGHT;
+     xenixFbs[index].fb_size = FBSIZE;
+     xenixFbs[index].EnterLeave = (void(*)()) NULL;
+     return TRUE;
+ }
+ 
+ Bool
+ xenixVGACreate(pScreenInfo, argc, argv)
+     ScreenInfo	  *pScreenInfo;
+     int	    	  argc;
+     char    	  **argv;
+ {
+     if (xenixGeneration != serverGeneration)
+     {
+ 	xenixVGAScreenIndex = AllocateScreenPrivateIndex();
+ 	if (xenixVGAScreenIndex < 0)
+ 	    return FALSE;
+     }
+     return (AddScreen(xenixVGAInit, argc, argv) >= 0);
+ }
+ 
+ void
+ xenixSwitchConsoleMode()
+ {
+     if (xenixConsoleXMode) {
+ 	xenixVGASaveFb();
+ 	xenixVGAResetColor();
+ 	xenixVGAResetScreen();
+ 	reset_tty(0);
+     	xenixConsoleXMode = 0;
+     } else {
+ 	xenixVGASetScreen();
+ 	xenixVGASetColor();
+     	xenixVGARestoreFb();
+     	set_tty(0);
+     	xenixConsoleXMode = 1;
+     }
+ }
+ 
+ static void
+ xenixInitSwitcher()
+ {
+ 	struct vt_mode smode;
+ 
+ 	xenixConsoleXMode = 1;
+ 	return;
+ }
+ 
+ static void
+ xenixVGASaveFb()
+ {
+ 	ulong_t *p, *q;
+ 	int	i;
+ 
+ 	i = FBSIZE / sizeof(ulong_t);
+ 	p = (ulong_t *) &VGASaveFb;
+ 	q = (ulong_t *) xenixVGAFb;
+ 
+ 	while (i--)
+ 		*p++ = *q, *q++ = 0;
+ }
+ 
+ static void
+ xenixVGARestoreFb()
+ {
+ 	ulong_t *p, *q;
+ 	int	i;
+ 
+ 	i = FBSIZE / sizeof(ulong_t);
+ 	p = (ulong_t *) &VGASaveFb;
+ 	q = (ulong_t *) xenixVGAFb;
+ 
+ 	while (i--)
+ 		*q++ = *p++;
+ }
+ 
+ static int
+ xenixInitVGAScreen(fd)
+ int	fd;
+ {
+ 	int mapaddr;
+ 	char *color, *getenv();
+ 
+ 	if (color=getenv("XBACKGROUND"))
+ 		sscanf(color, "%d:%d:%d", &bg_red, &bg_green, &bg_blue);
+ 	if (color=getenv("XFOREGROUND"))
+ 		sscanf(color, "%d:%d:%d", &fg_red, &fg_green, &fg_blue); 
+ 
+ 	xenixVGASetScreen();
+ 	mapaddr = ioctl(fd, 0, 0);
+ 	xenixVGAFb = (caddr_t) mapaddr;
+ 	xenixVGASetColor();
+ 	return mapaddr;
+ }
+ 
+ static void
+ xenixVGASetScreen()
+ {
+ 	ioctl(xenixVGAFd, SW_VGA11, 0);
+ 
+ 	save_vga_state(VS);
+ 	SETMODE(VS);
+ 	restore_vga_state(VS);
+ 	outb(0x3ce, 0x06);
+ 	outb(0x3cf, inb(0x3cf)&0xf3);
+ 
+ 	/* set interlace mode */
+ 	outb(0x3d4, 0x1e);
+ #if FBTYPE == FBTYPE_VGA4
+ 	outb(0x3d5, 0x04);
+ #else
+ 	outb(0x3d5, 0x00);
+ #endif
+ 	outb(0x3c4, 0);
+ 	outb(0x3c5, 1);
+ 	outb(0x3c5, 3);
+ }
+ 
+ static void
+ xenixVGAResetScreen()
+ {
+ 	ioctl(xenixVGAFd, SW_VGA80x25, 0);
+ 
+ 	/* Turn off interlace mode */
+ 	outb(0x3d4, 0x1e);
+ 	outb(0x3d5, 0x00);
+ }
+ 
+ static void
+ xenixVGASetColor()
+ {
+ 	int	i;
+ 
+ 	vgaSetColor(0, 0, 0, 0);
+ 	vgaSetColor(1, bg_red, bg_green, bg_blue);
+ 	vgaSetColor(63, fg_red, fg_green, fg_blue);
+ 	vga_color_init(xenixVGAFb,bg_color,fg_color,FBSIZE);
+ }
+ 
+ static void
+ xenixVGAResetColor()
+ {
+ 	vga_color_init(xenixVGAFb,0,0,FBSIZE);
+ }
+ 	
*** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixIo.c	Sun Jan  6 01:03:56 1991
--- X11R4/mit/server/ddx/xenix/trident/xenixIo.c	Sun Dec  9 18:53:33 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/trident/xenixKeyMap.c	Sun Jan  6 01:03:59 1991
--- X11R4/mit/server/ddx/xenix/trident/xenixKeyMap.c	Sun Dec  9 18:53: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 */
+ };
+ 



More information about the Alt.sources mailing list