From ff5740e039c05e04952496fe67385187daa53222 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Apr 2019 22:02:24 +0200 Subject: spelling fixes --- nx-X11/programs/Xserver/hw/nxagent/Options.h | 2 +- nx-X11/programs/Xserver/xkb/ddxLoad.c | 2 +- nxdialog/bin/nxdialog | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h index 8e898bd77..b5394ee01 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h @@ -365,7 +365,7 @@ typedef struct _AgentOptions int DeferLevel; /* - * Maxuimum elapsed time before a new full + * Maximum elapsed time before a new full * synchronization. */ diff --git a/nx-X11/programs/Xserver/xkb/ddxLoad.c b/nx-X11/programs/Xserver/xkb/ddxLoad.c index d63512846..b770ba026 100644 --- a/nx-X11/programs/Xserver/xkb/ddxLoad.c +++ b/nx-X11/programs/Xserver/xkb/ddxLoad.c @@ -389,7 +389,7 @@ char tmpname[PATH_MAX]; #ifdef __sun if (Pclose(out) != 0) { - ErrorF("Warning: Spurious failure reported in Pclose() runnning 'xkbcomp'.\n"); + ErrorF("Warning: Spurious failure reported in Pclose() running 'xkbcomp'.\n"); } if (1) #else diff --git a/nxdialog/bin/nxdialog b/nxdialog/bin/nxdialog index 7cd6467f4..f735dc45f 100755 --- a/nxdialog/bin/nxdialog +++ b/nxdialog/bin/nxdialog @@ -180,7 +180,7 @@ def show_yes_no_suspend_box(title, text): @param title: Message box title @type text: str @param text: Message box text - @return: Choosen action + @return: Chosen action """ dlg = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION, @@ -207,7 +207,7 @@ def show_yes_no_box(title, text): @param title: Message box title @type text: str @param text: Message box text - @return: Choosen action + @return: Chosen action """ dlg = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION, @@ -227,12 +227,12 @@ def show_yes_no_box(title, text): def handle_session_action(agentpid, action): - """ Execute session action choosen by user. + """ Execute session action chosen by user. @type agentpid: int @param agentpid: Nxagent process id as passed by command line @type action: int or None - @param action: Choosen action + @param action: Chosen action """ -- cgit v1.2.3 From dece08252b6696b74091ebcde3dc557e2e60171b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Apr 2019 22:02:47 +0200 Subject: Reconnect.c: initialize stateFile path We check that via strlen() while never properly initializing it. --- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index a921df6ca..b78c01e30 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -134,7 +134,7 @@ static enum RECONNECTION_STEP failedStep; /* * Path of state File */ -char stateFile[PATH_MAX]; +char stateFile[PATH_MAX] = {0}; void setStatePath(char* path) -- cgit v1.2.3 From b32a984f8f34d34fcc4114028712367c47c545d7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 7 Nov 2018 21:29:19 +0100 Subject: Die XTESTEXT1, die! commit a73e0f8cdfec1c9199ffe696146ba7d677c4c10d Author: Daniel Stone 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 --- nx-X11/include/extensions/Imakefile | 2 +- nx-X11/include/extensions/xtestext1.h | 325 ------ nx-X11/programs/Xserver/Xext/Imakefile | 6 +- nx-X11/programs/Xserver/Xext/xtest1dd.c | 1612 -------------------------- nx-X11/programs/Xserver/Xext/xtest1dd.h | 126 -- nx-X11/programs/Xserver/Xext/xtest1di.c | 915 --------------- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 2 - nx-X11/programs/Xserver/hw/nxagent/TestExt.c | 91 -- nx-X11/programs/Xserver/mi/miinitext.c | 6 - nx-X11/programs/Xserver/os/WaitFor.c | 20 +- 10 files changed, 5 insertions(+), 3100 deletions(-) delete mode 100644 nx-X11/include/extensions/xtestext1.h delete mode 100644 nx-X11/programs/Xserver/Xext/xtest1dd.c delete mode 100644 nx-X11/programs/Xserver/Xext/xtest1dd.h delete mode 100644 nx-X11/programs/Xserver/Xext/xtest1di.c delete mode 100644 nx-X11/programs/Xserver/hw/nxagent/TestExt.c 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 -#endif - -#include -#include -#include -#include -#include -#include "misc.h" -#include "dixstruct.h" -#define XTestSERVER_SIDE -#include - -#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(¤t_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 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(¤t_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 - - 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 -#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 -#endif - -#include -#include -#include -#include "misc.h" -#include "os.h" -#include "gcstruct.h" -#include "extnsionst.h" -#include "dixstruct.h" -#include "opaque.h" -#define XTestSERVER_SIDE -#include - -#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 */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* 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 -#include -#include -#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 #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 */ -- cgit v1.2.3 From bee0f13ce4ebc475b1727c5715e8222c0e472a78 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Apr 2019 15:37:10 +0200 Subject: nxagent: Remove own GetTimeInMillis() implementation along with the DDXTIME define that has been dropped in Xorg upstream, too. commit 985c34bf06af70a7296db8307899a17347a25558 Author: Adam Jackson Date: Thu Jul 20 17:33:13 2006 -0400 Remove the DDXTIME conditional, for being unused. --- nx-X11/config/cf/gnu.cf | 2 +- nx-X11/config/cf/linux.cf | 32 ++++++++++++++--------------- nx-X11/programs/Xserver/hw/nxagent/Millis.c | 13 ------------ nx-X11/programs/Xserver/hw/nxagent/Millis.h | 2 -- 4 files changed, 17 insertions(+), 32 deletions(-) diff --git a/nx-X11/config/cf/gnu.cf b/nx-X11/config/cf/gnu.cf index d57580125..a1d564569 100644 --- a/nx-X11/config/cf/gnu.cf +++ b/nx-X11/config/cf/gnu.cf @@ -127,7 +127,7 @@ XCOMM Not implemented and will always fail. XCOMM i386Architecture #define OptimizedCDebugFlags DefaultGcc2i386Opt #define GNUMachineDefines -D__i386__ -#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +#define ServerOSDefines XFree86ServerOSDefines #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #define HasPlugin YES #define VendorHasX11R6_3libXext YES diff --git a/nx-X11/config/cf/linux.cf b/nx-X11/config/cf/linux.cf index fe8d97ec3..c3e9eaafd 100644 --- a/nx-X11/config/cf/linux.cf +++ b/nx-X11/config/cf/linux.cf @@ -683,7 +683,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags DefaultGcc2AxpOpt # endif # define LinuxMachineDefines -D__alpha__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 -DJENSEN_SUPPORT # ifdef UseCompaqMathLibrary # define MathLibrary -lcpml -lm @@ -693,7 +693,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #ifdef HPArchitecture # define OptimizedCDebugFlags -O2 GccAliasingArgs # define LinuxMachineDefines -D__hppa__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* HPArchitecture */ @@ -702,7 +702,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags -O3 # endif # define LinuxMachineDefines -D__arm__ -D__arm32__ -U__arm -Uarm -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Arm32Achitecture */ @@ -711,7 +711,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags -O3 # endif # define LinuxMachineDefines -D__aarch64__ -U__arm -Uarm -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* Arm64Achitecture */ @@ -720,7 +720,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags DefaultGcc2i386Opt # endif # define LinuxMachineDefines -D__i386__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* i386Architecture */ @@ -729,7 +729,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__ia64__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* ia64Architecture */ @@ -738,7 +738,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__mc68000__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Mc68020Architecture */ @@ -747,7 +747,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags DefaultGcc2MipsOpt # endif # define LinuxMachineDefines -D__mips__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif @@ -756,7 +756,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags DefaultGcc2MipsOpt # endif # define LinuxMachineDefines -D__MIPSEL__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # ifdef Mips64elArchitecture # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 # else @@ -770,7 +770,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags DefaultGcc2Ppc64Opt # endif # define LinuxMachineDefines -D__powerpc64__ -D__powerpc__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +# define ServerOSDefines XFree86ServerOSDefines -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* Ppc64Architecture */ @@ -779,7 +779,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags DefaultGcc2PpcOpt # endif # define LinuxMachineDefines -D__powerpc__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* PpcArchitecture */ @@ -788,7 +788,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags -O2 -fomit-frame-pointer GccAliasingArgs # endif # define LinuxMachineDefines -D__s390__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* s390Architecture */ @@ -796,7 +796,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) /*#define DefaultCCOptions -fsigned-char */ #define OptimizedCDebugFlags -O3 -fomit-frame-pointer #define LinuxMachineDefines -D__s390x__ -#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +#define ServerOSDefines XFree86ServerOSDefines #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* s390xArchitecture */ @@ -805,7 +805,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__sparc__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define AsVISOption -Av9a # ifdef Sparc64Architecture # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 @@ -835,7 +835,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags -O2 SuperHArchOptFlags SuperHEndianFlags GccAliasingArgs # endif # define LinuxMachineDefines -D__sh__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif @@ -844,7 +844,7 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) # define OptimizedCDebugFlags DefaultGcc2AMD64Opt # endif # define LinuxMachineDefines -D__amd64__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* AMD64Architecture */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Millis.c b/nx-X11/programs/Xserver/hw/nxagent/Millis.c index ba801b62a..d3eb09a66 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Millis.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Millis.c @@ -29,19 +29,6 @@ #include "Xos.h" #include "Millis.h" -#ifdef DDXTIME - -CARD32 GetTimeInMillis() -{ - struct timeval ts; - - X_GETTIMEOFDAY(&ts); - - return(ts.tv_sec * 1000) + (ts.tv_usec / 1000); -} - -#endif - const char *GetTimeAsString() { char *value; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Millis.h b/nx-X11/programs/Xserver/hw/nxagent/Millis.h index 1e76ccbfb..3ba88ae63 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Millis.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Millis.h @@ -28,8 +28,6 @@ #include "Xmd.h" -CARD32 GetTimeInMillis(void); - const char *GetTimeInMillisAsString(void); const char *GetTimeAsString(void); -- cgit v1.2.3 From 0a211b6b614a64953b9325e23a12822792ee5d61 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 2 Nov 2018 20:56:55 +0100 Subject: Keyboard.c: improve TEST and DEBUG output --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 05adab494..5fc322dde 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -842,7 +842,7 @@ XkbError: { #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using default keyboard: model [%s] layout [%s].\n", - model, layout); + model?model:"(default)", layout?layout:"(default)"); #endif } @@ -917,7 +917,8 @@ XkbError: #ifdef DEBUG fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device: " "[rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", - rules, model, layout, variant, options); + rules?rules:"(default)", model?model:"(default)", layout?layout:"(default)", + variant?variant:"(default)", options?options:"(default)"); #endif XkbSetRulesDflts(rules, model, layout, variant, options); -- cgit v1.2.3 From 34e9c6b0b69898000afde8c67f8b874ec58b7ece Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 30 Apr 2019 21:00:31 +0200 Subject: Keyboard.c: clean/unify formatting --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 32 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 5fc322dde..045fa19fa 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -647,14 +647,15 @@ N/A if (keymap64 == NULL) { XFreeModifiermap(modifier_keymap); - return -1; } len = (max_keycode - min_keycode + 1) * mapWidth; keymap = (KeySym *)malloc(len * sizeof(KeySym)); for(i = 0; i < len; ++i) + { keymap[i] = keymap64[i]; + } XFree(keymap64); } @@ -668,7 +669,6 @@ N/A if (keymap == NULL) { XFreeModifiermap(modifier_keymap); - return -1; } @@ -682,18 +682,24 @@ N/A memset(modmap, 0, sizeof(modmap)); for (j = 0; j < 8; j++) - for(i = 0; i < modifier_keymap->max_keypermod; i++) { + { + for(i = 0; i < modifier_keymap->max_keypermod; i++) + { CARD8 keycode; if ((keycode = modifier_keymap-> modifiermap[j * modifier_keymap->max_keypermod + i])) + { modmap[keycode] |= 1< 0) { nxagentCheckModifierMasks(keycode, j); } } + } + XFreeModifiermap(modifier_keymap); modifier_keymap = NULL; @@ -747,9 +753,6 @@ XkbError: #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using XKB extension.\n"); - #endif - - #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: nxagentKeyboard is [%s].\n", nxagentKeyboard ? nxagentKeyboard : "NULL"); #endif @@ -779,10 +782,9 @@ XkbError: { for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++); - if(nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0) + if (nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0) { ErrorF("Warning: Wrong keyboard type: %s.\n", nxagentKeyboard); - goto XkbError; } @@ -873,7 +875,9 @@ XkbError: * instead of a file. */ if (nxagentX2go == 1) + { nxagentWriteKeyboardDir(); + } } else { @@ -891,7 +895,9 @@ XkbError: * we can drop this here. */ if (nxagentX2go == 1) + { nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); + } } } #ifdef DEBUG @@ -905,12 +911,12 @@ XkbError: if (xkb && xkb->geom) { - XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); + XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); } #ifdef TEST else { - fprintf(stderr, "nxagentKeyboardProc: No current keyboard.\n"); + fprintf(stderr, "nxagentKeyboardProc: No current keyboard.\n"); } #endif @@ -932,7 +938,7 @@ XkbError: if (xkb && xkb->geom) { - XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls); + XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls); } if (nxagentOption(Shadow) == 1 && pDev && pDev->key) @@ -943,8 +949,8 @@ XkbError: if (xkb) { - XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); - xkb = NULL; + XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); + xkb = NULL; } free(model); -- cgit v1.2.3 From 249be6680ea1077eeaeffb6eda28ff906ee952d7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2019 14:38:31 +0200 Subject: NXwindow.c: add missing change was forgotten during backport (see commit 7401a6691a9a3cd77431466b941eaf169c9b2b2c) --- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 64bbf67c4..2fe37f79c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -1021,8 +1021,6 @@ SaveScreens(int on, int mode) if (on == SCREEN_SAVER_FORCER) { - UpdateCurrentTimeIf(); - lastDeviceEventTime = currentTime; if (mode == ScreenSaverReset) what = SCREEN_SAVER_OFF; else -- cgit v1.2.3 From f0ba303d48439e0ebb572d56db972995388ac865 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2019 15:04:26 +0200 Subject: NXdamage.c: add missing upstream fixes Some of those fixes have been part of xorg's INITIAL damage.c from 2004. They where missing in NX nevertheless. The other fixes come from this commit: commit fec868bf0f67a8f62fc69d55e2ff72b6cacea6f8 Author: Roland Mainz Date: Tue Nov 23 17:10:55 2004 +0000 //freedesktop.org/bugzilla/show_bug.cgi?id=1204): Fix X11 test suite (caused by DAMAGE layer) failure with Xvfb when rendering text using |XDrawText*()| (XDrawText() tests 1, 3, 4, 27, 28, 29, 30, 34, 37, 39, 41, 43 and XDrawText16() tests 1, 3, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 34, 37, 39, 41, 43). Patch by Hong Bo Peng and Stefan Dirsch . --- nx-X11/programs/Xserver/hw/nxagent/NXdamage.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c b/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c index ad02e13a8..ef50edbee 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c @@ -154,10 +154,10 @@ damagePolyText8(DrawablePtr pDrawable, DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (checkGCDamage (pDrawable, pGC)) - damageText (pDrawable, pGC, x, y, (unsigned long) count, chars, + x = damageText (pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, TT_POLY8); - - x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); + else + x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; @@ -174,11 +174,11 @@ damagePolyText16(DrawablePtr pDrawable, DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (checkGCDamage (pDrawable, pGC)) - damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, + x = damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_POLY16); - - x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); + else + x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; @@ -197,8 +197,8 @@ damageImageText8(DrawablePtr pDrawable, if (checkGCDamage (pDrawable, pGC)) damageText (pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, TT_IMAGE8); - - (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); + else + (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -217,8 +217,8 @@ damageImageText16(DrawablePtr pDrawable, damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_IMAGE16); - - (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); + else + (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } -- cgit v1.2.3 From 0312a8cfed0fa8211cb4cbc92a83bfb0233ac3ef Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2019 20:11:14 +0200 Subject: Rename libdamage to (correct) libdamageext upstream xorg is also using that name --- nx-X11/programs/Xserver/Imakefile | 2 +- nx-X11/programs/Xserver/damageext/Imakefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 64c4e2e7f..95628651b 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -115,7 +115,7 @@ INSTPGMFLAGS = #endif #if BuildDamage DAMAGEDIR = damageext - DAMAGELIB = $(DAMAGEDIR)/libdamage.a + DAMAGELIB = $(DAMAGEDIR)/libdamageext.a #endif #if BuildComposite CWDIR = miext/cw diff --git a/nx-X11/programs/Xserver/damageext/Imakefile b/nx-X11/programs/Xserver/damageext/Imakefile index d8cc1bfa4..b80853f6a 100644 --- a/nx-X11/programs/Xserver/damageext/Imakefile +++ b/nx-X11/programs/Xserver/damageext/Imakefile @@ -20,9 +20,9 @@ $(NX_DEFINES) \ $(NULL) -NormalLibraryTarget(damage,$(OBJS)) +NormalLibraryTarget(damageext,$(OBJS)) NormalLibraryObjectRule() -LintLibraryTarget(damage,$(SRCS)) +LintLibraryTarget(damageext,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() -- cgit v1.2.3 From 3d254765c33c6e206a790bb927690b5026552c3d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 4 May 2019 00:30:21 +0200 Subject: NXdispatch.c: add missing change This change was missing in 239fe3d0802b12ce8947741693244ff8154fa559 --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 22d5f191e..fab670517 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -1309,6 +1309,9 @@ CloseDownClient(register ClientPtr client) CallCallbacks((&ClientStateCallback), (void *)&clientinfo); } FreeClientResources(client); + /* Disable client ID tracking. This must be done after + * ClientStateCallback. */ + ReleaseClientIds(client); if (client->index < nextFreeClientID) nextFreeClientID = client->index; clients[client->index] = NullClient; -- cgit v1.2.3 From f6845fbd926dd7478e864207a430490687c3d071 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 4 May 2019 00:40:49 +0200 Subject: NXdispatch.c: add missing fixes transfer to derived file was incomplete in 6acbfab33133a92dbd7f128284d26f94bfeb1af2 --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index fab670517..7e5edddb0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -626,7 +626,7 @@ ProcReparentWindow(register ClientPtr client) int ProcQueryTree(register ClientPtr client) { - xQueryTreeReply reply; + xQueryTreeReply reply = {0}; int numChildren = 0; register WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; @@ -637,7 +637,6 @@ ProcQueryTree(register ClientPtr client) DixReadAccess); if (!pWin) return(BadWindow); - memset(&reply, 0, sizeof(xQueryTreeReply)); reply.type = X_Reply; reply.root = pWin->drawable.pScreen->root->drawable.id; reply.sequenceNumber = client->sequence; @@ -720,8 +719,6 @@ ProcSetSelectionOwner(register ClientPtr client) i++; if (i < NumCurrentSelections) { - xEvent event = {0}; - /* If the timestamp in client's request is in the past relative to the time stamp indicating the last time the owner of the selection was set, do not set the selection, just return @@ -732,6 +729,7 @@ ProcSetSelectionOwner(register ClientPtr client) if (CurrentSelections[i].client && (!pWin || (CurrentSelections[i].client != client))) { + xEvent event = {0}; event.u.u.type = SelectionClear; event.u.selectionClear.time = time.milliseconds; event.u.selectionClear.window = CurrentSelections[i].window; @@ -765,7 +763,7 @@ ProcSetSelectionOwner(register ClientPtr client) CurrentSelections[i].client = (pWin ? client : NullClient); if (SelectionCallback) { - SelectionInfoRec info; + SelectionInfoRec info = {0}; info.selection = &CurrentSelections[i]; info.kind= SelectionSetOwner; -- cgit v1.2.3 From 0db8b0353f1aaff3c62bcbed333050d3eaf34c7a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 4 May 2019 01:04:06 +0200 Subject: NXdispatch.c: indent code to match environment --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 7e5edddb0..465e791da 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -278,9 +278,9 @@ Dispatch(void) if (!clientReady) return; - #ifdef WATCH + #ifdef WATCH - fprintf(stderr, "Dispatch: Watchpoint 12.\n"); + fprintf(stderr, "Dispatch: Watchpoint 12.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio @@ -294,22 +294,22 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio #98 1 256 bits (0 KB) -> 34 bits (0 KB) -> 256/1 -> 34/1 = 7.529:1 */ - sleep(30); + sleep(30); - #endif + #endif - #ifdef TEST - fprintf(stderr, "Dispatch: Value of dispatchException is [%x].\n", - dispatchException); + #ifdef TEST + fprintf(stderr, "Dispatch: Value of dispatchException is [%x].\n", + dispatchException); - fprintf(stderr, "Dispatch: Value of dispatchExceptionAtReset is [%x].\n", - dispatchExceptionAtReset); - #endif + fprintf(stderr, "Dispatch: Value of dispatchExceptionAtReset is [%x].\n", + dispatchExceptionAtReset); + #endif - if (!(dispatchException & DE_TERMINATE)) - dispatchException = 0; + if (!(dispatchException & DE_TERMINATE)) + dispatchException = 0; - while (!dispatchException) + while (!dispatchException) { if (*icheck[0] != *icheck[1]) { -- cgit v1.2.3 From a31d2801405834bd52bed6a73b030d124151203b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 May 2019 21:57:01 +0200 Subject: README.keystrokes: refine description --- doc/nxagent/README.keystrokes | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/nxagent/README.keystrokes b/doc/nxagent/README.keystrokes index 3d55f5096..241619b31 100644 --- a/doc/nxagent/README.keystrokes +++ b/doc/nxagent/README.keystrokes @@ -58,12 +58,13 @@ usually you will need Mod1 and Control. Boolean in this context means '0', 'false' and an unspecified attribute are false, anything else is considered true. -Everything in this file is case-sensitive. Unknown lines are ignored. -Keybindings are evaluated from top to bottom, so if a keybinding -matches, other keybindings further down will be ignored. The contents -of the file replaces the default keybindings, and only one file is -read, no merging between different configuration files is done. This -also means that an empty or invalid configuration file deactivates all +Everything in this file is case-sensitive. Unknown lines are ignored +(accompanied by a warning in the session log). Keybindings are +evaluated from top to bottom, so if a keybinding matches, other +keybindings further down will be ignored. The contents of the file +replaces the default keybindings, and only one file is read, no +merging between different configuration files is done. This also means +that an empty or invalid configuration file deactivates all keybindings. If an attribute occurs more than once in a line the last one wins. @@ -72,7 +73,10 @@ List of possible 'action' attributes: ------------------------------------- close_session - This terminates the session. + This terminates the session. If a proper helper is available + (NX_CLIENT environment variable point to e.g. nxdialog path) this + will ask the user if he want to suspend or terminate the session, + otherwise it will terminate without askting. fullscreen Switches the client window into or out of fullscreen mode, using @@ -102,7 +106,9 @@ defer ignore Ignores the following keystroke, nothing will happen when this - keystroke is pressed. + keystroke is pressed. The keystroke will NOT be passed to the + clients. If you want the clients to see the keystroke you need to + eliminate the line from the config file instead of using 'ignore'. reread_keystrokes Forces nxagent to re-read the keystroke configuration. Useful to -- cgit v1.2.3 From 79a2b7b241e61dae4c2ae7a3896f98243e41ff3b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 May 2019 21:49:50 +0200 Subject: Remove useless "ignore" keystroke for Ctrl-Alt-Backspace nxagent does not react on that anyway (see xkb/xkbDflts.h) --- etc/keystrokes.cfg | 1 - nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/etc/keystrokes.cfg b/etc/keystrokes.cfg index c57d2efbb..856369839 100644 --- a/etc/keystrokes.cfg +++ b/etc/keystrokes.cfg @@ -5,7 +5,6 @@ - diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index 6def29ae4..3e02d318d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -113,8 +113,6 @@ struct nxagentSpecialKeystrokeMap default_map[] = { {KEYSTROKE_FULLSCREEN, ControlMask | ShiftMask, True, XK_f}, {KEYSTROKE_MINIMIZE, ControlMask, True, XK_m}, {KEYSTROKE_DEFER, ControlMask, True, XK_e}, - {KEYSTROKE_IGNORE, ControlMask, True, XK_BackSpace}, - {KEYSTROKE_IGNORE, 0, False, XK_Terminate_Server}, {KEYSTROKE_FORCE_SYNCHRONIZATION, ControlMask, True, XK_j}, #ifdef DUMP {KEYSTROKE_REGIONS_ON_SCREEN, ControlMask, True, XK_a}, -- cgit v1.2.3 From 1b9d735b01dd39a2ac6c0b32e00c4f31ae0d85d6 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 May 2019 22:25:02 +0200 Subject: README.keystrokes: mention nxdialog --- doc/nxagent/README.keystrokes | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/nxagent/README.keystrokes b/doc/nxagent/README.keystrokes index 241619b31..750a460eb 100644 --- a/doc/nxagent/README.keystrokes +++ b/doc/nxagent/README.keystrokes @@ -69,14 +69,24 @@ keybindings. If an attribute occurs more than once in a line the last one wins. +Some of the actions can open a dialog window. Depending on the user's +answer the selected action will be taken. Some actions will only show +a dialog informing the user about the taken action. All these dialogs +will only work if the nxagent/x2goagent process has a properly +configured NX_CLIENT environment variable pointing to an executable +(like nxdialog) that is responsible for showing the dialogs and taking +the action(s). If that executable cannot be run no dialog will show up +and no action will be taken. + List of possible 'action' attributes: ------------------------------------- close_session - This terminates the session. If a proper helper is available - (NX_CLIENT environment variable point to e.g. nxdialog path) this - will ask the user if he want to suspend or terminate the session, - otherwise it will terminate without askting. + This terminates the session. If a proper dialog helper is available + ask the user if he wants to disconnect + or terminate the session and then perform the selected + action. Without proper helper it will do nothing (except writing an + error the session log) fullscreen Switches the client window into or out of fullscreen mode, using @@ -102,7 +112,9 @@ viewport_scroll_left/up/right/down (maximum step size is 200px). defer - Activates/deactivates deferred screen updates. + Activates/deactivates deferred screen updates. With a proper + dialog helper (see above) it will open a dialog informing the user + about the action taken. ignore Ignores the following keystroke, nothing will happen when this -- cgit v1.2.3 From fac36b24f55b02040bd6950d8de0385fdbb33703 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 May 2019 23:23:54 +0200 Subject: nxagent: make nxagentX2go a Boolean --- nx-X11/programs/Xserver/hw/nxagent/Init.c | 14 +++++++------- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index d02af3f8d..80ca5fac1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -183,13 +183,13 @@ int nxagentSaveUnder; int nxagentDoFullGeneration = 1; /* - * 1 if agent running as X2goAgent - * 0 if NX Agent + * True if agent is running as X2goAgent + * False if agent is running as NXAgent */ -int nxagentX2go; +Bool nxagentX2go; /* - * Checking if agent is x2go agent + * Check if agent is x2go agent */ void checkX2goAgent(void) @@ -200,13 +200,13 @@ void checkX2goAgent(void) fprintf(stderr, "%s: nxagentProgName [%s]\n", __func__, nxagentProgName); #endif - if( strcasecmp(nxagentProgName,"x2goagent") == 0) + if (strcasecmp(nxagentProgName,"x2goagent") == 0) { fprintf(stderr, "\nrunning as X2Go Agent\n"); - nxagentX2go=1; + nxagentX2go = True; } else - nxagentX2go=0; + nxagentX2go = False; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 045fa19fa..96b33ea7d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -756,7 +756,7 @@ XkbError: fprintf(stderr, "nxagentKeyboardProc: nxagentKeyboard is [%s].\n", nxagentKeyboard ? nxagentKeyboard : "NULL"); #endif - if (nxagentX2go == 1 && nxagentKeyboard && (strcmp(nxagentKeyboard, "null/null") == 0)) + if (nxagentX2go && nxagentKeyboard && (strcmp(nxagentKeyboard, "null/null") == 0)) { #ifdef TEST fprintf(stderr, "%s: changing nxagentKeyboard from [null/null] to [clone].\n", __func__); @@ -874,7 +874,7 @@ XkbError: * method for switching that off is the creation of a dir * instead of a file. */ - if (nxagentX2go == 1) + if (nxagentX2go) { nxagentWriteKeyboardDir(); } @@ -894,7 +894,7 @@ XkbError: * know about that yet. Once x2go starts using clone * we can drop this here. */ - if (nxagentX2go == 1) + if (nxagentX2go) { nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); } -- cgit v1.2.3