aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2018-11-07 21:29:19 +0100
committerUlrich Sibiller <uli42@gmx.de>2019-05-10 19:02:51 +0200
commitb32a984f8f34d34fcc4114028712367c47c545d7 (patch)
treeb89c98d30a8c36d3fc75b06503539ff364f87361 /nx-X11
parentdece08252b6696b74091ebcde3dc557e2e60171b (diff)
downloadnx-libs-b32a984f8f34d34fcc4114028712367c47c545d7.tar.gz
nx-libs-b32a984f8f34d34fcc4114028712367c47c545d7.tar.bz2
nx-libs-b32a984f8f34d34fcc4114028712367c47c545d7.zip
Die XTESTEXT1, die!
commit a73e0f8cdfec1c9199ffe696146ba7d677c4c10d Author: Daniel Stone <daniel@fooishbar.org> Date: Thu Jun 1 18:47:47 2006 +0000 Die XTESTEXT1, die! Citing an email from the xorg-modular mailing list: On Tuesday 21 February 2006 23:04, Enrico Weigelt wrote: > Hi folks, > > I'm wondering what's the difference between XTEST and XTESTEXT1 > (the second one can be configured w/ my current patch ...) > Are they both the same ( -> XTest extension ) ? > Can I put both symbols together ? They're not the same extension. XTest is the one you want, if you want either. The other hasn't been built by default in ages and I should probably go ahead and nuke it from the tree. - ajax
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/include/extensions/Imakefile2
-rw-r--r--nx-X11/include/extensions/xtestext1.h325
-rw-r--r--nx-X11/programs/Xserver/Xext/Imakefile6
-rw-r--r--nx-X11/programs/Xserver/Xext/xtest1dd.c1612
-rw-r--r--nx-X11/programs/Xserver/Xext/xtest1dd.h126
-rw-r--r--nx-X11/programs/Xserver/Xext/xtest1di.c915
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Imakefile2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/TestExt.c91
-rw-r--r--nx-X11/programs/Xserver/mi/miinitext.c6
-rw-r--r--nx-X11/programs/Xserver/os/WaitFor.c20
10 files changed, 5 insertions, 3100 deletions
diff --git a/nx-X11/include/extensions/Imakefile b/nx-X11/include/extensions/Imakefile
index cdd2446fb..29f3b97fa 100644
--- a/nx-X11/include/extensions/Imakefile
+++ b/nx-X11/include/extensions/Imakefile
@@ -54,7 +54,7 @@ HEADERS = \
xcmiscstr.h \
bigreqstr.h \
XI.h XIproto.h \
- xtestconst.h xtestext1.h xteststr.h \
+ xtestconst.h xteststr.h \
XKB.h XKBgeom.h XKBproto.h XKBstr.h XKBsrv.h \
Xdbeproto.h \
$(EXTRAHEADERS) \
diff --git a/nx-X11/include/extensions/xtestext1.h b/nx-X11/include/extensions/xtestext1.h
deleted file mode 100644
index 5b67d7856..000000000
--- a/nx-X11/include/extensions/xtestext1.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * xtestext1.h
- *
- * X11 Input Synthesis Extension include file
- */
-
-/*
-
-
-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.
-
-*/
-
-/*
- * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
- */
-
-/*
- * used in the XTestPressButton and XTestPressKey functions
- */
-#define XTestPRESS 1 << 0
-#define XTestRELEASE 1 << 1
-#define XTestSTROKE 1 << 2
-
-/*
- * When doing a key or button stroke, the number of milliseconds
- * to delay between the press and the release of a key or button
- * in the XTestPressButton and XTestPressKey functions.
- */
-
-#define XTestSTROKE_DELAY_TIME 10
-
-/*
- * used in the XTestGetInput function
- */
-#define XTestEXCLUSIVE 1 << 0
-#define XTestPACKED_ACTIONS 1 << 1
-#define XTestPACKED_MOTION 1 << 2
-
-/*
- * used in the XTestFakeInput function
- */
-#define XTestFAKE_ACK_NOT_NEEDED 0
-#define XTestFAKE_ACK_REQUEST 1
-
-/*
- * used in the XTest extension initialization routine
- */
-#define XTestEXTENSION_NAME "XTestExtension1"
-#define XTestEVENT_COUNT 2
-
-/*
- * XTest request type values
- *
- * used in the XTest extension protocol requests
- */
-#define X_TestFakeInput 1
-#define X_TestGetInput 2
-#define X_TestStopInput 3
-#define X_TestReset 4
-#define X_TestQueryInputSize 5
-
-/*
- * This defines the maximum size of a list of input actions
- * to be sent to the server. It should always be a multiple of
- * 4 so that the entire xTestFakeInputReq structure size is a
- * multiple of 4.
- */
-#define XTestMAX_ACTION_LIST_SIZE 64
-
-typedef struct {
- CARD8 reqType; /* always XTestReqCode */
- CARD8 XTestReqType; /* always X_TestFakeInput */
- CARD16 length B16; /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */
- CARD32 ack B32;
- CARD8 action_list[XTestMAX_ACTION_LIST_SIZE];
-} xTestFakeInputReq;
-#define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8)
-
-typedef struct {
- CARD8 reqType; /* always XTestReqCode */
- CARD8 XTestReqType; /* always X_TestGetInput */
- CARD16 length B16; /* 2 */
- CARD32 mode B32;
-} xTestGetInputReq;
-#define sz_xTestGetInputReq 8
-
-typedef struct {
- CARD8 reqType; /* always XTestReqCode */
- CARD8 XTestReqType; /* always X_TestStopInput */
- CARD16 length B32; /* 1 */
-} xTestStopInputReq;
-#define sz_xTestStopInputReq 4
-
-typedef struct {
- CARD8 reqType; /* always XTestReqCode */
- CARD8 XTestReqType; /* always X_TestReset */
- CARD16 length B16; /* 1 */
-} xTestResetReq;
-#define sz_xTestResetReq 4
-
-typedef struct {
- CARD8 reqType; /* always XTestReqCode */
- CARD8 XTestReqType; /* always X_TestQueryInputSize */
- CARD16 length B16; /* 1 */
-} xTestQueryInputSizeReq;
-#define sz_xTestQueryInputSizeReq 4
-
-/*
- * This is the definition of the reply for the xTestQueryInputSize
- * request. It should remain the same minimum size as other replies
- * (32 bytes).
- */
-typedef struct {
- CARD8 type; /* always X_Reply */
- CARD8 pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32; /* always 0 */
- CARD32 size_return B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xTestQueryInputSizeReply;
-
-/*
- * This is the definition for the input action wire event structure.
- * This event is sent to the client when the server has one or
- * more user input actions to report to the client. It must
- * remain the same size as all other wire events (32 bytes).
- */
-#define XTestACTIONS_SIZE 28
-
-typedef struct {
- CARD8 type; /* always XTestInputActionType */
- CARD8 pad00;
- CARD16 sequenceNumber B16;
- CARD8 actions[XTestACTIONS_SIZE];
-} xTestInputActionEvent;
-
-/*
- * This is the definition for the xTestFakeAck wire event structure.
- * This event is sent to the client when the server has completely
- * processed its input action buffer, and is ready for more.
- * It must remain the same size as all other wire events (32 bytes).
- */
-typedef struct {
- CARD8 type; /* always XTestFakeAckType */
- CARD8 pad00;
- CARD16 sequenceNumber B16;
- CARD32 pad02 B32;
- CARD32 pad03 B32;
- CARD32 pad04 B32;
- CARD32 pad05 B32;
- CARD32 pad06 B32;
- CARD32 pad07 B32;
- CARD32 pad08 B32;
-} xTestFakeAckEvent;
-
-/*
- * The server side of this extension does not (and should not) have
- * definitions for Display and Window. The ifndef allows the server
- * side of the extension to ignore the following typedefs.
- */
-#ifndef XTestSERVER_SIDE
-/*
- * This is the definition for the input action host format event structure.
- * This is the form that a client using this extension will see when
- * it receives an input action event.
- */
-typedef struct {
- int type; /* always XTestInputActionType */
- Display *display;
- Window window;
- CARD8 actions[XTestACTIONS_SIZE];
-} XTestInputActionEvent;
-
-/*
- * This is the definition for the xTestFakeAck host format event structure.
- * This is the form that a client using this extension will see when
- * it receives an XTestFakeAck event.
- */
-typedef struct {
- int type; /* always XTestFakeAckType */
- Display *display;
- Window window;
-} XTestFakeAckEvent;
-#endif
-
-/*
- * This is the definition for the format of the header byte
- * in the input action structures.
- */
-#define XTestACTION_TYPE_MASK 0x03 /* bits 0 and 1 */
-#define XTestKEY_STATE_MASK 0x04 /* bit 2 (key action) */
-#define XTestX_SIGN_BIT_MASK 0x04 /* bit 2 (motion action) */
-#define XTestY_SIGN_BIT_MASK 0x08 /* bit 3 (motion action) */
-#define XTestDEVICE_ID_MASK 0xf0 /* bits 4 through 7 */
-
-#define XTestMAX_DEVICE_ID 0x0f
-#define XTestPackDeviceID(x) (((x) & XTestMAX_DEVICE_ID) << 4)
-#define XTestUnpackDeviceID(x) (((x) & XTestDEVICE_ID_MASK) >> 4)
-
-/*
- * These are the possible action types.
- */
-#define XTestDELAY_ACTION 0
-#define XTestKEY_ACTION 1
-#define XTestMOTION_ACTION 2
-#define XTestJUMP_ACTION 3
-
-/*
- * These are the definitions for key/button motion input actions.
- */
-#define XTestKEY_UP 0x04
-#define XTestKEY_DOWN 0x00
-
-typedef struct {
- CARD8 header; /* which device, key up/down */
- CARD8 keycode; /* which key/button to move */
- CARD16 delay_time B16; /* how long to delay (in ms) */
-} XTestKeyInfo;
-
-/*
- * This is the definition for pointer jump input actions.
- */
-typedef struct {
- CARD8 header; /* which pointer */
- CARD8 pad1; /* unused padding byte */
- CARD16 jumpx B16; /* x coord to jump to */
- CARD16 jumpy B16; /* y coord to jump to */
- CARD16 delay_time B16; /* how long to delay (in ms) */
-} XTestJumpInfo;
-
-/*
- * These are the definitions for pointer relative motion input
- * actions.
- *
- * The sign bits for the x and y relative motions are contained
- * in the header byte. The x and y relative motions are packed
- * into one byte to make things fit in 32 bits. If the relative
- * motion range is larger than +/-15, use the pointer jump action.
- */
-#define XTestMOTION_MAX 15
-#define XTestMOTION_MIN -15
-
-#define XTestX_NEGATIVE 0x04
-#define XTestY_NEGATIVE 0x08
-
-#define XTestX_MOTION_MASK 0x0f
-#define XTestY_MOTION_MASK 0xf0
-
-#define XTestPackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
-#define XTestPackYMotionValue(x) (((x) << 4) & XTestY_MOTION_MASK)
-
-#define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
-#define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4)
-
-typedef struct {
- CARD8 header; /* which pointer */
- CARD8 motion_data; /* x,y relative motion */
- CARD16 delay_time B16; /* how long to delay (in ms) */
-} XTestMotionInfo;
-
-/*
- * These are the definitions for a long delay input action. It is
- * used when more than XTestSHORT_DELAY_TIME milliseconds of delay
- * (approximately one minute) is needed.
- *
- * The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
- * This guarantees that a header byte with a value of 0 is not
- * a valid header, so it can be used as a flag to indicate that
- * there are no more input actions in an XTestInputAction event.
- */
-
-#define XTestSHORT_DELAY_TIME 0xffff
-#define XTestDELAY_DEVICE_ID 0x0f
-
-typedef struct {
- CARD8 header; /* always XTestDELAY_DEVICE_ID */
- CARD8 pad1; /* unused padding byte */
- CARD16 pad2 B16; /* unused padding word */
- CARD32 delay_time B32; /* how long to delay (in ms) */
-} XTestDelayInfo;
diff --git a/nx-X11/programs/Xserver/Xext/Imakefile b/nx-X11/programs/Xserver/Xext/Imakefile
index becc7b66e..8262f667d 100644
--- a/nx-X11/programs/Xserver/Xext/Imakefile
+++ b/nx-X11/programs/Xserver/Xext/Imakefile
@@ -73,21 +73,21 @@ XF86BIGFOBJS = xf86bigfont.o
#endif
SRCS = shape.c $(SHMSRCS) xcmisc.c\
- xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
+ xtest.c sleepuntil.c \
bigreq.c sync.c $(SCRNSAVSRC) \
$(XF86BIGFSRCS) $(SECURITYSRCS) \
$(PNRXSRCS) $(DPMSSRCS) \
$(XVSRCS) $(XRESSRCS) $(DMXSRCS)
OBJS = shape.o $(SHMOBJS) xcmisc.o \
- xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
+ xtest.o sleepuntil.o \
bigreq.o sync.o $(SCRNSAVOBJ) \
$(XF86BIGFOBJS) $(SECURITYOBJS) \
$(PNRXOBJS) $(DPMSOBJS) \
$(XVOBJS) $(XRESOBJS) $(DMXOBJS)
SOBJS = $(SHMOBJS) $(SECURITYOBJS) \
- shape.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \
+ shape.o xtest.o sleepuntil.o $(PNRXOBJS) \
$(XF86BIGFOBJS)
#if defined(NXAgentServer) && NXAgentServer
diff --git a/nx-X11/programs/Xserver/Xext/xtest1dd.c b/nx-X11/programs/Xserver/Xext/xtest1dd.c
deleted file mode 100644
index e3a7aa07e..000000000
--- a/nx-X11/programs/Xserver/Xext/xtest1dd.c
+++ /dev/null
@@ -1,1612 +0,0 @@
-/*
- * File: xtest1dd.c
- *
- * This file contains the device dependent 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.
-
-*/
-
-/***************************************************************
- * include files
- ***************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <nx-X11/Xos.h>
-#include <nx-X11/X.h>
-#include <nx-X11/Xmd.h>
-#include <nx-X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#define XTestSERVER_SIDE
-#include <nx-X11/extensions/xtestext1.h>
-
-#include "xtest1dd.h"
-
-/***************************************************************
- * defines
- ***************************************************************/
-
-/*
- * the size of the fake input action array
- */
-#define ACTION_ARRAY_SIZE 100
-
-/***************************************************************
- * externals
- ***************************************************************/
-
-/*
- * Holds the xTestInputAction event type code.
- * This is defined in xtestext1di.c.
- */
-extern int XTestInputActionType;
-/*
- * Holds the xTestFakeAck event type code.
- * This is defined in xtestext1di.c.
- */
-extern int XTestFakeAckType;
-/*
- * used in the WriteReplyToClient macro
- */
-extern int exclusive_steal;
-
-/***************************************************************
- * variables
- ***************************************************************/
-
-/*
- * array to hold fake input actions
- */
-struct {
- /*
- * holds the action type, one of: XTestDELAY_ACTION,
- * XTestKEY_ACTION, XTestMOTION_ACTION, XTestJUMP_ACTION
- */
- CARD8 type;
- /*
- * holds the device type, in the range 0 to 15
- */
- CARD8 device;
- /*
- * for XTestKEY_ACTION type, holds the keycode
- */
- CARD8 keycode;
- /*
- * for XTestKEY_ACTION type, holds the key up/down state
- */
- CARD8 keystate;
- /*
- * for XTestMOTION_ACTION and XTestJUMP_ACTION types,
- * holds the x and y coordinates to move the mouse to
- */
- int x;
- int y;
- /*
- * holds the time to delay (in milliseconds) before performing
- * the action
- */
- CARD32 delay_time;
-}action_array[ACTION_ARRAY_SIZE];
-
-/*
- * write index for input action array
- */
-static int write_index = 0;
-/*
- * read index for input action array
- */
-static int read_index = 0;
-/*
- * this is where the input actions are accumulated until they are sent
- * to a client (in a wire event)
- */
-static xTestInputActionEvent input_action_packet;
-/*
- * holds the index (in bytes) into the input actions buffer in the
- * current input action event
- */
-static int packet_index;
-/*
- * logical x position of the mouse during input action gathering
- */
-short xtest_mousex;
-/*
- * logical y position of the mouse during input action gathering
- */
-short xtest_mousey;
-/*
- * logical x position of the mouse while we are reading fake input actions
- * from the client and putting them into the fake input action array
- */
-static short pmousex;
-/*
- * logical y position of the mouse while we are reading fake input actions
- * from the client and putting them into the fake input action array
- */
-static short pmousey;
-/*
- * The playback_on flag is set to 1 while there are input actions in the
- * input action array. It is set to 0 when the server has received all of
- * the user actions.
- */
-int playback_on = 0;
-/*
- * identity of the client using XTestGetInput to get user input actions
- */
-ClientPtr current_xtest_client;
-/*
- * if 1 send multiple input actions per XTestInputAction event;
- * if 0 send one input action per XTestInputAction event
- */
-static char packed_mode;
-/*
- * identity of the client using the XTestFakeInput function to send some
- * fake input actions to the server
- */
-ClientPtr playback_client = NULL;
-/*
- * Set to 1 when the XTestFAKE_ACK_REQUEST flag is set in a XTestFakeInput
- * request. Set back to 0 when all of the input actions have been sent
- * to the server.
- */
-static int acknowledge = 0;
-/*
- * The server's idea of the current time is saved in these variables when
- * a XTestFakeInput request is received. It is restored when all fake input
- * actions are sent to the server or when the playback client disconnects.
- */
-static int saved_sec;
-static int saved_usec;
-/*
- * Set to 1 when there is a valid time in saved_sec and saved_usec.
- */
-static int time_saved = 0;
-/*
- * holds the extension's notion of what the current time is while it is
- * sending input actions to a client
- */
-static struct timeval current_time;
-/*
- * holds the time when the extension should place the next fake input action
- * into the server's normal events queue
- */
-static struct timeval play_time;
-/*
- * set to 1 when play_time is first set, cleared to 0 when the
- * client using the extension disconnects, or when XTestReset is called
- */
-static char play_clock = 0;
-/*
- * holds the amount of time left until the next input action from the
- * input action array can be sent to the server
- */
-static struct timeval rtime;
-/*
- * Set to 1 after the extension is done waiting for the correct time delay
- * for an input action to be sent to the server. Remains a 1 until the time
- * delay for the next input action is computed. Then set to 0 if the
- * extension has to wait for the correct time delay.
- */
-static int go_for_next = 1;
-/*
- * needed to restore waitime if playback is to be aborted
- */
-static struct timeval *restorewait;
-/*
- * tmon special command key
- *
- * To use the test monitor program (called tmon) efficiently, it is
- * desirable to have the extension be able to recognize a special "trigger"
- * key. If the extension did not do this, tmon would have to have the
- * extension send all keyboard user input actions exclusively to tmon,
- * only to have tmon send them right back if they were not the command key.
- *
- * If the extension can recognize the command key, then tmon can let the
- * extension handle keyboard user input actions normally until the command
- * key is pressed (and released), and only then have the extension start
- * sending keyboard user input actions exclusively to tmon.
- *
- * Any key on the keyboard can be used for this command key. It is most
- * convenient if it is a low-frequency key. If you want to generate a
- * normal occurrance of this key to a client, just hit it twice. Tmon
- * will recognize the first occurrance of the key, take control of the input
- * actions, and wait for certain keys. If it sees another occurrance of the
- * command key, it will send one occurrance of the command key to the
- * extension, and go back to waiting.
- *
- * set and also referenced in device layer
- * XXX there should be a way to set this through the protocol
- */
-KeyCode xtest_command_key = 0;
-
-/***************************************************************
- * function declarations
- ***************************************************************/
-
-static void parse_key_fake(
- XTestKeyInfo * /* fkey */
- );
-static void parse_motion_fake(
- XTestMotionInfo * /* fmotion */
- );
-static void parse_jump_fake(
- XTestJumpInfo * /* fjump */
- );
-static void parse_delay_fake(
- XTestDelayInfo * /* tevent */
- );
-static void send_ack(
- ClientPtr /* client */
- );
-static void start_play_clock(
- void
- );
-static void compute_action_time(
- struct timeval * /* rtime */
- );
-static int find_residual_time(
- struct timeval * /* rtime */
- );
-
-static CARD16 check_time_event(
- void
- );
-static CARD32 current_ms(
- struct timeval * /* otime */
- );
-static int there_is_room(
- int /* actsize */
- );
-
-/******************************************************************************
- *
- * stop_stealing_input
- *
- * Stop stealing input actions.
- */
-void
-stop_stealing_input()
-{
-/*
- * put any code that you might need to stop stealing input actions here
- */
- if (packet_index != 0)
- {
- /*
- * if there is a partially full input action event waiting
- * when this function is called, send it to the client
- */
- flush_input_actions();
- }
-}
-
-/******************************************************************************
- *
- * steal_input
- *
- * Start stealing input actions and sending them to the passed-in client.
- */
-void
-steal_input(client, mode)
-/*
- * which client is to receive the input action events
- */
-ClientPtr client;
-/*
- * what input action packing mode to use. one of 0, XTestPACKED_MOTION,
- * or XTestPACKED_ACTIONS; optionally 'or'ed with XTestEXCLUSIVE,
- */
-CARD32 mode;
-{
- if (packet_index != 0)
- {
- /*
- * if there is a partially full input action event waiting
- * when this function is called, send it to the client
- */
- flush_input_actions();
- }
- else
- {
- /*
- * otherwise, set up a new input action event
- */
- input_action_packet.type = XTestInputActionType;
- packet_index = 0;
- }
- /*
- * set up the new input action packing mode
- */
- packed_mode = mode & ~(XTestEXCLUSIVE);
- /*
- * keep track of where the mouse is
- */
- XTestGetPointerPos(&xtest_mousex, &xtest_mousey);
- /*
- * keep track of which client is getting input actions
- */
- current_xtest_client = client;
- /*
- * find out what time it is
- */
- X_GETTIMEOFDAY(&current_time);
- /*
- * jump to the initial position of the mouse, using a device type of 0.
- */
- XTestStealJumpData(xtest_mousex, xtest_mousey, 0);
-}
-
-/******************************************************************************
- *
- * flush_input_actions
- *
- * Write the input actions event to the current requesting client
- * and re-initialize the input action event.
- */
-void
-flush_input_actions()
-{
- /*
- * pointer to the input action event
- */
- char *rep;
- /*
- * loop index
- */
- int i;
-
- if (packet_index == 0)
- {
- /*
- * empty input actions event
- */
- return;
- }
- else if (packet_index < XTestACTIONS_SIZE)
- {
- /*
- * fill to the end of the input actions event with 0's
- */
- for (i = packet_index; i <XTestACTIONS_SIZE; i++)
- {
- input_action_packet.actions[i] = 0;
- }
- }
- rep = (char *) (&input_action_packet);
-
- /*
- * set the serial number of the input action event
- */
- input_action_packet.sequenceNumber = current_xtest_client->sequence;
- /*
- * send the input action event to the client
- */
- WriteEventsToClient(current_xtest_client, 1, (xEvent *) rep);
- /*
- * re-initialize the input action event
- */
- input_action_packet.type = XTestInputActionType;
- packet_index = 0;
-}
-
-/******************************************************************************
- *
- * XTestStealJumpData
- *
- * Create one or more input actions and put them in the input action
- * event. The input actions will be an (maybe) XTestDELAY_ACTION
- * and an XTestJUMP_ACTION.
- */
-void
-XTestStealJumpData(jx, jy, dev_type)
-/*
- * the x and y coordinates to jump to
- */
-int jx;
-int jy;
-/*
- * which device caused the jump
- */
-int dev_type;
-{
- XTestJumpInfo *jmp_ptr;
- /*
- * time delta (in ms) from previous event
- */
- CARD16 tchar;
-
- /*
- * Get the time delta from the previous event. If needed,
- * the check_time_event routine will put an XTestDELAY_ACTION
- * type action in the input action event.
- */
- tchar = check_time_event();
- if (!there_is_room(sizeof(XTestJumpInfo)))
- {
- /*
- * If there isn't room in the input action event for
- * an XTestJUMP_ACTION, then send that event to the
- * client and start filling an empty one.
- */
- flush_input_actions();
- }
- /*
- * update the logical mouse position
- */
- xtest_mousex = jx;
- xtest_mousey = jy;
- /*
- * point jmp_ptr to the correct place in the input action event
- */
- jmp_ptr = (XTestJumpInfo *)
- &(input_action_packet.actions[packet_index]);
- /*
- * compute the input action header
- */
- jmp_ptr->header = (XTestPackDeviceID(dev_type) | XTestJUMP_ACTION);
- /*
- * set the x and y coordinates to jump to in the input action
- */
- jmp_ptr->jumpx = jx;
- jmp_ptr->jumpy = jy;
- /*
- * set the delay time in the input action
- */
- jmp_ptr->delay_time = tchar;
- /*
- * increment the packet index by the size of the input action
- */
- packet_index = packet_index + sizeof(XTestJumpInfo);
- if (packed_mode == 0)
- {
- /*
- * if input actions are not packed, send the input
- * action event to the client
- */
- flush_input_actions();
- }
-}
-
-/******************************************************************************
- *
- * current_ms
- *
- * Returns the number of milliseconds from the passed-in time to the
- * current time, and then updates the passed-in time to the current time.
- */
-static CARD32
-current_ms(otime)
-struct timeval *otime;
-{
- struct timeval tval;
- unsigned long the_ms;
- unsigned long sec;
- unsigned long usec;
-
- /*
- * get the current time
- */
- X_GETTIMEOFDAY(&tval);
- if (tval.tv_usec < otime->tv_usec)
- {
- /*
- * borrow a second's worth of microseconds if needed
- */
- usec = tval.tv_usec - otime->tv_usec + 1000000;
- sec = tval.tv_sec - 1 - otime->tv_sec;
- }
- else
- {
- usec = tval.tv_usec - otime->tv_usec;
- sec = tval.tv_sec - otime->tv_sec;
- }
- /*
- * update the passed-in time to the new time
- */
- *otime = tval;
- /*
- * compute the number of milliseconds contained in
- * 'sec' seconds and 'usec' microseconds
- */
- the_ms = (sec * 1000000L + usec) / 1000L;
- return (the_ms);
-}
-
-/******************************************************************************
- *
- * check_time_event
- *
- * If time delta is > XTestSHORT_DELAY_TIME then insert a time event
- * and return 0; else return the delay time.
- */
-static CARD16
-check_time_event()
-{
- CARD32 tstamp;
- CARD16 tchar;
- XTestDelayInfo *tptr;
-
- /*
- * get the number of milliseconds between input actions
- */
- tstamp = current_ms(&current_time);
- /*
- * if the number of milliseconds is too large to fit in a CARD16,
- * then add a XTestDELAY_ACTION to the input action event.
- */
- if (tstamp > XTestSHORT_DELAY_TIME)
- {
- /*
- * If there isn't room in the input action event for
- * an XTestDELAY_ACTION, then send that event to the
- * client and start filling an empty one.
- */
- if (!there_is_room(sizeof(XTestDelayInfo)))
- {
- flush_input_actions();
- }
- /*
- * point tptr to the correct place in the input action event
- */
- tptr = (XTestDelayInfo *)
- (&(input_action_packet.actions[packet_index]));
- /*
- * compute the input action header
- */
- tptr->header = XTestPackDeviceID(XTestDELAY_DEVICE_ID) |
- XTestDELAY_ACTION;
- /*
- * set the delay time in the input action
- */
- tptr->delay_time = tstamp;
- /*
- * increment the packet index by the size of the input action
- */
- packet_index = packet_index + (sizeof(XTestDelayInfo));
- if (packed_mode != XTestPACKED_ACTIONS)
- {
- /*
- * if input actions are not packed, send the input
- * action event to the client
- */
- flush_input_actions();
- }
- /*
- * set the returned delay time to 0
- */
- tchar = 0;
- }
- else
- {
- /*
- * set the returned delay time to the computed delay time
- */
- tchar = tstamp;
- }
- return(tchar);
-}
-
-/******************************************************************************
- *
- * there_is_room
- *
- * Checks if there is room in the input_action_packet for an input action
- * of the size actsize bytes. Returns 1 if there is space, 0 otherwise.
- *
- */
-static int
-there_is_room(actsize)
-/*
- * the number of bytes of space needed
- */
-int actsize;
-{
- if ((packet_index + actsize) > XTestACTIONS_SIZE)
- {
- return(0);
- }
- else
- {
- return(1);
- }
-}
-
-/******************************************************************************
- *
- * XTestStealMotionData
- *
- * Put motion information from the locator into an input action.
- *
- * called from x_hil.c
- */
-void
-XTestStealMotionData(dx, dy, dev_type, mx, my)
-/*
- * the x and y delta motion of the locator
- */
-int dx;
-int dy;
-/*
- * which locator did the moving
- */
-int dev_type;
-/*
- * the x and y position of the locator before the delta motion
- */
-int mx;
-int my;
-{
- /*
- * pointer to a XTestMOTION_ACTION input action
- */
- XTestMotionInfo *fm;
- /*
- * time delta from previous event
- */
- CARD16 tchar;
-
- /*
- * if the current position of the locator is not the same as
- * the logical position, then update the logical position
- */
- if ((mx != xtest_mousex) || (my != xtest_mousey))
- {
- XTestStealJumpData(mx, my, dev_type);
- }
- /*
- * if the delta motion is outside the range that can
- * be held in a motion input action, use a jump input action
- */
- if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) ||
- (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN))
- {
- XTestStealJumpData((xtest_mousex + dx),
- (xtest_mousey + dy), dev_type);
- }
- else
- {
- /*
- * compute the new logical position of the mouse
- */
- xtest_mousex += dx;
- xtest_mousey += dy;
- /*
- * Get the time delta from the previous event. If needed,
- * the check_time_event routine will put an XTestDELAY_ACTION
- * type action in the input action event.
- */
- tchar = check_time_event();
- /*
- * If there isn't room in the input action event for
- * an XTestDELAY_ACTION, then send that event to the
- * client and start filling an empty one.
- */
- if (!there_is_room(sizeof(XTestMotionInfo)))
- {
- flush_input_actions();
- /*
- * point fm to the correct place in the input action event
- */
- }
- fm = (XTestMotionInfo *)
- &(input_action_packet.actions[packet_index]);
- /*
- * compute the input action header
- */
- fm->header = XTestMOTION_ACTION;
- if (dx < 0)
- {
- fm->header |= XTestX_NEGATIVE;
- dx = abs(dx);
- }
- if (dy < 0)
- {
- fm->header |= XTestY_NEGATIVE;
- dy = abs(dy);
- }
- fm->header |= XTestPackDeviceID(dev_type);
- /*
- * compute the motion data byte
- */
- fm->motion_data = XTestPackYMotionValue(dy);
- fm->motion_data |= XTestPackXMotionValue(dx);
- /*
- * set the delay time in the input action
- */
- fm->delay_time = tchar;
- /*
- * increment the packet index by the size of the input action
- */
- packet_index = packet_index + sizeof(XTestMotionInfo);
- if (packed_mode == 0)
- {
- /*
- * if input actions are not packed, send the input
- * action event to the client
- */
- flush_input_actions();
- }
-
- }
-}
-
-/******************************************************************************
- *
- * XTestStealKeyData
- *
- * Place this key data in the input_action_packet.
- *
- */
-Bool
-XTestStealKeyData(keycode, keystate, dev_type, locx, locy)
-/*
- * which key/button moved
- */
-unsigned keycode;
-/*
- * whether the key/button was pressed or released
- */
-int keystate;
-/*
- * which device caused the input action
- */
-int dev_type;
-/*
- * the x and y coordinates of the locator when the action happenned
- */
-int locx;
-int locy;
-{
- /*
- * pointer to key/button motion input action
- */
- XTestKeyInfo *kp;
- /*
- * time delta from previous event
- */
- CARD16 tchar;
- char keytrans = 0;
-
- /*
- * update the logical position of the locator if the physical position
- * of the locator is not the same as the logical position.
- */
- if ((locx != xtest_mousex) || (locy != xtest_mousey))
- {
- XTestStealJumpData(locx, locy, dev_type);
- }
- /*
- * Get the time delta from the previous event. If needed,
- * the check_time_event routine will put an XTestDELAY_ACTION
- * type action in the input action event.
- */
- tchar = check_time_event();
- if (!there_is_room(sizeof(XTestKeyInfo)))
- {
- /*
- * If there isn't room in the input action event for
- * an XTestDELAY_ACTION, then send that event to the
- * client and start filling an empty one.
- */
- flush_input_actions();
- }
- /*
- * point kp to the correct place in the input action event
- */
- kp = (XTestKeyInfo *)
- (&(input_action_packet.actions[packet_index]));
- /*
- * compute the input action header
- */
- kp->header = XTestPackDeviceID(dev_type);
- if ((keystate == KeyRelease) || (keystate == ButtonRelease))
- {
- keytrans = XTestKEY_UP;
- }
- else if ((keystate == KeyPress) || (keystate == ButtonPress))
- {
- keytrans = XTestKEY_DOWN;
- }
- else
- {
- printf("%s: invalid key/button state %d.\n",
- XTestEXTENSION_NAME,
- keystate);
- }
- kp->header = kp->header | keytrans | XTestKEY_ACTION;
- /*
- * set the keycode in the input action
- */
- kp->keycode = keycode;
- /*
- * set the delay time in the input action
- */
- kp->delay_time = tchar;
- /*
- * increment the packet index by the size of the input action
- */
- packet_index = packet_index + sizeof(XTestKeyInfo);
- /*
- * if the command key has been released or input actions are not
- * packed, send the input action event to the client
- */
- if(((keycode == xtest_command_key) && (keystate == KeyRelease)) ||
- (packed_mode != XTestPACKED_ACTIONS))
- {
- flush_input_actions();
- }
- /* return TRUE if the event should be passed on to DIX */
- if (exclusive_steal)
- return ((keystate == KeyRelease) &&
- (keycode == xtest_command_key));
- else
- return ((keystate != KeyRelease) ||
- (keycode != xtest_command_key));
-}
-
-/******************************************************************************
- *
- * parse_fake_input
- *
- * Parsing routine for a XTestFakeInput request. It will take a request
- * and parse its contents into the input action array. Eventually the
- * XTestProcessInputAction routine will be called to take input actions
- * from the input action array and send them to the server to be handled.
- */
-void
-parse_fake_input(client, req)
-/*
- * which client did the XTestFakeInput request
- */
-ClientPtr client;
-/*
- * a pointer to the xTestFakeInputReq structure sent by the client
- */
-char *req;
-{
- /*
- * if set to 1, done processing input actions from the request
- */
- int done = 0;
- /*
- * type of input action
- */
- CARD8 action_type;
- /*
- * device type
- */
- CARD8 dev_type;
- /*
- * pointer to an xTestFakeInputReq structure
- */
- xTestFakeInputReq *request;
- /*
- * holds the index into the action list in the request
- */
- int parse_index;
-
- /*
- * get a correct-type pointer to the client-supplied request data
- */
- request = (xTestFakeInputReq *) req;
- /*
- * save the acknowledge requested state for use in
- * XTestProcessInputAction
- */
- acknowledge = request->ack;
- /*
- * set up an index into the action list in the request
- */
- parse_index = 0;
- if (write_index >= ACTION_ARRAY_SIZE)
- {
- /*
- * if the input action array is full, don't add any more
- */
- done = 1;
- }
- while (!done)
- {
- /*
- * get the type of input action in the list
- */
- action_type = (request->action_list[parse_index])
- & XTestACTION_TYPE_MASK;
- /*
- * get the type of device in the list
- */
- dev_type = XTestUnpackDeviceID(request->action_list[parse_index]);
- /*
- * process the input action appropriately
- */
- switch (action_type)
- {
- case XTestKEY_ACTION:
- parse_key_fake((XTestKeyInfo *)
- &(request->action_list[parse_index]));
- parse_index = parse_index + sizeof(XTestKeyInfo);
- break;
- case XTestMOTION_ACTION:
- parse_motion_fake((XTestMotionInfo *)
- &(request->action_list[parse_index]));
- parse_index = parse_index + sizeof(XTestMotionInfo);
- break;
- case XTestJUMP_ACTION:
- parse_jump_fake((XTestJumpInfo *)
- &(request->action_list[parse_index]));
- parse_index = parse_index + sizeof(XTestJumpInfo);
- break;
- case XTestDELAY_ACTION:
- if (dev_type == XTestDELAY_DEVICE_ID)
- {
- parse_delay_fake((XTestDelayInfo *)
- &(request->action_list[parse_index]));
- parse_index = parse_index +
- sizeof(XTestDelayInfo);
- }
- else
- {
- /*
- * An invalid input action header byte has
- * been detected, so there are no more
- * input actions in this request.
- * The intended invalid action header byte
- * for this case should have a value of 0.
- */
- done = 1;
- }
- break;
- }
- if (parse_index >= XTestMAX_ACTION_LIST_SIZE)
- {
- /*
- * entire XTestFakeInput request has been processed
- */
- done = 1;
- }
- if (write_index >= ACTION_ARRAY_SIZE)
- {
- /*
- * no room in the input actions array
- */
- done = 1;
- }
- }
- if (write_index > read_index)
- {
- /*
- * there are fake input actions in the input action array
- * to be given to the server
- */
- playback_on = 1;
- playback_client = client;
- }
-}
-
-/******************************************************************************
- *
- * parse_key_fake
- *
- * Called from parse_fake_input.
- *
- * Copy the fake key input action from its packed form into the array of
- * pending input events.
- */
-static void
-parse_key_fake(fkey)
-XTestKeyInfo *fkey;
-{
- action_array[write_index].type = XTestKEY_ACTION;
- action_array[write_index].device = XTestUnpackDeviceID(fkey->header);
- action_array[write_index].keycode = fkey->keycode;
- action_array[write_index].keystate = fkey->header & XTestKEY_STATE_MASK;
- action_array[write_index].delay_time = fkey->delay_time;
- write_index++;
-}
-
-/******************************************************************************
- *
- * parse_motion_fake
- *
- * Called from parse_fake_input.
- *
- * Copy the fake motion input action from its packed form into the array of
- * pending input events.
- */
-static void
-parse_motion_fake(fmotion)
-XTestMotionInfo *fmotion;
-{
- int dx;
- int dy;
-
- dx = (XTestUnpackXMotionValue(fmotion->motion_data));
- dy = (XTestUnpackYMotionValue(fmotion->motion_data));
- if (((fmotion->header) & XTestX_SIGN_BIT_MASK) == XTestX_NEGATIVE)
- {
- pmousex -= dx;
- }
- else
- {
- pmousex += dx;
- }
- if (((fmotion->header) & XTestY_SIGN_BIT_MASK) == XTestY_NEGATIVE)
- {
- pmousey -= dy;
- }
- else
- {
- pmousey += dy;
- }
- action_array[write_index].type = XTestJUMP_ACTION;
- action_array[write_index].device = XTestUnpackDeviceID(fmotion->header);
- action_array[write_index].x = pmousex;
- action_array[write_index].y = pmousey;
- action_array[write_index].delay_time = fmotion->delay_time;
- write_index++;
-}
-
-/******************************************************************************
- *
- * parse_jump_fake
- *
- * Called from parse_fake_input.
- *
- * Copy the fake jump input action from its packed form into the array of
- * pending input events.
- */
-static void
-parse_jump_fake(fjump)
-XTestJumpInfo *fjump;
-{
- pmousex = fjump->jumpx;
- pmousey = fjump->jumpy;
- action_array[write_index].type = XTestJUMP_ACTION;
- action_array[write_index].device = XTestUnpackDeviceID(fjump->header);
- action_array[write_index].x = pmousex;
- action_array[write_index].y = pmousey;
- action_array[write_index].delay_time = fjump->delay_time;
- write_index++;
-}
-
-/******************************************************************************
- *
- * parse_delay_fake
- *
- * Called from parse_fake_input.
- *
- * Copy the fake delay input action from its packed form into the array of
- * pending input events.
- */
-static void
-parse_delay_fake(tevent)
-XTestDelayInfo *tevent;
-{
- action_array[write_index].type = XTestDELAY_ACTION;
- action_array[write_index].delay_time = tevent->delay_time;
- write_index++;
-}
-
-/******************************************************************************
- *
- * XTestComputeWaitTime
- *
- * Compute the amount of time the server should wait before sending the
- * next monitor event in playback mode.
- */
-void
-XTestComputeWaitTime(waittime)
-struct timeval *waittime;
-{
- /*
- * The playback_on flag is set to 1 in parse_fake_input. It is set to
- * 0 in XTestProcessInputAction if the server has replayed all input
- * actions.
- */
- if (playback_on)
- {
- if (!play_clock)
- {
- /*
- * if the playback clock has never been set,
- * then do it now
- */
- start_play_clock();
- }
- /*
- * We need to save the waittime the first time through. This
- * is a value the server uses, and we have to restore it when
- * all of the input actions are processed by the server.
- */
- if (!time_saved)
- {
- saved_sec = waittime->tv_sec;
- saved_usec = waittime->tv_usec;
- time_saved = 1;
- }
- if (go_for_next)
- {
- /*
- * if we just processed an input action, figure out
- * how long to wait for the next input action
- */
- compute_action_time(&rtime);
- }
- else
- {
- /*
- * else just find out how much more time to wait
- * on the current input action
- */
- (void)find_residual_time(&rtime);
- }
- waittime->tv_sec = rtime.tv_sec;
- waittime->tv_usec = rtime.tv_usec;
- }
-}
-
-/******************************************************************************
- *
- * XTestProcessInputAction
- *
- * If there are any input actions in the input action array,
- * then take one out and process it.
- *
- */
-int
-XTestProcessInputAction(readable, waittime)
-/*
- * This is the value that a 'select' function returned just before this
- * routine was called. If the select timed out, this value will be 0.
- *
- * This extension modifies the select call's timeout value to cause the
- * select to time out when the next input action is ready to given to
- * the server. This routine is called immediately after the select, to
- * give it a chance to process an input action. If we have an input action
- * to process and the only reason that the select returned was because it
- * timed out, then we change the select value to 1 and return 1 instead of 0.
- */
-int readable;
-/*
- * this is the timeout value that the select was called with
- */
-struct timeval *waittime;
-{
-int mousex, mousey;
- /*
- * if playback_on is 0, then the input action array is empty
- */
- if (playback_on)
- {
- restorewait = waittime;
- /*
- * figure out if we need to wait for the next input action
- */
- if (find_residual_time(&rtime) > 0)
- {
- /*
- * still have to wait before processing the current
- * input action
- */
- go_for_next = 0;
- }
- else
- {
- /*
- * don't have to wait any longer before processing
- * the current input action
- */
- go_for_next = 1;
- }
- /*
- * if we have an input action to process and the only reason
- * that the select returned was because it timed out, then we
- * change the select value to 1 and return 1 instead of 0
- */
- if (readable == 0)
- {
- readable++;
- }
- /*
- * if we don't need to wait, then get an input action from
- * the input action array and process it
- */
- if (go_for_next)
- {
- /*
- * There are three possible types of input actions in
- * the input action array (motion input actions are
- * converted to jump input actions before being put
- * into the input action array). Delay input actions
- * are processed by the compute_action_time function
- * which is called from XTestComputeWaitTime. The
- * other two types of input actions are processed here.
- */
- if (action_array[read_index].type == XTestJUMP_ACTION)
- {
- XTestJumpPointer(
- action_array[read_index].x,
- action_array[read_index].y,
- action_array[read_index].device);
- }
- if (action_array[read_index].type == XTestKEY_ACTION)
- {
- GetSpritePosition(&mousex, &mousey);
- XTestGenerateEvent(
- action_array[read_index].device,
- action_array[read_index].keycode,
- action_array[read_index].keystate,
- mousex,
- mousey);
- }
- read_index++;
- /*
- * if all input actions are processed, then restore
- * the server state
- */
- if (read_index >= write_index)
- {
- waittime->tv_sec = saved_sec;
- waittime->tv_usec = saved_usec;
- time_saved = 0;
- playback_on = 0;
- if (acknowledge)
- {
- /*
- * if the playback client is waiting
- * for an xTestFakeAck event, send
- * it to him
- */
- send_ack(playback_client);
- acknowledge = 0;
- }
- write_index = 0;
- read_index = 0;
- playback_client = (ClientPtr) NULL;
- play_clock = 0;
- }
- }
- }
- return(readable);
-}
-
-/******************************************************************************
- *
- * send_ack
- *
- * send an xTestFakeAck event to the client
- */
-static void
-send_ack(client)
-ClientPtr client;
-{
- xTestFakeAckEvent rep;
-
- /*
- * set the serial number of the xTestFakeAck event
- */
- rep.sequenceNumber = client->sequence;
- rep.type = XTestFakeAckType;
- WriteEventsToClient(client, 1, (xEvent *) &rep);
-}
-
-/******************************************************************************
- *
- * start_play_clock
- *
- * start the clock for play back.
- */
-static void
-start_play_clock()
-{
- X_GETTIMEOFDAY(&play_time);
- /*
- * flag that play_time is valid
- */
- play_clock = 1;
-}
-
-/******************************************************************************
- *
- * compute_action_time
- *
- * Set the play clock to the time when the next input action should be put
- * into the server's input queue. Fill the rtime structure with values
- * for the delta until the time for the next input action.
- */
-static void
-compute_action_time(rtime)
-struct timeval *rtime;
-{
- /*
- * holds the delay time in milliseconds
- */
- unsigned long dtime;
- /*
- * holds the number of microseconds in the sum of the dtime value
- * and the play_time value
- */
- unsigned long tot_usec;
- /*
- * holds the number of seconds and microseconds in the
- * dtime value
- */
- unsigned long sec;
- unsigned long usec;
- /*
- * holds the current time
- */
- struct timeval btime;
-
- /*
- * Put the time from the current input action in dtime
- */
- dtime = action_array[read_index].delay_time;
- /*
- * If the current input action is a delay input action,
- * add in the time from the following input action.
- */
- if ((action_array[read_index].type == XTestDELAY_ACTION) &&
- ((read_index + 1) < write_index))
- {
- read_index++;
- dtime = dtime + action_array[read_index].delay_time;
- }
- /*
- * compute the number of seconds and microseconds in the
- * dtime value
- */
- sec = dtime / 1000;
- usec = (dtime % 1000) * 1000;
- /*
- * get the current time in btime
- */
- X_GETTIMEOFDAY(&btime);
- /*
- * compute the number of microseconds in the sum of the dtime value
- * and the current usec value
- */
- tot_usec = btime.tv_usec + usec;
- /*
- * if it is greater than one second's worth, adjust the seconds
- */
- if (tot_usec >= 1000000)
- {
- tot_usec -= 1000000;
- sec++;
- }
- play_time.tv_usec = tot_usec;
- play_time.tv_sec = btime.tv_sec + sec;
- /*
- * put the time until the next input action in rtime
- */
- rtime->tv_sec = sec;
- rtime->tv_usec = usec;
-}
-
-/******************************************************************************
- *
- * find_residual_time
- *
- * Find the time interval from the current time to the value in play_time.
- * This is the time to wait till putting the next input action into the
- * server's input queue. If the time is already up, reset play_time to
- * the current time.
- */
-static int
-find_residual_time(the_residual)
-struct timeval *the_residual;
-{
- /*
- * if > 0, there is time to wait. If < 0, then don't wait
- */
- int wait = 1;
- /*
- * holds the current time
- */
- struct timeval btime;
- /*
- * holds the current time in seconds and microseconds
- */
- unsigned long bsec;
- unsigned long busec;
- /*
- * holds the playback time in seconds and microseconds
- */
- unsigned long psec;
- unsigned long pusec;
-
- /*
- * get the current time in btime
- */
- X_GETTIMEOFDAY(&btime);
- /*
- * get the current time in seconds and microseconds
- */
- bsec = btime.tv_sec;
- busec = btime.tv_usec;
- /*
- * get the playback time in seconds and microseconds
- */
- psec = play_time.tv_sec;
- pusec = play_time.tv_usec;
- /*
- * if the current time is already later than the playback time,
- * we don't need to wait
- */
- if (bsec > psec)
- {
- wait = -1;
- }
- else
- {
- if (bsec == psec)
- {
- /*
- * if the current and playback times have the same
- * second value, then compare the microsecond values
- */
- if ( busec >= pusec)
- {
- /*
- * if the current time is already later than
- * the playback time, we don't need to wait
- */
- wait = -1;
- }
- else
- {
- the_residual->tv_usec = pusec - busec;
- the_residual->tv_sec = 0;
- }
- }
- else
- {
- if (busec > pusec)
- {
- /*
- * 'borrow' a second's worth of microseconds
- * from the seconds left to wait
- */
- the_residual->tv_usec = 1000000 - busec + pusec;
- psec--;
- the_residual->tv_sec = psec - bsec;
- }
- else
- {
- the_residual->tv_sec = psec - bsec;
- the_residual->tv_usec = pusec - busec;
- }
- }
- }
- if (wait < 0)
- {
- /*
- * if don't need to wait, set the playback time
- * to the current time
- */
- X_GETTIMEOFDAY(&play_time);
- /*
- * set the time to wait to 0
- */
- the_residual->tv_sec = 0;
- the_residual->tv_usec = 0;
- }
- return(wait);
-}
-
-/******************************************************************************
- *
- * abort_play_back
- */
-void
-abort_play_back()
-{
- /*
- * If we were playing back input actions at the time of the abort,
- * restore the original wait time for the select in the main wait
- * loop of the server
- */
- if (playback_on)
- {
- restorewait->tv_sec = saved_sec;
- restorewait->tv_usec = saved_usec;
- }
- /*
- * make the input action array empty
- */
- read_index = 0;
- write_index = 0;
- /*
- * we are no longer playing back anything
- */
- playback_on = 0;
- play_clock = 0;
- go_for_next = 1;
- /*
- * there is no valid wait time saved any more
- */
- time_saved = 0;
- /*
- * there are no valid clients using this extension
- */
- playback_client = (ClientPtr) NULL;
- current_xtest_client = (ClientPtr) NULL;
-}
-
-/******************************************************************************
- *
- * return_input_array_size
- *
- * Return the number of input actions in the input action array.
- */
-void
-return_input_array_size(client)
-/*
- * which client to send the reply to
- */
-ClientPtr client;
-{
- xTestQueryInputSizeReply rep;
-
- rep.type = X_Reply;
- /*
- * set the serial number of the reply
- */
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.size_return = ACTION_ARRAY_SIZE;
- WriteReplyToClient(client,
- sizeof(xTestQueryInputSizeReply),
- (void *) &rep);
-}
diff --git a/nx-X11/programs/Xserver/Xext/xtest1dd.h b/nx-X11/programs/Xserver/Xext/xtest1dd.h
deleted file mode 100644
index 5a3ee1781..000000000
--- a/nx-X11/programs/Xserver/Xext/xtest1dd.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/************************************************************
-
-Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
-
- 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 name of the above listed
-copyright holder(s) not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission.
-
-THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef XTEST1DD_H
-#define XTEST1DD_H 1
-
-extern short xtest_mousex;
-extern short xtest_mousey;
-extern int playback_on;
-extern ClientPtr current_xtest_client;
-extern ClientPtr playback_client;
-extern KeyCode xtest_command_key;
-
-extern void stop_stealing_input(
- void
-);
-
-extern void
-steal_input(
- ClientPtr /* client */,
- CARD32 /* mode */
-);
-
-extern void
-flush_input_actions(
- void
-);
-
-extern void
-XTestStealJumpData(
- int /* jx */,
- int /* jy */,
- int /* dev_type */
-);
-
-extern void
-XTestStealMotionData(
- int /* dx */,
- int /* dy */,
- int /* dev_type */,
- int /* mx */,
- int /* my */
-);
-
-extern Bool
-XTestStealKeyData(
- unsigned /* keycode */,
- int /* keystate */,
- int /* dev_type */,
- int /* locx */,
- int /* locy */
-);
-
-extern void
-parse_fake_input(
- ClientPtr /* client */,
- char * /* req */
-);
-
-extern void
-XTestComputeWaitTime(
- struct timeval * /* waittime */
-);
-
-extern int
-XTestProcessInputAction(
- int /* readable */,
- struct timeval * /* waittime */
-);
-
-extern void
-abort_play_back(
- void
-);
-
-extern void
-return_input_array_size(
- ClientPtr /* client */
-);
-
-extern void XTestGenerateEvent(
- int /* dev_type */,
- int /* keycode */,
- int /* keystate */,
- int /* mousex */,
- int /* mousey */
-);
-
-extern void XTestGetPointerPos(
- short * /* fmousex */,
- short * /* fmousey */
-);
-
-extern void XTestJumpPointer(
- int /* jx */,
- int /* jy */,
- int /* dev_type */
-);
-
-#endif /* XTEST1DD_H */
diff --git a/nx-X11/programs/Xserver/Xext/xtest1di.c b/nx-X11/programs/Xserver/Xext/xtest1di.c
deleted file mode 100644
index b1d69ef47..000000000
--- a/nx-X11/programs/Xserver/Xext/xtest1di.c
+++ /dev/null
@@ -1,915 +0,0 @@
-/*
- * File: xtest1di.c
- *
- * This file contains the device independent 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.
-
-*/
-
-/*****************************************************************************
- * include files
- ****************************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "gcstruct.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "opaque.h"
-#define XTestSERVER_SIDE
-#include <nx-X11/extensions/xtestext1.h>
-
-#include "xtest1dd.h"
-
-/*****************************************************************************
- * defines
- ****************************************************************************/
-
-/*****************************************************************************
- * 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.
- */
-int XTestInputActionType = 0;
-int XTestFakeAckType = 1;
-/*
- * true => monitor stealing input
- */
-int on_steal_input = FALSE;
-/*
- * true => monitor alone getting input
- */
-int exclusive_steal = FALSE;
-/*
- * holds the resource type assigned to this extension
- */
-static RESTYPE XTestType;
-/*
- * holds the resource ID for the client currently using XTestGetInput
- */
-static XID current_client_id;
-
-/*****************************************************************************
- * function declarations
- ****************************************************************************/
-
-static DISPATCH_PROC(ProcXTestDispatch);
-static DISPATCH_PROC(SProcXTestDispatch);
-static DISPATCH_PROC(ProcTestFakeInput);
-static DISPATCH_PROC(SProcTestFakeInput);
-static DISPATCH_PROC(ProcTestGetInput);
-static DISPATCH_PROC(SProcTestGetInput);
-static DISPATCH_PROC(ProcTestStopInput);
-static DISPATCH_PROC(SProcTestStopInput);
-static DISPATCH_PROC(ProcTestReset);
-static DISPATCH_PROC(SProcTestReset);
-static DISPATCH_PROC(ProcTestQueryInputSize);
-static DISPATCH_PROC(SProcTestQueryInputSize);
-
-static void XTestResetProc(
- ExtensionEntry * /* unused */
- );
-static void SReplyXTestDispatch(
- ClientPtr /* client_ptr */,
- int /* size */,
- char * /* reply_ptr */
- );
-static void SEventXTestDispatch(
- xEvent * /* from */,
- xEvent * /* to */
- );
-
-static int XTestCurrentClientGone(
- void * /* value */,
- XID /* id */
- );
-
-/*****************************************************************************
- *
- * XTestExtension1Init
- *
- * Called from InitExtensions in main() or from QueryExtension() if the
- * extension is dynamically loaded.
- *
- * XTestExtension1Init has no events or errors
- * (other than the core errors).
- */
-void
-XTestExtension1Init(void)
-{
- /*
- * holds the pointer to the extension entry structure
- */
- ExtensionEntry *extEntry;
-
- extEntry = AddExtension(XTestEXTENSION_NAME,
- XTestEVENT_COUNT,
- 0,
- ProcXTestDispatch,
- SProcXTestDispatch,
- XTestResetProc,
- StandardMinorOpcode);
- if (extEntry)
- {
- /*
- * remember the request code assigned to this extension
- */
- XTestReqCode = extEntry->base;
- /*
- * make an atom saying that this extension is present
- */
- (void) MakeAtom(XTestEXTENSION_NAME,
- strlen(XTestEXTENSION_NAME),
- TRUE);
- /*
- * remember the event codes assigned to this extension
- */
- XTestInputActionType += extEntry->eventBase;
- XTestFakeAckType += extEntry->eventBase;
- /*
- * install the routine to handle byte-swapping the replies
- * for this extension in the ReplySwapVector table
- */
- ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch;
- /*
- * install the routine to handle byte-swapping the events
- * for this extension in the EventSwapVector table
- */
- EventSwapVector[XTestInputActionType] = SEventXTestDispatch;
- EventSwapVector[XTestFakeAckType] = SEventXTestDispatch;
- /*
- * get the resource type for this extension
- */
- XTestType = CreateNewResourceType(XTestCurrentClientGone);
- if (XTestType == 0)
- {
- FatalError("XTestExtension1Init: CreateNewResourceType failed\n");
- }
- }
- else
- {
- FatalError("XTestExtension1Init: AddExtensions failed\n");
- }
-}
-
-/*****************************************************************************
- *
- * ProcXTestDispatch
- *
- *
- */
-static int
-ProcXTestDispatch(client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- if (stuff->data == X_TestFakeInput)
- {
- return(ProcTestFakeInput(client));
- }
- else if (stuff->data == X_TestGetInput)
- {
- return(ProcTestGetInput(client));
- }
- else if (stuff->data == X_TestStopInput)
- {
- return(ProcTestStopInput(client));
- }
- else if (stuff->data == X_TestReset)
- {
- return(ProcTestReset(client));
- }
- else if (stuff->data == X_TestQueryInputSize)
- {
- return(ProcTestQueryInputSize(client));
- }
- else
- {
- SendErrorToClient(client,
- XTestReqCode,
- stuff->data,
- None,
- BadRequest);
- return(BadRequest);
- }
-}
-
-/*****************************************************************************
- *
- * SProcXTestDispatch
- *
- *
- */
-static int
-SProcXTestDispatch(client)
- register ClientPtr client;
-{
- REQUEST(xReq);
- if (stuff->data == X_TestFakeInput)
- {
- return(SProcTestFakeInput(client));
- }
- else if (stuff->data == X_TestGetInput)
- {
- return(SProcTestGetInput(client));
- }
- else if (stuff->data == X_TestStopInput)
- {
- return(SProcTestStopInput(client));
- }
- else if (stuff->data == X_TestReset)
- {
- return(SProcTestReset(client));
- }
- else if (stuff->data == X_TestQueryInputSize)
- {
- return(SProcTestQueryInputSize(client));
- }
- else
- {
- SendErrorToClient(client,
- XTestReqCode,
- stuff->data,
- None,
- BadRequest);
- return(BadRequest);
- }
-}
-
-/*****************************************************************************
- *
- * SProcTestFakeInput
- *
- *
- */
-static int
-SProcTestFakeInput(client)
- register ClientPtr client;
-{
- /*
- * index counter
- */
- int i;
- /*
- * pointer to the next input action in the request
- */
- CARD8 *input_action_ptr;
- /*
- * holds the type of the next input action in the request
- */
- int input_action_type;
-
- REQUEST(xTestFakeInputReq);
- /*
- * byte-swap the fields in the request
- */
- swaps(&stuff->length);
- swapl(&stuff->ack);
- /*
- * have to parse and then byte-swap the input action list here
- */
- for (i = 0; i < XTestMAX_ACTION_LIST_SIZE;)
- {
- /*
- * point to the next input action in the request
- */
- input_action_ptr = &(((xTestFakeInputReq *) stuff)->action_list[i]);
- /*
- * figure out what type of input action it is
- */
- input_action_type = (*input_action_ptr) & XTestACTION_TYPE_MASK;
- /*
- * byte-swap the input action according to it's type
- */
- switch (input_action_type)
- {
- case XTestKEY_ACTION:
- /*
- * byte-swap the delay_time field
- */
- swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time));
- /*
- * advance to the next input action
- */
- i += sizeof(XTestKeyInfo);
- break;
- case XTestMOTION_ACTION:
- /*
- * byte-swap the delay_time field
- */
- swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time));
- /*
- * advance to the next input action
- */
- i += sizeof(XTestMotionInfo);
- break;
- case XTestJUMP_ACTION:
- /*
- * byte-swap the jumpx field
- */
- swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx));
- /*
- * byte-swap the jumpy field
- */
- swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy));
- /*
- * byte-swap the delay_time field
- */
- swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time));
- /*
- * advance to the next input action
- */
- i += sizeof(XTestJumpInfo);
- break;
- default:
- /*
- * if this is a delay input action, then byte-swap it,
- * otherwise we have reached the end of the input
- * actions in this request
- */
- if (XTestUnpackDeviceID(*input_action_ptr) ==
- XTestDELAY_DEVICE_ID)
- {
- /*
- * byte-swap the delay_time field
- */
- swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time));
- /*
- * advance to the next input action
- */
- i += sizeof(XTestDelayInfo);
- }
- else
- {
- /*
- * if the input action header byte is 0 or
- * ill-formed, then there are no more input
- * actions in this request
- */
- i = XTestMAX_ACTION_LIST_SIZE;
- }
- break;
- }
- }
- return(ProcTestFakeInput(client));
-}
-
-/*****************************************************************************
- *
- * SProcTestGetInput
- *
- *
- */
-static int
-SProcTestGetInput(client)
- register ClientPtr client;
-{
- REQUEST(xTestGetInputReq);
- /*
- * byte-swap the fields in the request
- */
- swaps(&stuff->length);
- swapl(&stuff->mode);
- return(ProcTestGetInput(client));
-}
-
-/*****************************************************************************
- *
- * SProcTestStopInput
- *
- *
- */
-static int
-SProcTestStopInput(client)
- register ClientPtr client;
-{
- REQUEST(xTestStopInputReq);
- /*
- * byte-swap the length field in the request
- */
- swaps(&stuff->length);
- return(ProcTestStopInput(client));
-}
-
-/*****************************************************************************
- *
- * SProcTestReset
- *
- *
- */
-static int
-SProcTestReset(client)
- register ClientPtr client;
-{
- REQUEST(xTestResetReq);
- /*
- * byte-swap the length field in the request
- */
- swaps(&stuff->length);
- return(ProcTestReset(client));
-}
-
-/*****************************************************************************
- *
- * SProcTestQueryInputSize
- *
- *
- */
-static int
-SProcTestQueryInputSize(client)
- register ClientPtr client;
-{
- REQUEST(xTestQueryInputSizeReq);
- /*
- * byte-swap the length field in the request
- */
- swaps(&stuff->length);
- return(ProcTestQueryInputSize(client));
-}
-
-/*****************************************************************************
- *
- * ProcTestFakeInput
- *
- *
- */
-static int
-ProcTestFakeInput(client)
- register ClientPtr client;
-{
- REQUEST(xTestFakeInputReq);
- REQUEST_SIZE_MATCH(xTestFakeInputReq);
-
- if (playback_client == NULL)
- {
- playback_client = client;
- current_client_id = FakeClientID(client->index);
- AddResource(current_client_id,
- XTestType,
- 0);
- MakeClientGrabImpervious(client);
- }
- if (playback_client == client)
- {
- /*
- * This extension does not need to clean up any
- * server state when a client using this function
- * "goes away". The server will just process any
- * input actions that have already been sent to it,
- * and will then reset its association with a client.
- */
- parse_fake_input(client, (char *)stuff);
- return(Success);
- }
- else
- {
- /*
- * this is a request by another client to send fake
- * input while the server is still being used
- */
- SendErrorToClient(client,
- XTestReqCode,
- X_TestFakeInput,
- None,
- BadAccess);
- return(BadAccess);
- }
-}
-
-/*****************************************************************************
- *
- * ProcTestGetInput
- *
- *
- */
-static int
-ProcTestGetInput(client)
- register ClientPtr client;
-{
- REQUEST(xTestGetInputReq);
- REQUEST_SIZE_MATCH(xTestGetInputReq);
- if (on_steal_input)
- {
- /*
- * this is a request by another client to get fake input
- * while the server is still sending input to the first client
- */
- SendErrorToClient(client,
- XTestReqCode,
- X_TestGetInput,
- None,
- BadAccess);
- return(BadAccess);
- }
- else
- {
- /*
- * Set up a resource associated with the client using this
- * function so that this extension gets called when the
- * client "goes away". This allows this extension to
- * clean up the server state.
- */
- current_client_id = FakeClientID(client->index);
- AddResource(current_client_id,
- XTestType,
- 0);
- /*
- * indicate that a client is stealing input
- */
- on_steal_input = TRUE;
- if ((stuff->mode & XTestEXCLUSIVE) == 0)
- {
- exclusive_steal = FALSE;
- }
- else
- {
- exclusive_steal = TRUE;
- }
- steal_input(client, stuff->mode);
- return(Success);
- }
-}
-
-/*****************************************************************************
- *
- * ProcTestStopInput
- *
- *
- */
-static int
-ProcTestStopInput(client)
- register ClientPtr client;
-{
- REQUEST_SIZE_MATCH(xTestStopInputReq);
- if (on_steal_input && (current_xtest_client == client))
- {
- on_steal_input = FALSE;
- exclusive_steal = FALSE;
- stop_stealing_input();
- /*
- * remove the resource associated with this client
- */
- FreeResource(current_client_id, RT_NONE);
- return(Success);
- }
- else
- {
- /*
- * this is a request to stop fake input when fake input has
- * never been started or from a client that hasn't started
- * fake input
- */
- SendErrorToClient(client,
- XTestReqCode,
- X_TestStopInput,
- None,
- BadAccess);
- return(BadAccess);
- }
-}
-
-/*****************************************************************************
- *
- * ProcTestReset
- *
- *
- */
-static int
-ProcTestReset(client)
- register ClientPtr client;
-{
- REQUEST_SIZE_MATCH(xTestResetReq);
- on_steal_input = FALSE;
- exclusive_steal = FALSE;
- /*
- * defined in xtest1dd.c
- */
- stop_stealing_input();
- /*
- * defined in xtest1dd.c
- */
- abort_play_back();
- return(Success);
-}
-
-/*****************************************************************************
- *
- * ProcTestQueryInputSize
- *
- *
- */
-static int
-ProcTestQueryInputSize(client)
- register ClientPtr client;
-{
- REQUEST_SIZE_MATCH(xTestQueryInputSizeReq);
- /*
- * defined in xtest1dd.c
- */
- return_input_array_size(client);
- return(Success);
-}
-
-/*****************************************************************************
- *
- * XTestResetProc
- *
- * This function is called by the server when the server has no clients
- * connected to it. It must put eveything back the way it was before
- * this extension was installed.
- */
-/*ARGSUSED*/
-static void
-XTestResetProc(unused)
- ExtensionEntry * unused;
-{
- /*
- * remove the routine to handle byte-swapping the replies
- * for this extension in the ReplySwapVector table
- */
- ReplySwapVector[XTestReqCode] = ReplyNotSwappd;
- /*
- * remove the routine to handle byte-swapping the events
- * for this extension in the EventSwapVector table
- */
- EventSwapVector[XTestInputActionType] = NotImplemented;
- EventSwapVector[XTestFakeAckType] = NotImplemented;
- /*
- * reset the variables initialized just once at load time
- */
- XTestReqCode = 0;
- XTestInputActionType = 0;
- XTestFakeAckType = 1;
- on_steal_input = FALSE;
- exclusive_steal = FALSE;
- playback_client = 0; /* Don't really need this but it looks nice */
-}
-
-/*****************************************************************************
- *
- * PXTestCurrentClientGone
- *
- * This routine is called when a client that has asked for input actions
- * to be sent to it "goes away". This routine must clean up the
- * server state.
- */
-/*ARGSUSED*/
-static int
-XTestCurrentClientGone(value, id)
- void * value;
- XID id;
-{
- /*
- * defined in xtest1dd.c
- */
- on_steal_input = FALSE;
- exclusive_steal = FALSE;
- /*
- * defined in xtestdd.c
- */
- playback_client = 0;
- abort_play_back();
- return TRUE;
-}
-
-/*****************************************************************************
- *
- * SReplyXTestDispatch
- *
- * Swap any replies defined in this extension.
- */
-static void
-SReplyXTestDispatch(client_ptr, size, reply_ptr)
- ClientPtr client_ptr;
- int size;
- char *reply_ptr;
-{
- /*
- * pointer to xTestQueryInputSizeReply
- */
- xTestQueryInputSizeReply *rep_ptr;
-
- /*
- * there is only one reply in this extension, so byte-swap it
- */
- rep_ptr = (xTestQueryInputSizeReply *) reply_ptr;
- swaps(&(rep_ptr->sequenceNumber));
- swapl(&(rep_ptr->length));
- swapl(&(rep_ptr->size_return));
- /*
- * now write the swapped reply to the client
- */
- WriteToClient(client_ptr, size, reply_ptr);
-}
-
-/*****************************************************************************
- *
- * SEventXTestDispatch
- *
- * Swap any events defined in this extension.
- */
-static void
-SEventXTestDispatch(from, to)
- xEvent *from;
- xEvent *to;
-{
- /*
- * index counter
- */
- int i;
- /*
- * pointer to the next input action in the event
- */
- CARD8 *input_action_ptr;
- /*
- * holds the type of the next input action in the event
- */
- int input_action_type;
-
-
- /*
- * copy the type information from the "from" event to the "to" event
- */
- ((xTestInputActionEvent *) to)->type =
- ((xTestInputActionEvent *) from)->type;
- /*
- * copy the sequence number information from the "from" event to the
- * "to" event
- */
- ((xTestInputActionEvent *) to)->sequenceNumber =
- ((xTestInputActionEvent *) from)->sequenceNumber;
- /*
- * byte-swap the sequence number in the "to" event
- */
- swaps(&(((xTestInputActionEvent *) to)->sequenceNumber));
- /*
- * If the event is an xTestInputActionEvent, then it needs more
- * processing. Otherwise, it is an xTestFakeAckEvent, which
- * has no other information in it.
- */
- if ((((xTestInputActionEvent *) to)->type & 0x7f) ==
- XTestInputActionType)
- {
- /*
- * copy the input actions from the "from" event
- * to the "to" event
- */
- for (i = 0; i < XTestACTIONS_SIZE; i++)
- {
- ((xTestInputActionEvent *) to)->actions[i] =
- ((xTestInputActionEvent *) from)->actions[i];
- }
- /*
- * byte-swap the input actions in the "to" event
- */
- for (i = 0; i < XTestACTIONS_SIZE; i++)
- {
- /*
- * point to the next input action in the event
- */
- input_action_ptr = &(((xTestInputActionEvent *) to)->actions[i]);
- /*
- * figure out what type of input action it is
- */
- input_action_type = (*input_action_ptr) &
- XTestACTION_TYPE_MASK;
- /*
- * byte-swap the input action according to it's type
- */
- switch (input_action_type)
- {
- case XTestKEY_ACTION:
- /*
- * byte-swap the delay_time field
- */
- swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time));
- /*
- * advance to the next input action
- */
- i += sizeof(XTestKeyInfo);
- break;
- case XTestMOTION_ACTION:
- /*
- * byte-swap the delay_time field
- */
- swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time));
- /*
- * advance to the next input action
- */
- i += sizeof(XTestMotionInfo);
- break;
- case XTestJUMP_ACTION:
- /*
- * byte-swap the jumpx field
- */
- swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx));
- /*
- * byte-swap the jumpy field
- */
- swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy));
- /*
- * byte-swap the delay_time field
- */
- swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time));
- /*
- * advance to the next input action
- */
- i += sizeof(XTestJumpInfo);
- break;
- default:
- /*
- * if this is a delay input action, then
- * byte-swap it, otherwise we have reached the
- * end of the input actions in this event
- */
- if (XTestUnpackDeviceID(*input_action_ptr) ==
- XTestDELAY_DEVICE_ID)
- {
- /*
- * byte-swap the delay_time field
- */
- swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time));
- /*
- * advance to the next input action
- */
- i += sizeof(XTestDelayInfo);
- }
- else
- {
- /*
- * if the input action header byte is 0
- * or ill-formed, then there are no
- * more input actions in this event
- */
- i = XTestACTIONS_SIZE;
- }
- break;
- }
- }
- }
-}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
index ddbf08fab..c14b59a2c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile
+++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
@@ -42,7 +42,6 @@ SRCS = \
Keystroke.c \
Pointer.c \
Screen.c \
- TestExt.c \
Visual.c \
Drawable.c \
Window.c \
@@ -104,7 +103,6 @@ OBJS = \
Keystroke.o \
Pointer.o \
Screen.o \
- TestExt.o \
Visual.o \
Drawable.o \
Window.o \
diff --git a/nx-X11/programs/Xserver/hw/nxagent/TestExt.c b/nx-X11/programs/Xserver/hw/nxagent/TestExt.c
deleted file mode 100644
index 51a2ecb3d..000000000
--- a/nx-X11/programs/Xserver/hw/nxagent/TestExt.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
-/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
-/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
-/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
-/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
-/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
-/* */
-/* NXAGENT, NX protocol compression and NX extensions to this software */
-/* are copyright of the aforementioned persons and companies. */
-/* */
-/* Redistribution and use of the present software is allowed according */
-/* to terms specified in the file LICENSE which comes in the source */
-/* distribution. */
-/* */
-/* All rights reserved. */
-/* */
-/* NOTE: This software has received contributions from various other */
-/* contributors, only the core maintainers and supporters are listed as */
-/* copyright holders. Please contact us, if you feel you should be listed */
-/* as copyright holder, as well. */
-/* */
-/**************************************************************************/
-
-/*
-
-Copyright 1993 by Davor Matic
-
-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. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#include <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
-#include <nx-X11/Xlib.h>
-#undef Bool
-#include "screenint.h"
-#include "input.h"
-#include "misc.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#include "mipointer.h"
-#define XTestSERVER_SIDE
-#include "xtestext1.h"
-
-extern CARD32 nxagentLastEventTime;
-
-void XTestGetPointerPos(short *fmousex, short *fmousey);
-
-void XTestJumpPointer(int jx, int jy, int dev_type);
-
-void XTestGenerateEvent(int dev_type, int keycode, int keystate,
- int mousex, int mousey);
-
-void XTestGetPointerPos(short *fmousex, short *fmousey)
-{
- int x,y;
-
- miPointerPosition(&x, &y);
- *fmousex = x;
- *fmousey = y;
-}
-
-void XTestJumpPointer(int jx, int jy, int dev_type)
-{
- miPointerAbsoluteCursor(jx, jy, GetTimeInMillis());
-}
-
-void XTestGenerateEvent(int dev_type, int keycode, int keystate,
- int mousex, int mousey)
-{
-/*
- xEvent tevent;
-
- tevent.u.u.type = (dev_type == XE_POINTER) ?
- (keystate == XTestKEY_UP) ? ButtonRelease : ButtonPress :
- (keystate == XTestKEY_UP) ? KeyRelease : KeyPress;
- tevent.u.u.detail = keycode;
- tevent.u.keyButtonPointer.rootX = mousex;
- tevent.u.keyButtonPointer.rootY = mousey;
- tevent.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
- mieqEnqueue(&tevent);
-*/
-}
diff --git a/nx-X11/programs/Xserver/mi/miinitext.c b/nx-X11/programs/Xserver/mi/miinitext.c
index b39f8f4da..9e0f82643 100644
--- a/nx-X11/programs/Xserver/mi/miinitext.c
+++ b/nx-X11/programs/Xserver/mi/miinitext.c
@@ -171,9 +171,6 @@ typedef void (*InitExtension)(void);
#endif
/* FIXME: this whole block of externs should be from the appropriate headers */
-#ifdef XTESTEXT1
-extern void XTestExtension1Init(void);
-#endif
#ifdef SHAPE
extern void ShapeExtensionInit(void);
#endif
@@ -382,9 +379,6 @@ InitExtensions(argc, argv)
if (!noPanoramiXExtension) PanoramiXExtensionInit();
# endif
#endif
-#ifdef XTESTEXT1
- if (!noTestExtensions) XTestExtension1Init();
-#endif
#ifdef SHAPE
if (!noShapeExtension) ShapeExtensionInit();
#endif
diff --git a/nx-X11/programs/Xserver/os/WaitFor.c b/nx-X11/programs/Xserver/os/WaitFor.c
index 55fb997ea..9db3faef1 100644
--- a/nx-X11/programs/Xserver/os/WaitFor.c
+++ b/nx-X11/programs/Xserver/os/WaitFor.c
@@ -143,13 +143,6 @@ mffs(fd_mask mask)
#include <nx-X11/extensions/dpms.h>
#endif
-#ifdef XTESTEXT1
-/*
- * defined in xtestext1dd.c
- */
-extern int playback_on;
-#endif /* XTESTEXT1 */
-
struct _OsTimerRec {
OsTimerPtr next;
CARD32 expires;
@@ -244,13 +237,6 @@ WaitForSomething(int *pClientsReady)
BlockHandler((void *)&wt, (void *)&LastSelectMask);
if (NewOutputPending)
FlushAllOutput();
-#ifdef XTESTEXT1
- /* XXX how does this interact with new write block handling? */
- if (playback_on) {
- wt = &waittime;
- XTestComputeWaitTime (&waittime);
- }
-#endif /* XTESTEXT1 */
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP)
@@ -375,11 +361,7 @@ WaitForSomething(int *pClientsReady)
#endif
selecterr = GetErrno();
WakeupHandler(i, (void *)&LastSelectMask);
-#ifdef XTESTEXT1
- if (playback_on) {
- i = XTestProcessInputAction (i, &waittime);
- }
-#endif /* XTESTEXT1 */
+
SmartScheduleStartTimer ();
if (i <= 0) /* An error or timeout occurred */