[comp.sources.x] v09i094: patches for X11R4 for SCO UNIX, Part08/12

jimke@uunet.uu.net (10/12/90)

Submitted-by: microsoft!jimke@uunet.uu.net
Posting-number: Volume 9, Issue 94
Archive-name: sco.patches/part08

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 8 (of 12)."
# Contents:  fix-14.sco08
# Wrapped by jimke@kellman on Sat Oct  6 17:13:31 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'fix-14.sco08' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fix-14.sco08'\"
else
echo shar: Extracting \"'fix-14.sco08'\" \(42622 characters\)
sed "s/^X//" >'fix-14.sco08' <<'END_OF_FILE'
X*** ./mit-orig/server/ddx/ibm/sysV/OScursor.h	Thu Oct  4 18:02:19 1990
X--- ./mit/server/ddx/ibm/sysV/OScursor.h	Mon Sep 17 10:45:31 1990
X***************
X*** 0 ****
X--- 1,55 ----
X+ /*
X+  * Copyright IBM Corporation 1987,1988,1989
X+  *
X+  * All Rights Reserved
X+  *
X+  * Permission to use, copy, modify, and distribute this software and its
X+  * documentation for any purpose and without fee is hereby granted,
X+  * provided that the above copyright notice appear in all copies and that
X+  * both that copyright notice and this permission notice appear in
X+  * supporting documentation, and that the name of IBM not be
X+  * used in advertising or publicity pertaining to distribution of the
X+  * software without specific, written prior permission.
X+  *
X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+  * SOFTWARE.
X+  *
X+ */
X+ #ifndef OS_CURS
X+ #define OS_CURS 1
X+ /***********************************************************
X+                 Copyright IBM Corporation 1988
X+                       All Rights Reserved
X+ Permission to use, copy, modify, and distribute this software and its
X+ documentation for any purpose and without fee is hereby granted,
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in
X+ supporting documentation, and that the name of IBM not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.
X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ ******************************************************************/
X+ /* $Header $ */
X+ /* $Source $ */
X+ #define	OS_TellCursorPosition(x,y) \
X+ 	{ SYSVCurrentX = (x) ; SYSVCurrentY = (y) ; }
X+ extern	int	SYSVSetCursorPosition() ;
X+ extern	void	SYSVPointerNonInterestBox() ;
X+ extern	void	SYSVConstrainCursor() ;
X+ extern  void   	SYSVCursorLimits() ;
X+ #define	OS_SetCursorPosition		SYSVSetCursorPosition
X+ #define	OS_PointerNonInterestBox	SYSVPointerNonInterestBox
X+ #define OS_ConstrainCursor		SYSVConstrainCursor
X+ #define	OS_CursorLimits			SYSVCursorLimits
X+ #endif /* ndef OS_CURSOR */
X*** ./mit-orig/server/ddx/ibm/sysV/OSio.h	Thu Oct  4 18:02:19 1990
X--- ./mit/server/ddx/ibm/sysV/OSio.h	Mon Sep 17 10:45:31 1990
X***************
X*** 0 ****
X--- 1,93 ----
X+ /*
X+  * Copyright IBM Corporation 1987,1988,1989
X+  *
X+  * All Rights Reserved
X+  *
X+  * Permission to use, copy, modify, and distribute this software and its
X+  * documentation for any purpose and without fee is hereby granted,
X+  * provided that the above copyright notice appear in all copies and that
X+  * both that copyright notice and this permission notice appear in
X+  * supporting documentation, and that the name of IBM not be
X+  * used in advertising or publicity pertaining to distribution of the
X+  * software without specific, written prior permission.
X+  *
X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+  * SOFTWARE.
X+  *
X+ */
X+ #ifndef OS_IOH
X+ #define OS_IOH 1
X+ /***********************************************************
X+                 Copyright IBM Corporation 1988
X+                       All Rights Reserved
X+ Permission to use, copy, modify, and distribute this software and its
X+ documentation for any purpose and without fee is hereby granted,
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in
X+ supporting documentation, and that the name of IBM not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.
X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ ******************************************************************/
X+ /* $Header $ */
X+ /* $Source $ */
X+ #define	CURRENT_X()	(SYSVCurrentX)
X+ #define	CURRENT_Y()	(SYSVCurrentY)
X+ #define KBD_LSHIFT  0x0001
X+ #define KBD_RSHIFT  0x0002
X+ #define KBD_LALT    0x0004
X+ #define KBD_RALT    0x0008
X+ #define KBD_CTRL    0x0010
X+ #define KBD_MAKE    0x0100
X+ #define KBD_RPT     0x0200
X+ #define MSM_LBUTTON  4
X+ #define MSM_MBUTTON  2
X+ #define MSM_RBUTTON  1
X+ #define MS_LBUTTON   32
X+ #define MS_RBUTTON   16
X+ #define MS_BUTTONS   48
X+ #define MicroSoft    1
X+ #define MouseSystems 0
X+ extern	int	SYSVDefaultDisplay ;
X+ extern	int	SYSVCurrentX ;
X+ extern	int	SYSVCurrentY ;
X+ extern	int	SYSVProcessArgument() ;
X+ extern  char *  SYSVresolution;
X+ extern  char *  SYSVPtrDev;
X+ extern  int     SYSVMouseType;
X+ extern  int     MSMPtrEvent();
X+ extern  int     MSPtrEvent();
X+ extern  int     (* SYSVPtrEvents)();
X+ extern  int     SYSVMouseState;
X+ extern  int     SYSVmouseFd;
X+ extern  int     SYSVconsoleFd;
X+ extern  int     SYSVconsoleNum;
X+ extern	void	NoopDDA() ;
X+ #define	OS_BlockHandler			NoopDDA
X+ #define	OS_WakeupHandler		NoopDDA
X+ #define	OS_MouseProc			SYSVMouseProc
X+ #define	OS_KeybdProc			SYSVKeybdProc
X+ #define	OS_ProcessArgument		SYSVProcessArgument
X+ #define OS_CapsLockFeedback(dir)	NoopDDA()
X+ #define	OS_PreScreenInit()		SYSVMachineDependentInit()
X+ #define	OS_PostScreenInit()		NoopDDA()
X+ #define	OS_ScreenStateChange(e)		NoopDDA()
X+ #define	OS_GetDefaultScreens()		SYSVGetDefaultScreens()
X+ #define	OS_InitInput()			NoopDDA()
X+ #define OS_AddAndRegisterOtherDevices()	NoopDDA()
X+ #define	OS_SaveState()			NoopDDA()
X+ #define	OS_RestoreState()		NoopDDA()
X+ #define	OS_GiveUp()			NoopDDA()
X+ #define	OS_Abort()			NoopDDA()
X+ #endif /* ndef OS_IOH */
X*** ./mit-orig/server/ddx/ibm/sysV/Xibm.man	Thu Oct  4 18:02:19 1990
X--- ./mit/server/ddx/ibm/sysV/Xibm.man	Mon Sep 17 10:45:30 1990
X***************
X*** 0 ****
X--- 1,28 ----
X+ .TH XIBM 1 "Release 4" "X Version 11"
X+ .SH NAME
X+ Xibm - VGA server for the X Window System
X+ .SH DESCRIPTION
X+ .PP
X+ This driver supports the VGA display on a SYS V/386 3.2.
X+ .PP
X+ The VGA hardware is a color display. It supports 16 colors. You can currently
X+ choose from following resolutions:
X+ \fB 640x480 \fP
X+ \fB 720x540 \fP
X+ \fB 864x606 \fP
X+ .SH OPTIONS
X+ \fB-help\fP get some help for server specific options.
X+ .sp
X+ The server also takes all of the standard server options (See \fIXserver(1)\fP
X+ for a complete list.)
X+ .SH "SEE ALSO"
X+ .PP
X+ Xserver(1), xinit(1), X(1)
X+ .SH COPYRIGHT
X+ Copyright 1990, Thomas Roell (PizzaMan).
X+ .br
X+ See \fIX(1)\fP for a full statement of rights and permissions.
X+ .SH AUTHORS
X+ .PP
X+ Thomas Roell (PizzaMan) wrote all SYS V/386 specific pieces.
X+ Original code was done by IBM.
X*** ./mit-orig/server/ddx/ibm/sysV/sysV386.s	Thu Oct  4 18:02:19 1990
X--- ./mit/server/ddx/ibm/sysV/sysV386.s	Mon Sep 17 10:45:33 1990
X***************
X*** 0 ****
X--- 1,41 ----
X+ 	.text
X+ 	.align	4
X+ 	.globl	inb
X+ inb:
X+ 	pushl	%ebp
X+ 	movl	%esp,%ebp
X+ 	movl	8(%ebp),%edx
X+ 	subl	%eax,%eax
X+ 	inb	(%dx)
X+ 	leave
X+ 	ret
X+ 	.align	4
X+ 	.globl	outb
X+ outb:
X+ 	pushl	%ebp
X+ 	movl	%esp,%ebp
X+ 	movl	8(%ebp),%edx
X+ 	movl	12(%ebp),%eax
X+ 	outb	(%dx)
X+ 	leave
X+ 	ret
X+ 	.align	4
X+ 	.globl	inw
X+ inw:
X+ 	pushl	%ebp
X+ 	movl	%esp,%ebp
X+ 	movl	8(%ebp),%edx
X+ 	subl	%eax,%eax
X+ 	inw	(%dx)
X+ 	leave
X+ 	ret
X+ 	.align	4
X+ 	.globl	outw
X+ outw:
X+ 	pushl	%ebp
X+ 	movl	%esp,%ebp
X+ 	movl	8(%ebp),%edx
X+ 	movl	12(%ebp),%eax
X+ 	outw	(%dx)
X+ 	leave
X+ 	ret
X*** ./mit-orig/server/ddx/ibm/sysV/sysVCursor.c	Thu Oct  4 18:02:20 1990
X--- ./mit/server/ddx/ibm/sysV/sysVCursor.c	Mon Sep 17 16:57:31 1990
X***************
X*** 0 ****
X--- 1,108 ----
X+ /*
X+  * Copyright IBM Corporation 1987,1988,1989
X+  *
X+  * All Rights Reserved
X+  *
X+  * Permission to use, copy, modify, and distribute this software and its
X+  * documentation for any purpose and without fee is hereby granted,
X+  * provided that the above copyright notice appear in all copies and that
X+  * both that copyright notice and this permission notice appear in
X+  * supporting documentation, and that the name of IBM not be
X+  * used in advertising or publicity pertaining to distribution of the
X+  * software without specific, written prior permission.
X+  *
X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+  * SOFTWARE.
X+  *
X+ */
X+ /***********************************************************
X+ 		Copyright IBM Corporation 1987
X+                       All Rights Reserved
X+ Permission to use, copy, modify, and distribute this software and its
X+ documentation for any purpose and without fee is hereby granted,
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in
X+ supporting documentation, and that the name of IBM not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.
X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ ******************************************************************/
X+ #include <stdio.h>
X+ #include <sys/types.h>
X+ #include <sys/file.h>
X+ #define NEED_EVENTS
X+ #include "X.h"
X+ #include "Xproto.h"
X+ #include "input.h"
X+ #include "scrnintstr.h"
X+ #include "cursorstr.h"
X+ #include "miscstruct.h"
X+ #include "OSio.h"
X+ #include "ibmScreen.h"
X+ #include "ibmIO.h"
X+ #include "sysVCursor.h"
X+ #include "ibmTrace.h"
X+ /***============================================================***/
X+ void
X+ SYSVConstrainCursor( pScr, pBox )
X+ register ScreenPtr      pScr ;
X+ register BoxPtr         pBox ;
X+ {
X+     TRACE( ( "SYSVConstrainCursor(pScr=0x%x,pBox=0x%x)\n" ) ) ;
X+     /* XXX -- not implemented yet */
X+     return ;
X+ }
X+ /***============================================================***/
X+ int
X+ SYSVSetCursorPosition( pScr, x, y, generateEvent )
X+     register ScreenPtr 	pScr;
X+     register int	x,y;
X+     Bool	generateEvent;
X+ {
X+ xEvent		motion;
X+ DevicePtr	mouse;
X+     TRACE(("SYSVSetCursorPosition( pScr= 0x%x, x= %d, y= %d )\n",pScr,x,y));
X+     if (pScr->myNum!=ibmCurrentScreen) {
X+ 	(*ibmHideCursor(ibmCurrentScreen))(ibmScreen(ibmCurrentScreen));
X+ 	ibmCurrentScreen= pScr->myNum;
X+     }
X+     if (generateEvent) {
X+ 	ProcessInputEvents();
X+ 	motion.u.keyButtonPointer.rootX=	x;
X+ 	motion.u.keyButtonPointer.rootY=	y;
X+ 	motion.u.keyButtonPointer.time=	lastEventTime;
X+ 	motion.u.u.type=			MotionNotify;
X+ 	mouse= LookupPointerDevice();
X+ 	(*mouse->processInputProc)(&motion,mouse);
X+     }
X+     SYSVCurrentX= x;
X+     SYSVCurrentY= y;
X+     (*(ibmCursorShow(pScr->myNum)))(x,y);
X+     return TRUE;
X+ }
X+ /***============================================================***/
X+ void
X+ SYSVCursorLimits( pScr, pCurs, pHotBox, pTopLeftBox )
X+ ScreenPtr	pScr;
X+ CursorPtr	pCurs;
X+ BoxPtr		pHotBox;
X+ BoxPtr		pTopLeftBox;
X+ {
X+     TRACE(("SYSVCursorLimits( pScr= 0x%x, pCurs= 0x%x, pHotBox= 0x%x, pTopLeftBox= 0x%x)\n", pScr, pCurs, pHotBox, pTopLeftBox));
X+     pTopLeftBox->x1= max( pHotBox->x1, 0 );
X+     pTopLeftBox->y1= max( pHotBox->y1, 0 );
X+     pTopLeftBox->x2= min( pHotBox->x2, pScr->width );
X+     pTopLeftBox->y2= min( pHotBox->y2, pScr->height );
X+     return ;
X+ }
X*** ./mit-orig/server/ddx/ibm/sysV/sysVCursor.h	Thu Oct  4 18:02:20 1990
X--- ./mit/server/ddx/ibm/sysV/sysVCursor.h	Mon Sep 17 10:45:31 1990
X***************
X*** 0 ****
X--- 1,45 ----
X+ /*
X+  * Copyright IBM Corporation 1987,1988,1989
X+  *
X+  * All Rights Reserved
X+  *
X+  * Permission to use, copy, modify, and distribute this software and its
X+  * documentation for any purpose and without fee is hereby granted,
X+  * provided that the above copyright notice appear in all copies and that
X+  * both that copyright notice and this permission notice appear in
X+  * supporting documentation, and that the name of IBM not be
X+  * used in advertising or publicity pertaining to distribution of the
X+  * software without specific, written prior permission.
X+  *
X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+  * SOFTWARE.
X+  *
X+ */
X+ #ifndef SYSV_CURS
X+ #define SYSV_CURS 1
X+ /***********************************************************
X+ 		Copyright IBM Corporation 1987
X+                       All Rights Reserved
X+ Permission to use, copy, modify, and distribute this software and its
X+ documentation for any purpose and without fee is hereby granted,
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in
X+ supporting documentation, and that the name of IBM not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.
X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ ******************************************************************/
X+ extern	int	SYSVSetCursorPosition();
X+ extern	void	SYSVCursorLimits();
X+ #endif /* SYSV_CURS */
X*** ./mit-orig/server/ddx/ibm/sysV/sysVEvents.c	Thu Oct  4 18:02:20 1990
X--- ./mit/server/ddx/ibm/sysV/sysVEvents.c	Mon Sep 17 16:57:32 1990
X***************
X*** 0 ****
X--- 1,555 ----
X+ /*
X+  * Copyright IBM Corporation 1987,1988,1989
X+  *
X+  * All Rights Reserved
X+  *
X+  * Permission to use, copy, modify, and distribute this software and its
X+  * documentation for any purpose and without fee is hereby granted,
X+  * provided that the above copyright notice appear in all copies and that
X+  * both that copyright notice and this permission notice appear in
X+  * supporting documentation, and that the name of IBM not be
X+  * used in advertising or publicity pertaining to distribution of the
X+  * software without specific, written prior permission.
X+  *
X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+  * SOFTWARE.
X+  *
X+ */
X+ #include <sys/types.h>
X+ #include <sys/times.h>
X+ #define NEED_EVENTS
X+ #define NEED_REPLIES
X+ #include "X.h"
X+ #include "Xproto.h"
X+ #include "miscstruct.h"
X+ #include "scrnintstr.h"
X+ #include "cursorstr.h"
X+ #include "input.h"
X+ #include "inputstr.h"
X+ #include "OScompiler.h"
X+ #include "OSio.h"
X+ #include "OScursor.h"
X+ #include "ibmIO.h"
X+ #include "ibmMouse.h"
X+ #include "ibmKeybd.h"
X+ #include "ibmScreen.h"
X+ #include "ibmCmdArgs.h"
X+ #include "sysVModKeys.h"
X+ #include "ibmTrace.h"
X+ extern  int      screenIsSaved;
X+ extern  int	 kbdType ;
X+ static  int      delayed_left;
X+ static  int      delayed_right;
X+ static  int      delayed_middle;
X+ static  int      lastButtons = 0x00 ;
X+ static  int      pendingX;
X+ static  int      pendingY;
X+ static  int      SYSVreset = 0;
X+ static long clock = 0;
X+ int SYSVmouseFd = -1;
X+ int SYSVconsoleFd = -1;
X+ #ifdef sco
X+ int SYSVconsoleNum = -1;
X+ #endif
X+ int SYSVMouseState = 0;
X+ #define GET_OS_TIME() (GetTimeInMillis())
X+ /***====================================================================***/
X+ 	/*
X+ 	 * 11/19/88 (ef) -- XXX!! Not really sure where these should live.
X+ 	 *	sysvCursor, maybe?
X+ 	 *	Actually, once all of our systems give relative coordinates,
X+ 	 *	this can move to common.
X+ 	 */
X+ int	SYSVCurrentX = 0;
X+ int	SYSVCurrentY = 0;
X+ /***====================================================================***/
X+ static void
X+ SYSVFlushMouse()
X+ {
X+ register	int	x,y;
X+ register	ibmPerScreenInfo	*screenInfo;
X+ 		int	oldScr;
X+ 		int	setCursor;
X+ 		xEvent	e;
X+     TRACE(("SYSVFlushMouse\n"));
X+     if ((pendingX)||(pendingY)) {
X+ 	ibmAccelerate(pendingX,pendingY);
X+ 	x= SYSVCurrentX+pendingX;
X+ 	y= SYSVCurrentY-pendingY;
X+ 	screenInfo = ibmScreens[ oldScr = ibmCurrentScreen ];
X+ 	setCursor = FALSE;
X+ 	if (ibmYWrapScreen) {
X+ 	    while ( y<0 ) {
X+ 		y+=	screenInfo->ibm_ScreenBounds.y2;
X+ 		setCursor= TRUE;
X+ 	    }
X+ 	    while ( y>screenInfo->ibm_ScreenBounds.y2 ) {
X+ 		y-=	screenInfo->ibm_ScreenBounds.y2;
X+ 		setCursor= TRUE;
X+ 	    }
X+ 	}
X+ 	while ( x<0 ) {
X+ 	    if ( screenInfo == ibmScreens[ 0 ] ) {
X+ 		/* Already at first possible screen */
X+ 		if ( ibmXWrapScreen ) {
X+ 		    screenInfo =
X+ 			ibmScreens[ ibmCurrentScreen = ibmNumScreens -1 ];
X+ 		    x+= screenInfo->ibm_ScreenBounds.x2;
X+ 		}
X+ 		else {
X+ 		    x= 0;
X+ 		}
X+ 	    }
X+ 	    else {
X+ 		screenInfo= ibmScreens[ --ibmCurrentScreen ];
X+ 		x+= screenInfo->ibm_ScreenBounds.x2;
X+ 	    }
X+ 	    setCursor= TRUE;
X+ 	}
X+ 	while ( x>screenInfo->ibm_ScreenBounds.x2 ) {
X+ 	    if ( screenInfo == ibmScreens[ ibmNumScreens - 1 ] ) {
X+ 		/* Already at last possible screen */
X+ 		if ( ibmXWrapScreen ) {
X+ 		    x-= screenInfo->ibm_ScreenBounds.x2;
X+ 		    screenInfo= ibmScreens[ ibmCurrentScreen = 0 ];
X+ 		}
X+ 		else {
X+ 		    x= screenInfo->ibm_ScreenBounds.x2;
X+ 		}
X+ 	    }
X+ 	    else {
X+ 		x-=  screenInfo->ibm_ScreenBounds.x2;	/* now x>0 */
X+ 		screenInfo= ibmScreens[ ++ibmCurrentScreen ];
X+ 	    }
X+ 	    setCursor= TRUE;
X+ 	}
X+ 	if (y>screenInfo->ibm_ScreenBounds.y2) {
X+ 	    y= screenInfo->ibm_ScreenBounds.y2;
X+ 	    setCursor= TRUE;
X+ 	}
X+ 	if (y<0) {
X+ 	    y= 0;
X+ 	    setCursor= TRUE;
X+ 	}
X+ 	if (setCursor) {
X+ 	    /* OS-DEPENDENT MACRO GOES HERE!!
X+ 	     * MACRO DEFINED IN FILE ibmos.h
X+ 	     * TELL OS THAT CURSOR HAS MOVED
X+ 	     * TO A NEW POSITION
X+ 	     */
X+ 	    OS_TellCursorPosition(x,y);
X+ 	}
X+ #if defined(MULTIPLE_HEADS)
X+ 	if ( oldScr != ibmCurrentScreen ) {
X+ 	    (*ibmHideCursor( oldScr ) )( oldScr ) ;
X+ 	    NewCurrentScreen( screenInfo->ibm_Screen, x, y ) ;
X+ 	    if ( screenInfo->ibm_CurrentCursor != ibmCurrentCursor( oldScr ) ) {
X+ 		(* screenInfo->ibm_Screen->RealizeCursor )(
X+ 			screenInfo->ibm_Screen,
X+ 			ibmCurrentCursor( oldScr ) ) ;
X+ 	    }
X+ 	    (* screenInfo->ibm_Screen->DisplayCursor )(
X+ 			screenInfo->ibm_Screen,
X+ 			ibmCurrentCursor( oldScr ) ) ;
X+ 	}
X+ #endif /* MULTIPLE HEADS */
X+ 	(* screenInfo->ibm_CursorShow )( x, y ) ;
X+ 	e.u.u.type= 			MotionNotify;
X+ 	e.u.keyButtonPointer.rootX=	SYSVCurrentX= x;
X+ 	e.u.keyButtonPointer.rootY=	SYSVCurrentY= y;
X+ 	e.u.keyButtonPointer.time=	lastEventTime = GET_OS_TIME();
X+ 	pendingX= pendingY= 0;
X+ 	(*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+     }
X+ }
X+ /***====================================================================***/
X+ 	/*
X+ 	 * All of this keyboard stuff needs to
X+ 	 * be reorganized anyway (into osKeymap.h and a single keyboard.c)
X+ 	 */
X+ /***====================================================================***/
X+ static int
X+ SYSVKbdEvents()
X+ {
X+   DeviceIntPtr	        KeyboardPtr;
X+   xEvent		e;
X+   int                   key,keymodifier,i,nBytes;
X+   unsigned char         rBuf[64];
X+   Bool                  rpt;
X+   static int            lastkey = 0;
X+   static int		doomsday = 0;
X+ 
X+   if ((nBytes=read(SYSVconsoleFd,rBuf,64)) == 0) return 0;
X+   for (i=0; i<nBytes; i++) {
X+     key = ( rBuf[i] & 0x7f) + SYSV_MIN_KEY ;
X+     TRACE(("SYSVKbdEvent (%d)\n",key));
X+     if ((pendingX)||(pendingY))
X+     SYSVFlushMouse();
X+     e.u.keyButtonPointer.rootX=	SYSVCurrentX;
X+     e.u.keyButtonPointer.rootY=	SYSVCurrentY;
X+     e.u.keyButtonPointer.time=	lastEventTime= GET_OS_TIME();
X+     e.u.u.detail= key ;
X+     rpt = (rBuf[i] == lastkey);
X+     lastkey = rBuf[i];
X+     KeyboardPtr = (DeviceIntPtr)ibmKeybd;
X+     keymodifier = KeyboardPtr->key->modifierMap[key];
X+     if (((!ibmKeyRepeat) || ( keymodifier != 0)) && rpt)
X+       continue;
X+     if (rpt) {
X+       e.u.u.type= KeyRelease;
X+       (*ibmKeybd->processInputProc)(&e,ibmKeybd,1);
X+       e.u.u.type= KeyPress;
X+     }
X+     else if (rBuf[i] & 0x80)	e.u.u.type= KeyRelease;
X+     else			e.u.u.type= KeyPress;
X+     /*
X+      * Handle Ctrl & Alt & Del as ServerShutdown !
X+      */
X+     switch (key) {
X+         case Sysv_Delete:
X+ 	    doomsday = (doomsday | 0x4) ^ ((rBuf[i] & 0x80)>>5);
X+ 	    break;
X+         case Sysv_Alt_L:
X+ 	    doomsday = (doomsday | 0x2) ^ ((rBuf[i] & 0x80)>>6);
X+ 	    break;
X+         case Sysv_Control_L:
X+ 	    doomsday = (doomsday | 0x1) ^ ((rBuf[i] & 0x80)>>7);
X+ 	    break;
X+ 	}
X+     if ((!ibmDontZap) && (doomsday == 7)) GiveUp();
X+     /*
X+      *	toggle lock & numlock shift keys:
X+      *	ignore releases, toggle on & off on presses
X+      */
X+     if( keymodifier & ( LockMask | NumLockMask))
X+       {
X+ 	if( e.u.u.type == KeyRelease )
X+ 	  break;
X+ 	if( KeyboardPtr->key->down[key >> 3] & (1 << (key & 7)) )
X+ 	  {
X+ 	    e.u.u.type = KeyRelease;
X+ 	  }
X+       }
X+     (*ibmKeybd->processInputProc)(&e,ibmKeybd,1);
X+   }
X+   return(nBytes);
X+ }
X+ /***====================================================================***/
X+ #define NONE    0x00
X+ #define LEFT    Button1
X+ #define MIDDLE  Button2
X+ #define RIGHT   Button3
X+ #define UP      ButtonRelease
X+ #define DOWN    ButtonPress
X+ 	/*
X+ 	 * 11/17/88 (ef) -- XXX!  This function should be revisited.  It
X+ 	 *	seems awfully large and complicated.  Two options leap to
X+ 	 *	to the fore:  a) just delay for a bit and check for new
X+ 	 *	events or go to a finite-state machine.
X+ 	 */
X+ int
X+ MSPtrEvent(pMouse)
X+      DevicePtr pMouse;
X+ {
X+   extern int	  SYSVMouseChordDelay;
X+   static int      buttons;
X+   static int      DeltaX,DeltaY;
X+   int             i,nBytes;
X+   unsigned char   rBuf[64];
X+   int             changed;
X+   xEvent          e;
X+   nBytes = read(SYSVmouseFd,&rBuf,64);
X+   for ( i=0; i <=nBytes; i++) {
X+     if (i != nBytes) {
X+       switch(SYSVMouseState) {
X+       case 0:
X+ 	if ((rBuf[i] & 0x40) == 0x40) {
X+ 	  buttons= rBuf[i] & 0x30;
X+ 	  DeltaY = (signed char)((rBuf[i] &0xC) <<4);
X+ 	  DeltaX = (signed char)((rBuf[i] &0x3) <<6);
X+ 	  SYSVMouseState++; }
X+ 	break;
X+       case 1:
X+ 	DeltaX |= (signed char)(rBuf[i]&0x3F);
X+ 	SYSVMouseState++;
X+ 	break;
X+       case 2:
X+ 	DeltaY |= (signed char)(rBuf[i]&0x3F);
X+ 	SYSVMouseState = 0;
X+ 	break;
X+       }
X+     }
X+     if (SYSVMouseState == 0) {
X+       TRACE(("SYSVPtrEvent (%d,%d)\n", DeltaX, DeltaY));
X+       pendingX+= DeltaX;
X+       pendingY-= DeltaY;
X+       if (pendingX||pendingY)
X+ 	SYSVFlushMouse();
X+       DeltaX = DeltaY = 0;
X+       e.u.keyButtonPointer.rootX=     SYSVCurrentX;
X+       e.u.keyButtonPointer.rootY=     SYSVCurrentY;
X+       e.u.keyButtonPointer.time=      GET_OS_TIME();
X+       if ((i != nBytes) || ((e.u.keyButtonPointer.time - lastEventTime) > 225))
X+ 	{
X+ 	  switch(lastButtons)
X+ 	    {
X+ 	    case NONE  :
X+ 	      switch(buttons)
X+ 		{
X+ 		case NONE  :
X+ 		  break;
X+ 		case MS_LBUTTON  :
X+ 		  delayed_left = TRUE;
X+ 		  break;
X+ 		case MS_RBUTTON  :
X+ 		  delayed_right = TRUE;
X+ 		  break;
X+ 		case MS_BUTTONS  :
X+ 		  e.u.u.detail= MIDDLE;
X+ 		  e.u.u.type=   DOWN;
X+ 		  (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		  break;
X+ 		}
X+ 	      break;
X+ 	    case MS_LBUTTON  :
X+ 	      switch(buttons)
X+ 		{
X+ 		case NONE  :
X+ 		  if (delayed_left) {
X+ 		    e.u.u.detail= LEFT;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_left = FALSE;
X+ 		  }
X+ 		  if (delayed_middle) {
X+ 		    e.u.u.detail= MIDDLE;
X+ 		    e.u.u.type=   UP;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_middle = FALSE;
X+ 		  } else {
X+ 		    e.u.u.detail= LEFT;
X+ 		    e.u.u.type=   UP;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		  }
X+ 		  break;
X+ 		case MS_LBUTTON  :
X+ 		  if (delayed_left) {
X+ 		    e.u.u.detail= LEFT;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_left = FALSE;
X+ 		  }
X+ 		  break;
X+ 		case MS_RBUTTON  :
X+ 		  if (delayed_left) {
X+ 		    e.u.u.detail= LEFT;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_left = FALSE;
X+ 		  }
X+ 		  e.u.u.detail= LEFT;
X+ 		  e.u.u.type=   UP;
X+ 		  (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		  delayed_right = TRUE;
X+ 		  break;
X+ 		case MS_BUTTONS  :
X+ 		  if (delayed_left) {
X+ 		    e.u.u.detail= MIDDLE;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_left = FALSE;
X+ 		  } else if (!delayed_middle) {
X+ 		    e.u.u.detail= LEFT;
X+ 		    e.u.u.type=   UP;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    e.u.u.detail= MIDDLE;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		  }
X+ 		  break;
X+ 		}
X+ 	      break;
X+ 	    case MS_RBUTTON  :
X+ 	      switch(buttons)
X+ 		{
X+ 		case NONE  :
X+ 		  if (delayed_right) {
X+ 		    e.u.u.detail= RIGHT;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_right = FALSE;
X+ 		  }
X+ 		  if (delayed_middle) {
X+ 		    e.u.u.detail= MIDDLE;
X+ 		    e.u.u.type=   UP;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_middle = FALSE;
X+ 		  } else {
X+ 		    e.u.u.detail= RIGHT;
X+ 		    e.u.u.type=   UP;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		  }
X+ 		  break;
X+ 		case MS_LBUTTON  :
X+ 		  if (delayed_right) {
X+ 		    e.u.u.detail= RIGHT;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_right = FALSE;
X+ 		  }
X+ 		  e.u.u.detail= RIGHT;
X+ 		  e.u.u.type=   UP;
X+ 		  (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		  delayed_left = TRUE;
X+ 		  break;
X+ 		case MS_RBUTTON  :
X+ 		  if (delayed_right) {
X+ 		    e.u.u.detail= RIGHT;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_right = FALSE;
X+ 		  }
X+ 		  break;
X+ 		case MS_BUTTONS  :
X+ 		  if (delayed_right) {
X+ 		    e.u.u.detail= MIDDLE;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    delayed_right = FALSE;
X+ 		  } else if (!delayed_middle) {
X+ 		    e.u.u.detail= RIGHT;
X+ 		    e.u.u.type=   UP;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		    e.u.u.detail= MIDDLE;
X+ 		    e.u.u.type=   DOWN;
X+ 		    (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		  }
X+ 		  break;
X+ 		}
X+ 	      break;
X+ 	    case MS_BUTTONS  :
X+ 	      switch(buttons)
X+ 		{
X+ 		case NONE  :
X+ 		  e.u.u.detail= MIDDLE;
X+ 		  e.u.u.type=   UP;
X+ 		  (*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+ 		  break;
X+ 		case MS_LBUTTON  :
X+ 		case MS_RBUTTON  :
X+ 		  delayed_middle = TRUE;
X+ 		  break;
X+ 		case MS_BUTTONS  :
X+ 		  break;
X+ 		}
X+ 	      break;
X+ 	    }
X+ 	  lastButtons = buttons;
X+ 	}
X+     }
X+   }
X+   return(nBytes);
X+ }
X+ /***====================================================================***/
X+ int
X+   MSMPtrEvent()
X+ {
X+   extern  int     SYSVMouseChordDelay;
X+   static int      buttons;
X+   static int      DeltaX,DeltaY;
X+   xEvent          e;
X+   int             i,nBytes;
X+   unsigned char   rBuf[64];
X+   int             changed;
X+   if ((nBytes = read(SYSVmouseFd,&rBuf,64)) == 0) return(0);
X+   for ( i=0; i < nBytes; i++) {
X+     switch(SYSVMouseState) {
X+     case 0:
X+       if ((rBuf[i] & 0xF8) == 0x80) {
X+ 	buttons = (~rBuf[i]) & 0x07;
X+ 	SYSVMouseState++; }
X+       break;
X+     case 1:
X+       DeltaX=(signed char)rBuf[i];
X+       SYSVMouseState++;
X+       break;
X+     case 2:
X+       DeltaY=(signed char)rBuf[i];
X+       SYSVMouseState++;
X+       break;
X+     case 3:
X+       DeltaX=(signed char)rBuf[i];
X+       SYSVMouseState++;
X+       break;
X+     case 4:
X+       DeltaY=(signed char)rBuf[i];
X+       SYSVMouseState=0;
X+       break;
X+     }
X+     if (SYSVMouseState == 0) {
X+       TRACE(("MSM_PtrEvent (%d,%d)\n", DeltaX,DeltaY));
X+       pendingX+= DeltaX;
X+       pendingY+= DeltaY;
X+       if (pendingX||pendingY)
X+ 	SYSVFlushMouse();
X+       e.u.keyButtonPointer.rootX=     SYSVCurrentX;
X+       e.u.keyButtonPointer.rootY=     SYSVCurrentY;
X+       e.u.keyButtonPointer.time=      GET_OS_TIME();
X+       changed = buttons ^ lastButtons;
X+       if (changed & MSM_LBUTTON) {
X+ 	if (buttons & MSM_LBUTTON)      e.u.u.type = DOWN;
X+ 	else                        e.u.u.type = UP;
X+ 	e.u.u.detail= LEFT;
X+ 	(*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+       }
X+       if (changed & MSM_RBUTTON) {
X+ 	if (buttons & MSM_RBUTTON)      e.u.u.type = DOWN;
X+ 	else                        e.u.u.type = UP;
X+ 	e.u.u.detail= RIGHT;
X+ 	(*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+       }
X+       if (changed & MSM_MBUTTON) {
X+ 	if (buttons & MSM_MBUTTON)      e.u.u.type = DOWN;
X+ 	else                        e.u.u.type = UP;
X+ 	e.u.u.detail= MIDDLE;
X+ 	(*ibmPtr->processInputProc)(&e,ibmPtr,1);
X+       }
X+       lastButtons = buttons;
X+     }
X+   }
X+   return(nBytes);
X+ }
X+ /***====================================================================***/
X+ void
X+ ProcessInputEvents ()
X+ {
X+   TRACE(("ProcessInputEvents\n"));
X+ #ifdef IBM_SPECIAL_MALLOC
X+   if (ibmShouldDumpArena) {
X+     ibmDumpArena();
X+   }
X+ #endif /* IBM_SPECIAL_MALLOC */
X+   /*
X+    * So long as one event from either device remains unprocess, we loop:
X+    * Take the oldest remaining event and pass it to the proper module
X+    * for processing. The DDXEvent will be sent to ProcessInput by the
X+    * function called.
X+    */
X+   while (1) {
X+     if (((* SYSVPtrEvents)() == 0) &&
X+ 	(SYSVKbdEvents() == 0))
X+       break;
X+     lastEventTime = GetTimeInMillis();
X+     if (screenIsSaved == SCREEN_SAVER_ON) {
X+       SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
X+     }
X+   }
X+   if (pendingX||pendingY)
X+     SYSVFlushMouse();
X+   return;
X+ }
X*** ./mit-orig/server/ddx/ibm/sysV/sysVInit.c	Thu Oct  4 18:02:21 1990
X--- ./mit/server/ddx/ibm/sysV/sysVInit.c	Mon Sep 17 10:45:32 1990
X***************
X*** 0 ****
X--- 1,91 ----
X+ /*
X+  * Copyright IBM Corporation 1987,1988,1989
X+  *
X+  * All Rights Reserved
X+  *
X+  * Permission to use, copy, modify, and distribute this software and its
X+  * documentation for any purpose and without fee is hereby granted,
X+  * provided that the above copyright notice appear in all copies and that
X+  * both that copyright notice and this permission notice appear in
X+  * supporting documentation, and that the name of IBM not be
X+  * used in advertising or publicity pertaining to distribution of the
X+  * software without specific, written prior permission.
X+  *
X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+  * SOFTWARE.
X+  *
X+ */
X+ #include <sys/types.h>
X+ #include <sys/file.h>
X+ #include <sys/fcntl.h>
X+ #ifdef sco
X+ #include <sys/vtkd.h>
X+ #else
X+ #include <sys/vt.h>
X+ #endif
X+ #include <stdio.h>
X+ #include "Xmd.h"
X+ #include "miscstruct.h"
X+ #include "scrnintstr.h"
X+ #include "cursor.h"
X+ #include "ibmScreen.h"
X+ #include "OSio.h"
X+ #include "ibmTrace.h"
X+ /***====================================================================***/
X+ int	SYSVDefaultDisplay= 0;
X+ void
X+ SYSVMachineDependentInit()
X+ {
X+   int  tmp;
X+   long ttyno;
X+   char vtname[10];
X+   extern int errno;
X+   TRACE(("SYSVMachineDependentInit()\n"));
X+ #ifdef sco
X+   strcpy(vtname, ttyname(0));
X+   if (strcmp(vtname, "/dev/syscon"))
X+       SYSVconsoleNum = atoi( vtname [strlen(vtname)-2] ) - 1;
X+   else
X+       SYSVconsoleNum = 0;
X+ 
X+   /*
X+    * For SCO we will detach from the controlling terminal now
X+    * that we got a handle on the situation.
X+    */
X+ 
X+   close(0);
X+   close(1);
X+   setpgrp();
X+ 
X+   if ((SYSVconsoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) < 0)
X+     ErrorF ("Opening the display (%s, %d)\n", vtname, errno);
X+ #else
X+   if ((tmp = open("/dev/console",O_RDONLY,0)) <0)
X+     ErrorF("Opening /dev/console\n");
X+   if (ioctl(tmp, VT_OPENQRY, &ttyno) <0)
X+     ErrorF("Finding free virtual terminal\n");
X+   close(tmp);
X+   sprintf(vtname,"/dev/vt0%1d",ttyno);
X+   if ((SYSVconsoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) < 0)
X+     ErrorF ("Opening the display (%s, %d)\n", vtname, errno);
X+ #endif
X+ 
X+   TRACE(("Init: %d,%s\n",SYSVconsoleFd,vtname));
X+   return;
X+ }
X+ /***====================================================================***/
X+ char * SYSVresolution = "640x480";
X+ void
X+ SYSVGetDefaultScreens()
X+ {
X+   TRACE(("SYSVGetDefaultScreens()\n"));
X+   /*
X+    * add defaults Flag for resolution 640x480
X+    */
X+   return;
X+ }
X*** ./mit-orig/server/ddx/ibm/sysV/sysVKeybd.c	Thu Oct  4 18:02:21 1990
X--- ./mit/server/ddx/ibm/sysV/sysVKeybd.c	Fri Sep 28 11:25:36 1990
X***************
X*** 0 ****
X--- 1,206 ----
X+ /*
X+  * Copyright IBM Corporation 1987,1988,1989
X+  *
X+  * All Rights Reserved
X+  *
X+  * Permission to use, copy, modify, and distribute this software and its
X+  * documentation for any purpose and without fee is hereby granted,
X+  * provided that the above copyright notice appear in all copies and that
X+  * both that copyright notice and this permission notice appear in
X+  * supporting documentation, and that the name of IBM not be
X+  * used in advertising or publicity pertaining to distribution of the
X+  * software without specific, written prior permission.
X+  *
X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+  * SOFTWARE.
X+  *
X+ */
X+ /***********************************************************
X+ 		Copyright IBM Corporation 1987,1988
X+                       All Rights Reserved
X+ Permission to use, copy, modify, and distribute this software and its
X+ documentation for any purpose and without fee is hereby granted,
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in
X+ supporting documentation, and that the name of IBM not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.
X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ ******************************************************************/
X+ #include <stdio.h>
X+ #include <sys/types.h>
X+ #include <sys/file.h>
X+ #include <sys/fcntl.h>
X+ #include <sys/termio.h>
X+ #ifdef sco
X+ #include <sys/vtkd.h>
X+ #else
X+ #include <sys/at_ansi.h>
X+ #include <sys/kd.h>
X+ #include <sys/vt.h>
X+ #endif
X+ #include "X.h"
X+ #include "Xmd.h"
X+ #include "input.h"
X+ #include "miscstruct.h"
X+ #include "scrnintstr.h"
X+ #include "keysym.h"
X+ #include "cursorstr.h"
X+ #include "sysVModKeys.h"
X+ #include "sysVKeymap.h"
X+ #include "ibmIO.h"
X+ #include "ibmKeybd.h"
X+ #include "ibmScreen.h"
X+ #include "ibmTrace.h"
X+ #include "OSio.h"
X+ /***============================================================***/
X+ static void
X+ SYSVChangeKeyboardControl(pDevice,ctrl)
X+     DevicePtr pDevice;
X+     KeybdCtrl *ctrl;
X+ {
X+     int volume;
X+     TRACE(("SYSVChangeKeyboardControl(pDev=0x%x,ctrl=0x%x)\n",pDevice,ctrl));
X+     ibmKeyClick =   ctrl->click;
X+     /* X specifies duration in milliseconds, RT in 1/128th's of a second */
X+     ibmBellPitch=	ctrl->bell_pitch;
X+     ibmBellDuration= 	((double)ctrl->bell_duration)*(128.0/1000.0);
X+     ibmKeyRepeat= ctrl->autoRepeat;
X+     ioctl(SYSVconsoleFd, KDSETLED, (ibmLEDState=ctrl->leds));
X+     return;
X+ }
X+ /***============================================================***/
X+ 
X+ static void
X+ SYSVBell(loud, pDevice)
X+     int loud;
X+     DevicePtr pDevice;
X+ {
X+     TRACE(("SYSVBell(loud= %d, pDev= 0x%x)\n",loud,pDevice));
X+ 
X+ #ifdef sco
X+     ioctl(SYSVconsoleFd, KIOCSOUND, ibmBellPitch << 2);
X+     nap(ibmBellDuration << 4);
X+     ioctl(SYSVconsoleFd, KIOCSOUND, 0);
X+ #else
X+     ioctl(SYSVconsoleFd, KDMKTONE, (ibmBellDuration << 16) | ibmBellPitch);
X+ #endif
X+     return;
X+ }
X+ /***============================================================***/
X+ Bool
X+ LegalModifier (key)
X+ BYTE    key;
X+ {
X+     TRACE(("LegalModifier(key= 0x%x)\n",key));
X+     if ((key==Sysv_Control_L) || (key==Sysv_Shift_L) || (key==Sysv_Shift_R) ||
X+ 	(key==Sysv_Caps_Lock) || (key==Sysv_Alt_L) || (key==Sysv_Alt_R) ||
X+ 	(key==Sysv_Control_R))
X+       return TRUE ;
X+     else
X+       return FALSE;
X+ }
X+ /***============================================================***/
X+ extern int ibmUsePCKeys;
X+ int kbdType ;
X+ SYSVGetKbdMappings(pKeySyms, pModMap)
X+ KeySymsPtr pKeySyms;
X+ CARD8 *pModMap;
X+ {
X+     register int i;
X+     TRACE(("SYSVGetKbdMappings( pKeySyms= 0x%x, pModMap= 0x%x )\n",
X+ 							pKeySyms,pModMap));
X+     for (i = 0; i < MAP_LENGTH; i++)
X+        pModMap[i] = NoSymbol;
X+     if (ibmUsePCKeys) {
X+ 	pModMap[ Sysv_Control_L ] = LockMask;
X+ 	pModMap[ Sysv_Caps_Lock ] = ControlMask;
X+     }
X+     else {
X+ 	pModMap[ Sysv_Caps_Lock ] = LockMask;
X+ 	pModMap[ Sysv_Control_L ] = ControlMask;
X+     }
X+     pModMap[ Sysv_Control_R ] =	ControlMask;
X+     pModMap[ Sysv_Shift_L ] =	ShiftMask;
X+     pModMap[ Sysv_Shift_R ] =	ShiftMask;
X+     pModMap[ Sysv_Num_Lock ] =	NumLockMask;
X+     pModMap[ Sysv_Alt_L ] = Mod1Mask;
X+     pModMap[ Sysv_Alt_R ] = Mod1Mask;
X+     pKeySyms->minKeyCode=       SYSV_MIN_KEY;
X+     pKeySyms->maxKeyCode=       SYSV_MAX_KEY;
X+     pKeySyms->mapWidth=         SYSV_GLYPHS_PER_KEY;
X+     pKeySyms->map=              sysvmap;
X+   }
X+ /***============================================================***/
X+ int
X+ SYSVKeybdProc(pDev, onoff, argc, argv)
X+     DevicePtr 	 pDev;
X+     int 	 onoff;
X+     int		 argc;
X+     char	*argv[];
X+ {
X+   KeySymsRec		keySyms;
X+   CARD8 		modMap[MAP_LENGTH];
X+   struct termio         tty;
X+   static int            SYSVKbdTrans;
X+   static struct termio  SYSVKbdTTY;
X+   TRACE(("SYSVKeybdProc( pDev= 0x%x, onoff= 0x%x )\n",pDev,onoff));
X+   switch (onoff)
X+     {
X+     case DEVICE_INIT:
X+       ioctl (SYSVconsoleFd, KDGKBMODE, &SYSVKbdTrans);
X+       ioctl (SYSVconsoleFd, TCGETA, &SYSVKbdTTY);
X+       pDev->on = FALSE;
X+       ibmKeybd = pDev;
X+       SYSVGetKbdMappings( &keySyms, modMap );
X+       InitKeyboardDeviceStruct(
X+ 			       ibmKeybd, &keySyms, modMap, SYSVBell,
X+ 			       SYSVChangeKeyboardControl);
X+       break;
X+     case DEVICE_ON:
X+       /*
X+        * Set the keyboard into "direct" mode and turn on
X+        * event translation.
X+        */
X+       ioctl (SYSVconsoleFd, KDSKBMODE, K_RAW);
X+       tty = SYSVKbdTTY;
X+       tty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
X+       tty.c_oflag = 0;
X+       tty.c_cflag = CREAD | CS8 | B9600;
X+       tty.c_lflag = 0;
X+       tty.c_cc[VINTR]=0;
X+       tty.c_cc[VQUIT]=0;
X+       tty.c_cc[VERASE]=0;
X+       tty.c_cc[VKILL]=0;
X+       tty.c_cc[VEOF]=0;
X+       tty.c_cc[VEOL]=0;
X+       tty.c_cc[VTIME]=0;
X+       tty.c_cc[VMIN]=1;
X+       ioctl (SYSVconsoleFd, TCSETA, &tty);
X+       AddEnabledDevice(SYSVconsoleFd);
X+       pDev->on = TRUE;
X+       break;
X+     case DEVICE_CLOSE:
X+     case DEVICE_OFF:
X+       /*
X+        * Restore original keyboard directness and translation.
X+        */
X+       ioctl (SYSVconsoleFd, TCSETA, &SYSVKbdTTY);
X+       ioctl (SYSVconsoleFd, KDSKBMODE, SYSVKbdTrans);
X+       RemoveEnabledDevice(SYSVconsoleFd);
X+       pDev->on = FALSE;
X+       break;
X+     }
X+     return (Success);
X+ }
END_OF_FILE
if test 42622 -ne `wc -c <'fix-14.sco08'`; then
    echo shar: \"'fix-14.sco08'\" unpacked with wrong size!
fi
# end of 'fix-14.sco08'
fi
echo shar: End of archive 8 \(of 12\).
cp /dev/null ark8isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 12 archives.
    echo "instructions are in fix-14.sco01"
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0


dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.