From b16b9e4656e7199c2aec74a4c8ebc7a875d3ba73 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 2 Feb 2015 15:02:49 +0100 Subject: massive reduction of unneeded files --- nx-X11/lib/XTrap/Imakefile | 30 --- nx-X11/lib/XTrap/XECallBcks.c | 175 ------------ nx-X11/lib/XTrap/XEConTxt.c | 589 ----------------------------------------- nx-X11/lib/XTrap/XEDsptch.c | 111 -------- nx-X11/lib/XTrap/XEPrInfo.c | 274 ------------------- nx-X11/lib/XTrap/XERqsts.c | 412 ---------------------------- nx-X11/lib/XTrap/XEStrMap.c | 284 -------------------- nx-X11/lib/XTrap/XETrapInit.c | 218 --------------- nx-X11/lib/XTrap/XEWrappers.c | 325 ----------------------- nx-X11/lib/XTrap/XTrap-def.cpp | 76 ------ 10 files changed, 2494 deletions(-) delete mode 100644 nx-X11/lib/XTrap/Imakefile delete mode 100644 nx-X11/lib/XTrap/XECallBcks.c delete mode 100644 nx-X11/lib/XTrap/XEConTxt.c delete mode 100644 nx-X11/lib/XTrap/XEDsptch.c delete mode 100644 nx-X11/lib/XTrap/XEPrInfo.c delete mode 100644 nx-X11/lib/XTrap/XERqsts.c delete mode 100644 nx-X11/lib/XTrap/XEStrMap.c delete mode 100644 nx-X11/lib/XTrap/XETrapInit.c delete mode 100644 nx-X11/lib/XTrap/XEWrappers.c delete mode 100644 nx-X11/lib/XTrap/XTrap-def.cpp (limited to 'nx-X11/lib/XTrap') diff --git a/nx-X11/lib/XTrap/Imakefile b/nx-X11/lib/XTrap/Imakefile deleted file mode 100644 index 54bfdd6dd..000000000 --- a/nx-X11/lib/XTrap/Imakefile +++ /dev/null @@ -1,30 +0,0 @@ -XCOMM $XFree86$ - -#define DoNormalLib NormalLibXTrap -#define DoSharedLib SharedLibXTrap -#define DoDebugLib DebugLibXTrap -#define DoProfileLib ProfileLibXTrap -#define LibName XTrap -#define SoRev SOXTRAPREV -#define LibHeaders NO - -#include - -#ifdef SharedXmuReqs -REQUIREDLIBS = SharedXmuReqs -#endif - -XCOMM wish this weren't necessary, but need xlib and xt internals... -INCLUDES=-I$(TOP)/include -I$(TOOLKITSRC) - - - SRCS = XECallBcks.c XEConTxt.c XEDsptch.c XEPrInfo.c \ - XERqsts.c XEStrMap.c XETrapInit.c XEWrappers.c - OBJS = XECallBcks.o XEConTxt.o XEDsptch.o XEPrInfo.o \ - XERqsts.o XEStrMap.o XETrapInit.o XEWrappers.o - -LINTLIBS = $(LINTXLIB) - -#include - -DependTarget() diff --git a/nx-X11/lib/XTrap/XECallBcks.c b/nx-X11/lib/XTrap/XECallBcks.c deleted file mode 100644 index fb1e0893e..000000000 --- a/nx-X11/lib/XTrap/XECallBcks.c +++ /dev/null @@ -1,175 +0,0 @@ -/* $XFree86$ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA - -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 and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -*****************************************************************************/ -/* - * - * CONTRIBUTORS: - * - * Dick Annicchiarico - * Robert Chesler - * Dan Coutu - * Gene Durso - * Marc Evans - * Alan Jamison - * Mark Henry - * Ken Miller - * - */ -/* - * This file contains XETrap Callback initilization routines. - * The callback data hang off of the TC and are freed as part of the - * XEFreeTC routine. - */ - -#include -#include -#include - -int XEAddRequestCB(XETC *tc, CARD8 req, void_function func, BYTE *data) -{ - if (!tc->values.req_cb) - { /* This is the first time for this particular TC, need to malloc */ - if ((tc->values.req_cb = - (XETrapCB *)XtCalloc(256L,sizeof(XETrapCB))) == NULL) - { - /* XtCalloc already reported the error */ - return(False); - } - } - tc->values.req_cb[req].func = func; - tc->values.req_cb[req].data = data; - - return(True); -} - -int XEAddRequestCBs(XETC *tc, ReqFlags req_flags, void_function func, - BYTE *data) -{ - int i; - int status = True; - - for (i=0; i<=255L; i++) - { - if (BitIsTrue(req_flags, i)) - { - status = XEAddRequestCB(tc, (CARD8)i, func, data); - } - } - return(status); -} - -int XEAddEventCB(XETC *tc, CARD8 evt, void_function func, BYTE *data) -{ - if (!tc->values.evt_cb) - { /* This is the first time for this particular TC, need to malloc */ - if ((tc->values.evt_cb = - (XETrapCB *)XtCalloc(XETrapCoreEvents,sizeof(XETrapCB))) == NULL) - { - /* XtCalloc already reported the error */ - return(False); - } - } - tc->values.evt_cb[evt].func = func; - tc->values.evt_cb[evt].data = data; - - return(True); -} - -int XEAddEventCBs(XETC *tc, EventFlags evt_flags, void_function func, - BYTE *data) -{ - int i; - int status = True; - - for (i=KeyPress; i<=MotionNotify; i++) - { - if (BitIsTrue(evt_flags, i)) - { - status = XEAddEventCB(tc, (CARD8)i, func, data); - } - } - return(status); -} - -void XERemoveRequestCB(XETC *tc, CARD8 req) -{ - if (!tc->values.req_cb) - { /* We gotta problem! CB struct not allocated! */ - return; - } - tc->values.req_cb[req].func = (void_function)NULL; - tc->values.req_cb[req].data = (BYTE *)NULL; - return; -} -void XERemoveRequestCBs(XETC *tc, ReqFlags req_flags) -{ - int i; - - for (i=0; i<=255L; i++) - { - if (BitIsTrue(req_flags, i)) - { - XERemoveRequestCB(tc, (CARD8)i); - } - } -} - -void XERemoveAllRequestCBs(XETC *tc) -{ - if (!tc->values.req_cb) - { /* We gotta problem! CB struct not allocated! */ - return; - } - XtFree((XtPointer)tc->values.req_cb); -} - -void XERemoveEventCB(XETC *tc, CARD8 evt) -{ - if (!tc->values.evt_cb) - { /* We gotta problem! CB struct not allocated! */ - return; - } - tc->values.evt_cb[evt].func = (void_function)NULL; - tc->values.evt_cb[evt].data = (BYTE *)NULL; - return; -} - -void XERemoveEventCBs(XETC *tc, EventFlags evt_flags) -{ - int i; - - for (i=KeyPress; i<=MotionNotify; i++) - { - if (BitIsTrue(evt_flags, i)) - { - XERemoveEventCB(tc, (CARD8)i); - } - } -} - -void XERemoveAllEventCBs(XETC *tc) -{ - if (!tc->values.evt_cb) - { /* We gotta problem! CB struct not allocated! */ - return; - } - XtFree((XtPointer)tc->values.evt_cb); -} diff --git a/nx-X11/lib/XTrap/XEConTxt.c b/nx-X11/lib/XTrap/XEConTxt.c deleted file mode 100644 index 7da96894b..000000000 --- a/nx-X11/lib/XTrap/XEConTxt.c +++ /dev/null @@ -1,589 +0,0 @@ -/* $XFree86: xc/lib/XTrap/XEConTxt.c,v 1.1 2001/11/02 23:29:27 dawes Exp $ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., -Maynard, MA - -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 and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -*****************************************************************************/ -/* - * - * CONTRIBUTORS: - * - * Dick Annicchiarico - * Robert Chesler - * Dan Coutu - * Gene Durso - * Marc Evans - * Alan Jamison - * Mark Henry - * Ken Miller - * - */ - -#define NEED_REPLIES -#define NEED_EVENTS - - -#include -#include - -#ifndef TRUE -# define TRUE 1L -#endif -#ifndef FALSE -# define FALSE 0L -#endif - -extern char *extensionData; - -static XETC TC; - -/* - * This function is used to create a new XTrap context structure. The new - * context is initialized to a hard coded default, then modified by the - * valuemask and values passed in by the caller. - */ - -XETC *XECreateTC(Display *dpy, CARD32 valuemask, XETCValues *value) -{ - static Bool firsttime = True; - register XETC *tc = &TC; - register XETC *last_tc; - XETrapGetAvailRep rep; - - /* If this is the first time here, then initialize the default TC */ - if (firsttime == True) - { - firsttime = False; - /* The first Trap Context is the Template (default) TC */ - (void)memset(tc,0L,sizeof(tc)); - tc->eventBase = 0x7FFFFFFFL; - tc->errorBase = 0x7FFFFFFFL; - tc->values.v.max_pkt_size = 0x7FFFL; - } - - /* Position to the end of the list */ - for (;tc->next != NULL; tc = tc->next); - - /* Allocate memory for the new context */ - last_tc = tc; /* save the address of the last on the list */ - if ((tc = (tc->next = (XETC *)XtMalloc(sizeof(*tc)))) == NULL) - { /* No memory to build TC, XtMalloc has already reported the error */ - return(NULL); - } - - /* Use the original TC as the template to start from */ - (void)memcpy(tc,&TC,sizeof(TC)); - tc->next = NULL; - tc->dpy = dpy; - tc->xmax_size = XMaxRequestSize(tc->dpy); - - /* Initialize Extension */ - if (!XETrapQueryExtension(dpy,&(tc->eventBase),&(tc->errorBase), - &(tc->extOpcode))) - { - char *params = XTrapExtName; - unsigned int num_params = 1L; - XtWarningMsg("CantLoadExt", "XECreateTC", "XTrapToolkitError", - "Can't load %s extension", ¶ms, &num_params); - (void)XtFree((XtPointer)tc); - last_tc->next = NULL; /* Clear now nonexistant forward pointer */ - return(NULL); - } - - /* Allocate memory for the XLIB transport */ - if ((tc->xbuff = (BYTE *)XtMalloc(tc->xmax_size * sizeof(CARD32) + - SIZEOF(XETrapHeader))) == NULL) - { /* No memory to build TC, XtMalloc has already reported the error */ - (void)XtFree((XtPointer)tc); /* free the allocated TC */ - last_tc->next = NULL; /* Clear now nonexistant forward pointer */ - return(NULL); - } - - /* Decide on a protocol version to communicate with */ - /* would *like* to use XEGetVersionRequest() but it's broken in V3.1 */ - if (XEGetAvailableRequest(tc,&rep) == True) - { - /* stow the protocol number */ - switch (rep.xtrap_protocol) - { - /* known acceptable protocols */ - case 31: - case XETrapProtocol: - tc->protocol = rep.xtrap_protocol; - break; - /* all else */ - default: /* stay backwards compatible */ - tc->protocol = 31; - break; - } - /* TC to contain *oldest* release/version/revision */ - if (XETrapGetAvailRelease(&rep) <= XETrapRelease) - { - tc->release = XETrapGetAvailRelease(&rep); - if (XETrapGetAvailVersion(&rep) <= XETrapVersion) - { - tc->version = XETrapGetAvailVersion(&rep); - tc->revision = (XETrapGetAvailRevision(&rep) <= XETrapRevision ? - XETrapGetAvailRevision(&rep) : XETrapRevision); - } - else - { - tc->version = XETrapVersion; - tc->revision = XETrapRevision; - } - } - else - { - tc->release = XETrapRelease; - tc->version = XETrapVersion; - tc->revision = XETrapRevision; - } - } - else - { /* We can't seem to communicate with the extension! */ - char *params = XTrapExtName; - unsigned int num_params = 1L; - XtWarningMsg("CantComm", "XECreateTC", "XTrapToolkitError", - "Can't communicate with extension %s", ¶ms, &num_params); - (void)XtFree((XtPointer)tc->xbuff);/* de-allocate memory just alloc'd */ - (void)XtFree((XtPointer)tc); /* free the allocated TC */ - last_tc->next = NULL; /* Clear now nonexistant forward pointer */ - return(NULL); - } - - /* Assign the context values the caller provided */ - (void)XEChangeTC(tc, valuemask, value); - - return (tc); -} - - -static int CheckChangeBits(XETrapFlags *dest, XETrapFlags *src, INT32 bit) -{ - int chg_flag = False; - - if (!(BitIsFalse(dest->valid,bit) && BitIsFalse(src->valid,bit)) || - !(BitIsTrue(dest->valid,bit) && BitIsTrue(src->valid,bit))) - { - BitCopy(dest->valid, src->valid, bit); - chg_flag = True; - } - if (!(BitIsFalse(dest->data,bit) && BitIsFalse(src->data,bit)) || - !(BitIsTrue(dest->data,bit) && BitIsTrue(src->data,bit))) - { - BitCopy(dest->data, src->data, bit); - chg_flag = True; - } - return(chg_flag); -} - -/* - * This function is called to change one or more parameters used to define - * a context in which XTrap is or will be running. - */ -int XEChangeTC(XETC *tc, CARD32 mask, XETCValues *values) -{ - int status = True; - register XETCValues *tval = &(tc->values); - register int i; - - if (mask & TCStatistics) - { /* Statistics need changing */ - if(CheckChangeBits(&(tval->v.flags), &(values->v.flags), - XETrapStatistics)) - { - tc->dirty |= TCStatistics; - } - } - if (mask & TCRequests) - { /* Requests need changing */ - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapRequest); - for (i=0; i<256L; i++) - { - XETrapSetCfgFlagReq(tval, i, BitValue(values->v.flags.req,i)); - } - tc->dirty |= TCRequests; - } - if (mask & TCEvents) - { /* Events need changing */ - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapEvent); - for (i=KeyPress; i<=MotionNotify; i++) - { - XETrapSetCfgFlagEvt(tval, i, BitValue(values->v.flags.event,i)); - } - tc->dirty |= TCEvents; - } - if (mask & TCMaxPacket) - { /* MaxPacket needs changing */ - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapMaxPacket); - XETrapSetCfgMaxPktSize(tval, values->v.max_pkt_size); - tc->dirty |= TCMaxPacket; - } - if (mask & TCCmdKey) - { /* CmdKey needs changing */ - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapCmd); - tval->v.cmd_key = values->v.cmd_key; - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapCmdKeyMod); - tc->dirty |= TCCmdKey; - } - if (mask & TCTimeStamps) - { /* TimeStamps needs changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapTimestamp)) - { - tc->dirty |= TCTimeStamps; - } - BitCopy(tval->tc_flags, values->tc_flags, XETCDeltaTimes); - } - if (mask & TCWinXY) - { /* Window XY's need changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapWinXY)) - { - tc->dirty |= TCWinXY; - } - } - if (mask & TCCursor) - { /* Window XY's need changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags),XETrapCursor)) - { - tc->dirty |= TCCursor; - } - } - if (mask & TCXInput) - { /* XInput flag needs changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags),XETrapXInput)) - { - tc->dirty |= TCXInput; - } - } - if (mask & TCColorReplies) - { /* ColorReplies flag needs changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), - XETrapColorReplies)) - { - tc->dirty |= TCColorReplies; - } - } - if (mask & TCGrabServer ) - { /* GrabServer flag needs changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), - XETrapGrabServer )) - { - tc->dirty |= TCGrabServer; - } - } - if (XETrapGetTCFlagTrapActive(tc)) - { - status = XEFlushConfig(tc); - } -#ifdef VMS - sys$setast(True); /* Make sure AST's are enabled */ -#endif /* VMS */ - return(status); -} - - -void XEFreeTC(XETC *tc) -{ - register XETC *list = &TC; - - if (tc) - { - while(list->next != NULL) - { - if (list->next == tc) - list->next = list->next->next; /* Got it, remove from list */ - else - list = list->next; /* Update the list pointer */ - } - if (tc->values.req_cb) - { - XtFree((XtPointer)tc->values.req_cb); - } - if (tc->values.evt_cb) - { - XtFree((XtPointer)tc->values.evt_cb); - } - if (tc->xbuff != NULL) - { - XtFree((XtPointer)tc->xbuff); - } - - XtFree((XtPointer)tc); - if (extensionData) - { - XtFree(extensionData); - } - } - return; -} - -/* The following are Convenience routines for setting values within - * the Trap Context. These are analogous to the GC's Convenience - * Functions such as XSetState & XSetForeground - */ -int XETrapSetMaxPacket(XETC *tc, Bool set_flag, CARD16 size) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagMaxPacket(&tcv, valid, True); - XETrapSetCfgFlagMaxPacket(&tcv, data, set_flag); - XETrapSetCfgMaxPktSize(&tcv, size); - status = XEChangeTC(tc, TCMaxPacket, &tcv); - return(status); -} -int XETrapSetCommandKey(XETC *tc, Bool set_flag, KeySym cmd_key, Bool mod_flag) -{ - XETCValues tcv; - int status = True; - KeyCode cmd_keycode; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagCmd(&tcv, valid, True); - XETrapSetCfgFlagCmd(&tcv, data, set_flag); - if (set_flag == True) - { - XETrapSetCfgFlagCmdKeyMod(&tcv, valid, True); - XETrapSetCfgFlagCmdKeyMod(&tcv, data, mod_flag); - if (!(cmd_keycode = XKeysymToKeycode(XETrapGetDpy(tc), cmd_key))) - { - status = False; - } - else - { - XETrapSetCfgCmdKey(&tcv, cmd_keycode); - } - } - else - { /* Clear command key */ - XETrapSetCfgFlagCmdKeyMod(&tcv, valid, True); - XETrapSetCfgFlagCmdKeyMod(&tcv, data, False); - XETrapSetCfgCmdKey(&tcv, 0); - } - if (status == True) - { - status = XEChangeTC(tc, TCCmdKey, &tcv); - } - return(status); -} - -int XETrapSetTimestamps(XETC *tc, Bool set_flag, Bool delta_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagTimestamp(&tcv, valid, True); - XETrapSetCfgFlagTimestamp(&tcv, data, set_flag); - XETrapSetValFlagDeltaTimes(&tcv, delta_flag); - status = XEChangeTC(tc, TCTimeStamps, &tcv); - return(status); -} - -int XETrapSetWinXY(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagWinXY(&tcv, valid, True); - XETrapSetCfgFlagWinXY(&tcv, data, set_flag); - status = XEChangeTC(tc, TCWinXY, &tcv); - return(status); -} - -int XETrapSetCursor(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagCursor(&tcv, valid, True); - XETrapSetCfgFlagCursor(&tcv, data, set_flag); - status = XEChangeTC(tc, TCCursor, &tcv); - return(status); -} - -int XETrapSetXInput(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagXInput(&tcv, valid, True); - XETrapSetCfgFlagXInput(&tcv, data, set_flag); - status = XEChangeTC(tc, TCXInput, &tcv); - return(status); -} - -int XETrapSetColorReplies(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagColorReplies(&tcv, valid, True); - XETrapSetCfgFlagColorReplies(&tcv, data, set_flag); - status = XEChangeTC(tc, TCColorReplies, &tcv); - return(status); -} - -int XETrapSetGrabServer(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagGrabServer(&tcv, valid, True); - XETrapSetCfgFlagGrabServer(&tcv, data, set_flag); - status = XEChangeTC(tc, TCGrabServer, &tcv); - return(status); -} - -int XETrapSetStatistics(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagStatistics(&tcv, valid, True); - XETrapSetCfgFlagStatistics(&tcv, data, set_flag); - status = XEChangeTC(tc, TCStatistics, &tcv); - return(status); -} - -int XETrapSetRequests(XETC *tc, Bool set_flag, ReqFlags requests) -{ - XETCValues tcv; - int status = True; - int i; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagRequest(&tcv, valid, True); - XETrapSetCfgFlagRequest(&tcv, data, set_flag); - for (i=0; i<256L; i++) - { - XETrapSetCfgFlagReq(&tcv, i, BitValue(requests, i)); - } - status = XEChangeTC(tc, TCRequests, &tcv); - return(status); -} - -int XETrapSetEvents(XETC *tc, Bool set_flag, EventFlags events) -{ - XETCValues tcv; - int status = True; - int i; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagEvent(&tcv, valid, True); - XETrapSetCfgFlagEvent(&tcv, data, set_flag); - for (i=KeyPress; i<=MotionNotify; i++) - { - XETrapSetCfgFlagEvt(&tcv, i, BitValue(events, i)); - } - status = XEChangeTC(tc, (CARD32)TCEvents, &tcv); - return(status); -} - -Bool XESetCmdGateState(XETC *tc, CARD8 type, Bool *gate_closed, - CARD8 *next_key, Bool *key_ignore) -{ - - *key_ignore = False; - if (XETrapGetTCFlagCmdKeyMod(tc,data) == True) - { - switch (type) - { - case KeyPress: - if (*next_key == XEKeyIsEcho) - { - break; - } - *gate_closed = True; - *next_key = XEKeyIsClear; - break; - - case KeyRelease: - if (*next_key == XEKeyIsEcho) - { - *next_key = XEKeyIsClear; - break; - } - if (*next_key == XEKeyIsClear) - { - *next_key = XEKeyIsEcho; - } - else - { /* it's XEKeyIsOther, so Clear it */ - *next_key = XEKeyIsClear; - } - *gate_closed = False; - *key_ignore = True; - break; - - default: break; - } - } - else - { - switch (type) - { - case KeyPress: - if (*next_key == XEKeyIsEcho) - { - *gate_closed = False; - break; - } - /* Open gate on cmd key release */ - if ((*next_key == XEKeyIsOther) && - *gate_closed == True) - { - break; - } - *gate_closed = True; - *next_key = XEKeyIsClear; - break; - - case KeyRelease: - if (*next_key == XEKeyIsClear) - { - *next_key = XEKeyIsEcho; - break; - } - - if (*next_key == XEKeyIsEcho) - { - *next_key = XEKeyIsClear; - break; - } - - *gate_closed = False; - *key_ignore = True; - *next_key = XEKeyIsClear; - break; - - default: - break; - } - } - - return(*gate_closed); -} diff --git a/nx-X11/lib/XTrap/XEDsptch.c b/nx-X11/lib/XTrap/XEDsptch.c deleted file mode 100644 index b50392638..000000000 --- a/nx-X11/lib/XTrap/XEDsptch.c +++ /dev/null @@ -1,111 +0,0 @@ -/* $XFree86$ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA - -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 and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -*****************************************************************************/ -/* - * - * CONTRIBUTORS: - * - * Dick Annicchiarico - * Robert Chesler - * Dan Coutu - * Gene Durso - * Marc Evans - * Alan Jamison - * Mark Henry - * Ken Miller - * - */ - -#include -#include -#include -#include - -static void XETrapDispatchCB(XETC *tc, XETrapDatum *pdatum) -{ - void_function pfunc = NULL; - BYTE *userp = NULL; - - /* Need to deal with Delta Timestamps here before calling client CB */ - if (XETrapGetTCFlagDeltaTimes(tc)) - { - CARD32 last_time = XETrapGetTCTime(tc); - if (XETrapHeaderIsEvent(&pdatum->hdr)) - { /* then we can play with the timestamps */ - pdatum->hdr.timestamp = - pdatum->u.event.u.keyButtonPointer.time; - } - else - { /* - * the current one from GetTimeInMillis is worthless - * as it's only updated during event instances (e.g. not - * wall clock). - */ - pdatum->hdr.timestamp = last_time; - } - if (!pdatum->hdr.timestamp) - { /* for dual monitor bug */ - pdatum->hdr.timestamp = last_time; - } - if (!last_time) - { /* first one! Prime it! */ - last_time = pdatum->hdr.timestamp; - } - tc->values.last_time = pdatum->hdr.timestamp; /* no macro! */ - if (pdatum->hdr.timestamp < last_time) - { /* for clock rollover */ - pdatum->hdr.timestamp = 0; - } - else - { /* the real delta */ - pdatum->hdr.timestamp = pdatum->hdr.timestamp - last_time; - } - } - /* Get the user supplied callback function */ - if (XETrapHeaderIsEvent(&pdatum->hdr)) - { - pfunc = tc->values.evt_cb[pdatum->u.event.u.u.type].func; - userp = tc->values.evt_cb[pdatum->u.event.u.u.type].data; - } - else if (XETrapHeaderIsRequest(&pdatum->hdr) || - XETrapHeaderIsReply(&pdatum->hdr)) - { - pfunc = tc->values.req_cb[pdatum->u.req.reqType].func; - userp = tc->values.req_cb[pdatum->u.req.reqType].data; - } - - /* If there is a callback then call it with the data */ - if (pfunc != NULL) - { - (*pfunc)(tc,pdatum,userp); - } -} - -Boolean XETrapDispatchXLib(XETrapDataEvent *event, XETC *tc) -{ - memcpy(&tc->xbuff[event->idx*sz_EventData], event->data, sz_EventData); - - if (event->detail == XETrapDataLast) - { - XETrapDispatchCB(tc, (XETrapDatum *)tc->xbuff); - } - return True; -} diff --git a/nx-X11/lib/XTrap/XEPrInfo.c b/nx-X11/lib/XTrap/XEPrInfo.c deleted file mode 100644 index 908ca3ad9..000000000 --- a/nx-X11/lib/XTrap/XEPrInfo.c +++ /dev/null @@ -1,274 +0,0 @@ -/* $XFree86$ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., -Maynard, MA - -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 and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -*****************************************************************************/ -#include -#include -#include -#include - -#ifndef TRUE -# define TRUE 1L -#endif -#ifndef FALSE -# define FALSE 0L -#endif - -void XEPrintRelease( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - fprintf(ofp,"\tRelease: %d.%d-%d\n", XETrapGetAvailRelease(pavail), - XETrapGetAvailVersion(pavail), XETrapGetAvailRevision(pavail)); -} -void XEPrintTkRelease( FILE *ofp, XETC *tc) -{ - fprintf(ofp,"\tRelease: %d.%d-%d\n", XEGetRelease(tc), XEGetVersion(tc), - XEGetRevision(tc)); -} - -void XEPrintPlatform( FILE *ofp, XETrapGetAvailRep *pavail) -{ - fprintf(ofp,"\tPlatform: %s (0x%02x)\n", - XEPlatformIDToString(XETrapGetAvailPFIdent(pavail)), - (int)XETrapGetAvailPFIdent(pavail)); -} - -void XEPrintAvailFlags( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - CARD8 f[4L]; - - XETrapGetAvailFlags(pavail,f); - fprintf(ofp,"\tFlags: "); - if (XETrapGetAvailFlagTimestamp(pavail)) fputs("Timestamps ", ofp); - if (XETrapGetAvailFlagCmd(pavail)) fputs("CmdKey ", ofp); - if (XETrapGetAvailFlagCmdKeyMod(pavail)) fputs("CmdKeyMod ", ofp); - if (XETrapGetAvailFlagRequest(pavail)) fputs("Requests ", ofp); - if (XETrapGetAvailFlagEvent(pavail)) fputs("Events ", ofp); - if (XETrapGetAvailFlagMaxPacket(pavail)) fputs("MaxPkt ", ofp); - if (XETrapGetAvailFlagStatistics(pavail)) fputs("Statistics ", ofp); - if (XETrapGetAvailFlagWinXY(pavail)) fputs("WinXY ", ofp); - if (XETrapGetAvailFlagCursor(pavail)) fputs("Cursor ", ofp); - if (XETrapGetAvailFlagXInput(pavail)) fputs("XInput ", ofp); - if (XETrapGetAvailFlagVecEvt(pavail)) fputs("Vect_Evnts ", ofp); - if (XETrapGetAvailFlagColorReplies(pavail)) fputs("ColorRep ", ofp); - if (XETrapGetAvailFlagGrabServer(pavail)) fputs("GrabServer ", ofp); - fprintf(ofp," (0x%02x%02x%02x%02x)\n", f[0], f[1], f[2], f[3]); -} - -void XEPrintAvailPktSz( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - fprintf(ofp,"\tMax Packet Size: %d\n", XETrapGetAvailMaxPktSize(pavail)); -} -void XEPrintStateFlags( FILE *ofp, XETrapGetCurRep *pcur) -{ - - CARD8 f[2]; - XETrapGetCurSFlags(pcur, f); - fputs("\tFlags: ",ofp); - if (BitIsTrue(f,XETrapTrapActive)) fputs("I/O Active ", ofp); - fprintf(ofp," (0x%02x%02x)\n", f[0], f[1]); -} - -void XEPrintMajOpcode( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - fprintf(ofp,"\tMajor Opcode: %d\n", (int)XETrapGetAvailOpCode(pavail)); -} -void XEPrintCurXY( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - fprintf(ofp,"\tCurrent (x,y): (%d,%d)\n", XETrapGetCurX(pavail), - XETrapGetCurY(pavail)); -} - -void XEPrintTkFlags( FILE *ofp, XETC *tc) -{ - - CARD8 f[2]; - XETrapGetTCLFlags(tc, f); - fputs("\tFlags: ",ofp); - if (XETrapGetTCFlagDeltaTimes(tc)) fputs("Delta Times ", ofp); - if (XETrapGetTCFlagTrapActive(tc)) fputs("Trap Active ", ofp); - fprintf(ofp," (0x%02x%02x)\n", f[0], f[1]); -} - -void XEPrintLastTime( FILE *ofp, XETC *tc) -{ - - fprintf(ofp,"\tLast Relative Time: %d\n", (int)XETrapGetTCTime(tc)); -} - -void XEPrintCfgFlags( FILE *ofp, XETrapGetCurRep *pcur) -{ - - CARD8 f[4L]; - - XETrapGetCurCFlags(pcur,data,f); - fprintf(ofp,"\tFlags: "); - if (XETrapGetCurFlagTimestamp(pcur,data)) fputs("Timestamps ", ofp); - if (XETrapGetCurFlagCmd(pcur,data)) fputs("CmdKey ", ofp); - if (XETrapGetCurFlagCmdKeyMod(pcur,data)) fputs("CmdKeyMod ", ofp); - if (XETrapGetCurFlagRequest(pcur,data)) fputs("Requests ", ofp); - if (XETrapGetCurFlagEvent(pcur,data)) fputs("Events ", ofp); - if (XETrapGetCurFlagMaxPacket(pcur,data)) fputs("MaxPkt ", ofp); - if (XETrapGetCurFlagStatistics(pcur,data)) fputs("Statistics ", ofp); - if (XETrapGetCurFlagWinXY(pcur,data)) fputs("WinXY ", ofp); - if (XETrapGetCurFlagCursor(pcur,data)) fputs("Cursor ", ofp); - if (XETrapGetCurFlagXInput(pcur,data)) fputs("XInput ", ofp); - if (XETrapGetCurFlagColorReplies(pcur,data)) fputs("ColorReplies ", ofp); - if (XETrapGetCurFlagGrabServer(pcur,data)) fputs("GrabServer ", ofp); - fprintf(ofp," (0x%02x%02x%02x%02x)\n", f[0], f[1], f[2], f[3]); -} - -void XEPrintRequests( FILE *ofp, XETrapGetCurRep *pcur) -{ - - long i; - fprintf(ofp,"\tX Requests: "); - for (i=0L; i<=XETrapMaxRequest-1; i++) - { /* Not using the macro cause we're doing things - * a byte at a time rather than a bit. - */ - fprintf(ofp,"%02x ", pcur->config.flags.req[i]); - if ((i+1L)%4L == 0L) - { - fprintf(ofp," "); - } - if ((i+1L)%16L == 0L) - { - fprintf(ofp,"\n\t\t "); - } - } - fprintf(ofp,"\n"); -} - -void XEPrintEvents( FILE *ofp, XETrapGetCurRep *pcur) -{ - - int i; - fprintf(ofp,"\tX Events: "); - for (i=0L; iconfig.flags.event[i]); - if ((i+1L)%4L == 0L) - { - fprintf(ofp," "); - } - if ((i+1L)%16L == 0L) - { - fprintf(ofp,"\n\t\t "); - } - } - fprintf(ofp,"\n"); -} - -void XEPrintCurPktSz( FILE *ofp, XETrapGetCurRep *pcur) -{ - - fprintf(ofp,"\tMax Packet Size: %d\n", XETrapGetCurMaxPktSize(pcur)); -} - -void XEPrintCmdKey( FILE *ofp, XETrapGetCurRep *pcur) -{ - - fprintf(ofp,"\tcmd_key: 0x%02x\n", XETrapGetCurCmdKey(pcur)); -} - -void XEPrintEvtStats( FILE *ofp, XETrapGetStatsRep *pstats, XETC *tc) -{ - - int i; - fprintf(ofp,"\tX Events:\n"); - for (i=0; i -#define NEED_REPLIES -#define NEED_EVENTS -#include -#else /* NO_DEC_BUG_FIX */ -#include -#define NEED_REPLIES -#define NEED_EVENTS -#include -#endif /* NO_DEC_BUG_FIX */ -/* the following's a hack to support V3.1 protocol */ -#if defined(__STDC__) && !defined(UNIXCPP) -#define GetOldReq(name, req, old_length) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = old_length>>2;\ - dpy->bufptr += old_length;\ - dpy->request++ - -#else /* non-ANSI C uses empty comment instead of "##" for token concat */ -#define GetOldReq(name, req, old_length) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = old_length>>2;\ - dpy->bufptr += old_length;\ - dpy->request++ -#endif - -#ifndef vms -#include -#else /* vms */ -#define SyncHandle() \ - if (dpy->synchandler) (*dpy->synchandler)(dpy) -/* - * LockDisplay uses an undocumented feature in V5 of VMS that allows - * disabling ASTs without calling $SETAST. A bit is set in P1 space - * that disables a user mode AST from being delivered to this process. - * - */ -#define LockDisplay(dis) \ -{ globalref char ctl$gb_soft_ast_disable; \ - globalref char ctl$gb_lib_lock; \ - globalref short ctl$gw_soft_ast_lock_depth; \ - if ( ctl$gb_soft_ast_disable == 0 ) { \ - ctl$gb_soft_ast_disable = 1; \ - ctl$gb_lib_lock = 1; \ - ctl$gw_soft_ast_lock_depth = 1; \ - } \ - else ctl$gw_soft_ast_lock_depth++; \ -} - -/* - * UnlockDisplay clears the AST disable bit, then checks to see if an - * AST delivery attempt was made during the critical section. If so, - * reenable_ASTs is set, and $SETAST must be called to turn AST delivery - * back on. - * - * Note that it assumed that LockDisplay and UnlockDisplay appear in - * matched sets within a single routine. - */ -#define UnlockDisplay(dis) \ -{ globalref char ctl$gb_reenable_asts; \ - globalref char ctl$gb_soft_ast_disable; \ - globalref char ctl$gb_lib_lock; \ - globalref short ctl$gw_soft_ast_lock_depth; \ - if (!--ctl$gw_soft_ast_lock_depth) \ - if ( ctl$gb_lib_lock ) { \ - ctl$gb_lib_lock = 0; \ - ctl$gb_soft_ast_disable = 0; \ - if (ctl$gb_reenable_asts != 0) \ - sys$setast(1); \ - } \ -} - -#define WORD64ALIGN -#if defined(__STDC__) && !defined(UNIXCPP) -#define GetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = (SIZEOF(x##name##Req))>>2;\ - dpy->bufptr += SIZEOF(x##name##Req);\ - dpy->request++ - -#else /* non-ANSI C uses empty comment instead of "##" for token concat */ -#define GetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = (SIZEOF(x/**/name/**/Req))>>2;\ - dpy->bufptr += SIZEOF(x/**/name/**/Req);\ - dpy->request++ -#endif -#endif /* vms */ - -#include -#include - -/* Returns the all important protocol number to be used. - * The only request guaranteed to be of the same request/reply - * size is XEGetVersionRequest. All others need the protocol - * number to determine how to communicate. - * Unfortunately, this was broken for V3.1 so GetAvailable will - * have to be used to determine the protocol version. - */ -int XEGetVersionRequest(XETC *tc, XETrapGetVersRep *ret) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrapGet = tc->extOpcode; - xXTrapGetReq *reqptr; - xXTrapGetVersReply rep; - int numlongs = (SIZEOF(xXTrapGetVersReply) - - SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); - LockDisplay(dpy); - GetReq(XTrapGet,reqptr); - reqptr->minor_opcode = XETrap_GetVersion; - reqptr->protocol = XETrapProtocol; - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - SyncHandle(); - UnlockDisplay(dpy); - memcpy((char *)ret,&(rep.data),sizeof(XETrapGetVersRep)); - return(status); -} - -int XEGetAvailableRequest(XETC *tc, XETrapGetAvailRep *ret) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrapGet = tc->extOpcode; - xXTrapGetReq *reqptr; - xXTrapGetAvailReply rep; - int numlongs = (SIZEOF(xXTrapGetAvailReply) - - SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); - LockDisplay(dpy); - GetReq(XTrapGet,reqptr); - reqptr->minor_opcode = XETrap_GetAvailable; - reqptr->protocol = XETrapProtocol; - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - SyncHandle(); - UnlockDisplay(dpy); - memcpy((char *)ret,&(rep.data),sizeof(XETrapGetAvailRep)); - return(status); -} - -/* should not be called directly by clients */ -static int XEConfigRequest(XETC *tc) -{ /* protocol changed between V3.1 and V3.2! */ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrapConfig = tc->extOpcode; - xXTrapConfigReq *reqptr; - if (tc->protocol == 31) - { /* hack to allocate the old request length */ - GetOldReq(XTrapConfig,reqptr,276); - } - else - { - GetReq(XTrapConfig,reqptr); - } - reqptr->minor_opcode = XETrap_Config; - - memcpy((char *)reqptr->config_flags_valid, - (char *)tc->values.v.flags.valid,4); - memcpy((char *)reqptr->config_flags_data, - (char *)tc->values.v.flags.data,4); - memcpy((char *)reqptr->config_flags_req, - (char *)tc->values.v.flags.req,XETrapMaxRequest); - memcpy((char *)reqptr->config_flags_event, - (char *)tc->values.v.flags.event,XETrapMaxEvent); - reqptr->config_max_pkt_size=tc->values.v.max_pkt_size; - reqptr->config_cmd_key=tc->values.v.cmd_key; - - XFlush(dpy); - SyncHandle(); - tc->dirty = 0L; /* Configuration is no longer dirty */ - return(status); -} - -/* Flush out any pending configuration */ -int XEFlushConfig(XETC *tc) -{ - return((tc->dirty) ? XEConfigRequest(tc) : True); -} -int XEResetRequest(XETC *tc) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_Reset; - XFlush(dpy); - SyncHandle(); - } - return(status); -} - - -int XEGetLastInpTimeRequest(XETC *tc, XETrapGetLastInpTimeRep *ret) -{ /* this was broken in V3.1! */ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - xXTrapGetLITimReply rep; - int numlongs = (SIZEOF(xXTrapGetLITimReply) - - SIZEOF(xReply) + SIZEOF(CARD32) - 1) / SIZEOF(CARD32); - LockDisplay(dpy); - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_GetLastInpTime; - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - SyncHandle(); - UnlockDisplay(dpy); - - ret->last_time=rep.data_last_time; - - return(status); -} - -int XEStartTrapRequest(XETC *tc) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - /* Add our event handler for the XLib transport */ - XETrapSetEventHandler(tc, XETrapData, XETrapDispatchXLib); - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_StartTrap; - XFlush(dpy); - SyncHandle(); - BitTrue(tc->values.tc_flags, XETCTrapActive); - } - return(status); -} -int XEStopTrapRequest(XETC *tc) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_StopTrap; - XFlush(dpy); - SyncHandle(); - BitFalse(tc->values.tc_flags, XETCTrapActive); - /* Remove our event handler for the XLib transport */ - XETrapSetEventHandler(tc, XETrapData, NULL); - } - - return(status); -} - -#ifndef _XINPUT -int XESimulateXEventRequest(XETC *tc, CARD8 type, CARD8 detail, - CARD16 x, CARD16 y, CARD8 screen) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrapInput = tc->extOpcode; - xXTrapInputReq *reqptr; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { /* write out the input event */ - GetReq(XTrapInput,reqptr); - reqptr->minor_opcode = XETrap_SimulateXEvent; - reqptr->input.type = type; - reqptr->input.detail = detail; - reqptr->input.x = x; - reqptr->input.y = y; - reqptr->input.screen = screen; - XFlush(dpy); - } - return(status); -} -#endif -int XEGetCurrentRequest(XETC *tc, XETrapGetCurRep *ret) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - xXTrapGetCurReply rep; - int numlongs = (SIZEOF(xXTrapGetCurReply) - - SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - LockDisplay(dpy); - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_GetCurrent; - /* to support comm. w/ V3.1 extensions */ - if (tc->protocol == 31) - { - char tmp[284]; /* need space for the big *old* reply */ - numlongs = (284-sizeof(xReply)+sizeof(long)-1)/sizeof(long); - status = _XReply(dpy,(xReply *)tmp,numlongs,xTrue); - memcpy(&rep,tmp,sizeof(rep)); /* move just what's needed */ - } - else - { - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - } - SyncHandle(); - UnlockDisplay(dpy); - - memcpy((char *)ret->state_flags,rep.data_state_flags,2); - memcpy((char *)ret->config.flags.valid,rep.data_config_flags_valid,4); - memcpy((char *)ret->config.flags.data,rep.data_config_flags_data,4); - memcpy((char *)ret->config.flags.req,rep.data_config_flags_req, - XETrapMaxRequest); - memcpy((char *)ret->config.flags.event,rep.data_config_flags_event, - XETrapMaxEvent); - ret->config.max_pkt_size=rep.data_config_max_pkt_size; - ret->config.cmd_key=rep.data_config_cmd_key; - - } - return(status); -} - -int XEGetStatisticsRequest(XETC *tc, XETrapGetStatsRep *ret) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - xXTrapGetStatsReply rep; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - LockDisplay(dpy); - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_GetStatistics; - /* to support comm. w/ V3.1 extensions */ -#ifndef CRAY - if (tc->protocol == 31) - { /* this is the way we used to do it which breaks Cray's */ -#ifndef VECTORED_EVENTS - int numlongs = (1060-sizeof(xReply)+sizeof(long)-1)/sizeof(long); -#else - int numlongs = (1544-sizeof(xReply)+sizeof(long)-1)/sizeof(long); -#endif - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - if (status == True) - { /* need to shift it back into the data struct */ - xXTrapGetStatsReply tmp; - tmp = rep; - memcpy(&(rep.data),&(tmp.pad0), sizeof(rep.data)); - } - } - else -#endif /* CRAY */ - { /* this is the way we do it for V3.2 */ - int numbytes = SIZEOF(xXTrapGetStatsReply) - SIZEOF(xReply); - status = _XReply(dpy, (xReply *)&rep, 0, xFalse); - if (status == True) - { - status = _XRead(dpy, (char *)&rep.data, numbytes); - } - } - SyncHandle(); - UnlockDisplay(dpy); - memcpy(ret,&(rep.data),sizeof(XETrapGetStatsRep)); - } - return(status); -} diff --git a/nx-X11/lib/XTrap/XEStrMap.c b/nx-X11/lib/XTrap/XEStrMap.c deleted file mode 100644 index 2a97f13f4..000000000 --- a/nx-X11/lib/XTrap/XEStrMap.c +++ /dev/null @@ -1,284 +0,0 @@ -/* $XFree86: xc/lib/XTrap/XEStrMap.c,v 1.1 2001/11/02 23:29:27 dawes Exp $ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1994 by Digital Equipment Corp., -Maynard, MA - -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 and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -*****************************************************************************/ -#include -#include -#include -#include - -static char *eventName[] = { - "", "", - "KeyPress", "KeyRelease", "ButtonPress", - "ButtonRelease", "MotionNotify", "EnterNotify", - "LeaveNotify", "FocusIn", "FocusOut", - "KeymapNotify", "Expose", "GraphicsExpose", - "NoExpose", "VisibilityNotify", "CreateNotify", - "DestroyNotify", "UnmapNotify", "MapNotify", - "MapRequest", "ReparentNotify", "ConfigureNotify", - "ConfigureRequest", "GravityNotify", "ResizeRequest", - "CirculateNotify", "CirculateRequest", "PropertyNotify", - "SelectionClear", "SelectionRequest", "SelectionNotify", - "ColormapNotify", "ClientMessage", "MappingNotify", - "LASTEvent", -}; - -static char *requestName[] = { - "Invalid", - "X_CreateWindow", "X_ChangeWindowAttributes", - "X_GetWindowAttributes", "X_DestroyWindow", - "X_DestroySubwindows", "X_ChangeSaveSet", - "X_ReparentWindow", "X_MapWindow", - "X_MapSubwindows", "X_UnmapWindow", - "X_UnmapSubwindows", "X_ConfigureWindow", - "X_CirculateWindow", "X_GetGeometry", - "X_QueryTree", "X_InternAtom", - "X_GetAtomName", "X_ChangeProperty", - "X_DeleteProperty", "X_GetProperty", - "X_ListProperties", "X_SetSelectionOwner", - "X_GetSelectionOwner", "X_ConvertSelection", - "X_SendEvent", "X_GrabPointer", - "X_UngrabPointer", "X_GrabButton", - "X_UngrabButton", "X_ChangeActivePointerGrab", - "X_GrabKeyboard", "X_UngrabKeyboard", - "X_GrabKey", "X_UngrabKey", - "X_AllowEvents", "X_GrabServer", - "X_UngrabServer", "X_QueryPointer", - "X_GetMotionEvents", "X_TranslateCoords", - "X_WarpPointer", "X_SetInputFocus", - "X_GetInputFocus", "X_QueryKeymap", - "X_OpenFont", "X_CloseFont", - "X_QueryFont", "X_QueryTextExtents", - "X_ListFonts", "X_ListFontsWithInfo", - "X_SetFontPath", "X_GetFontPath", - "X_CreatePixmap", "X_FreePixmap", - "X_CreateGC", "X_ChangeGC", - "X_CopyGC", "X_SetDashes", - "X_SetClipRectangles", "X_FreeGC", - "X_ClearArea", "X_CopyArea", - "X_CopyPlane", "X_PolyPoint", - "X_PolyLine", "X_PolySegment", - "X_PolyRectangle", "X_PolyArc", - "X_FillPoly", "X_PolyFillRectangle", - "X_PolyFillArc", "X_PutImage", - "X_GetImage", "X_PolyText8", - "X_PolyText16", "X_ImageText8", - "X_ImageText16", "X_CreateColormap", - "X_FreeColormap", "X_CopyColormapAndFree", - "X_InstallColormap", "X_UninstallColormap", - "X_ListInstalledColormaps", "X_AllocColor", - "X_AllocNamedColor", "X_AllocColorCells", - "X_AllocColorPlanes", "X_FreeColors", - "X_StoreColors", "X_StoreNamedColor", - "X_QueryColors", "X_LookupColor", - "X_CreateCursor", "X_CreateGlyphCursor", - "X_FreeCursor", "X_RecolorCursorSize", - "X_QueryBestSize", "X_QueryExtension", - "X_ListExtensions", "X_ChangeKeyboardMapping", - "X_GetKeyboardMapping", "X_ChangeKeyboardControl", - "X_GetKeyboardControl", "X_Bell", - "X_ChangePointerControl", "X_GetPointerControl", - "X_SetScreenSaver", "X_GetScreenSaver", - "X_ChangeHosts", "X_ListHosts", - "X_SetAccessControl", "X_SetCloseDownMode", - "X_KillClient", "X_RotateProperties", - "X_ForceScreenSaver", "X_SetPointerMapping", - "X_GetPointerMapping", "X_SetModifierMapping", - "X_GetModifierMapping", "Invalid", - "Invalid", "Invalid", - "Invalid", "Invalid", - "Invalid", "Invalid", - "X_NoOperation", -}; - -typedef struct -{ - char *extName; - int extEvent; -} _extensionData; -_extensionData *extensionData; -int numExtension = -1; - -static struct _pf_tbl {CARD32 id; char *str;} pf_tbl[] = -{ - {PF_Apollo, "Apollo"}, - {PF_ATT, "ATT"}, - {PF_Cray1, "Cray1"}, - {PF_Cray2, "Cray2"}, - {PF_DECUltrix, "DECUltrix"}, - {PF_DECVMS, "DECVMS"}, - {PF_DECELN, "DECELN"}, - {PF_DECOSF1, "DECOSF1"}, - {PF_DECVT1000, "DECVT1000"}, - {PF_DECXTerm, "DECXTerm"}, - {PF_HP9000s800, "HP9000s800"}, - {PF_HP9000s300, "HP9000s300"}, - {PF_IBMAT, "IBMAT"}, - {PF_IBMRT, "IBMRT"}, - {PF_IBMPS2, "IBMPS2"}, - {PF_IBMRS, "IBMRS"}, - {PF_MacII, "MacII"}, - {PF_Pegasus, "Pegasus"}, - {PF_SGI, "SGI"}, - {PF_Sony, "Sony"}, - {PF_Sun3, "Sun3"}, - {PF_Sun386i, "Sun386i"}, - {PF_SunSparc, "SunSparc"}, - {PF_Other, "Other"} /* always the last one! */ -}; - -static char unknown[] = "unknown"; - -#define ASize(array) (sizeof(array)/sizeof((array)[0])) - -static INT16 _StringToID(register char *match, register char **strings, - INT16 nstrings) -{ - register INT16 id = nstrings; - - if (match && *match) - { while ((--id >= 0L) && (strcmp(match,strings[id]) != 0L)); } - else - { id = -1L; } - - return(id); -} -static void loadExtStrings(XETC *tc) -{ - char **extensionName=XListExtensions(tc->dpy,&numExtension); - if (numExtension) - { - int i; - extensionData = (_extensionData *)XtCalloc(numExtension, - sizeof(_extensionData)); - for (i = 0; i < numExtension; i++) - { /* Arrange extensions in opcode order */ - int opcode,event,error; - if (XQueryExtension(tc->dpy,extensionName[i],&opcode,&event, - &error)) - { - extensionData[opcode-128].extName = extensionName[i]; - extensionData[opcode-128].extEvent = event; - } - else - { /* This extension didn't load! Error! */ - extensionData[opcode-128].extName = "Invalid_Extension"; - } - } - XFreeExtensionList(extensionName); - } -} - -INT16 XEEventStringToID(register char *string) -{ - return(_StringToID(string,eventName,ASize(eventName))); -} - -INT16 XERequestStringToID(register char *string) -{ - return(_StringToID(string,requestName,ASize(requestName))); -} - -CARD32 XEPlatformStringToID(register char *string) -{ - struct _pf_tbl *ptr = &(pf_tbl[0]); - while(ptr->id != PF_Other) - { - if (!strncmp(ptr->str, string, strlen(ptr->str))) - { - return(ptr->id); - } - ptr++; - } - return((!strncmp(ptr->str,string,strlen(ptr->str))) ? ptr->id : -1L); -} - -char *XEEventIDToString(register CARD8 id, XETC *tc) -{ - int i; - if (id < ASize(eventName)) - return(eventName[id]); - /* either erroneous or an extension event */ - if (numExtension < 0) - { /* - * This is unfortunate, but necessary. The client - * program has requested the string identifier for - * an extension request/event. Since there's no Xlib - * equivalent for this, we have to query *all* the - * extensions looking for a match. Chances are - * if a client wants one, it'll want them all, - * so just go through and initialize the extension - * list once. - */ - loadExtStrings(tc); - } - /* Find id within extensionData */ - for (i=0; i=0 && extid < numExtension) ? - extensionData[extid].extName : unknown); -} - - -char *XERequestIDToString(register CARD8 id, XETC *tc) -{ - return((id < ASize(requestName)) ? requestName[id] : - XERequestIDToExtString(id,tc)); -} - -char *XEPlatformIDToString(register CARD32 id) -{ - struct _pf_tbl *ptr = &(pf_tbl[0]); - while((ptr->id != PF_Other) || (id == ptr->id)) - { - if (id == ptr->id) - { - return(ptr->str); - } - ptr++; - } - return(unknown); -} diff --git a/nx-X11/lib/XTrap/XETrapInit.c b/nx-X11/lib/XTrap/XETrapInit.c deleted file mode 100644 index a4a04310f..000000000 --- a/nx-X11/lib/XTrap/XETrapInit.c +++ /dev/null @@ -1,218 +0,0 @@ -/* $XFree86: xc/lib/XTrap/XETrapInit.c,v 1.2 2001/11/08 04:00:12 tsi Exp $ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1992 by Digital Equipment Corp., -Maynard, MA - -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 and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -*****************************************************************************/ -#define NEED_EVENTS -#define NEED_REPLIES - -#include -#include -#include -#include -#include - -#ifndef XETrapNumberErrors -#define XETrapNumberErrors 0 -#endif - -#ifdef UWS40 -#define _XSetLastRequestRead _SetLastRequestRead -#endif -#ifndef vms -extern unsigned long _XSetLastRequestRead(Display *dpy, xGenericReply *rep); -#else -static unsigned long _XSetLastRequestRead(Display *dpy, xGenericReply *rep); -#endif - -static XExtensionInfo *xtrap_info = NULL; -static /* const */ char *xtrap_extension_name = XTrapExtName; - -#define XTrapCheckExtension(dpy,i,val) \ - XextCheckExtension(dpy, i, xtrap_extension_name, val) -#define XTrapSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension(dpy, i, xtrap_extension_name) - -static XEXT_CLOSE_DISPLAY_PROTO(close_display); -static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire_ev); -static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire_ev); - -#ifdef X11R3 -static int error_string(); -#else -static XEXT_ERROR_STRING_PROTO(error_string); -#endif -static /* const */ XExtensionHooks xtrap_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - close_display, /* close_display */ - wire_to_event, /* wire_to_event */ - event_to_wire, /* event_to_wire */ - NULL, /* error */ - error_string /* error_string */ -}; - -static /* const */ char *xtrap_error_list[] = { - "BadTransport (I/O transport not available)", - "BadMailbox (Cannot connect/disconnect to mailbox)", - "BadIO (I/O error while reading/writing in extension)", - "BadHostname (Cannot locate requested host)", - "BadStatistics (Statistics not configured/available)", - "BadDevices (Devices not properly vectored)", - "BadSocket (Cannot connect to INTERNET socket)", - "BadScreen (Cannot send event to given screen)", - "BadSwapReq (Cannot trap extension requests for swapped client)", -}; - -static XEXT_GENERATE_FIND_DISPLAY (find_display, xtrap_info, - xtrap_extension_name, - &xtrap_extension_hooks, - XETrapNumberEvents, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xtrap_info) - -static XEXT_GENERATE_ERROR_STRING (error_string, xtrap_extension_name, - XETrapNumErrors, xtrap_error_list) - -static Bool event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent) -{ - Bool status = False; - XExtDisplayInfo *info = find_display(dpy); - - XTrapCheckExtension(dpy,info,False); - - /* If we had more then one event */ -#if XETrapNumberErrors > 1 - switch((netevent->u.u.type & 0x7f) - info->codes->first_event) - { case XETrapData: -#endif - { - XETrapDataEvent *ev = (XETrapDataEvent *) libevent; - xETrapDataEvent *event = (xETrapDataEvent *) netevent; - - event->type = ev->type; - event->detail = ev->detail; - event->sequenceNumber = (ev->serial & 0xFFFF); - event->idx = ev->idx; - (void)memcpy(event->data,ev->data,sizeof(event->data)); - status = True; - } -#if XETrapNumberErrors > 1 - } -#endif - return(status); -} - -static Bool wire_to_event(Display *dpy, XEvent *libevent, xEvent *netevent) -{ - Bool status = False; - XExtDisplayInfo *info = find_display(dpy); - - XTrapCheckExtension(dpy,info,False); - - /* If we had more then one event */ -#if XETrapNumberErrors > 1 - switch((netevent->u.u.type & 0x7f) - info->codes->first_event) - { case XETrapData: -#endif - { - XETrapDataEvent *ev = (XETrapDataEvent *) libevent; - xETrapDataEvent *event = (xETrapDataEvent *) netevent; - - ev->type = event->type & 0x7F; - ev->detail = event->detail; - ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *)netevent); - ev->synthetic = ((event->type & 0x80) != 0); - ev->display = dpy; - ev->idx = event->idx; - (void)memcpy(ev->data,event->data,sizeof(ev->data)); - status = True; - } -#if XETrapNumberErrors > 1 - } -#endif - return(status); -} - -/* - * XETrapQueryExtension - - * Returns True if the DEC-XTRAP extension is available - * on the given display. If the extension exists, the value of the - * first event code is stored into event_base and the value of the first - * error code is stored into error_base. - */ -Bool XETrapQueryExtension(Display *dpy,INT32 *event_base_return, - INT32 *error_base_return, INT32 *opcode_return) -{ - Bool status = True; - XExtDisplayInfo *info = find_display (dpy); - - if (XextHasExtension (info)) - { - *event_base_return = (INT32)(info->codes->first_event); - *error_base_return = (INT32)(info->codes->first_error); - *opcode_return = (INT32)(info->codes->major_opcode); - } - else - { - status = False; - } - return(status); -} - -#ifdef vms -/* Hard-coded since this didn't make it into XLibShr's xfer vector */ -/* From [.XLIBEL.SRC]XLibInt.c in VMS Source Pool */ -unsigned long _XSetLastRequestRead(Display *dpy, xGenericReply *rep) -{ - register unsigned long newseq, lastseq; - - /* - * KeymapNotify has no sequence number, but is always guaranteed - * to immediately follow another event, except when generated via - * SendEvent (hmmm). - */ - if ((rep->type & 0x7f) == KeymapNotify) - return(dpy->last_request_read); - - newseq = (dpy->last_request_read & ~((unsigned long)0xffff)) | - rep->sequenceNumber; - lastseq = dpy->last_request_read; - while (newseq < lastseq) { - newseq += 0x10000; - if (newseq > dpy->request) { - (void) fprintf (stderr, - "Xlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n", - newseq, dpy->request, - (unsigned int) rep->type); - newseq -= 0x10000; - break; - } - } - - dpy->last_request_read = newseq; - return(newseq); -} -#endif - diff --git a/nx-X11/lib/XTrap/XEWrappers.c b/nx-X11/lib/XTrap/XEWrappers.c deleted file mode 100644 index 40b7e211e..000000000 --- a/nx-X11/lib/XTrap/XEWrappers.c +++ /dev/null @@ -1,325 +0,0 @@ -/* $XFree86$ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., -Maynard, MA -X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH. - -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 and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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. - -*****************************************************************************/ -#include -#include -#include -#ifdef vms -#define IS_AT_OR_AFTER(t1, t2) (((t2).high > (t1).high) \ - || (((t2).high == (t1).high)&& ((t2).low >= (t1).low))) -typedef struct _vms_time { - unsigned long low; - unsigned long high; -}vms_time; /* from IntrinsicP.h */ -#ifdef VMSDW_V3 -typedef struct _ModToKeysymTable { - Modifiers mask; - int count; - int index; -} ModToKeysymTable; /* from TranslateI.h */ -typedef struct _ConverterRec **ConverterTable; /* from ConvertI.h */ -#include "libdef.h" -typedef struct _CallbackRec *CallbackList; /* from CallbackI.h */ -typedef struct _XtGrabRec *XtGrabList; /* from EventI.h */ -#include -#include -#else /* VMSDW_V3 */ -typedef struct _ModToKeysymTable { - Modifiers mask; - int count; - int index; -} ModToKeysymTable; /* from TranslateI.h */ -typedef struct _ConverterRec **ConverterTable; /* from ConvertI.h */ -#include "libdef.h" -#define NFDBITS (sizeof(fd_mask) * 8) -typedef long fd_mask; -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif /* howmany */ -typedef struct Fd_set { - fd_mask fds_bits[howmany(256, NFDBITS)]; -} Fd_set; /* from fd.h */ -#include -#endif /* VMSDW_V3 */ -#else /* !vms */ -#include -#define IS_AT_OR_AFTER(t1, t2) (((t2).tv_sec > (t1).tv_sec) \ - || (((t2).tv_sec == (t1).tv_sec)&& ((t2).tv_usec >= (t1).tv_usec))) -#endif /* vms */ - -/* The following has been lifted from NextEvent.c in X11R4 */ - -#ifndef NEEDS_NTPD_FIXUP -# ifdef sun -# define NEEDS_NTPD_FIXUP 1 -# else -# define NEEDS_NTPD_FIXUP 0 -# endif -#endif - -#if NEEDS_NTPD_FIXUP -#define FIXUP_TIMEVAL(t) { \ - while ((t).tv_usec >= 1000000) { \ - (t).tv_usec -= 1000000; \ - (t).tv_sec++; \ - } \ - while ((t).tv_usec < 0) { \ - if ((t).tv_sec > 0) { \ - (t).tv_usec += 1000000; \ - (t).tv_sec--; \ - } else { \ - (t).tv_usec = 0; \ - break; \ - } \ - }} -#else -#define FIXUP_TIMEVAL(t) -#endif /*NEEDS_NTPD_FIXUP*/ - - -/* The following code is required for the use of the XLIB transport of XTrap - * events. This is in line with what MIT wants to see proper extension - * implementations do, as compared to using one of the core input event masks. - */ - -Boolean (*XETrapGetEventHandler(XETC *tc, CARD32 id))(XETrapDataEvent *event, XETC *tc) -{ - return((id < XETrapNumberEvents) ? tc->eventFunc[id] : NULL); -} - -Boolean (*XETrapSetEventHandler(XETC *tc, CARD32 id, - Boolean (*pfunc)(XETrapDataEvent *event, XETC *tc)))(XETrapDataEvent *event, XETC *tc) -{ - register Boolean (*rfunc)(XETrapDataEvent *event, XETC *tc) = NULL; - - if (id < XETrapNumberEvents) - { - rfunc = XETrapGetEventHandler(tc,id); - tc->eventFunc[id] = pfunc; - } - return(rfunc); -} - -Boolean XETrapDispatchEvent(XEvent *pevent, XETC *tc) -{ - Boolean status = False; - register CARD32 id = pevent->type; - register CARD32 firstEvent = tc->eventBase; - register CARD32 lastEvent = tc->eventBase + XETrapNumberEvents - 1L; - - /* If it is our extension event, handle it specially, otherwise, pass - * it off to Xt. - */ - if (firstEvent != 0 && id >= firstEvent && id <= lastEvent) - { - /* We may be ignoring the event */ - if (tc->eventFunc[id - firstEvent] != NULL) - { - status = (*tc->eventFunc[id - firstEvent])((XETrapDataEvent*)pevent,tc); - } - } - else - { - status = XtDispatchEvent(pevent); - } - return(status); -} - -XtInputMask XETrapAppPending(XtAppContext app) -{ - TimerEventRec *te_ptr; -#ifndef VMS - struct timeval cur_time; -#else /* vms */ - vms_time cur_time; - long efnMask = 0L; - int status; -#endif /* vms */ - XtInputMask retmask = XtAppPending(app); /* Prime XtIMEvent */ - - retmask &= ~(XtIMTimer | XtIMAlternateInput); /* clear timer & input */ - /* Now test for timer */ - te_ptr = app->timerQueue; - while (te_ptr != NULL) - { -#ifndef vms - (void)gettimeofday(&cur_time, NULL); - FIXUP_TIMEVAL(cur_time); -#else - sys$gettim(&cur_time); -#endif /* vms */ - if (IS_AT_OR_AFTER(te_ptr->te_timer_value, cur_time)) - { /* this timer is due to fire */ - retmask |= XtIMTimer; - break; - } - te_ptr = te_ptr->te_next; - } - - /* Now test for alternate input */ -#ifndef vms - if (app->outstandingQueue != NULL) - { - retmask |= XtIMAlternateInput; - } -#else /* vms */ - if ((app->Input_EF_Mask != 0L) && ((status=SYS$READEF(1,&efnMask)) == 1)) - { /* we have input configured & retrieved the efn cluster 0 */ - efnMask &= app->Input_EF_Mask; /* mask out non-input */ - if (efnMask) /* any left? */ - { /* yes, an alt-input efn is set */ - retmask |= XtIMAlternateInput; - } - } -#endif /* vms */ - return(retmask); -} - -void XETrapAppMainLoop(XtAppContext app, XETC *tc) -{ - XEvent event; - XtInputMask imask; - - while (1) - { - imask = XETrapAppPending(app); - /* Check to see what's going on so that we don't block - * in either NextEvent or ProcessEvent since neither - * of these routines can correctly deal with XTrap Events - */ - if (imask & XtIMXEvent) - { - (void)XtAppNextEvent(app,&event); - (void)XETrapDispatchEvent(&event,tc); - } - else if (imask & (XtIMTimer | XtIMAlternateInput)) - { - XtAppProcessEvent(app, (XtIMTimer | XtIMAlternateInput)); - } - else - { /* Nothing going on, so we need to block */ - (void)XETrapWaitForSomething(app); - } - } -} - -int XETrapAppWhileLoop(XtAppContext app, XETC *tc, Bool *done) -{ - XEvent event; - XtInputMask imask; - int status = True; - - if(done) - { - while (!(*done)) - { - imask = XETrapAppPending(app); - /* Check to see what's going on so that we don't block - * in either NextEvent or ProcessEvent since neither - * of these routines can correctly deal with XTrap Events - */ - if (imask & XtIMXEvent) - { - (void)XtAppNextEvent(app, &event); - (void)XETrapDispatchEvent(&event,tc); - } - else if (imask & (XtIMTimer | XtIMAlternateInput)) - { - XtAppProcessEvent(app, (XtIMTimer | XtIMAlternateInput)); - } - else - { /* Nothing going on, so we need to block */ - (void)XETrapWaitForSomething(app); - } - } - } - else - { - status = False; - } - return(status); -} - -/* Wait for either Timer, Alternate Input, or an X Event to arrive */ -int XETrapWaitForSomething(XtAppContext app) -{ -#ifndef vms - return(_XtWaitForSomething(app, FALSE, FALSE, FALSE, FALSE, TRUE -#ifdef XTHREADS - , FALSE -#endif /* XTHREADS */ - , 0L)); -#else /* vms */ -#define IS_AFTER(t1,t2) (((t2).high > (t1).high) \ - ||(((t2).high == (t1).high)&& ((t2).low > (t1).low))) - long retval = 0L; - TimerEventRec *te_ptr; - vms_time cur_time,result_time; - int status = 0; - long quotient, remainder = 0; - int d; - - if (app->timerQueue!= NULL) - { /* check timeout queue */ - cur_time.low = cur_time.high = result_time.low = result_time.high = 0; - te_ptr = app->timerQueue; - sys$gettim(&cur_time); - if ((IS_AFTER(app->timerQueue->te_timer_value, cur_time)) && - (app->timerQueue->te_proc != 0)) - { /* it's fired! return! */ - return(0); - } - /* Jump through hoops to get the time specified in the queue into - * milliseconds - */ - status = lib$sub_times (&(te_ptr->te_timer_value.low), &cur_time, - &result_time); - /* - * See if this timer has expired. A timer is considered expired - * if it's value in the past (the NEGTIM case) or if there is - * less than one integral milli second before it would go off. - */ - - if (status == LIB$_NEGTIM || - (result_time.high == -1 && result_time.low > -10000)) - { /* We've got a timer and it's ready to fire! */ - return(0); - } - else if ((status & 1) == 1) - { - lib$ediv (&(10000), &result_time, "ient, &remainder); - quotient *= -1; /* flip the sign bit */ - - return(XMultiplexInput(app->count, &(app->list[0L]), - app->Input_EF_Mask, quotient, 0L, &retval)); - } - else - { - status = -1; - } - } - - return((status == -1 ? -1 : XMultiplexInput(app->count, &(app->list[0L]), - app->Input_EF_Mask, 0L, 0L, &retval))); -#endif /* vms */ -} diff --git a/nx-X11/lib/XTrap/XTrap-def.cpp b/nx-X11/lib/XTrap/XTrap-def.cpp deleted file mode 100644 index dc8a65a1a..000000000 --- a/nx-X11/lib/XTrap/XTrap-def.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* $XFree86$ */ -LIBRARY XTrap -VERSION LIBRARY_VERSION -EXPORTS - XEAddEventCB - XEAddEventCBs - XEAddRequestCB - XEAddRequestCBs - XERemoveAllEventCBs - XERemoveAllRequestCBs - XERemoveEventCB - XERemoveEventCBs - XERemoveRequestCB - XERemoveRequestCBs - XEChangeTC - XECreateTC - XEFreeTC - XESetCmdGateState - XETrapSetColorReplies - XETrapSetCommandKey - XETrapSetCursor - XETrapSetEvents - XETrapSetGrabServer - XETrapSetMaxPacket - XETrapSetRequests - XETrapSetStatistics - XETrapSetTimestamps - XETrapSetWinXY - XETrapSetXInput - XETrapDispatchXLib - XEPrintAvail - XEPrintAvailFlags - XEPrintAvailPktSz - XEPrintCfgFlags - XEPrintCmdKey - XEPrintCurPktSz - XEPrintCurXY - XEPrintCurrent - XEPrintEvents - XEPrintEvtStats - XEPrintLastTime - XEPrintMajOpcode - XEPrintPlatform - XEPrintRelease - XEPrintReqStats - XEPrintRequests - XEPrintStateFlags - XEPrintStatistics - XEPrintTkFlags - XEPrintTkRelease - XEPrintTkState - XEFlushConfig - XEGetAvailableRequest - XEGetCurrentRequest - XEGetLastInpTimeRequest - XEGetStatisticsRequest - XEGetVersionRequest - XEResetRequest - XESimulateXEventRequest - XEStartTrapRequest - XEStopTrapRequest - XEEventIDToString - XEEventStringToID - XEPlatformIDToString - XEPlatformStringToID - XERequestIDToExtString - XERequestIDToString - XERequestStringToID - XETrapQueryExtension - XETrapAppMainLoop - XETrapAppPending - XETrapAppWhileLoop - XETrapDispatchEvent - XETrapGetEventHandler - XETrapSetEventHandler - XETrapWaitForSomething -- cgit v1.2.3