aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-06-28 12:20:00 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-06-28 16:27:57 +0200
commitf051b7a2d3c150c819d44c7ee648108755f71c85 (patch)
treef321f6d6eba5693c915cb32e63a323b0d69ee746 /nx-X11/lib
parente9857d5ea394255f5e1f38678447fa855c821b57 (diff)
downloadnx-libs-f051b7a2d3c150c819d44c7ee648108755f71c85.tar.gz
nx-libs-f051b7a2d3c150c819d44c7ee648108755f71c85.tar.bz2
nx-libs-f051b7a2d3c150c819d44c7ee648108755f71c85.zip
libNX_Xext: Drop unused extensions: DPMS, XTestExt1, XSync, XSecurity.
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/Xext/DPMS.c293
-rw-r--r--nx-X11/lib/Xext/Imakefile10
-rw-r--r--nx-X11/lib/Xext/XSecurity.c310
-rw-r--r--nx-X11/lib/Xext/XSync.c817
-rw-r--r--nx-X11/lib/Xext/XTestExt1.c1321
-rw-r--r--nx-X11/lib/Xext/Xext-def.cpp99
6 files changed, 0 insertions, 2850 deletions
diff --git a/nx-X11/lib/Xext/DPMS.c b/nx-X11/lib/Xext/DPMS.c
deleted file mode 100644
index a2c0dc3c5..000000000
--- a/nx-X11/lib/Xext/DPMS.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/* $Xorg: DPMS.c,v 1.3 2000/08/17 19:45:50 cpqbld Exp $ */
-/*****************************************************************
-
-Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-/* $XFree86: xc/lib/Xext/DPMS.c,v 3.5 2002/10/16 00:37:27 dawes Exp $ */
-
-/*
- * HISTORY
- */
-
-#define NEED_REPLIES
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <nx-X11/Xlibint.h>
-#include <nx-X11/extensions/dpms.h>
-#include <nx-X11/extensions/dpmsstr.h>
-#include <nx-X11/extensions/Xext.h>
-#include <nx-X11/extensions/extutil.h>
-#include <stdio.h>
-
-static XExtensionInfo _dpms_info_data;
-static XExtensionInfo *dpms_info = &_dpms_info_data;
-static char *dpms_extension_name = DPMSExtensionName;
-
-#define DPMSCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, dpms_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static /* const */ XExtensionHooks dpms_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, dpms_info,
- dpms_extension_name,
- &dpms_extension_hooks, DPMSNumberEvents,
- NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dpms_info)
-
-/*****************************************************************************
- * *
- * public routines *
- * *
- *****************************************************************************/
-
-Bool
-DPMSQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-Status
-DPMSGetVersion(Display *dpy, int *major_versionp, int *minor_versionp)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xDPMSGetVersionReply rep;
- register xDPMSGetVersionReq *req;
-
- DPMSCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (DPMSGetVersion, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSGetVersion;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_versionp = rep.majorVersion;
- *minor_versionp = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-Bool
-DPMSCapable(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSCapableReq *req;
- xDPMSCapableReply rep;
-
- DPMSCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(DPMSCapable, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSCapable;
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.capable;
-}
-
-Status
-DPMSSetTimeouts(Display *dpy, CARD16 standby, CARD16 suspend, CARD16 off)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSSetTimeoutsReq *req;
-
- if ((off != 0)&&(off < suspend))
- {
- return BadValue;
- }
- if ((suspend != 0)&&(suspend < standby))
- {
- return BadValue;
- }
-
- DPMSCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(DPMSSetTimeouts, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSSetTimeouts;
- req->standby = standby;
- req->suspend = suspend;
- req->off = off;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Bool
-DPMSGetTimeouts(Display *dpy, CARD16 *standby, CARD16 *suspend, CARD16 *off)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSGetTimeoutsReq *req;
- xDPMSGetTimeoutsReply rep;
-
- DPMSCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(DPMSGetTimeouts, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSGetTimeouts;
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- *standby = rep.standby;
- *suspend = rep.suspend;
- *off = rep.off;
- return 1;
-}
-
-Status
-DPMSEnable(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSEnableReq *req;
-
- DPMSCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(DPMSEnable, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSEnable;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Status
-DPMSDisable(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSDisableReq *req;
-
- DPMSCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(DPMSDisable, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSDisable;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-
-Status
-DPMSForceLevel(Display *dpy, CARD16 level)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSForceLevelReq *req;
-
- DPMSCheckExtension (dpy, info, 0);
-
- if ((level != DPMSModeOn) &&
- (level != DPMSModeStandby) &&
- (level != DPMSModeSuspend) &&
- (level != DPMSModeOff))
- return BadValue;
-
- LockDisplay(dpy);
- GetReq(DPMSForceLevel, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSForceLevel;
- req->level = level;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Status
-DPMSInfo(Display *dpy, CARD16 *power_level, BOOL *state)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSInfoReq *req;
- xDPMSInfoReply rep;
-
- DPMSCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(DPMSInfo, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSInfo;
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- *power_level = rep.power_level;
- *state = rep.state;
- return 1;
-}
-
-
-
diff --git a/nx-X11/lib/Xext/Imakefile b/nx-X11/lib/Xext/Imakefile
index 0111500c5..e96e23510 100644
--- a/nx-X11/lib/Xext/Imakefile
+++ b/nx-X11/lib/Xext/Imakefile
@@ -33,26 +33,16 @@ ALLOC_DEFINES = Malloc0ReturnsNullDefines
extutil.c \
XShape.c \
$(SHMSRCS) \
- XTestExt1.c \
- XSync.c \
- XSecurity.c \
- DPMS.c \
$(NULL)
OBJS = globals.o \
extutil.o \
XShape.o \
$(SHMOBJS) \
- XTestExt1.o \
- XSync.o \
- XSecurity.o \
- DPMS.o \
$(NULL)
LINTLIBS = $(LINTXLIB)
#include <Library.tmpl>
-LinkFile(ImUtil.h,$(XLIBSRC)/ImUtil.h)
-
DependTarget()
diff --git a/nx-X11/lib/Xext/XSecurity.c b/nx-X11/lib/Xext/XSecurity.c
deleted file mode 100644
index a9899916f..000000000
--- a/nx-X11/lib/Xext/XSecurity.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/* $Xorg: XSecurity.c,v 1.6 2001/02/09 02:03:49 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/* $XFree86: xc/lib/Xext/XSecurity.c,v 1.5 2002/10/16 00:37:27 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <nx-X11/Xlibint.h>
-#include <stdio.h>
-#include <nx-X11/extensions/Xext.h>
-#include <nx-X11/extensions/extutil.h>
-#include <nx-X11/extensions/securstr.h>
-
-static XExtensionInfo _Security_info_data;
-static XExtensionInfo *Security_info = &_Security_info_data;
-static char *Security_extension_name = SECURITY_EXTENSION_NAME;
-
-#define SecurityCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, Security_extension_name, val)
-#define SecuritySimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, Security_extension_name)
-
-#define SecurityGetReq(name,req,info) GetReq (name, req); \
- req->reqType = info->codes->major_opcode; \
- req->securityReqType = X_##name;
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-/*
- * find_display - locate the display info block
- */
-static int close_display(Display *dpy, XExtCodes *codes);
-static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire);
-static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire);
-static char *error_string(Display *dpy, int code, XExtCodes *codes,
- char *buf, int n);
-
-static XExtensionHooks Security_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 char *security_error_list[] = {
- "BadAuthorization"
- "BadAuthorizationProtocol"
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, Security_info,
- Security_extension_name,
- &Security_extension_hooks,
- XSecurityNumberEvents, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, Security_info)
-
-static
-XEXT_GENERATE_ERROR_STRING(error_string, Security_extension_name,
- XSecurityNumberErrors, security_error_list)
-
-static Bool
-wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- SecurityCheckExtension (dpy, info, False);
-
- switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
- {
- case XSecurityAuthorizationRevoked:
- {
- xSecurityAuthorizationRevokedEvent *rwire =
- (xSecurityAuthorizationRevokedEvent *)wire;
- XSecurityAuthorizationRevokedEvent *revent =
- (XSecurityAuthorizationRevokedEvent *)event;
-
- revent->type = rwire->type & 0x7F;
- revent->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *) wire);
- revent->send_event = (rwire->type & 0x80) != 0;
- revent->display = dpy;
- revent->auth_id = rwire->authId;
- return True;
- }
- }
- return False;
-}
-
-static Status
-event_to_wire(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- SecurityCheckExtension(dpy, info, False);
-
- switch ((event->type & 0x7F) - info->codes->first_event)
- {
- case XSecurityAuthorizationRevoked:
- {
- xSecurityAuthorizationRevokedEvent *rwire =
- (xSecurityAuthorizationRevokedEvent *)wire;
- XSecurityAuthorizationRevokedEvent *revent =
- (XSecurityAuthorizationRevokedEvent *)event;
- rwire->type = revent->type | (revent->send_event ? 0x80 : 0);
- rwire->sequenceNumber = revent->serial & 0xFFFF;
- return True;
- }
- }
- return False;
-}
-
-/*****************************************************************************
- * *
- * Security public interfaces *
- * *
- *****************************************************************************/
-
-Status XSecurityQueryExtension (
- Display *dpy,
- int *major_version_return,
- int *minor_version_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xSecurityQueryVersionReply rep;
- register xSecurityQueryVersionReq *req;
-
- if (!XextHasExtension (info))
- return (Status)0; /* failure */
-
- LockDisplay (dpy);
- SecurityGetReq (SecurityQueryVersion, req, info);
- req->majorVersion = SECURITY_MAJOR_VERSION;
- req->minorVersion = SECURITY_MINOR_VERSION;
-
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return (Status)0; /* failure */
- }
- *major_version_return = rep.majorVersion;
- *minor_version_return = rep.minorVersion;
- UnlockDisplay (dpy);
-
- SyncHandle ();
-
- if (*major_version_return != SECURITY_MAJOR_VERSION)
- return (Status)0; /* failure */
- else
- return (Status)1; /* success */
-}
-
-Xauth *
-XSecurityAllocXauth(void)
-{
- return Xcalloc(1, sizeof(Xauth));
-}
-
-void
-XSecurityFreeXauth(Xauth *auth)
-{
- XFree(auth);
-}
-
-static int
-Ones(Mask mask)
-{
- register Mask y;
-
- y = (mask >> 1) &033333333333;
- y = mask - y - ((y >>1) & 033333333333);
- return (((y + (y >> 3)) & 030707070707) % 077);
-}
-
-Xauth *
-XSecurityGenerateAuthorization(
- Display *dpy,
- Xauth *auth_in,
- unsigned long valuemask,
- XSecurityAuthorizationAttributes *attributes,
- XSecurityAuthorization *auth_id_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xSecurityGenerateAuthorizationReq *req;
- xSecurityGenerateAuthorizationReply rep;
- Xauth *auth_return;
- unsigned long values[3];
- unsigned long *value = values;
- unsigned int nvalues;
-
- *auth_id_return = 0; /* in case we fail */
-
- /* make sure extension is available */
-
- SecurityCheckExtension (dpy, info, (Xauth *)NULL);
-
- LockDisplay(dpy);
- SecurityGetReq(SecurityGenerateAuthorization, req, info);
-
- req->nbytesAuthProto = auth_in->name_length;
- req->nbytesAuthData = auth_in->data_length;
-
- /* adjust length to account for auth name and data */
- req->length += (auth_in->name_length + (unsigned)3) >> 2;
- req->length += (auth_in->data_length + (unsigned)3) >> 2;
-
- /* adjust length to account for list of values */
- req->valueMask = valuemask & XSecurityAllAuthorizationAttributes;
- nvalues = Ones(req->valueMask);
- req->length += nvalues;
-
- /* send auth name and data */
- Data(dpy, auth_in->name, auth_in->name_length);
- Data(dpy, auth_in->data, auth_in->data_length);
-
- /* send values */
- if (valuemask & XSecurityTimeout) *value++ = attributes->timeout;
- if (valuemask & XSecurityTrustLevel) *value++ = attributes->trust_level;
- if (valuemask & XSecurityGroup) *value++ = attributes->group;
- if (valuemask & XSecurityEventMask) *value++ = attributes->event_mask;
-
- nvalues <<= 2;
- Data32(dpy, (long *)values, (long)nvalues);
-
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return (Xauth *)NULL;
- }
-
- *auth_id_return = rep.authId;
-
- /* Allocate space for the Xauth struct and the auth name and data all
- * in one hunk. This lets XSecurityFreeXauth not have to care
- * about whether the auth was allocated here or in
- * XSecurityAllocXauth; in both cases, you just free one pointer.
- */
-
- if ((auth_return = (Xauth *)Xcalloc(1,
- (sizeof(Xauth) + auth_in->name_length + rep.dataLength))))
- {
- auth_return->data_length = rep.dataLength;
- auth_return->data = (char *)&auth_return[1];
- _XReadPad(dpy, auth_return->data, (long)rep.dataLength);
-
- auth_return->name_length = auth_in->name_length;
- auth_return->name = auth_return->data + auth_return->data_length;
- memcpy(auth_return->name, auth_in->name, auth_return->name_length);
- }
- else
- {
- _XEatData(dpy, (unsigned long) (rep.dataLength + 3) & ~3);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return auth_return;
-
-} /* XSecurityGenerateAuthorization */
-
-Status
-XSecurityRevokeAuthorization(
- Display *dpy,
- XSecurityAuthorization auth_id)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xSecurityRevokeAuthorizationReq *req;
-
- SecurityCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- SecurityGetReq(SecurityRevokeAuthorization, req, info);
- req->authId = auth_id;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-} /* XSecurityRevokeAuthorization */
diff --git a/nx-X11/lib/Xext/XSync.c b/nx-X11/lib/Xext/XSync.c
deleted file mode 100644
index 39eb97cdd..000000000
--- a/nx-X11/lib/Xext/XSync.c
+++ /dev/null
@@ -1,817 +0,0 @@
-/* $Xorg: XSync.c,v 1.5 2001/02/09 02:03:49 xorgcvs Exp $ */
-/*
-
-Copyright 1991, 1993, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-/***********************************************************
-Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
-and Olivetti Research Limited, Cambridge, England.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or Olivetti
-not be used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL THEY 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.
-
-******************************************************************/
-/* $XFree86: xc/lib/Xext/XSync.c,v 1.7tsi Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <nx-X11/Xlibint.h>
-#include <nx-X11/extensions/Xext.h>
-#include <nx-X11/extensions/extutil.h>
-#include <nx-X11/extensions/syncstr.h>
-
-static XExtensionInfo _sync_info_data;
-static XExtensionInfo *sync_info = &_sync_info_data;
-static char *sync_extension_name = SYNC_NAME;
-
-#define SyncCheckExtension(dpy,i,val) \
- XextCheckExtension(dpy, i, sync_extension_name, val)
-#define SyncSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension(dpy, i, sync_extension_name)
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire);
-static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire);
-static char *error_string(Display *dpy, int code, XExtCodes *codes,
- char *buf, int n);
-
-static XExtensionHooks sync_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 char *sync_error_list[] = {
- "BadCounter",
- "BadAlarm",
-};
-
-static
-XEXT_GENERATE_FIND_DISPLAY(find_display, sync_info,
- sync_extension_name,
- &sync_extension_hooks,
- XSyncNumberEvents, (XPointer) NULL)
-
-static
-XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info)
-
-static
-XEXT_GENERATE_ERROR_STRING(error_string, sync_extension_name,
- XSyncNumberErrors, sync_error_list)
-
-
-static Bool
-wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display(dpy);
- XSyncCounterNotifyEvent *aevent;
- xSyncCounterNotifyEvent *awire;
- XSyncAlarmNotifyEvent *anl;
- xSyncAlarmNotifyEvent *ane;
-
- SyncCheckExtension(dpy, info, False);
-
- switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
- {
- case XSyncCounterNotify:
- awire = (xSyncCounterNotifyEvent *) wire;
- aevent = (XSyncCounterNotifyEvent *) event;
- aevent->type = awire->type & 0x7F;
- aevent->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *) wire);
- aevent->send_event = (awire->type & 0x80) != 0;
- aevent->display = dpy;
- aevent->counter = awire->counter;
- XSyncIntsToValue(&aevent->wait_value, awire->wait_value_lo,
- awire->wait_value_hi);
- XSyncIntsToValue(&aevent->counter_value,
- awire->counter_value_lo,
- awire->counter_value_hi);
- aevent->time = awire->time;
- aevent->count = awire->count;
- aevent->destroyed = awire->destroyed;
- return True;
-
- case XSyncAlarmNotify:
- ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */
- anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */
- anl->type = ane->type & 0x7F;
- anl->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *) wire);
- anl->send_event = (ane->type & 0x80) != 0;
- anl->display = dpy;
- anl->alarm = ane->alarm;
- XSyncIntsToValue(&anl->counter_value,
- ane->counter_value_lo,
- ane->counter_value_hi);
- XSyncIntsToValue(&anl->alarm_value,
- ane->alarm_value_lo,
- ane->alarm_value_hi);
- anl->state = (XSyncAlarmState)ane->state;
- anl->time = ane->time;
- return True;
- }
-
- return False;
-}
-
-static Status
-event_to_wire(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display(dpy);
- XSyncCounterNotifyEvent *aevent;
- xSyncCounterNotifyEvent *awire;
- XSyncAlarmNotifyEvent *anl;
- xSyncAlarmNotifyEvent *ane;
-
- SyncCheckExtension(dpy, info, False);
-
- switch ((event->type & 0x7F) - info->codes->first_event)
- {
- case XSyncCounterNotify:
- awire = (xSyncCounterNotifyEvent *) wire;
- aevent = (XSyncCounterNotifyEvent *) event;
- awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
- awire->sequenceNumber = aevent->serial & 0xFFFF;
- awire->counter = aevent->counter;
- awire->wait_value_lo = XSyncValueLow32(aevent->wait_value);
- awire->wait_value_hi = XSyncValueHigh32(aevent->wait_value);
- awire->counter_value_lo = XSyncValueLow32(aevent->counter_value);
- awire->counter_value_hi = XSyncValueHigh32(aevent->counter_value);
- awire->time = aevent->time;
- awire->count = aevent->count;
- awire->destroyed = aevent->destroyed;
- return True;
-
- case XSyncAlarmNotify:
- ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */
- anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */
- ane->type = anl->type | (anl->send_event ? 0x80 : 0);
- ane->sequenceNumber = anl->serial & 0xFFFF;
- ane->alarm = anl->alarm;
- ane->counter_value_lo = XSyncValueLow32(anl->counter_value);
- ane->counter_value_hi = XSyncValueHigh32(anl->counter_value);
- ane->alarm_value_lo = XSyncValueLow32(anl->alarm_value);
- ane->alarm_value_hi = XSyncValueHigh32(anl->alarm_value);
- ane->state = anl->state;
- ane->time = anl->time;
- return True;
- }
- return False;
-}
-
-Status
-XSyncQueryExtension(
- Display *dpy,
- int *event_base_return, int *error_base_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- if (XextHasExtension(info))
- {
- *event_base_return = info->codes->first_event;
- *error_base_return = info->codes->first_error;
- return True;
- }
- else
- return False;
-}
-
-Status
-XSyncInitialize(
- Display *dpy,
- int *major_version_return, int *minor_version_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncInitializeReply rep;
- xSyncInitializeReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncInitialize, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncInitialize;
- req->majorVersion = SYNC_MAJOR_VERSION;
- req->minorVersion = SYNC_MINOR_VERSION;
- if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- *major_version_return = rep.majorVersion;
- *minor_version_return = rep.minorVersion;
- return ((rep.majorVersion == SYNC_MAJOR_VERSION)
-#if SYNC_MINOR_VERSION > 0 /* avoid compiler warning */
- && (rep.minorVersion >= SYNC_MINOR_VERSION)
-#endif
- );
-}
-
-XSyncSystemCounter *
-XSyncListSystemCounters(Display *dpy, int *n_counters_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncListSystemCountersReply rep;
- xSyncListSystemCountersReq *req;
- XSyncSystemCounter *list = NULL;
-
- SyncCheckExtension(dpy, info, NULL);
-
- LockDisplay(dpy);
- GetReq(SyncListSystemCounters, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncListSystemCounters;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
- goto bail;
-
- *n_counters_return = rep.nCounters;
- if (rep.nCounters > 0)
- {
- xSyncSystemCounter *pWireSysCounter, *pNextWireSysCounter;
- XSyncCounter counter;
- int replylen;
- int i;
-
- list = (XSyncSystemCounter *)Xmalloc(
- rep.nCounters * sizeof(XSyncSystemCounter));
- replylen = rep.length << 2;
- pWireSysCounter = (xSyncSystemCounter *) Xmalloc ((unsigned) replylen + 1);
- /* +1 to leave room for last null-terminator */
-
- if ((!list) || (!pWireSysCounter))
- {
- if (list) Xfree((char *) list);
- if (pWireSysCounter) Xfree((char *) pWireSysCounter);
- _XEatData(dpy, (unsigned long) replylen);
- list = NULL;
- goto bail;
- }
-
- _XReadPad(dpy, (char *)pWireSysCounter, replylen);
-
- counter = pWireSysCounter->counter;
- for (i = 0; i < rep.nCounters; i++)
- {
- list[i].counter = counter;
- XSyncIntsToValue(&list[i].resolution,
- pWireSysCounter->resolution_lo,
- pWireSysCounter->resolution_hi);
-
- /* we may be about to clobber the counter field of the
- * next syscounter because we have to add a null terminator
- * to the counter name string. So we save the next counter
- * here.
- */
- pNextWireSysCounter = (xSyncSystemCounter *)
- (((char *)pWireSysCounter) + ((SIZEOF(xSyncSystemCounter) +
- pWireSysCounter->name_length + 3) & ~3));
- counter = pNextWireSysCounter->counter;
-
- list[i].name = ((char *)pWireSysCounter) +
- SIZEOF(xSyncSystemCounter);
- /* null-terminate the string */
- *(list[i].name + pWireSysCounter->name_length) = '\0';
- pWireSysCounter = pNextWireSysCounter;
- }
- }
-
-bail:
- UnlockDisplay(dpy);
- SyncHandle();
- return list;
-}
-
-void
-XSyncFreeSystemCounterList(XSyncSystemCounter *list)
-{
- if (list)
- {
- Xfree( ((char *)list[0].name) - SIZEOF(xSyncSystemCounter));
- Xfree(list);
- }
-}
-
-
-XSyncCounter
-XSyncCreateCounter(Display *dpy, XSyncValue initial_value)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncCreateCounterReq *req;
-
- SyncCheckExtension(dpy, info, None);
-
- LockDisplay(dpy);
- GetReq(SyncCreateCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncCreateCounter;
-
- req->cid = XAllocID(dpy);
- req->initial_value_lo = XSyncValueLow32(initial_value);
- req->initial_value_hi = XSyncValueHigh32(initial_value);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return req->cid;
-}
-
-Status
-XSyncSetCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncSetCounterReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncSetCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncSetCounter;
- req->cid = counter;
- req->value_lo = XSyncValueLow32(value);
- req->value_hi = XSyncValueHigh32(value);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncChangeCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncChangeCounterReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncChangeCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncChangeCounter;
- req->cid = counter;
- req->value_lo = XSyncValueLow32(value);
- req->value_hi = XSyncValueHigh32(value);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncDestroyCounter(Display *dpy, XSyncCounter counter)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncDestroyCounterReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncDestroyCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncDestroyCounter;
- req->counter = counter;
- UnlockDisplay(dpy);
- SyncHandle();
-
- return True;
-}
-
-Status
-XSyncQueryCounter(Display *dpy, XSyncCounter counter, XSyncValue *value_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncQueryCounterReply rep;
- xSyncQueryCounterReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncQueryCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncQueryCounter;
- req->counter = counter;
- if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- XSyncIntsToValue(value_return, rep.value_lo, rep.value_hi);
- UnlockDisplay(dpy);
- SyncHandle();
-
- return True;
-}
-
-
-Status
-XSyncAwait(Display *dpy, XSyncWaitCondition *wait_list, int n_conditions)
-{
- XExtDisplayInfo *info = find_display(dpy);
- XSyncWaitCondition *wait_item = wait_list;
- xSyncAwaitReq *req;
- unsigned int len;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncAwait, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncAwait;
- len = (n_conditions * SIZEOF(xSyncWaitCondition)) >> 2;
- SetReqLen(req, len, len /* XXX */ );
-
- while (n_conditions--)
- {
- xSyncWaitCondition wc;
- wc.counter = wait_item->trigger.counter;
- wc.value_type = wait_item->trigger.value_type;
- wc.wait_value_lo = XSyncValueLow32(wait_item->trigger.wait_value);
- wc.wait_value_hi = XSyncValueHigh32(wait_item->trigger.wait_value);
- wc.test_type = wait_item->trigger.test_type;
- wc.event_threshold_lo = XSyncValueLow32(wait_item->event_threshold);
- wc.event_threshold_hi = XSyncValueHigh32(wait_item->event_threshold);
- Data(dpy, (char *)&wc, SIZEOF(xSyncWaitCondition));
- wait_item++; /* get next trigger */
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-static void
-_XProcessAlarmAttributes(Display *dpy, xSyncChangeAlarmReq *req,
- unsigned long valuemask,
- XSyncAlarmAttributes *attributes)
-{
-
- unsigned long values[32];
- unsigned long *value = values;
- unsigned int nvalues;
-
- if (valuemask & XSyncCACounter)
- *value++ = attributes->trigger.counter;
-
- if (valuemask & XSyncCAValueType)
- *value++ = attributes->trigger.value_type;
-
- if (valuemask & XSyncCAValue)
- {
- *value++ = XSyncValueHigh32(attributes->trigger.wait_value);
- *value++ = XSyncValueLow32(attributes->trigger.wait_value);
- }
-
- if (valuemask & XSyncCATestType)
- *value++ = attributes->trigger.test_type;
-
- if (valuemask & XSyncCADelta)
- {
- *value++ = XSyncValueHigh32(attributes->delta);
- *value++ = XSyncValueLow32(attributes->delta);
- }
-
- if (valuemask & XSyncCAEvents)
- *value++ = attributes->events;
-
- /* N.B. the 'state' field cannot be set or changed */
- req->length += (nvalues = value - values);
- nvalues <<= 2; /* watch out for macros... */
-
- Data32(dpy, (long *) values, (long) nvalues);
-}
-
-XSyncAlarm
-XSyncCreateAlarm(
- Display *dpy,
- unsigned long values_mask,
- XSyncAlarmAttributes *values)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncCreateAlarmReq *req;
- XSyncAlarm aid;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncCreateAlarm, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncCreateAlarm;
- req->id = aid = XAllocID(dpy);
- values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
- | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
- if ((req->valueMask = values_mask))
- _XProcessAlarmAttributes(dpy, (xSyncChangeAlarmReq *) req,
- values_mask, values);
- UnlockDisplay(dpy);
- SyncHandle();
- return aid;
-}
-
-Status
-XSyncDestroyAlarm(Display *dpy, XSyncAlarm alarm)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncDestroyAlarmReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncDestroyAlarm, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncDestroyAlarm;
- req->alarm = alarm;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncQueryAlarm(
- Display *dpy,
- XSyncAlarm alarm,
- XSyncAlarmAttributes *values_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncQueryAlarmReq *req;
- xSyncQueryAlarmReply rep;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncQueryAlarm, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncQueryAlarm;
- req->alarm = alarm;
-
- if (!(_XReply(dpy, (xReply *) & rep,
- ((SIZEOF(xSyncQueryAlarmReply) - SIZEOF(xGenericReply)) >> 2), xFalse)))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- values_return->trigger.counter = rep.counter;
- values_return->trigger.value_type = (XSyncValueType)rep.value_type;
- XSyncIntsToValue(&values_return->trigger.wait_value,
- rep.wait_value_lo, rep.wait_value_hi);
- values_return->trigger.test_type = (XSyncTestType)rep.test_type;
- XSyncIntsToValue(&values_return->delta, rep.delta_lo,
- rep.delta_hi);
- values_return->events = rep.events;
- values_return->state = (XSyncAlarmState)rep.state;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncChangeAlarm(
- Display *dpy,
- XSyncAlarm alarm,
- unsigned long values_mask,
- XSyncAlarmAttributes *values)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncChangeAlarmReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncChangeAlarm, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncChangeAlarm;
- req->alarm = alarm;
- values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
- | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
- if ((req->valueMask = values_mask))
- _XProcessAlarmAttributes(dpy, req, values_mask, values);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncSetPriority(
- Display *dpy,
- XID client_resource_id,
- int priority)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncSetPriorityReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncSetPriority, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncSetPriority;
- req->id = client_resource_id;
- req->priority = priority;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncGetPriorityReply rep;
- xSyncGetPriorityReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncGetPriority, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncGetPriority;
- req->id = client_resource_id;
-
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- if (return_priority)
- *return_priority = rep.priority;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-/*
- * Functions corresponding to the macros for manipulating 64-bit values
- */
-
-/* get rid of macros so we can define corresponding functions */
-#undef XSyncIntToValue
-#undef XSyncIntsToValue
-#undef XSyncValueGreaterThan
-#undef XSyncValueLessThan
-#undef XSyncValueGreaterOrEqual
-#undef XSyncValueLessOrEqual
-#undef XSyncValueEqual
-#undef XSyncValueIsNegative
-#undef XSyncValueIsZero
-#undef XSyncValueIsPositive
-#undef XSyncValueLow32
-#undef XSyncValueHigh32
-#undef XSyncValueAdd
-#undef XSyncValueSubtract
-#undef XSyncMaxValue
-#undef XSyncMinValue
-
-void
-XSyncIntToValue(XSyncValue *pv, int i)
-{
- _XSyncIntToValue(pv,i);
-}
-
-void
-XSyncIntsToValue(XSyncValue *pv, unsigned int l, int h)
-{
- _XSyncIntsToValue(pv, l, h);
-}
-
-Bool
-XSyncValueGreaterThan(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueGreaterThan(a, b);
-}
-
-Bool
-XSyncValueLessThan(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueLessThan(a, b);
-}
-
-Bool
-XSyncValueGreaterOrEqual(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueGreaterOrEqual(a, b);
-}
-
-Bool
-XSyncValueLessOrEqual(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueLessOrEqual(a, b);
-}
-
-Bool
-XSyncValueEqual(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueEqual(a, b);
-}
-
-Bool
-XSyncValueIsNegative(XSyncValue v)
-{
- return _XSyncValueIsNegative(v);
-}
-
-Bool
-XSyncValueIsZero(XSyncValue a)
-{
- return _XSyncValueIsZero(a);
-}
-
-Bool
-XSyncValueIsPositive(XSyncValue v)
-{
- return _XSyncValueIsPositive(v);
-}
-
-unsigned int
-XSyncValueLow32(XSyncValue v)
-{
- return _XSyncValueLow32(v);
-}
-
-int
-XSyncValueHigh32(XSyncValue v)
-{
- return _XSyncValueHigh32(v);
-}
-
-void
-XSyncValueAdd(XSyncValue *presult, XSyncValue a, XSyncValue b, Bool *poverflow)
-{
- _XSyncValueAdd(presult, a, b, poverflow);
-}
-
-void
-XSyncValueSubtract(
- XSyncValue *presult,
- XSyncValue a, XSyncValue b,
- Bool *poverflow)
-{
- _XSyncValueSubtract(presult, a, b, poverflow);
-}
-
-void
-XSyncMaxValue(XSyncValue *pv)
-{
- _XSyncMaxValue(pv);
-}
-
-void
-XSyncMinValue(XSyncValue *pv)
-{
- _XSyncMinValue(pv);
-}
diff --git a/nx-X11/lib/Xext/XTestExt1.c b/nx-X11/lib/Xext/XTestExt1.c
deleted file mode 100644
index 00da036bd..000000000
--- a/nx-X11/lib/Xext/XTestExt1.c
+++ /dev/null
@@ -1,1321 +0,0 @@
-/* $Xorg: XTestExt1.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $ */
-/*
- * File: xtestext1lib.c
- *
- * This file contains the Xlib parts of the input synthesis extension
- */
-
-/*
-
-
-Copyright 1986, 1987, 1988, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
-
-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 Hewlett-Packard not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-Hewlett-Packard makes no representations about the
-suitability of this software for any purpose. It is provided
-"as is" without express or implied warranty.
-
-This software is not subject to any license of the American
-Telephone and Telegraph Company or of the Regents of the
-University of California.
-
-*/
-/* $XFree86: xc/lib/Xext/XTestExt1.c,v 1.3 2001/01/17 19:42:46 dawes Exp $ */
-
-/******************************************************************************
- * include files
- *****************************************************************************/
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <nx-X11/Xproto.h>
-#include <nx-X11/Xlibint.h>
-#include <nx-X11/extensions/xtestext1.h>
-
-/******************************************************************************
- * variables
- *****************************************************************************/
-
-/*
- * Holds the request type code for this extension. The request type code
- * for this extension may vary depending on how many extensions are installed
- * already, so the initial value given below will be added to the base request
- * code that is aquired when this extension is installed.
- */
-static int XTestReqCode = 0;
-/*
- * Holds the two event type codes for this extension. The event type codes
- * for this extension may vary depending on how many extensions are installed
- * already, so the initial values given below will be added to the base event
- * code that is aquired when this extension is installed.
- *
- * These two variables must be available to programs that use this extension.
- */
-int XTestInputActionType = 0;
-int XTestFakeAckType = 1;
-/*
- * holds the current x and y coordinates for XTestMovePointer
- */
-static int current_x = 0;
-static int current_y = 0;
-/*
- * Holds input actions being accumulated until the input action buffer is
- * full or until XTestFlush is called.
- */
-static CARD8 action_buf[XTestMAX_ACTION_LIST_SIZE];
-/*
- * the index into the input action buffer
- */
-static int action_index = 0;
-/*
- * the number of input actions that the server can handle at one time
- */
-static unsigned long action_array_size = 0;
-/*
- * the current number of input actions
- */
-static unsigned long action_count = 0;
-
-/******************************************************************************
- * function declarations
- *****************************************************************************/
-
-static int XTestWireToEvent(Display *dpy, XEvent *reTemp, xEvent *eventTemp);
-static int XTestCheckExtInit(register Display *dpy);
-static Bool XTestIdentifyMyEvent(Display *display, XEvent *event_ptr, char *args);
-static int XTestInitExtension(register Display *dpy);
-static int XTestKeyOrButton(Display *display, int device_id, long unsigned int delay, unsigned int code, unsigned int action);
-static int XTestCheckDelay(Display *display, long unsigned int *delay_addr);
-static int XTestPackInputAction(Display *display, CARD8 *action_addr, int action_size);
-static int XTestWriteInputActions(Display *display, char *action_list_addr, int action_list_size, int ack_flag);
-
-/******************************************************************************
- *
- * XTestFakeInput
- *
- * Send a a request containing one or more input actions to be sent
- * to the server by this extension.
- */
-int
-XTestFakeInput(
-/*
- * the connection to the X server
- */
-register Display *dpy,
-/*
- * the address of a list of input actions to be sent to the server
- */
-char *action_list_addr,
-/*
- * the size (in bytes) of the list of input actions
- */
-int action_list_size,
-/*
- * specifies whether the server needs to send an event to indicate that its
- * input action buffer is empty
- */
-int ack_flag)
-{
- /*
- * pointer to xTestFakeInputReq structure
- */
- xTestFakeInputReq *req;
- /*
- * loop index
- */
- int i;
-
- LockDisplay(dpy);
- if ((XTestCheckExtInit(dpy) == -1) ||
- (action_list_size > XTestMAX_ACTION_LIST_SIZE))
- {
- /*
- * if the extension is not installed in the server or the
- * action list will not fit in the request, then unlock
- * the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestFakeInput, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestFakeInput, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestFakeInput
- */
- req->XTestReqType = X_TestFakeInput;
- /*
- * set the ack code
- */
- req->ack = ack_flag;
- /*
- * Set the action_list area to all 0's. An input action header
- * value of 0 is interpreted as a flag to the input action
- * list handling code in the server part of this extension
- * that there are no more input actions in this request.
- */
- for (i = 0; i < XTestMAX_ACTION_LIST_SIZE; i++)
- {
- req->action_list[i] = 0;
- }
- /*
- * copy the input actions into the request
- */
- for (i = 0; i < action_list_size; i++)
- {
- req->action_list[i] = *(action_list_addr++);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestGetInput
- *
- * Request the server to begin putting user input actions into events
- * to be sent to the client that called this function.
- */
-int
-XTestGetInput(
-/*
- * the connection to the X server
- */
-register Display *dpy,
-/*
- * tells the server what to do with the user input actions
- */
-int action_handling)
-{
- /*
- * pointer to xTestGetInputReq structure
- */
- xTestGetInputReq *req;
-
- LockDisplay(dpy);
- if (XTestCheckExtInit(dpy) == -1)
- {
- /*
- * if the extension is not installed in the server
- * then unlock the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestGetInput, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestGetInput, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestGetInput
- */
- req->XTestReqType = X_TestGetInput;
- /*
- * set the action handling mode
- */
- req->mode = action_handling;
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestStopInput
- *
- * Tell the server to stop putting information about user input actions
- * into events.
- */
-int
-XTestStopInput(
-/*
- * the connection to the X server
- */
-register Display *dpy)
-{
- /*
- * pointer to xTestStopInputReq structure
- */
- xTestStopInputReq *req;
-
- LockDisplay(dpy);
- if (XTestCheckExtInit(dpy) == -1)
- {
- /*
- * if the extension is not installed in the server
- * then unlock the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestStopInput, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestStopInput, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestStopInput
- */
- req->XTestReqType = X_TestStopInput;
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestReset
- *
- * Tell the server to set everything having to do with this extension
- * back to its initial state.
- */
-int
-XTestReset(
-/*
- * the connection to the X server
- */
-register Display *dpy)
-{
- /*
- * pointer to xTestReset structure
- */
- xTestResetReq *req;
-
- LockDisplay(dpy);
- if (XTestCheckExtInit(dpy) == -1)
- {
- /*
- * if the extension is not installed in the server
- * then unlock the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestReset, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestReset, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestReset
- */
- req->XTestReqType = X_TestReset;
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestQueryInputSize
- *
- * Returns the number of input actions in the server's input action buffer.
- */
-int
-XTestQueryInputSize(
-/*
- * the connection to the X server
- */
-register Display *dpy,
-/*
- * the address of the place to put the number of input actions in the
- * server's input action buffer
- */
-unsigned long *size_return)
-{
- /*
- * pointer to xTestQueryInputSize structure
- */
- xTestQueryInputSizeReq *req;
- /*
- * pointer to xTestQueryInputSize structure
- */
- xTestQueryInputSizeReply rep;
-
- LockDisplay(dpy);
- if (XTestCheckExtInit(dpy) == -1)
- {
- /*
- * if the extension is not installed in the server
- * then unlock the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestQueryInputSize, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestQueryInputSize, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestQueryInputSize
- */
- req->XTestReqType = X_TestQueryInputSize;
- /*
- * get a reply from the server
- */
- (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
- /*
- * put the size in the caller's variable
- */
- *size_return = (unsigned long) rep.size_return;
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestCheckExtInit
- *
- * Check to see if the XTest extension is installed in the server.
- */
-static int
-XTestCheckExtInit(
-/*
- * the connection to the X server
- */
-register Display *dpy)
-{
- /*
- * if the extension has not been initialized, then do so
- */
- if (!XTestReqCode)
- {
- return(XTestInitExtension(dpy));
- }
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestInitExtension
- *
- * Attempt to initialize this extension in the server. Return 0 if it
- * succeeds, -1 if it does not succeed.
- */
-static int
-XTestInitExtension(
-/*
- * the connection to the X server
- */
-register Display *dpy)
-{
- /*
- * loop index
- */
- int i;
- /*
- * return value from XInitExtension
- */
- XExtCodes *ret;
-
- /*
- * attempt to initialize the extension
- */
- ret = XInitExtension(dpy, XTestEXTENSION_NAME);
- /*
- * if the initialize failed, return -1
- */
- if (ret == NULL)
- {
- return (-1);
- }
- /*
- * the initialize succeeded, remember the major opcode
- * for this extension
- */
- XTestReqCode = ret->major_opcode;
- /*
- * set up the event handler for any events from
- * this extension
- */
- for (i = 0; i < XTestEVENT_COUNT; i++)
- {
- XESetWireToEvent(dpy,
- ret->first_event+i,
- XTestWireToEvent);
- }
- /*
- * compute the event type codes for the events
- * in this extension
- */
- XTestInputActionType += ret->first_event;
- XTestFakeAckType += ret->first_event;
- /*
- * everything worked ok
- */
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestWireToEvent
- *
- * Handle XTest extension events.
- * Reformat a wire event into an XEvent structure of the right type.
- */
-static Bool
-XTestWireToEvent(
-/*
- * the connection to the X server
- */
-Display *dpy,
-/*
- * a pointer to where a host formatted event should be stored
- * with the information copied to it
- */
-XEvent *reTemp,
-/*
- * a pointer to the wire event
- */
-xEvent *eventTemp)
-{
- XTestInputActionEvent *re = (XTestInputActionEvent *) reTemp;
- xTestInputActionEvent *event = (xTestInputActionEvent *) eventTemp;
-
- /*
- * loop index
- */
- int i;
- /*
- * pointer to where the input actions go in the host format event
- */
- CARD8 *to;
- /*
- * pointer to the input actions in the wire event
- */
- CARD8 *from;
-
- /*
- * Copy the type of the wire event to the new event.
- * This will work for either event type because the type,
- * display, and window fields in the events have to be the same.
- */
- re->type = event->type;
- /*
- * set the display parameter in case it is needed (by who?)
- */
- re->display = dpy;
- if (re->type == XTestInputActionType)
- {
- /*
- * point at the first byte of input actions in the wire event
- */
- from = &(event->actions[0]);
- /*
- * point at where the input action bytes go in the new event
- */
- to = &(re->actions[0]);
- /*
- * copy the input action bytes from the wire event to
- * the new event
- */
- for (i = 0; i < XTestACTIONS_SIZE; i++)
- {
- *(to++) = *(from++);
- }
- }
- else if (re->type == XTestFakeAckType)
- {
- /*
- * nothing else needs to be done
- */
- }
- else
- {
- printf("XTestWireToEvent: UNKNOWN WIRE EVENT! type=%d\n",
- (int) event->type);
- printf("%s is giving up.\n", XTestEXTENSION_NAME);
- exit (1);
- }
- return 1;
-}
-
-/******************************************************************************
- *
- * XTestPressKey
- *
- * Send input actions to the server to cause the server to think
- * that the specified key on the keyboard was moved as specified.
- */
-int
-XTestPressKey(
-Display *display,
-int device_id,
-unsigned long delay,
-unsigned int keycode,
-unsigned int key_action)
-{
- /*
- * bounds check the key code
- */
- if (keycode < 8 || keycode > 255)
- {
- return(-1);
- }
- /*
- * use the commmon key/button handling routine
- */
- return(XTestKeyOrButton(display,
- device_id,
- delay,
- keycode,
- key_action));
-}
-
-/******************************************************************************
- *
- * XTestPressButton
- *
- * Send input actions to the server to cause the server to think
- * that the specified button on the mouse was moved as specified.
- */
-int
-XTestPressButton(
-Display *display,
-int device_id,
-unsigned long delay,
-unsigned int button_number,
-unsigned int button_action)
-{
- /*
- * bounds check the button number
- */
- if (button_number > 7)
- {
- return(-1);
- }
- /*
- * use the commmon key/button handling routine
- */
- return(XTestKeyOrButton(display,
- device_id,
- delay,
- button_number,
- button_action));
-}
-
-/******************************************************************************
- *
- * XTestKeyOrButton
- *
- * Send input actions to the server to cause the server to think
- * that the specified key/button was moved as specified.
- */
-static int
-XTestKeyOrButton(
-Display *display,
-int device_id,
-unsigned long delay,
-unsigned int code,
-unsigned int action)
-{
- /*
- * holds a key input action to be filled out and sent to the server
- */
- XTestKeyInfo keyinfo;
-
- /*
- * bounds check the device id
- */
- if (device_id < 0 || device_id > XTestMAX_DEVICE_ID)
- {
- return(-1);
- }
- /*
- * fill out the key input action(s) as appropriate
- */
- switch(action)
- {
- case XTestPRESS:
- /*
- * Check the delay. If it is larger than will fit in the
- * key input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &delay) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * create the header
- */
- keyinfo.header = XTestPackDeviceID(device_id) |
- XTestKEY_ACTION |
- XTestKEY_DOWN;
- /*
- * set the key/button code
- */
- keyinfo.keycode = code;
- /*
- * set the delay time
- */
- keyinfo.delay_time = delay;
- /*
- * pack the input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- return(XTestPackInputAction(display,
- (CARD8 *) &keyinfo,
- sizeof(XTestKeyInfo)));
- case XTestRELEASE:
- /*
- * Check the delay. If it is larger than will fit in the
- * key input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &delay) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * create the header
- */
- keyinfo.header = XTestPackDeviceID(device_id) |
- XTestKEY_ACTION |
- XTestKEY_UP;
- /*
- * set the key/button code
- */
- keyinfo.keycode = code;
- /*
- * set the delay time
- */
- keyinfo.delay_time = delay;
- /*
- * pack the input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- return(XTestPackInputAction(display,
- (CARD8 *) &keyinfo,
- sizeof(XTestKeyInfo)));
- case XTestSTROKE:
- /*
- * Check the delay. If it is larger than will fit in the
- * key input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &delay) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * create a key/button-down input action header
- */
- keyinfo.header = XTestPackDeviceID(device_id) |
- XTestKEY_ACTION |
- XTestKEY_DOWN;
- /*
- * set the key/button code
- */
- keyinfo.keycode = code;
- /*
- * set the delay time
- */
- keyinfo.delay_time = delay;
- /*
- * pack the input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- if (XTestPackInputAction(display,
- (CARD8 *) &keyinfo,
- sizeof(XTestKeyInfo)) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * set the delay to XTestSTROKE_DELAY_TIME
- */
- delay = XTestSTROKE_DELAY_TIME;
- /*
- * Check the delay. If it is larger than will fit in the
- * key input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &delay) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * create a key/button-up input action header
- */
- keyinfo.header = XTestPackDeviceID(device_id) |
- XTestKEY_ACTION |
- XTestKEY_UP;
- /*
- * set the key/button code
- */
- keyinfo.keycode = code;
- /*
- * set the delay time
- */
- keyinfo.delay_time = delay;
- /*
- * pack the input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- return(XTestPackInputAction(display,
- (CARD8 *) &keyinfo,
- sizeof(XTestKeyInfo)));
- default:
- /*
- * invalid action value, return -1
- */
- return(-1);
- }
-}
-
-/******************************************************************************
- *
- * XTestMovePointer
- *
- * Send input actions to the server to cause the server to think
- * that the mouse was moved as specified.
- */
-int
-XTestMovePointer(
-Display *display,
-int device_id,
-unsigned long delay[],
-int x[],
-int y[],
-unsigned int count)
-{
- /*
- * holds a motion input action to be filled out and sent to the server
- */
- XTestMotionInfo motioninfo;
- /*
- * holds a jump input action to be filled out and sent to the server
- */
- XTestJumpInfo jumpinfo;
- /*
- * loop index
- */
- unsigned int i;
- /*
- * holds the change in x and y directions from the current x and y
- * coordinates
- */
- int dx;
- int dy;
-
- /*
- * bounds check the device id
- */
- if (device_id < 0 || device_id > XTestMAX_DEVICE_ID)
- {
- return(-1);
- }
- /*
- * if the count is 0, there is nothing to do. return 0
- */
- if (count == 0)
- {
- return(0);
- }
- /*
- * loop through the pointer motions, creating the appropriate
- * input actions for each motion
- */
- for (i = 0; i < count; i++)
- {
- /*
- * Check the delay. If it is larger than will fit in the
- * input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &(delay[i])) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * compute the change from the current x and y coordinates
- * to the new x and y coordinates
- */
- dx = x[i] - current_x;
- dy = y[i] - current_y;
- /*
- * update the current x and y coordinates
- */
- current_x = x[i];
- current_y = y[i];
- /*
- * If the pointer motion range is too large to fit into
- * a motion input action, then use a jump input action.
- * Otherwise, use a motion input action.
- */
- if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) ||
- (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN))
- {
- /*
- * create a jump input action header
- */
- jumpinfo.header = XTestPackDeviceID(device_id) |
- XTestJUMP_ACTION;
- /*
- * set the x and y coordinates to jump to
- */
- jumpinfo.jumpx = x[i];
- jumpinfo.jumpy = y[i];
- /*
- * set the delay time
- */
- jumpinfo.delay_time = delay[i];
- /*
- * pack the jump input action into a request to be
- * sent to the server when the request is full
- * or XTestFlush is called
- */
- if (XTestPackInputAction(display,
- (CARD8 *) &jumpinfo,
- sizeof(XTestJumpInfo)) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- }
- else
- {
- /*
- * create a motion input action header
- */
- motioninfo.header = XTestPackDeviceID(device_id) |
- XTestMOTION_ACTION;
- /*
- * compute the motion data byte
- */
- if (dx < 0)
- {
- motioninfo.header |= XTestX_NEGATIVE;
- dx = abs(dx);
- }
- if (dy < 0)
- {
- motioninfo.header |= XTestY_NEGATIVE;
- dy = abs(dy);
- }
- motioninfo.motion_data = XTestPackXMotionValue(dx);
- motioninfo.motion_data |= XTestPackYMotionValue(dy);
- /*
- * set the delay time
- */
- motioninfo.delay_time = delay[i];
- /*
- * pack the motion input action into a request to be
- * sent to the server when the request is full
- * or XTestFlush is called
- */
- if (XTestPackInputAction(display,
- (CARD8 *) &motioninfo,
- sizeof(XTestMotionInfo)) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- }
- }
- /*
- * if you get here, everything went ok
- */
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestCheckDelay
- *
- * Check the delay value at the passed-in address. If it is larger than
- * will fit in a normal input action, then send a delay input action.
- */
-static int
-XTestCheckDelay(
-Display *display,
-unsigned long *delay_addr)
-{
- /*
- * holds a delay input action to be filled out and sent to the server
- */
- XTestDelayInfo delayinfo;
-
- /*
- * if the delay value will fit in the input action,
- * then there is no need for a delay input action
- */
- if (*delay_addr <= XTestSHORT_DELAY_TIME)
- {
- return(0);
- }
- /*
- * fill out a delay input action
- */
- delayinfo.header = XTestPackDeviceID(XTestDELAY_DEVICE_ID);
- delayinfo.delay_time = *delay_addr;
- /*
- * all of the delay time will be accounted for in the
- * delay input action, so set the original delay value to 0
- */
- *delay_addr = 0;
- /*
- * pack the delay input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- return(XTestPackInputAction(display,
- (CARD8 *) &delayinfo,
- sizeof(XTestDelayInfo)));
-}
-
-/******************************************************************************
- *
- * XTestPackInputAction
- *
- * If the input action buffer is full or the number of input actions
- * has reached the maximum that the server can handle at one time,
- * then send the input actions to the server using XTestFakeInput.
- */
-static int
-XTestPackInputAction(
-Display *display,
-CARD8 *action_addr,
-int action_size)
-{
- /*
- * loop index
- */
- int i;
- /*
- * acknowledge flag
- */
- int ack_flag;
-
- /*
- * if we don't already know it, find out how many input actions
- * the server can handle at one time
- */
- if (action_array_size == 0)
- {
- if(XTestQueryInputSize(display, &action_array_size) == -1)
- {
- /*
- * if an error, return -1
- */
- return(-1);
- }
- }
- /*
- * if the specified input action will fit in the the input
- * action buffer and won't exceed the server's capacity, then
- * put the input action into the input buffer
- */
- if(((action_index + action_size) <= XTestMAX_ACTION_LIST_SIZE) &&
- ((action_count + 1) < action_array_size))
- {
- /*
- * copy the input action into the buffer
- */
- for (i = 0; i < action_size; i++)
- {
- action_buf[action_index++] = *(action_addr++);
- }
- /*
- * increment the action count
- */
- action_count++;
- /*
- * everything went ok, return 0
- */
- return(0);
- }
- /*
- * We have to write input actions to the server. If the server's
- * input action capacity will be reached, then ask for an
- * acknowledge event when the server has processed all of the
- * input actions. Otherwise, an acknowledge event is not needed.
- */
- if (action_count >= action_array_size)
- {
- ack_flag = XTestFAKE_ACK_REQUEST;
- }
- else
- {
- ack_flag = XTestFAKE_ACK_NOT_NEEDED;
- }
- /*
- * write the input actions to the server
- */
- if (XTestWriteInputActions(display,
- (char *) &(action_buf[0]),
- action_index,
- ack_flag) == -1)
- {
- /*
- * error, return -1
- */
- return(-1);
- }
- /*
- * copy the input action into the buffer
- */
- for (i = 0; i < action_size; i++)
- {
- action_buf[action_index++] = *(action_addr++);
- }
- /*
- * increment the action count
- */
- action_count++;
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestWriteInputActions
- *
- * Send input actions to the server.
- */
-static int
-XTestWriteInputActions(
-Display *display,
-char *action_list_addr,
-int action_list_size,
-int ack_flag)
-{
- /*
- * Holds an event. Used while waiting for an acknowledge event
- */
- XEvent event;
- /*
- * points to XTestIdentifyMyEvent
- */
- Bool (*func_ptr)();
-
- /*
- * write the input actions to the server
- */
- if (XTestFakeInput(display,
- action_list_addr,
- action_list_size,
- ack_flag) == -1)
- {
- /*
- * if an error, return -1
- */
- return(-1);
- }
- /*
- * flush X's buffers to make sure that the server really gets
- * the input actions
- */
- XFlush(display);
- /*
- * mark the input action buffer as empty
- */
- action_index = 0;
- /*
- * if we asked for an acknowledge event, then wait for it
- */
- if (ack_flag == XTestFAKE_ACK_REQUEST)
- {
- /*
- * point func_ptr at XTestIdentifyMyEvent
- */
- func_ptr = XTestIdentifyMyEvent;
- /*
- * Wait until the acknowledge event comes. When the
- * acknowledge event comes, it is removed from the event
- * queue without disturbing any other events that might
- * be in the queue.
- */
- XIfEvent(display, &event, func_ptr, NULL);
- /*
- * set the input action count back to 0
- */
- action_count = 0;
- }
- /*
- * if we got here, then everything is ok, return 0
- */
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestIdentifyMyEvent
- *
- * This function is called by XIfEvent to look at an event and see if
- * it is of XTestFakeAckType.
- */
-static Bool
-XTestIdentifyMyEvent(
-Display *display,
-/*
- * Holds the event that this routiine is supposed to look at.
- */
-XEvent *event_ptr,
-/*
- * this points to any user-specified arguments (ignored)
- */
-char *args)
-{
- /*
- * if the event if of the correct type, return the Bool True,
- * otherwise return the Bool False.
- */
- if (event_ptr->type == XTestFakeAckType)
- {
- return(True);
- }
- else
- {
- return(False);
- }
-}
-
-/******************************************************************************
- *
- * XTestFlush
- *
- * Send any input actions in the input action buffer to the server.
- */
-int
-XTestFlush(Display *display)
-{
- /*
- * acknowledge flag
- */
- int ack_flag;
-
- /*
- * if there are no input actions in the input action buffer,
- * then return 0
- */
- if (action_index == 0)
- {
- return(0);
- }
- /*
- * We have input actions to write to the server. We will
- * wait until the server has finished processing the input actions.
- */
- ack_flag = XTestFAKE_ACK_REQUEST;
- /*
- * write the input actions to the server
- */
- return(XTestWriteInputActions(display,
- (char *) &(action_buf[0]),
- action_index,
- ack_flag));
-}
diff --git a/nx-X11/lib/Xext/Xext-def.cpp b/nx-X11/lib/Xext/Xext-def.cpp
deleted file mode 100644
index 6ee37c70f..000000000
--- a/nx-X11/lib/Xext/Xext-def.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-LIBRARY XEXT
-VERSION LIBRARY_VERSION
-EXPORTS
- XMissingExtension
- XSetExtensionErrorHandler
- XShapeCombineMask
- XShapeCombineRectangles
- XShapeCombineRegion
- XShapeCombineShape
- XShapeGetRectangles
- XShapeInputSelected
- XShapeOffsetShape
- XShapeQueryExtension
- XShapeQueryExtents
- XShapeQueryVersion
- XShapeSelectInput
-#if (defined(__CYGWIN__) && defined(HAS_SHM)) || defined(__UNIXOS2__)
- XShmAttach
- XShmCreateImage
- XShmCreatePixmap
- XShmDetach
-;XShmDestroyImage
- XShmGetEventBase
- XShmGetImage
- XShmPixmapFormat
- XShmPutImage
- XShmQueryExtension
- XShmQueryVersion
-#endif
- XSyncAwait
- XSyncChangeAlarm
- XSyncChangeCounter
- XSyncCreateAlarm
- XSyncCreateCounter
- XSyncDestroyAlarm
- XSyncDestroyCounter
- XSyncFreeSystemCounterList
- XSyncGetPriority
- XSyncInitialize
- XSyncIntToValue
- XSyncIntsToValue
- XSyncListSystemCounters
- XSyncMaxValue
- XSyncMinValue
- XSyncQueryAlarm
- XSyncQueryCounter
- XSyncQueryExtension
- XSyncSetCounter
- XSyncSetPriority
- XSyncValueAdd
- XSyncValueEqual
- XSyncValueGreaterOrEqual
- XSyncValueGreaterThan
- XSyncValueHigh32
- XSyncValueIsNegative
- XSyncValueIsPositive
- XSyncValueIsZero
- XSyncValueLessOrEqual
- XSyncValueLessThan
- XSyncValueLow32
- XSyncValueSubtract
- XTestFakeInput
- XTestFlush
- XTestGetInput
- XTestMovePointer
- XTestPressButton
- XTestPressKey
- XTestQueryInputSize
- XTestReset
- XTestStopInput
- XextAddDisplay
- XextCreateExtension
- XextDestroyExtension
- XextFindDisplay
- XextRemoveDisplay
- XSecurityQueryExtension
- XSecurityAllocXauth
- XSecurityFreeXauth
- XSecurityGenerateAuthorization
- XSecurityRevokeAuthorization
-#if !defined(__CYGWIN__) && !defined(__UNIXOS2__)
- XPanoramiXQueryVersion
- XPanoramiXAllocInfo
- XPanoramiXGetScreenCount
- XPanoramiXGetScreenSize
- XPanoramiXGetState
- XPanoramiXQueryExtension
-#endif
- DPMSQueryExtension
- DPMSGetVersion
- DPMSCapable
- DPMSSetTimeouts
- DPMSGetTimeouts
- DPMSEnable
- DPMSDisable
- DPMSForceLevel
- DPMSInfo
-/* $Xorg: Xext-def.cpp,v 1.3 2000/08/17 19:45:53 cpqbld Exp $ */
-/* $XFree86: xc/lib/Xext/Xext-def.cpp,v 1.8 2001/05/06 10:35:51 alanh Exp $ */