⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xtest1di.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 2 页
字号:
	 */	register char	n;	REQUEST(xTestStopInputReq);	/*	 * byte-swap the length field in the request	 */	swaps(&stuff->length, n);	return(ProcTestStopInput(client));}/***************************************************************************** * *	SProcTestReset * * */static intSProcTestReset(client)	register ClientPtr	client;{	/*	 * used in the swaps and swapl macros for temporary storage space	 */	register char	n;	REQUEST(xTestResetReq);	/*	 * byte-swap the length field in the request	 */	swaps(&stuff->length, n);	return(ProcTestReset(client));}/***************************************************************************** * *	SProcTestQueryInputSize * * */static intSProcTestQueryInputSize(client)	register ClientPtr	client;{	/*	 * used in the swaps and swapl macros for temporary storage space	 */	register char	n;	REQUEST(xTestQueryInputSizeReq);	/*	 * byte-swap the length field in the request	 */	swaps(&stuff->length, n);	return(ProcTestQueryInputSize(client));}/***************************************************************************** * *	ProcTestFakeInput * * */static intProcTestFakeInput(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 intProcTestGetInput(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 intProcTestStopInput(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 intProcTestReset(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 intProcTestQueryInputSize(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 voidXTestResetProc(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 intXTestCurrentClientGone(value, id)	pointer	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 voidSReplyXTestDispatch(client_ptr, size, reply_ptr)	ClientPtr	client_ptr;	int		size;	char		*reply_ptr;{	/*	 * used in the swaps and swapl macros for temporary storage space	 */	register char	n;	/*	 * 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), n);	swapl(&(rep_ptr->length), n);	swapl(&(rep_ptr->size_return), n);	/*	 * now write the swapped reply to the client	 */	WriteToClient(client_ptr, size, reply_ptr);}/***************************************************************************** * *	SEventXTestDispatch * *	Swap any events defined in this extension. */static voidSEventXTestDispatch(from, to)	xEvent	*from;	xEvent	*to;{	/*	 * used in the swaps and swapl macros for temporary storage space	 */	register char	n;	/*	 * 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), n);	/*	 * 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), n);				/*				 * 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), n);				/*				 * advance to the next input action				 */				i += sizeof(XTestMotionInfo);				break;			case XTestJUMP_ACTION:				/*				 * byte-swap the jumpx field				 */				swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n);				/*				 * byte-swap the jumpy field				 */				swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n);				/*				 * byte-swap the delay_time field				 */				swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n);				/*				 * 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), n);					/*					 * 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;			}		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -