/* * $XConsortium: AIXV3.c /main/6 1995/12/19 13:05:24 matt $ * * Copyright IBM Corporation 1987,1988,1989,1990,1991 * * All Rights Reserved * * License 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 and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of IBM not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL * IBM BE LIABLE 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 AIXV3 #include #endif #include #include "ibmTrace.h" #ifndef _IBM_LFT #include "hftUtils.h" #else #include "lftUtils.h" #endif #ifdef AIXV3 #include #include "X_msg.h" extern void aixErrMsg(); #endif /*int AIXDefaultDisplay= 0;*/ #ifndef _IBM_LFT int AIXDefaultDisplay= HFT_SKYWAY_ID; #else int AIXDefaultDisplay= SKYWAY_ID; #endif #ifdef SOFTWARE_CURSOR int AIXCurrentX= 640; int AIXCurrentY= 512; #else int AIXCurrentX= 0; int AIXCurrentY= 0; #endif int AIXMouseChordDelay= 20; #ifndef _IBM_LFT extern int hftPending; #endif static int handleInput; int aixForceFlag = 0; /* to enable running from xdm etc on a non-lft terminal */ /***====================================================================***/ /* * BlockHandler is called just before the server goes into select * forever (effectively), WakeupHandler is called when select * returns (times out or is interrupted). * * Normally, the hft interrupt knocks us out of select, but not * back to Dispatch() -- only to WaitForSomething(). WaitForSomething() * does *not* check device input -- it loops back around to the block * handler and select. It doesn't return to dispatch until a client * does something. The WakeupHandler only needs to dispatch input * events when we're waiting for clients in WaitForSomething(). * * We need to set a timeout if input is pending, because * hftDispatchEvents wants to be called periodically if it has * a pending timeout, and it won't be generating any interrupts to * blow the select away. * * waittime is used to get a reasonable amount of time for timeouts * in the hft queue. The value of the timeout below was derived * experimentally -- I played with the length of the timeout * until the mouse felt "right." */ int SelectWaitTime = 10000; /* usec */ void AIXBlockHandler(scrNdx,blockData,ppTimeout,pReadmask) int scrNdx; char *blockData; struct timeval **ppTimeout; unsigned *pReadmask; { #ifndef _IBM_LFT static struct timeval waittime = { 0, 0 }; /* {sec, usec} */ TRACE(("AIXBlockHandler()\n")); waittime.tv_usec = SelectWaitTime; if (hftPending) { *ppTimeout= &waittime; handleInput= 1; } else { hftInterruptAlways(); handleInput= 0; } #else InputDevPrivate *pPriv = &lftInputInfo[KEYBOARD_ID]; /* check for input ring overflow */ if (lft_input_ring->ir_overflow == IROVERFLOW) { TRACE(("InputRing overflow\n")); ioctl(pPriv->fd, KSRFLUSH, NULL); } /* get signal everytime input ring have new event */ lft_input_ring->ir_notifyreq = IRSIGALWAYS; #endif /* _IBM_LFT */ return; } /***====================================================================***/ void AIXWakeupHandler(scrNdx,blockData,pTimeout,pReadmask) int scrNdx; char *blockData; struct timeval *pTimeout; unsigned *pReadmask; { #ifndef _IBM_LFT TRACE(("AIXWakeupHandler()\n")); if (handleInput) { ProcessInputEvents(); } hftInterruptOnFirst(); #else /* only get signal if inputring goes from empty to non-empty */ lft_input_ring->ir_notifyreq = IRSIGEMPTY; #endif return; } /***====================================================================***/ #ifndef NO_SECRETS static int aixShowSecretArgs= 0; #endif #ifdef AIXV3 void AIXUseMsg() { aixErrMsg(M_MSG_4); } #else void AIXUseMsg() { ErrorF("The \"X\" command accepts the following flags:\n"); ErrorF(" -a specify the mouse acceleration\n"); ErrorF(" -bp specify a BlackPixel color\n"); ErrorF(" -c specify the key click volume\n"); ErrorF(" -D specify the color definition data base file\n"); ErrorF(" -f specify the beep volume\n"); ErrorF(" -fc specify the font for cursor glyphs and masks\n"); ErrorF(" -fn specify the default text font\n"); ErrorF(" -fp specify the search path for fonts\n"); ErrorF(" -n : specify the connection number\n"); ErrorF(" -p specify the screen saver interval\n"); ErrorF(" -r disables auto repeat\n"); ErrorF(" -s specify the screen saver delay\n"); ErrorF(" -t specify the mouse threshold\n"); ErrorF(" -to