|
|
#include "Xlibint.h" #include "X11/Xproto.h" #include "xtestext1.h" #include <stdio.h>int XTestMovePointer (display, device_id, delay, x, y, count) Display display; int device_id; unsigned long delay[]; int x[]; int y[]; unsigned int count;
int XTestPressButton (display, device_id, delay, button_number, button_action) Display display; int device_id; unsigned long delay; unsigned int button_number; unsigned int button_action;
int XTestPressKey (display, device_id, delay, keycode, key_action) Display display; int device_id; unsigned long delay; unsigned int keycode; unsigned int key_action;
int XTestFlush (display) Display display;
int XTestGetInput (display, action_handling) Display display; int action_handling;
int XTestStopInput (display) Display display;
int XTestFakeInput (display, action_list_addr, action_list_size, ack_flag) Display display; char action_list_addr; int action_list_size; int ack_flag;
int XTestQueryInputSize (display, size_return) Display display; unsigned long size_return;
int XTestReset (display) Display display;
int XTestStartSimulation(dpy) Display *dpy;
int XTestStopSimulation(dpy) Display *dpy;
In this description, "input actions" are pointer movements, button presses and releases, and key presses and releases. They can be generated by a user or by a client (using functions in this extension). "User input actions" are input actions that are generated by the user moving a pointing device (typically a mouse), pressing and releasing buttons on the pointing device, and pressing and releasing keys on the keyboard.
This extension adds the following capabilities:
Input actions may be sent from a client to the server to be processed just as if the user had physically performed them. The information provided to the server includes what action should be performed, and how long to delay before processing the action in the server.
User input actions may be diverted to a client before being processed by the server. The effect on the server is as if the user had performed no input action.
User input actions may be copied, with one copy going to the server in the normal way, and the other copy being sent to a client.
Each XTest function will return -1 if there is an error, and 0 otherwise.
Each XTest function can return
an error code of BadAccess
.
The XTestMovePointer, XTestPressButton and XTestPressKey functions create input actions to be sent to the server. The input actions will be accumulated in a request. When the request is full or the XTestFlush function is called, the input actions will be sent to the server. The server will interpret the input actions as:
When the XTestGetInput function is used, the server will begin putting information about user input actions into events to be sent to the client. There are four types of user input actions that are passed from the server to the client. They are:
These events can be read via the Xlib XNextEvent(X3xlib) function. The server assigns an event type of TestInputActionType to these events. Passing XTestGetInput an action_handling value of:
If XTestEXCLUSIVE is not used, the server will copy user input actions, sending one copy to the client, and handling the other copy normally, as it would if this extension were not installed.
When the XTestStopInput function is called the server will stop putting information about user input actions into events. The server will process user input actions normally.
When the XTestFakeInput function is used the server will take the specified input actions and process them as if the user had physically performed them. The types of user input that can be sent are listed in the the XTestGetInput description.
The server can only accept a limited number of input actions. This limit is determined by the XTestQueryInputSize function; the limit is returned in size_return.
For calls to XTestFakeInput that do not reach this limit, set ack_flag to ``XTestFAKE_ACK_NOT_NEEDED''. On the call to XTestFakeInput that reaches this limit, set ack_flag to ``XTestFAKE_ACK_REQUEST''.
When the server receives an ack_flag
value of ``XTestFAKE_ACK_REQUEST''
it finishes processing its input action buffer, then sends an event with
type XTestFakeAckType to the client.
When the client reads this event, the client can resume
sending input actions to the server.
Since the actual value of the event type may vary depending on how many
extensions are included with an X11 implementation,
XTestFakeAckType is a variable that is contained
in the Xlib part of this extension.
It may be referenced as follows:
extern int XTestFakeAckType;
When the XTestReset function is used, the server will set everything having to do with this extension back to its initial state. This function is included to allow a client clean up the server state, such as after a serious error.
XTestStartSimulation is used to start the request process. This call must be made by the client using this extension to register itself with the server as the client which will be sending input. The client making this request will not be excluded from sending test events should the server be grabbed by another client using the XGrabServer(X3xlib) function.
XTestStopSimulation is used to tell the server that this client will no longer be sending test events to the server.
action_list_size
XTestMAX_ACTION_LIST_SIZE
action_handling
XTestPACKED_MOTION
XTestPACKED_ACTIONS
XTestEXCLUSIVE
button_action and key_action
XTestPRESS
XTestRELEASE
XTestSTROKE
BadAccess