Commit bd592c2e authored by Mike Gabriel's avatar Mike Gabriel

library clean-up: Don't build libNX_Xtst anymore. Use system's libXtst shared…

library clean-up: Don't build libNX_Xtst anymore. Use system's libXtst shared library. (Fixes ArcticaProject/nx-libs#32).
parent b768e812
......@@ -21,12 +21,12 @@ Build-Depends:
libxcomposite-dev,
libxrandr-dev,
libxfixes-dev,
libxtst-dev,
autoconf,
pkg-config,
x11proto-core-dev,
expat,
Build-Conflicts:
x11proto-record-dev,
x11proto-xinerama-dev,
Standards-Version: 3.9.6
Homepage: http://code.x2go.org/gitweb?p=nx-libs.git;a=summary
......@@ -851,20 +851,16 @@ Multi-Arch: same
Pre-Depends:
${misc:Pre-Depends},
Depends:
${shlibs:Depends},
${misc:Depends},
Breaks: nxlibs (<= 3.5.1),
libnx-x11 (<< 2:3.5.0.29-0x2go2~),
Description: nx-X11 Testing -- Record extension library
Description: nx-X11 Testing -- Record extension library (dummy package)
NX is a software suite which implements very efficient
compression of the X11 protocol. This increases performance when
using X applications over a network, especially a slow one.
.
libNX_Xtst provides an X Window System client interface to the Record
extension to the X protocol.
This package removes the obsoleted libNX_Xtst.so.6 library. With
recent versions of NX, the system-wide installed libXtst gets used.
.
The Record extension allows X clients to synthesise input events, which
is useful for automated testing.
This package can be safely removed.
Package: libnx-xtst-dev
Provides: libnx-xtst6-dev
......@@ -872,22 +868,17 @@ Section: libdevel
Architecture: any
Multi-Arch: same
Depends:
libnx-xtst6 (= ${binary:Version}),
${misc:Depends},
Breaks: nxlibs (<= 3.5.1),
libnx-x11-dev (<< 2:3.5.0.29-0x2go2~),
Description: nx-X11 Testing -- Record extension library (development headers)
Description: nx-X11 Testing -- Record extension library (dummy package)
NX is a software suite which implements very efficient
compression of the X11 protocol. This increases performance when
using X applications over a network, especially a slow one.
.
libNX_Xtst provides an X Window System client interface to the Record
extension to the X protocol.
.
The Record extension allows X clients to synthesise input events, which
is useful for automated testing.
This package removes the obsoleted headers for the libNX_Xtst.so.6
library. With recent versions of NX, the system-wide installed libXtst
gets used.
.
This package contains the development headers for this library.
This package can be safely removed.
Package: libnx-xtst6-dbg
Architecture: any
......@@ -895,22 +886,18 @@ Multi-Arch: same
Pre-Depends:
${misc:Pre-Depends},
Depends:
libnx-xtst6 (= ${binary:Version}),
${misc:Depends},
Section: debug
Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~),
Description: nx-X11 Testing -- Record extension library (debug package)
Description: nx-X11 Testing -- Record extension library (dummy package)
NX is a software suite which implements very efficient
compression of the X11 protocol. This increases performance when
using X applications over a network, especially a slow one.
.
libNX_Xtst provides an X Window System client interface to the Record
extension to the X protocol.
.
The Record extension allows X clients to synthesise input events, which
is useful for automated testing.
This package removes the obsoleted wire protocol headers for the
libNX_Xtst.so.6 library. With recent versions of NX, the system-wide
installed libXtst gets used.
.
This package contains debug symbols for this library.
This package can be safely removed.
Package: libnx-mesa-extras-dev
Section: libdevel
......
usr/lib/*/libNX_Xtst.so
usr/include/*/nx-X11/extensions/XTest.h
libNX_Xtst.so.6 libnx-xtst6 #MINVER#
XRecordAllocRange@Base 3.5.0.29
XRecordCreateContext@Base 3.5.0.29
XRecordDisableContext@Base 3.5.0.29
XRecordEnableContext@Base 3.5.0.29
XRecordEnableContextAsync@Base 3.5.0.29
XRecordFreeContext@Base 3.5.0.29
XRecordFreeData@Base 3.5.0.29
XRecordFreeState@Base 3.5.0.29
XRecordGetContext@Base 3.5.0.29
XRecordIdBaseMask@Base 3.5.0.29
XRecordProcessReplies@Base 3.5.0.29
XRecordQueryVersion@Base 3.5.0.29
XRecordRegisterClients@Base 3.5.0.29
XRecordUnregisterClients@Base 3.5.0.29
XTestCompareCurrentCursorWithWindow@Base 3.5.0.29
XTestCompareCursorWithWindow@Base 3.5.0.29
XTestDiscard@Base 3.5.0.29
XTestFakeButtonEvent@Base 3.5.0.29
XTestFakeDeviceButtonEvent@Base 3.5.0.29
XTestFakeDeviceKeyEvent@Base 3.5.0.29
XTestFakeDeviceMotionEvent@Base 3.5.0.29
XTestFakeKeyEvent@Base 3.5.0.29
XTestFakeMotionEvent@Base 3.5.0.29
XTestFakeProximityEvent@Base 3.5.0.29
XTestFakeRelativeMotionEvent@Base 3.5.0.29
XTestGrabControl@Base 3.5.0.29
XTestQueryExtension@Base 3.5.0.29
XTestSetGContextOfGC@Base 3.5.0.29
XTestSetVisualIDOfVisual@Base 3.5.0.29
usr/include/*/nx-X11/extensions/xteststr.h
usr/include/*/nx-X11/extensions/xtestconst.h
usr/include/*/nx-X11/extensions/shapestr.h
usr/include/*/nx-X11/extensions/shmstr.h
usr/include/*/nx-X11/extensions/syncstr.h
......@@ -196,7 +196,6 @@ X11.tmpl provides defaults for the following variables:
DebugLibX11 build libX11_d.a
DebugLibXau build libXau_d.a
DebugLibXext build libXext_d.a
DebugLibXtst build libXtst_d.a
DebugOldX build liboldX_d.a
DefaultCursorTheme name of default cursor theme
DefaultFontPath default server font path
......@@ -232,14 +231,12 @@ X11.tmpl provides defaults for the following variables:
NormalLibX11 build libX11.a
NormalLibXau build libXau.a
NormalLibXext build libXext.a
NormalLibXtst build libXtst.a
NormalOldX build liboldX.a
OsNameDefines If uname(2) unavailable, set to -DOS_NAME=OSName
PrimaryScreenResolution resolution of default server screen
ProfileLibX11 build libX11_p.a
ProfileLibXau build libXau_p.a
ProfileLibXext build libXext_p.a
ProfileLibXtst build libXtst_p.a
ProfileOldX build liboldX_p.a
ProjectX version indicating this is the X Window System
RemoveTargetProgramByMoving boolean for rm -f that doesn't
......@@ -252,7 +249,6 @@ X11.tmpl provides defaults for the following variables:
SharedLibX11 boolean for making sharable libX11.so
SharedLibXau boolean for making sharable libXau.so
SharedLibXext boolean for making sharable libXext.so
SharedLibXtst boolean for making sharable libXtst.so
SharedOldX boolean for making sharable liboldX.so
ShmDefines MIT-SHM define
TwmDir directory in which to install twm config files
......@@ -330,8 +326,6 @@ An <os>Lib.tmpl file provides defaults for the following variables:
SharedXauRev version number for libXau.so
SharedXextReqs required libs for libXext.so
SharedXextRev version number for libXext.so
SharedXtstReqs required libs for libXtst.so
SharedXtstRev version number for libXtst.so
Vendor.cf files and/or site/host specific .def files may define the
following variables:
......
......@@ -1463,28 +1463,6 @@ SharedLibReferences(OLDX,NX_oldX,$(OLDXLIBSRC),SOOLDXREV,SharedOldXRev)
ProjectUnsharedLibReferences(OLDX,NX_oldX,$(OLDXLIBSRC),XBuildLibDir)
#endif
#ifndef SharedLibXtst
#define SharedLibXtst HasSharedLibraries
#endif
#ifndef NormalLibXtst
#define NormalLibXtst (!SharedLibXtst | ForceNormalLib)
#endif
#ifndef DebugLibXtst
#define DebugLibXtst NO /* debugged Xtst library */
#endif
#ifndef ProfileLibXtst
#define ProfileLibXtst NO /* profiled Xtst library */
#endif
XTESTLIBSRC = $(LIBSRC)/Xtst
#if SharedLibXtst
#ifndef SharedXtstRev
#define SharedXtstRev 6.1
#endif
SharedLibReferences(XTEST,NX_Xtst,$(XTESTLIBSRC),SOXTESTREV,SharedXtstRev)
#else
ProjectUnsharedLibReferences(XTEST,NX_Xtst,$(XTESTLIBSRC),XBuildLibDir)
#endif
#if HasMotif
#ifndef MotifDir
......
......@@ -91,7 +91,7 @@ HEADERS = Xext.h \
bigreqstr.h \
extutil.h \
XI.h XInput.h XIproto.h \
XTest.h xtestext1.h xteststr.h \
xtestconst.h xtestext1.h xteststr.h \
XKB.h XKBgeom.h XKBproto.h XKBstr.h XKBsrv.h \
Xdbe.h Xdbeproto.h \
Xag.h Xagstr.h Xagsrv.h \
......
/*
Copyright 1992, 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.
*/
#ifndef _XTEST_H_
#define _XTEST_H_
#include <nx-X11/Xfuncproto.h>
#define X_XTestGetVersion 0
#define X_XTestCompareCursor 1
#define X_XTestFakeInput 2
#define X_XTestGrabControl 3
#define XTestNumberEvents 0
#define XTestNumberErrors 0
#define XTestMajorVersion 2
#define XTestMinorVersion 2
#define XTestExtensionName "XTEST"
#endif
......@@ -37,7 +37,6 @@ XEXTLIBDIR = Xext
#if BuildLibraries
OLDXLIBDIR = oldX
XTSTLIBDIR = Xtst
#endif
......@@ -46,7 +45,6 @@ LINTSUBDIRS = \
$(X11LIBDIR) \
$(OLDXLIBDIR) \
$(XEXTLIBDIR) \
$(XTSTLIBDIR) \
$(XKBLIBDIR) \
$(XINERAMADIR) \
$(RENDERLIBDIR) \
......
XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:23 cpqbld Exp $
XCOMM $XFree86: xc/lib/Xtst/Imakefile,v 1.2 1998/12/20 11:57:12 dawes Exp $
#define DoNormalLib NormalLibXtst
#define DoSharedLib SharedLibXtst
#define DoExtraLib SharedLibXtst
#define DoDebugLib DebugLibXtst
#define DoProfileLib ProfileLibXtst
#define LibName NX_Xtst
#define SoRev SOXTESTREV
#define LibHeaders NO
#include <Threads.tmpl>
#ifdef SharedXtstReqs
REQUIREDLIBS = SharedXtstReqs
#endif
INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
SRCS = XTest.c XRecord.c
OBJS = XTest.o XRecord.o
LINTLIBS = $(LINTXLIB)
#include <Library.tmpl>
DependTarget()
/*
$Xorg: XRecord.c,v 1.4 2001/02/09 02:04:00 xorgcvs Exp $
XRecord.c - client-side library for RECORD extension
Copyright 1995, 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 1995 Network Computing Devices
*
* 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, and that the name of Network Computing Devices
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission.
*
* NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES 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.
**************************************************************************/
/*
* By Stephen Gildea, X Consortium, and Martha Zimet, NCD.
*/
/* $XFree86: xc/lib/Xtst/XRecord.c,v 1.6 2002/10/16 00:37:33 dawes Exp $ */
#include <stdio.h>
#include <assert.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/recordstr.h>
static XExtensionInfo _xrecord_info_data;
static XExtensionInfo *xrecord_info = &_xrecord_info_data;
static /* const */ char *xrecord_extension_name = RECORD_NAME;
#define XRecordCheckExtension(dpy,i,val) \
XextCheckExtension(dpy, i, xrecord_extension_name, val)
/**************************************************************************
* *
* private utility routines *
* *
**************************************************************************/
static XExtDisplayInfo *find_display();
/*
* A reply buffer holds a reply from RecordEnableContext.
* Pieces of that buffer are passed to the XRecordEnableContext callback.
* ref_count is incremented each time we do that.
* ref_count is decremented each time XRecordFreeData is called on
* the buffer. When ref_count is 0, we can free or reuse the buffer.
*/
struct reply_buffer
{
struct reply_buffer *next; /* next in list or NULL */
unsigned char *buf; /* pointer to malloc'd buffer */
int nbytes; /* size of buf */
int ref_count; /* callback uses pending */
};
/*
* There's some extra information the implementation finds useful
* to attach to an XRecordInterceptData packet to handle memory
* management. So we really allocate one of these.
*/
struct intercept_queue
{
/* this struct gets passed to the user as an XRecordInterceptData,
so the data field must come first so we can cast the address
back and forth */
XRecordInterceptData data;
struct intercept_queue *next; /* next in free list or NULL */
struct mem_cache_str *cache; /* contains head of free list */
};
/*
* per-display pointers to cache of malloc'd but unused memory
*/
struct mem_cache_str
{
struct intercept_queue *inter_data; /* free structs only */
struct reply_buffer *reply_buffers; /* all reply buffers */
int inter_data_count; /* total allocated, free and in use */
Bool display_closed; /* so we know when to free ourself */
};
static int close_display(dpy, codes)
Display *dpy;
XExtCodes *codes; /* not used */
{
XExtDisplayInfo *info = find_display (dpy);
LockDisplay(dpy);
if (info && info->data) {
struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
struct intercept_queue *iq, *iq_next;
struct reply_buffer *rbp, **rbp_next_p;
for (iq=cache->inter_data; iq; iq=iq_next) {
iq_next = iq->next;
XFree(iq);
cache->inter_data_count--;
}
/* this is a little trickier, because some of these
might still be in use */
for (rbp_next_p = &cache->reply_buffers; *rbp_next_p; ) {
rbp = *rbp_next_p;
if (rbp->ref_count == 0) {
*rbp_next_p = rbp->next;
XFree(rbp->buf);
XFree(rbp);
} else {
rbp_next_p = &rbp->next;
}
}
if (cache->reply_buffers == NULL && cache->inter_data_count == 0) {
/* every thing has been freed, can free ourselves, too */
XFree(cache);
} else {
cache->display_closed = True;
cache->inter_data = NULL; /* neatness only; won't be used */
}
}
UnlockDisplay(dpy);
return XextRemoveDisplay(xrecord_info, dpy);
}
static XPointer alloc_mem_cache()
{
struct mem_cache_str *cache;
/* note that an error will go unnoticed */
cache = (struct mem_cache_str *) Xmalloc(sizeof(struct mem_cache_str));
if (cache) {
cache->display_closed = False;
cache->inter_data = NULL;
cache->inter_data_count = 0;
cache->reply_buffers = NULL;
}
return (XPointer) cache;
}
static char *xrecord_error_list[] = {
"XRecordBadContext (Not a defined RECORD context)",
};
static XEXT_GENERATE_ERROR_STRING (error_string, xrecord_extension_name,
RecordNumErrors, xrecord_error_list)
static XExtensionHooks xrecord_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 */
error_string /* error_string */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, xrecord_info,
xrecord_extension_name, &xrecord_extension_hooks, RecordNumEvents,
alloc_mem_cache())
/**************************************************************************
* *
* private library routines *
* *
**************************************************************************/
static void
SendRange(dpy, range_item, nranges)
Display *dpy;
XRecordRange **range_item;
int nranges;
{
int rlen = SIZEOF(xRecordRange);
while(nranges--)
{
xRecordRange xrange;
xrange.coreRequestsFirst = (*range_item)->core_requests.first;
xrange.coreRequestsLast = (*range_item)->core_requests.last;
xrange.coreRepliesFirst = (*range_item)->core_replies.first;
xrange.coreRepliesLast = (*range_item)->core_replies.last;
xrange.extRequestsMajorFirst = (*range_item)->ext_requests.ext_major.first;
xrange.extRequestsMajorLast = (*range_item)->ext_requests.ext_major.last;
xrange.extRequestsMinorFirst = (*range_item)->ext_requests.ext_minor.first;
xrange.extRequestsMinorLast = (*range_item)->ext_requests.ext_minor.last;
xrange.extRepliesMajorFirst = (*range_item)->ext_replies.ext_major.first;
xrange.extRepliesMajorLast = (*range_item)->ext_replies.ext_major.last;
xrange.extRepliesMinorFirst = (*range_item)->ext_replies.ext_minor.first;
xrange.extRepliesMinorLast = (*range_item)->ext_replies.ext_minor.last;
xrange.deliveredEventsFirst = (*range_item)->delivered_events.first;
xrange.deliveredEventsLast = (*range_item)->delivered_events.last;
xrange.deviceEventsFirst = (*range_item)->device_events.first;
xrange.deviceEventsLast = (*range_item)->device_events.last;
xrange.errorsFirst = (*range_item)->errors.first;
xrange.errorsLast = (*range_item)->errors.last;
xrange.clientStarted = (*range_item)->client_started;
xrange.clientDied = (*range_item)->client_died;
Data(dpy, (char *)&xrange, rlen);
range_item++;
}
}
/**************************************************************************
* *
* public routines *
* *
**************************************************************************/
XID
XRecordIdBaseMask(dpy)
Display *dpy;
{
return 0x1fffffff & ~dpy->resource_mask;
}
Status
XRecordQueryVersion (dpy, cmajor_return, cminor_return)
Display *dpy;
int *cmajor_return, *cminor_return;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordQueryVersionReq *req;
xRecordQueryVersionReply rep;
XRecordCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(RecordQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordQueryVersion;
req->majorVersion = RECORD_MAJOR_VERSION;
req->minorVersion = RECORD_MINOR_VERSION;
if (!_XReply(dpy,(xReply *)&rep, 0, True)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
UnlockDisplay(dpy);
SyncHandle();
*cmajor_return = rep.majorVersion;
*cminor_return = rep.minorVersion;
return ((rep.majorVersion == RECORD_MAJOR_VERSION) &&
(rep.minorVersion >= RECORD_LOWEST_MINOR_VERSION));
}
XRecordContext
XRecordCreateContext(dpy, datum_flags, clients, nclients, ranges, nranges)
Display *dpy;
int datum_flags;
XRecordClientSpec *clients;
int nclients;
XRecordRange **ranges;
int nranges;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordCreateContextReq *req;
int clen = 4 * nclients;
XRecordCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(RecordCreateContext, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordCreateContext;
req->context = XAllocID(dpy);
req->length += (nclients * 4 +
nranges * SIZEOF(xRecordRange)) >> 2;
req->elementHeader = datum_flags;
req->nClients = nclients;
req->nRanges = nranges;
Data32(dpy, (long *)clients, clen);
SendRange(dpy, ranges, nranges);
UnlockDisplay(dpy);
SyncHandle();
return req->context;
}
XRecordRange *
XRecordAllocRange()
{
return (XRecordRange*)Xcalloc(1, sizeof(XRecordRange));
}
Status
XRecordRegisterClients(dpy, context, datum_flags, clients, nclients, ranges, nranges)
Display *dpy;
XRecordContext context;
int datum_flags;
XRecordClientSpec *clients;
int nclients;
XRecordRange **ranges;
int nranges;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordRegisterClientsReq *req;
int clen = 4 * nclients;
XRecordCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(RecordRegisterClients, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordRegisterClients;
req->context = context;
req->length += (nclients * 4 +
nranges * SIZEOF(xRecordRange)) >> 2;
req->elementHeader = datum_flags;
req->nClients = nclients;
req->nRanges = nranges;
Data32(dpy, (long *)clients, clen);
SendRange(dpy, ranges, nranges);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
Status
XRecordUnregisterClients(dpy, context, clients, nclients)
Display *dpy;
XRecordContext context;
XRecordClientSpec *clients;
int nclients;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordUnregisterClientsReq *req;
int clen = 4 * nclients;
XRecordCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(RecordUnregisterClients, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordUnregisterClients;
req->context = context;
req->length += nclients;
req->nClients = nclients;
Data32(dpy, (long *)clients, clen);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
static void
WireToLibRange(wire_range, lib_range)
xRecordRange *wire_range;
XRecordRange *lib_range;
{
lib_range->core_requests.first = wire_range->coreRequestsFirst;
lib_range->core_requests.last = wire_range->coreRequestsLast;
lib_range->core_replies.first = wire_range->coreRepliesFirst;
lib_range->core_replies.last = wire_range->coreRepliesLast;
lib_range->ext_requests.ext_major.first = wire_range->extRequestsMajorFirst;
lib_range->ext_requests.ext_major.last = wire_range->extRequestsMajorLast;
lib_range->ext_requests.ext_minor.first = wire_range->extRequestsMinorFirst;
lib_range->ext_requests.ext_minor.last = wire_range->extRequestsMinorLast;
lib_range->ext_replies.ext_major.first = wire_range->extRepliesMajorFirst;
lib_range->ext_replies.ext_major.last = wire_range->extRepliesMajorLast;
lib_range->ext_replies.ext_minor.first = wire_range->extRepliesMinorFirst;
lib_range->ext_replies.ext_minor.last = wire_range->extRepliesMinorLast;
lib_range->delivered_events.first = wire_range->deliveredEventsFirst;
lib_range->delivered_events.last = wire_range->deliveredEventsLast;
lib_range->device_events.first = wire_range->deviceEventsFirst;
lib_range->device_events.last = wire_range->deviceEventsLast;
lib_range->errors.first = wire_range->errorsFirst;
lib_range->errors.last = wire_range->errorsLast;
lib_range->client_started = wire_range->clientStarted;
lib_range->client_died = wire_range->clientDied;
}
Status
XRecordGetContext(dpy, context, state_return)
Display *dpy;
XRecordContext context;
XRecordState **state_return;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordGetContextReq *req;
xRecordGetContextReply rep;
int count, i, rn;
xRecordRange xrange;
XRecordRange *ranges;
xRecordClientInfo xclient_inf;
XRecordClientInfo **client_inf, *client_inf_str;
XRecordState *ret;
XRecordCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(RecordGetContext, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordGetContext;
req->context = context;
if (!_XReply(dpy,(xReply *)&rep, 0, False)) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
count = rep.nClients;
ret = (XRecordState*)Xmalloc(sizeof(XRecordState));
if (!ret) {
/* XXX - eat data */
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
ret->enabled = rep.enabled;
ret->datum_flags = rep.elementHeader;
ret->nclients = count;
if (count)
{
client_inf = (XRecordClientInfo **) Xcalloc(count, sizeof(XRecordClientInfo*));
ret->client_info = client_inf;
client_inf_str = (XRecordClientInfo *) Xmalloc(count*sizeof(XRecordClientInfo));
if (!client_inf || !client_inf_str)
{
for(i = 0; i < count; i++)
{
_XEatData (dpy, sizeof(xRecordClientInfo));
_XEatData (dpy, SIZEOF(xRecordRange)); /* XXX - don't know how many */
}
UnlockDisplay(dpy);
XRecordFreeState(ret);
SyncHandle();
return 0;
}
for(i = 0; i < count; i++)
{
client_inf[i] = &(client_inf_str[i]);
_XRead(dpy, (char *)&xclient_inf, (long)sizeof(xRecordClientInfo));
client_inf_str[i].client = xclient_inf.clientResource;
client_inf_str[i].nranges = xclient_inf.nRanges;
if (xclient_inf.nRanges)
{
client_inf_str[i].ranges = (XRecordRange**) Xcalloc(xclient_inf.nRanges, sizeof(XRecordRange*));
ranges = (XRecordRange*) Xmalloc(xclient_inf.nRanges * sizeof(XRecordRange));
if (!client_inf_str[i].ranges || !ranges) {
/* XXX eat data */
UnlockDisplay(dpy);
XRecordFreeState(ret);
SyncHandle();
return 0;
}
for (rn=0; rn<xclient_inf.nRanges; rn++) {
client_inf_str[i].ranges[rn] = &(ranges[rn]);
_XRead(dpy, (char *)&xrange, (long)sizeof(xRecordRange));
WireToLibRange(&xrange, &(ranges[rn]));
}
} else {
client_inf_str[i].ranges = NULL;
}
}
} else {
ret->client_info = NULL;
}
*state_return = ret;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
void
XRecordFreeState(state)
XRecordState *state;
{
int i;
for(i=0; i<state->nclients; i++) {
if (state->client_info[i]->ranges) {
if (state->client_info[i]->ranges[0])
Xfree(state->client_info[i]->ranges[0]);
Xfree(state->client_info[i]->ranges);
}
}
if (state->client_info) {
if (state->client_info[0])
Xfree(state->client_info[0]);
Xfree(state->client_info);
}
Xfree(state);
}
static struct reply_buffer *alloc_reply_buffer(info, nbytes)
XExtDisplayInfo *info;
int nbytes;
{
struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
struct reply_buffer *rbp;
struct reply_buffer *saved_rb = NULL;
/*
* First look for an allocated buffer that is not in use.
* If we have a big enough buffer, use that, otherwise
* realloc an existing one.
*/
for (rbp = cache->reply_buffers; rbp; rbp = rbp->next) {
if (rbp->ref_count == 0) {
if (rbp->nbytes >= nbytes)
return rbp;
else
saved_rb = rbp;
}
}
if (saved_rb) {
saved_rb->buf = (unsigned char *)Xrealloc(saved_rb->buf, nbytes);
if (!saved_rb->buf) {
saved_rb->nbytes = 0;
return NULL;
}
saved_rb->nbytes = nbytes;
return saved_rb;
}
/*
* nothing available; malloc a new struct
*/
rbp = (struct reply_buffer *)Xmalloc(sizeof(struct reply_buffer));
if (!rbp)
return NULL;
rbp->buf = (unsigned char *)Xmalloc(nbytes);
if (!rbp->buf) {
Xfree(rbp);
return NULL;
}
rbp->nbytes = nbytes;
rbp->ref_count = 0;
rbp->next = cache->reply_buffers;
cache->reply_buffers = rbp;
return rbp;
}
static XRecordInterceptData *alloc_inter_data(info)
XExtDisplayInfo *info;
{
struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
struct intercept_queue *iq;
/* if there is one on the free list, pop it */
if (cache->inter_data) {
iq = cache->inter_data;
cache->inter_data = iq->next;
return &iq->data;
}
/* allocate a new one */
iq = (struct intercept_queue *)Xmalloc(sizeof(struct intercept_queue));
if (!iq)
return NULL;
iq->cache = cache;
cache->inter_data_count++;
return &iq->data;
}
void
XRecordFreeData(data)
XRecordInterceptData *data;
{
/* we can do this cast because that is what we really allocated */
struct intercept_queue *iq = (struct intercept_queue *)data;
struct reply_buffer *rbp = NULL;
struct mem_cache_str *cache = iq->cache;
/*
* figure out what reply_buffer this points at
* and decrement its ref_count.
*/
if (data->data) {
for (rbp = cache->reply_buffers; rbp; rbp = rbp->next) {
if (data->data >= rbp->buf
&& data->data < rbp->buf + rbp->nbytes)
{
assert(rbp->ref_count > 0);
rbp->ref_count--;
break;
}
}
/* it's an error if we didn't find something to free */
assert(rbp);
}
/*
* If the display is still open, put this back on the free queue.
*
* Otherwise the display is closed and we won't reuse this, so free it.
* See if we can free the reply buffer, too.
* If we can, see if this is the last reply buffer and if so
* free the list of reply buffers.
*/
if (cache->display_closed == False) {
iq->next = cache->inter_data;
cache->inter_data = iq;
} else {
if (rbp && rbp->ref_count == 0) {
struct reply_buffer *rbp2, **rbp_next_p;
/* Have to search the list again to find the prev element.
This is not the common case, so don't slow down the code
above by doing it then. */
for (rbp_next_p = &cache->reply_buffers; *rbp_next_p; ) {
rbp2 = *rbp_next_p;
if (rbp == rbp2) {
*rbp_next_p = rbp2->next;
break;
} else {
rbp_next_p = &rbp2->next;
}
}
XFree(rbp->buf);
XFree(rbp);
}
XFree(iq);
cache->inter_data_count--;
if (cache->reply_buffers == NULL && cache->inter_data_count == 0) {
XFree(cache); /* all finished */
}
}
}
/* the EXTRACT macros are adapted from ICElibint.h */
#define EXTRACT_CARD16(swap, src, dst) \
{ \
(dst) = *((CARD16 *) (src)); \
if (swap) \
(dst) = lswaps (dst); \
}
#define EXTRACT_CARD32(swap, src, dst) \
{ \
(dst) = *((CARD32 *) (src)); \
if (swap) \
(dst) = lswapl (dst); \
}
/* byte swapping macros from xfs/include/misc.h */
/* byte swap a long literal */
#define lswapl(x) ((((x) & 0xff) << 24) |\
(((x) & 0xff00) << 8) |\
(((x) & 0xff0000) >> 8) |\
(((x) >> 24) & 0xff))
/* byte swap a short literal */
#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
enum parser_return { Continue, End, Error };
static enum parser_return
parse_reply_call_callback(dpy, info, rep, reply, callback, closure)
Display *dpy;
XExtDisplayInfo *info;
xRecordEnableContextReply *rep;
struct reply_buffer *reply;
XRecordInterceptProc callback;
XPointer closure;
{
int current_index;
int datum_bytes = 0;
XRecordInterceptData *data;
/* call the callback for each protocol element in the reply */
current_index = 0;
do {
data = alloc_inter_data(info);
if (!data)
return Error;
data->id_base = rep->idBase;
data->category = rep->category;
data->client_swapped = rep->clientSwapped;
data->server_time = rep->serverTime;
data->client_seq = rep->recordedSequenceNumber;
/*
* compute the size of this protocol element.
*/
switch (rep->category) {
case XRecordFromServer:
if (rep->elementHeader&XRecordFromServerTime) {
EXTRACT_CARD32(rep->clientSwapped,
reply->buf+current_index,
data->server_time);
current_index += 4;
}
switch (reply->buf[current_index]) {
case X_Reply: /* reply */
EXTRACT_CARD32(rep->clientSwapped,
reply->buf+current_index+4, datum_bytes);
datum_bytes = (datum_bytes+8) << 2;
break;
default: /* error or event */
datum_bytes = 32;
}
break;
case XRecordFromClient:
if (rep->elementHeader&XRecordFromClientTime) {
EXTRACT_CARD32(rep->clientSwapped,
reply->buf+current_index,
data->server_time);
current_index += 4;
}
if (rep->elementHeader&XRecordFromClientSequence) {
EXTRACT_CARD32(rep->clientSwapped,
reply->buf+current_index,
data->client_seq);
current_index += 4;
}
if (reply->buf[current_index+2] == 0
&& reply->buf[current_index+3] == 0) /* needn't swap 0 */
{ /* BIG-REQUESTS */
EXTRACT_CARD32(rep->clientSwapped,
reply->buf+current_index+4, datum_bytes);
} else {
EXTRACT_CARD16(rep->clientSwapped,
reply->buf+current_index+2, datum_bytes);
}
datum_bytes <<= 2;
break;
case XRecordClientStarted:
EXTRACT_CARD16(rep->clientSwapped,
reply->buf+current_index+6, datum_bytes);
datum_bytes = (datum_bytes+2) << 2;
break;
case XRecordClientDied:
if (rep->elementHeader&XRecordFromClientSequence) {
EXTRACT_CARD32(rep->clientSwapped,
reply->buf+current_index,
data->client_seq);
current_index += 4;
}
/* fall through */
case XRecordStartOfData:
case XRecordEndOfData:
datum_bytes = 0;
}
if (datum_bytes > 0) {
if (current_index + datum_bytes > rep->length << 2)
fprintf(stderr,
"XRecord: %lu-byte reply claims %d-byte element (seq %lu)\n",
(long)rep->length << 2, current_index + datum_bytes,
dpy->last_request_read);
/*
* This assignment (and indeed the whole buffer sharing
* scheme) assumes arbitrary 4-byte boundaries are
* addressable.
*/
data->data = reply->buf+current_index;
reply->ref_count++;
} else {
data->data = NULL;
}
data->data_len = datum_bytes >> 2;
(*callback)(closure, data);
current_index += datum_bytes;
} while (current_index<rep->length<<2);
if (rep->category == XRecordEndOfData)
return End;
return Continue;
}
Status
XRecordEnableContext(dpy, context, callback, closure)
Display *dpy;
XRecordContext context;
XRecordInterceptProc callback;
XPointer closure;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordEnableContextReq *req;
xRecordEnableContextReply rep;
struct reply_buffer *reply;
enum parser_return status;
XRecordCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(RecordEnableContext, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordEnableContext;
req->context = context;
while (1)
{
/* This code should match that in XRecordEnableContextAsync */
if (!_XReply (dpy, (xReply *)&rep, 0, xFalse))
{
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
if (rep.length > 0) {
reply = alloc_reply_buffer(info, rep.length<<2);
if (!reply) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
_XRead (dpy, (char *)reply->buf, rep.length<<2);
} else {
reply = NULL;
}
status = parse_reply_call_callback(dpy, info, &rep, reply,
callback, closure);
switch (status) {
case Continue:
break;
case End:
UnlockDisplay(dpy);
SyncHandle();
return 1;
case Error:
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
}
}
typedef struct _record_async_state
{
unsigned long enable_seq;
_XAsyncHandler *async;
_XAsyncErrorState *error_state;
XExtDisplayInfo *info;
XRecordInterceptProc callback;
XPointer closure;
} record_async_state;
static Bool
record_async_handler(dpy, rep, buf, len, adata)
register Display *dpy;
register xReply *rep;
char *buf;
int len;
XPointer adata;
{
register record_async_state *state = (record_async_state *)adata;
struct reply_buffer *reply;
enum parser_return status;
if (dpy->last_request_read != state->enable_seq)
{
if (dpy->last_request_read > state->enable_seq) {
/* it is an error that we are still on the handler list */
fprintf(stderr, "XRecord: handler for seq %lu never saw XRecordEndOfData. (seq now %lu)\n",
state->enable_seq, dpy->last_request_read);
DeqAsyncHandler(dpy, state->async);
Xfree(state->async);
}
return False;
}
if (rep->generic.type == X_Error)
{
DeqAsyncHandler(dpy, state->async);
Xfree(state->async);
return False;
}
if (rep->generic.length > 0) {
reply = alloc_reply_buffer(state->info, rep->generic.length<<2);
if (!reply) {
DeqAsyncHandler(dpy, state->async);
Xfree(state->async);
return False;
}
_XGetAsyncData(dpy, (char *)reply->buf, buf, len,
SIZEOF(xRecordEnableContextReply),
rep->generic.length << 2, 0);
} else {
reply = NULL;
}
status = parse_reply_call_callback(dpy, state->info,
(xRecordEnableContextReply*) rep,
reply, state->callback, state->closure);
if (status != Continue)
{
DeqAsyncHandler(dpy, state->async);
Xfree(state->async);
if (status == Error)
return False;
}
return True;
}
/*
* reads the first reply, StartOfData, synchronously,
* then returns allowing the app to call XRecordProcessReplies
* to get the rest.
*/
Status
XRecordEnableContextAsync(dpy, context, callback, closure)
Display *dpy;
XRecordContext context;
XRecordInterceptProc callback;
XPointer closure;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordEnableContextReq *req;
xRecordEnableContextReply rep;
struct reply_buffer *reply;
enum parser_return status;
_XAsyncHandler *async;
record_async_state *async_state;
XRecordCheckExtension (dpy, info, 0);
async = (_XAsyncHandler *)Xmalloc(sizeof(_XAsyncHandler) +
sizeof(record_async_state));
if (!async)
return 0;
async_state = (record_async_state *)(async + 1);
LockDisplay(dpy);
GetReq(RecordEnableContext, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordEnableContext;
req->context = context;
/* Get the StartOfData reply. */
/* This code should match that in XRecordEnableContext */
if (!_XReply (dpy, (xReply *)&rep, 0, xFalse))
{
UnlockDisplay(dpy);
SyncHandle();
Xfree(async);
return 0;
}
/* this had better be a StartOfData, which has no extra data. */
if (rep.length != 0) {
fprintf(stderr, "XRecord: malformed StartOfData for sequence %lu\n",
dpy->last_request_read);
}
reply = NULL;
status = parse_reply_call_callback(dpy, info, &rep, reply,
callback, closure);
if (status != Continue)
{
UnlockDisplay(dpy);
Xfree(async);
return 0;
}
/* hook in the async handler for the rest of the replies */
async_state->enable_seq = dpy->request;
async_state->async = async;
async_state->info = info;
async_state->callback = callback;
async_state->closure = closure;
async->next = dpy->async_handlers;
async->handler = record_async_handler;
async->data = (XPointer)async_state;
dpy->async_handlers = async;
UnlockDisplay(dpy);
/* Don't invoke SyncHandle here, since this is an async
function. Does this break XSetAfterFunction() ? */
return 1;
}
void
XRecordProcessReplies(dpy)
Display *dpy;
{
(void) XPending(dpy);
}
Status
XRecordDisableContext(dpy, context)
Display *dpy;
XRecordContext context;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordDisableContextReq *req;
XRecordCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(RecordDisableContext, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordDisableContext;
req->context = context;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
Status
XRecordFreeContext(dpy, context)
Display *dpy;
XRecordContext context;
{
XExtDisplayInfo *info = find_display (dpy);
register xRecordFreeContextReq *req;
XRecordCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(RecordFreeContext, req);
req->reqType = info->codes->major_opcode;
req->recordReqType = X_RecordFreeContext;
req->context = context;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
/* $Xorg: XTest.c,v 1.5 2001/02/09 02:04:00 xorgcvs Exp $ */
/*
Copyright 1990, 1991 by UniSoft Group Limited
*/
/*
Copyright 1992, 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.
*/
/* $XFree86: xc/lib/Xtst/XTest.c,v 1.5 2001/12/14 19:56:40 dawes Exp $ */
#define NEED_REPLIES
#include <nx-X11/Xlibint.h>
#include <nx-X11/extensions/XTest.h>
#include <nx-X11/extensions/xteststr.h>
#include <nx-X11/extensions/Xext.h>
#include <nx-X11/extensions/extutil.h>
#include <nx-X11/extensions/XInput.h>
#include <nx-X11/extensions/XIproto.h>
static XExtensionInfo _xtest_info_data;
static XExtensionInfo *xtest_info = &_xtest_info_data;
static /* const */ char *xtest_extension_name = XTestExtensionName;
#define XTestCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, xtest_extension_name, val)
#define XTestICheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, xtest_extension_name, val); \
if (!i->data) return val
/*****************************************************************************
* *
* private utility routines *
* *
*****************************************************************************/
static int close_display();
static /* const */ XExtensionHooks xtest_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 XPointer
get_xinput_base(dpy)
Display *dpy;
{
int major_opcode, first_event, first_error;
first_event = 0;
XQueryExtension(dpy, INAME, &major_opcode, &first_event, &first_error);
return (XPointer)(long)first_event;
}
static XEXT_GENERATE_FIND_DISPLAY (find_display, xtest_info,
xtest_extension_name,
&xtest_extension_hooks, XTestNumberEvents,
get_xinput_base(dpy))
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xtest_info)
/*****************************************************************************
* *
* public routines *
* *
*****************************************************************************/
Bool
XTestQueryExtension (dpy, event_basep, error_basep, majorp, minorp)
Display *dpy;
int *event_basep, *error_basep;
int *majorp, *minorp;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestGetVersionReq *req;
xXTestGetVersionReply rep;
if (XextHasExtension(info)) {
LockDisplay(dpy);
GetReq(XTestGetVersion, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestGetVersion;
req->majorVersion = XTestMajorVersion;
req->minorVersion = XTestMinorVersion;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
UnlockDisplay(dpy);
SyncHandle();
*event_basep = info->codes->first_event;
*error_basep = info->codes->first_error;
*majorp = rep.majorVersion;
*minorp = rep.minorVersion;
return True;
} else {
return False;
}
}
Bool
XTestCompareCursorWithWindow(dpy, window, cursor)
Display *dpy;
Window window;
Cursor cursor;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestCompareCursorReq *req;
xXTestCompareCursorReply rep;
XTestCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestCompareCursor, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestCompareCursor;
req->window = window;
req->cursor = cursor;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
UnlockDisplay(dpy);
SyncHandle();
return rep.same;
}
Bool
XTestCompareCurrentCursorWithWindow(dpy, window)
Display *dpy;
Window window;
{
return XTestCompareCursorWithWindow(dpy, window, XTestCurrentCursor);
}
int
XTestFakeKeyEvent(dpy, keycode, is_press, delay)
Display *dpy;
unsigned int keycode;
Bool is_press;
unsigned long delay;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestFakeInputReq *req;
XTestCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = is_press ? KeyPress : KeyRelease;
req->detail = keycode;
req->time = delay;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
int
XTestFakeButtonEvent(dpy, button, is_press, delay)
Display *dpy;
unsigned int button;
Bool is_press;
unsigned long delay;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestFakeInputReq *req;
XTestCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = is_press ? ButtonPress : ButtonRelease;
req->detail = button;
req->time = delay;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
int
XTestFakeMotionEvent(dpy, screen, x, y, delay)
Display *dpy;
int screen;
int x, y;
unsigned long delay;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestFakeInputReq *req;
XTestCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = MotionNotify;
req->detail = False;
if (screen == -1)
req->root = None;
else
req->root = RootWindow(dpy, screen);
req->rootX = x;
req->rootY = y;
req->time = delay;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
int
XTestFakeRelativeMotionEvent(dpy, dx, dy, delay)
Display *dpy;
int dx, dy;
unsigned long delay;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestFakeInputReq *req;
XTestCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = MotionNotify;
req->detail = True;
req->root = None;
req->rootX = dx;
req->rootY = dy;
req->time = delay;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
static void
send_axes(dpy, info, req, dev, first_axis, axes, n_axes)
Display *dpy;
XExtDisplayInfo *info;
xXTestFakeInputReq *req;
XDevice *dev;
int first_axis;
int *axes;
int n_axes;
{
deviceValuator ev;
int n;
req->deviceid |= MORE_EVENTS;
req->length += ((n_axes + 5) / 6) * (SIZEOF(xEvent) >> 2);
ev.type = XI_DeviceValuator + (long)info->data;
ev.deviceid = dev->device_id;
ev.num_valuators = n_axes;
ev.first_valuator = first_axis;
while (n_axes > 0) {
n = n_axes;
if (n > 6)
n = 6;
switch (n) {
case 6:
ev.valuator5 = *(axes+5);
case 5:
ev.valuator4 = *(axes+4);
case 4:
ev.valuator3 = *(axes+3);
case 3:
ev.valuator2 = *(axes+2);
case 2:
ev.valuator1 = *(axes+1);
case 1:
ev.valuator0 = *axes;
}
Data(dpy, (char *)&ev, SIZEOF(xEvent));
axes += n;
n_axes -= n;
ev.first_valuator += n;
}
}
int
XTestFakeDeviceKeyEvent(dpy, dev, keycode, is_press, axes, n_axes, delay)
Display *dpy;
XDevice *dev;
unsigned int keycode;
Bool is_press;
int *axes;
int n_axes;
unsigned long delay;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestFakeInputReq *req;
XTestICheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = is_press ? XI_DeviceKeyPress : XI_DeviceKeyRelease;
req->type += (int)(long)info->data;
req->detail = keycode;
req->time = delay;
req->deviceid = dev->device_id;
if (n_axes)
send_axes(dpy, info, req, dev, 0, axes, n_axes);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
int
XTestFakeDeviceButtonEvent(dpy, dev, button, is_press, axes, n_axes, delay)
Display *dpy;
XDevice *dev;
unsigned int button;
Bool is_press;
int *axes;
int n_axes;
unsigned long delay;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestFakeInputReq *req;
XTestICheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = is_press ? XI_DeviceButtonPress : XI_DeviceButtonRelease;
req->type += (int)(long)info->data;
req->detail = button;
req->time = delay;
req->deviceid = dev->device_id;
if (n_axes)
send_axes(dpy, info, req, dev, 0, axes, n_axes);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
int
XTestFakeProximityEvent(dpy, dev, in_prox, axes, n_axes, delay)
Display *dpy;
XDevice *dev;
Bool in_prox;
int *axes;
int n_axes;
unsigned long delay;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestFakeInputReq *req;
XTestICheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = in_prox ? XI_ProximityIn : XI_ProximityOut;
req->type += (int)(long)info->data;
req->time = delay;
req->deviceid = dev->device_id;
if (n_axes)
send_axes(dpy, info, req, dev, 0, axes, n_axes);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
int
XTestFakeDeviceMotionEvent(dpy, dev, is_relative,
first_axis, axes, n_axes, delay)
Display *dpy;
XDevice *dev;
Bool is_relative;
int first_axis;
int *axes;
int n_axes;
unsigned long delay;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestFakeInputReq *req;
XTestICheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = XI_DeviceMotionNotify + (int)(long)info->data;
req->detail = is_relative;
req->time = delay;
req->deviceid = dev->device_id;
send_axes(dpy, info, req, dev, first_axis, axes, n_axes);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
int
XTestGrabControl(dpy, impervious)
Display *dpy;
Bool impervious;
{
XExtDisplayInfo *info = find_display (dpy);
register xXTestGrabControlReq *req;
XTestCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(XTestGrabControl, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestGrabControl;
req->impervious = impervious;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
void
XTestSetGContextOfGC(gc, gid)
GC gc;
GContext gid;
{
gc->gid = gid;
}
void
XTestSetVisualIDOfVisual(visual, visualid)
Visual *visual;
VisualID visualid;
{
visual->visualid = visualid;
}
static xReq _dummy_request = {
0, 0, 0
};
Status
XTestDiscard(dpy)
Display *dpy;
{
Bool something;
register char *ptr;
LockDisplay(dpy);
if ((something = (dpy->bufptr != dpy->buffer))) {
for (ptr = dpy->buffer;
ptr < dpy->bufptr;
ptr += (((xReq *)ptr)->length << 2))
dpy->request--;
dpy->bufptr = dpy->buffer;
dpy->last_req = (char *)&_dummy_request;
}
UnlockDisplay(dpy);
SyncHandle();
return something;
}
LIBRARY XTST
VERSION LIBRARY_VERSION
EXPORTS
XTestCompareCurrentCursorWithWindow
XTestCompareCursorWithWindow
XTestDiscard
XTestFakeButtonEvent
XTestFakeDeviceButtonEvent
XTestFakeDeviceKeyEvent
XTestFakeDeviceMotionEvent
XTestFakeKeyEvent
XTestFakeMotionEvent
XTestFakeProximityEvent
XTestFakeRelativeMotionEvent
XTestGrabControl
XTestQueryExtension
XTestSetGContextOfGC
XTestSetVisualIDOfVisual
XRecordQueryVersion
XRecordCreateContext
XRecordAllocRange
XRecordRegisterClients
XRecordUnregisterClients
XRecordGetContext
XRecordFreeState
XRecordEnableContext
XRecordEnableContextAsync
XRecordProcessReplies
XRecordFreeData
XRecordDisableContext
XRecordFreeContext
/* $Xorg: Xtst-def.cpp,v 1.3 2000/08/17 19:46:23 cpqbld Exp $ */
......@@ -403,17 +403,17 @@ $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS)
#if defined(SunArchitecture)
NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext -L ../../../nxcompshad \
-lXcomp -lXcompext -lXcompshad -lrt -L/usr/sfw/lib -lNX_Xrender -lXfixes -lXfont \
-L../../../nx-X11/exports/lib -lNX_Xtst -lXrandr -lXcomposite -lXdmcp \
-L../../../nx-X11/exports/lib -lXtst -lXrandr -lXcomposite -lXdmcp \
`pkg-config --libs libxml-2.0`
#elif defined(cygwinArchitecture)
NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext \
-lXcomp -lXcompext -lNX_Xrender -lX11 -lNX_Xext -lXcomposite -lXfixes -lXfont \
-L ../../../nxcompshad -lXcompshad -L../../../nx-X11/exports/lib -lNX_Xtst -lXdmcp \
-L ../../../nxcompshad -lXcompshad -L../../../nx-X11/exports/lib -lXtst -lXdmcp \
`pkg-config --libs libxml-2.0`
#else
NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext -L ../../../nxcompshad \
-lXcomp -lXcompext -lXcompshad -lNX_Xrender -lNX_X11 -lNX_Xext -lXfixes -lXfont \
-L../../../nx-X11/exports/lib -lNX_Xtst -lXrandr -lXcomposite -lNX_Xinerama -lXdmcp \
-L../../../nx-X11/exports/lib -lXtst -lXrandr -lXcomposite -lNX_Xinerama -lXdmcp \
`pkg-config --libs libxml-2.0`
#endif
......
......@@ -30,7 +30,7 @@ extern void MITMiscExtensionInit(INITARGS);
#ifdef XTEST
extern void XTestExtensionInit(INITARGS);
#define _XTEST_SERVER_
#include <nx-X11/extensions/XTest.h>
#include <nx-X11/extensions/xtestconst.h>
#include <nx-X11/extensions/xteststr.h>
#endif
......
......@@ -46,7 +46,7 @@ from The Open Group.
#include "dixevents.h"
#include "sleepuntil.h"
#define _XTEST_SERVER_
#include <nx-X11/extensions/XTest.h>
#include <nx-X11/extensions/xtestconst.h>
#include <nx-X11/extensions/xteststr.h>
#ifdef XINPUT
#include <nx-X11/extensions/XI.h>
......
......@@ -195,7 +195,7 @@ typedef void (*InitExtension)(INITARGS);
#endif
#ifdef XTEST
#define _XTEST_SERVER_
#include <nx-X11/extensions/XTest.h>
#include <nx-X11/extensions/xtestconst.h>
#endif
#ifdef XKB
#include <nx-X11/extensions/XKB.h>
......
......@@ -38,6 +38,7 @@ BuildRequires: pkgconfig(xdamage)
BuildRequires: pkgconfig(xcomposite)
BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xfixes)
BuildRequires: pkgconfig(xtst)
%else
BuildRequires: libexpat-devel
BuildRequires: libpng-devel
......@@ -51,6 +52,7 @@ BuildRequires: xorg-x11-libXdamage-devel
BuildRequires: xorg-x11-libXcomposite-devel
BuildRequires: xorg-x11-libXrandr-devel
BuildRequires: xorg-x11-libXfixes-devel
BuildRequires: xorg-x11-libXtst-devel
%endif
BuildRequires: xorg-x11-util-devel
%endif
......@@ -64,6 +66,7 @@ BuildRequires: libXdmcp-devel
BuildRequires: libXcomposite-devel
BuildRequires: libXrandr-devel
BuildRequires: libXfixes-devel
BuildRequires: libXtst-devel
%endif
# For imake
......@@ -291,26 +294,6 @@ The Xrender library is designed as a lightweight library interface to
the Render extension.
%package -n libNX_Xtst6
Group: System Environment/Libraries
Summary: Xlib-based client API for the XTEST and RECORD extensions on NX
Requires: %{name}%{?_isa} >= 3.5.0.29
Obsoletes: libNX_Xtst
%description -n libNX_Xtst6
NX is a software suite which implements very efficient compression of
the X11 protocol. This increases performance when using X
applications over a network, especially a slow one.
The XTEST extension is a minimal set of client and server extensions
required to completely test the X11 server with no user intervention.
This extension is not intended to support general journaling and
playback of user actions.
The RECORD extension supports the recording and reporting of all core
X protocol and arbitrary X extension protocol.
%package -n libXcomp-devel
Group: Development/Libraries
Summary: Development files for the NX differential compression library
......@@ -443,10 +426,6 @@ Provides: nx%{?_isa} = %{version}-%{release}
Requires: xorg-x11-fonts-core
%endif
# Should be a weak dependency, because this package
# works without the dependency.
Requires: xkeyboard-config
%description -n nxagent
NX is a software suite which implements very efficient compression of
the X11 protocol. This increases performance when using X
......@@ -589,7 +568,6 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X
%post -n libNX_Xext6 -p /sbin/ldconfig
%post -n libNX_Xinerama1 -p /sbin/ldconfig
%post -n libNX_Xrender1 -p /sbin/ldconfig
%post -n libNX_Xtst6 -p /sbin/ldconfig
%post -n libXcomp3 -p /sbin/ldconfig
%post -n libXcompext3 -p /sbin/ldconfig
%post -n libXcompshad3 -p /sbin/ldconfig
......@@ -599,7 +577,6 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X
%postun -n libNX_Xext6 -p /sbin/ldconfig
%postun -n libNX_Xinerama1 -p /sbin/ldconfig
%postun -n libNX_Xrender1 -p /sbin/ldconfig
%postun -n libNX_Xtst6 -p /sbin/ldconfig
%postun -n libXcomp3 -p /sbin/ldconfig
%postun -n libXcompext3 -p /sbin/ldconfig
%postun -n libXcompshad3 -p /sbin/ldconfig
......@@ -672,7 +649,6 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X
%{_includedir}/nx-X11/extensions/shape.h
%{_includedir}/nx-X11/extensions/sync.h
%{_includedir}/nx-X11/extensions/xtestext1.h
%{_includedir}/nx-X11/extensions/xteststr.h
%files -n libNX_Xext6
%defattr(-,root,root)
......@@ -691,10 +667,6 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X
%defattr(-,root,root)
%{_libdir}/libNX_Xrender.so.1*
%files -n libNX_Xtst6
%defattr(-,root,root)
%{_libdir}/libNX_Xtst.so.6*
%files -n libXcomp-devel
%defattr(-,root,root)
%_libdir/libXcomp.so
......@@ -751,10 +723,8 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X
%files devel
%defattr(-,root,root)
%{_libdir}/libNX_Xinerama.so
%{_libdir}/libNX_Xtst.so
%{_includedir}/nx-X11/X10.h
%dir %{_includedir}/nx-X11/extensions
%{_includedir}/nx-X11/extensions/XTest.h
%{_includedir}/nx-X11/extensions/Xevie.h
%{_includedir}/nx-X11/extensions/Xinerama.h
%{_includedir}/nx-X11/extensions/lbxbuf.h
......@@ -825,6 +795,8 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X
%{_includedir}/nx-X11/extensions/xf86vmstr.h
%{_includedir}/nx-X11/extensions/xfixesproto.h
%{_includedir}/nx-X11/extensions/xfixeswire.h
%{_includedir}/nx-X11/extensions/xtestconst.h
%{_includedir}/nx-X11/extensions/xteststr.h
%{_includedir}/nx-X11/extensions/xtrapbits.h
%{_includedir}/nx-X11/extensions/xtrapddmi.h
%{_includedir}/nx-X11/extensions/xtrapdi.h
......
......@@ -151,7 +151,7 @@ all: depend $(LIBARCHIVE) $(LIBDLL)
else
EXTRALIBS = -lNX_Xext -lNX_Xtst -lXrandr -lXdamage
EXTRALIBS = -lNX_Xext -lXtst -lXrandr -lXdamage
all: depend $(LIBFULL) $(LIBLOAD) $(LIBSHARED) $(LIBARCHIVE)
......
......@@ -25,7 +25,7 @@
#include <nx-X11/Xlibint.h>
#include <nx-X11/Xproto.h>
#include <nx-X11/keysym.h>
#include <nx-X11/extensions/XTest.h>
#include "X11/include/XTest_nxcompshad.h"
#include <string.h>
#include <sys/ipc.h>
#include <sys/shm.h>
......
/* $Xorg: XTest.h,v 1.5 2001/02/09 02:03:24 xorgcvs Exp $ */
/*
Copyright 1992, 1998 The Open Group
......@@ -24,31 +23,12 @@ 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/include/extensions/XTest.h,v 3.3 2001/12/14 19:53:28 dawes Exp $ */
#ifndef _XTEST_H_
#define _XTEST_H_
#include <nx-X11/Xfuncproto.h>
#define X_XTestGetVersion 0
#define X_XTestCompareCursor 1
#define X_XTestFakeInput 2
#define X_XTestGrabControl 3
#define XTestNumberEvents 0
#define XTestNumberErrors 0
#define XTestMajorVersion 2
#define XTestMinorVersion 2
#define XTestExtensionName "XTEST"
#ifndef _XTEST_SERVER_
#include <nx-X11/extensions/XInput.h>
_XFUNCPROTOBEGIN
Bool XTestQueryExtension(
......@@ -59,17 +39,6 @@ Bool XTestQueryExtension(
int* /* minorp */
);
Bool XTestCompareCursorWithWindow(
Display* /* dpy */,
Window /* window */,
Cursor /* cursor */
);
Bool XTestCompareCurrentCursorWithWindow(
Display* /* dpy */,
Window /* window */
);
extern int XTestFakeKeyEvent(
Display* /* dpy */,
unsigned int /* keycode */,
......@@ -92,73 +61,11 @@ extern int XTestFakeMotionEvent(
unsigned long /* delay */
);
extern int XTestFakeRelativeMotionEvent(
Display* /* dpy */,
int /* x */,
int /* y */,
unsigned long /* delay */
);
extern int XTestFakeDeviceKeyEvent(
Display* /* dpy */,
XDevice* /* dev */,
unsigned int /* keycode */,
Bool /* is_press */,
int* /* axes */,
int /* n_axes */,
unsigned long /* delay */
);
extern int XTestFakeDeviceButtonEvent(
Display* /* dpy */,
XDevice* /* dev */,
unsigned int /* button */,
Bool /* is_press */,
int* /* axes */,
int /* n_axes */,
unsigned long /* delay */
);
extern int XTestFakeProximityEvent(
Display* /* dpy */,
XDevice* /* dev */,
Bool /* in_prox */,
int* /* axes */,
int /* n_axes */,
unsigned long /* delay */
);
extern int XTestFakeDeviceMotionEvent(
Display* /* dpy */,
XDevice* /* dev */,
Bool /* is_relative */,
int /* first_axis */,
int* /* axes */,
int /* n_axes */,
unsigned long /* delay */
);
extern int XTestGrabControl(
Display* /* dpy */,
Bool /* impervious */
);
void XTestSetGContextOfGC(
GC /* gc */,
GContext /* gid */
);
void XTestSetVisualIDOfVisual(
Visual* /* visual */,
VisualID /* visualid */
);
Status XTestDiscard(
Display* /* dpy */
);
_XFUNCPROTOEND
#endif /* _XTEST_SERVER_ */
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment