aboutsummaryrefslogtreecommitdiff
path: root/libXext
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-12-06 08:03:07 +0000
committermarha <marha@users.sourceforge.net>2010-12-06 08:03:07 +0000
commit4218fd3a8c41e4d9715cbcd6d855736028835fb8 (patch)
tree528be12917049d77b6633654640765b804612cc1 /libXext
parent30eaf03aef5847adb6da7efd4bbf4a4abaf5d738 (diff)
downloadvcxsrv-4218fd3a8c41e4d9715cbcd6d855736028835fb8.tar.gz
vcxsrv-4218fd3a8c41e4d9715cbcd6d855736028835fb8.tar.bz2
vcxsrv-4218fd3a8c41e4d9715cbcd6d855736028835fb8.zip
libXext xserver pixman git update 6-12-2010
Diffstat (limited to 'libXext')
-rw-r--r--libXext/configure.ac4
-rw-r--r--libXext/include/X11/extensions/sync.h33
-rw-r--r--libXext/specs/Makefile.am2
-rw-r--r--libXext/specs/xtest1.xml954
-rw-r--r--libXext/src/XSync.c258
5 files changed, 1221 insertions, 30 deletions
diff --git a/libXext/configure.ac b/libXext/configure.ac
index 631b774cc..ea1d6ca92 100644
--- a/libXext/configure.ac
+++ b/libXext/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ([2.60])
AC_INIT([libXext],
- [1.2.0],
+ [1.2.99.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[libXext])
@@ -40,7 +40,7 @@ AC_PROG_LIBTOOL
AC_PROG_CC
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XEXT, [xproto >= 7.0.13] [x11 >= 1.1.99.1] [xextproto >= 7.0.99.2])
+PKG_CHECK_MODULES(XEXT, [xproto >= 7.0.13] [x11 >= 1.1.99.1] [xextproto >= 7.1.99])
AC_SUBST(XEXT_CFLAGS)
AC_SUBST(XEXT_LIBS)
diff --git a/libXext/include/X11/extensions/sync.h b/libXext/include/X11/extensions/sync.h
index 460bf56ca..0ed5b728d 100644
--- a/libXext/include/X11/extensions/sync.h
+++ b/libXext/include/X11/extensions/sync.h
@@ -335,6 +335,39 @@ extern Status XSyncGetPriority(
int* /*return_priority*/
);
+extern XSyncFence XSyncCreateFence(
+ Display* /*dpy*/,
+ Drawable /*d*/,
+ Bool /*initially_triggered*/
+);
+
+extern Bool XSyncTriggerFence(
+ Display* /*dpy*/,
+ XSyncFence /*fence*/
+);
+
+extern Bool XSyncResetFence(
+ Display* /*dpy*/,
+ XSyncFence /*fence*/
+);
+
+extern Bool XSyncDestroyFence(
+ Display* /*dpy*/,
+ XSyncFence /*fence*/
+);
+
+extern Bool XSyncQueryFence(
+ Display* /*dpy*/,
+ XSyncFence /*fence*/,
+ Bool* /*triggered*/
+);
+
+extern Bool XSyncAwaitFence(
+ Display* /*dpy*/,
+ const XSyncFence* /*fence_list*/,
+ int /*n_fences*/
+);
+
_XFUNCPROTOEND
#endif /* _SYNC_SERVER */
diff --git a/libXext/specs/Makefile.am b/libXext/specs/Makefile.am
index 0d6379223..10dbed24f 100644
--- a/libXext/specs/Makefile.am
+++ b/libXext/specs/Makefile.am
@@ -22,7 +22,7 @@
#
if ENABLE_SPECS
-doc_sources = dbelib.xml dpmslib.xml shapelib.xml synclib.xml
+doc_sources = dbelib.xml dpmslib.xml shapelib.xml synclib.xml xtest1.xml
dist_doc_DATA = $(doc_sources)
if HAVE_XMLTO
diff --git a/libXext/specs/xtest1.xml b/libXext/specs/xtest1.xml
new file mode 100644
index 000000000..4652de72a
--- /dev/null
+++ b/libXext/specs/xtest1.xml
@@ -0,0 +1,954 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+
+
+<book id="xtest1">
+
+<bookinfo>
+ <title>X11 INPUT SYNTHESIS EXTENSION PROPOSAL</title>
+ <subtitle>X Consortium Standard</subtitle>
+ <releaseinfo>Version 1.0</releaseinfo>
+ <authorgroup>
+ <author>
+ <firstname>Larry</firstname><surname>Woestman</surname>
+ <affiliation><orgname>Hewlett Packard, Member of Technical Staff</orgname></affiliation>
+ </author>
+ </authorgroup>
+ <corpname>X Consortium Standard</corpname>
+ <copyright><year>1993</year><holder>X Consortium</holder></copyright>
+ <affiliation><orgname>X Consortium</orgname></affiliation>
+ <productnumber>X Version 11, Release 7</productnumber>
+
+<abstract>
+<para>
+This is a proposal for an extension to the X11 server and Xlib.
+</para>
+</abstract>
+
+</bookinfo>
+
+<chapter>
+<title>TITLE</title>
+<sect1 id="introduction">
+<title>Introduction</title>
+<para>
+This is a proposal for an extension to the X11 server and Xlib.
+It provides two capabilities:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+It allows a client to generate user input actions in the server without
+requiring a user to be present.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+It also allows a client to control the
+handling of user input actions by the server.
+ </para>
+ </listitem>
+</itemizedlist>
+
+<para>
+The capability
+to allow a client to generate user input actions in the server
+will be used by some of the X Testing Consortium Xlib tests.
+Both capabilities will be used by the X Testing Consortium client exerciser
+program.
+These capabilities may also be useful in other programs.
+</para>
+
+<para>
+This extension requires modification to device-dependent code in the
+server. Therefore it is not a 'portable' extension as defined by the
+X11 Server Extensions document. However, the majority of the code
+and functionality of this extension will be implementation-independent.
+</para>
+
+</sect1>
+
+<sect1 id="conventions_used_in_this_document">
+<title>Conventions Used In This Document</title>
+
+<para>
+The naming conventions used in the Xlib documentation are followed
+with these additions:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+The names of all functions defined in this extension begin with 'XTest',
+with the first letter of each additional word capitalized.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+The names of the protocol request structures follow the Xlib convention
+of 'x&lt;name&gt;Req'.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+The names of the protocol request minor type codes follow the Xlib convention
+of 'X_&lt;name&gt;'.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+The names of all other constants defined in this extension begin with 'XTest',
+with the rest of the name in upper case letters.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+All constants and structures defined in this extension will have their
+values specified in the 'xtestext1.h' file (listed in section 5).
+ </para>
+ </listitem>
+</itemizedlist>
+
+</sect1>
+<sect1 id="definition_of_terms">
+<title>Definition Of Terms</title>
+
+<sect2 id="input_actions">
+<title>Input Actions</title>
+<para>
+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).
+</para>
+</sect2>
+
+<sect2 id="user_input_actions">
+<title>User Input Actions</title>
+<para>
+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.
+</para>
+</sect2>
+
+</sect1>
+
+<sect1 id="what_does_this_extension_do">
+<title>What Does This Extension Do?</title>
+<para>
+Without this extension, user input actions are processed by the server,
+and are converted into normal X events that are sent to the
+appropriate client or clients.
+</para>
+
+<para>
+This extension adds the following capabilities:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+Input actions may be sent from a client to the server to be
+processed just as if the user had physically performed them.
+The input actions are provided to the server in the form of X protocol
+requests defined by this extension.
+The information provided to the server includes what action should be
+performed, and how long to delay before processing the action in the server.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+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.
+The user input actions are provided to the client in the form of X events
+defined by this extension.
+The information provided to the client includes what user input action
+occurred and the delay between this user input action and the previous user
+input action.
+The client may then do anything it wishes with this information.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+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 as described above.
+ </para>
+ </listitem>
+</itemizedlist>
+
+</sect1>
+<sect1 id="functions_in_this_extension">
+<title>Functions In This Extension</title>
+
+<sect2 id="high_level_functions">
+<title>High Level Functions</title>
+
+<para>
+These functions are built on top of the low level functions described later.
+</para>
+
+<sect3 id="xtestmovepointer">
+<title>XTestMovePointer</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestMovePointer</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>int <parameter>device_id</parameter></paramdef>
+ <paramdef>unsigned long <parameter>delay</parameter></paramdef>
+ <paramdef>int <parameter>x</parameter></paramdef>
+ <paramdef>int <parameter>y</parameter></paramdef>
+ <paramdef>unsigned int <parameter>count</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>device_id</term>
+ <listitem>
+ <para>
+Specifies which pointer device was supposed to have caused the input action.
+This is a provision for future support of multiple (distinguishable) pointer
+devices, and should always be set to 0 for now.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>delay</term>
+ <listitem>
+ <para>
+Specifies the time (in milliseconds) to wait before each movement
+of the pointer.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>x, y</term>
+ <listitem>
+ <para>
+Specifies the x and y coordinates to move the pointer to relative to the
+root window for the specified display.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>count</term>
+ <listitem>
+ <para>
+Specifies the number of 'delay, x, y' triplets contained in the
+<emphasis>delay</emphasis>,
+<emphasis>x</emphasis> and
+<emphasis>y</emphasis> arrays.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XTestMovePointer</function>
+function creates input actions to be sent to the the server.
+The input actions will be accumulated in a request defined by this extension
+until the request is full or the XTestFlush function is called.
+They will then be sent to the server.
+When the input actions are sent to the server, the input actions will cause
+the server to think that the pointer was moved to the specified position(s),
+with the specified delay before each input action.
+</para>
+<para>
+The
+<function>XTestMovePointer</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+</sect3>
+
+<sect3 id="xtestpressbutton">
+<title>XTestPressButton</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestPressButton</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>int <parameter>device_id</parameter></paramdef>
+ <paramdef>unsigned long <parameter>delay</parameter></paramdef>
+ <paramdef>unsigned int <parameter>button_number</parameter></paramdef>
+ <paramdef>unsigned int <parameter>button_action</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+<!-- .VL 15 -->
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>device_id</term>
+ <listitem>
+ <para>
+Specifies which button device was supposed to have caused the input action.
+This is a provision for future support of multiple (distinguishable) button
+devices, and should always be set to 0 for now.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>delay</term>
+ <listitem>
+ <para>
+Specifies the time (in milliseconds) to wait before the input action.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>button_number</term>
+ <listitem>
+ <para>
+Specifies which button is being acted upon.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>button_action</term>
+ <listitem>
+ <para>
+Specifies the action to be performed (one of
+<emphasis>XTestPRESS</emphasis>,
+<emphasis>XTestRELEASE</emphasis>, or
+<emphasis>XTestSTROKE</emphasis>).
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XTestPressButton</function>
+function creates input actions to be sent to the the server.
+The input actions will be accumulated in a request defined by this extension
+until the request is full or the XTestFlush function is called.
+They will then be sent to the server.
+When the input actions are sent to the server, the input actions will cause
+the server to think that the specified button was moved as specified.
+</para>
+<para>
+The
+<function>XTestPressButton</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+</sect3>
+
+<sect3 id="xtestpresskey">
+<title>XTestPressKey</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestPressKey</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>int <parameter>device_id</parameter></paramdef>
+ <paramdef>unsigned long <parameter>delay</parameter></paramdef>
+ <paramdef>unsigned int <parameter>keycode</parameter></paramdef>
+ <paramdef>unsigned int <parameter>key_action</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<!-- .VL 12 -->
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>device_id</term>
+ <listitem>
+ <para>
+Specifies which keyboard device was supposed to have caused the input action.
+This is a provision for future support of multiple (distinguishable) keyboard
+devices, and should always be set to 0 for now.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>delay</term>
+ <listitem>
+ <para>
+Specifies the time (in milliseconds) to wait before the input action.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>keycode</term>
+ <listitem>
+ <para>
+Specifies which keycode is being acted upon.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>key_action</term>
+ <listitem>
+ <para>
+Specifies the action to be performed (one of
+<emphasis>XTestPRESS</emphasis>,
+<emphasis>XTestRELEASE</emphasis>, or
+<emphasis>XTestSTROKE</emphasis>).
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+
+<para>
+The
+<function>XTestPressKey</function>
+function creates input actions to be sent to the the server.
+The input actions will be accumulated in a request defined by this extension
+until the request is full or the XTestFlush function is called.
+They will then be sent to the server.
+When the input actions are sent to the server, the input actions will cause
+the server to think that the specified key on the keyboard was moved as
+specified.
+</para>
+
+<para>
+The
+<function>XTestPressKey</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+
+</sect3>
+<sect3 id="xtestflush">
+<title>XTestFlush</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestFlush</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<!-- .VL 9 -->
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XTestFlush</function>
+will send any remaining input actions to the server.
+</para>
+
+<para>
+The
+<function>XTestFlush</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+
+</sect3>
+</sect2>
+
+<!-- .H 2 Low~Level~Functions -->
+<sect2 id="low_level_functions">
+<title>Low Level Functions</title>
+
+<!-- .H 3 XTestGetInput -->
+<sect3 id="xtestgetinput">
+<title>XTestGetInput</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestGetInput</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>int <parameter>action_handling</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>action_handling</term>
+ <listitem>
+ <para>
+Specifies to the server what to do with the user input actions. (one of
+0, <emphasis>XTestPACKED_MOTION</emphasis> or
+<emphasis>XTestPACKED_ACTIONS</emphasis>; optionally 'or'ed
+with <emphasis>XTestEXCLUSIVE</emphasis>).
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+
+<para>
+The
+<function>XTestGetInput</function>
+function tells the server to begin putting information about user input actions
+into events to be sent to the client that called this function. These events
+can be read via the Xlib <function>XNextEvent</function>fR function.
+</para>
+
+<para>
+The server assigns an event type of
+<emphasis>XTestInputActionType</emphasis> to these events
+to distinguish them from other events.
+Since the actual value of the event type may vary depending on how many
+extensions are included with an X11 implementation,
+<emphasis>XTestInputActionType</emphasis> is a variable that will be
+contained in the Xlib
+part of this extension. It may be referenced as follows:
+</para>
+
+<para>
+extern int XTestInputActionType;
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+An <emphasis>action_handling</emphasis> value of 0 causes the server
+to send one user input action in each
+<emphasis>XTestInputActionType</emphasis> event.
+This can sometimes cause performance problems.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+An <emphasis>action_handling</emphasis> value of
+<emphasis>XTestPACKED_ACTIONS</emphasis> causes the server
+to pack as many user input actions as possible into a
+<emphasis>XTestInputActionType</emphasis> event.
+This is needed if user input actions are happening rapidly (such as
+when the user moves the pointer) to keep performance at a reasonable level.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+An <emphasis>action_handling</emphasis> value of
+<emphasis>XTestPACKED_MOTION</emphasis> causes the server
+to pack only user input actions associated with moving the pointer.
+This allows the
+client to receive button and key motions as they happen without waiting for the
+event to fill up, while still keeping performance at a reasonable level.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+An <emphasis>action_handling</emphasis> value with
+<emphasis>XTestEXCLUSIVE</emphasis> 'or'ed in
+causes the server to send user input actions only to the client.
+The effect on the server is as if the user had performed no input actions.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+An <emphasis>action_handling</emphasis> value without
+<emphasis>XTestEXCLUSIVE</emphasis>
+causes the server to 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).
+ </para>
+ </listitem>
+</itemizedlist>
+
+<para>
+There are four types of input actions that are passed from the server
+to the client. They are:
+</para>
+
+<variablelist>
+ <varlistentry>
+ <term>key/button~state~change</term>
+ <listitem>
+ <para>
+This type of input action contains the keycode of the key or button that
+changed state;
+whether the key or button is up or down,
+and the time delay between this input action and the previous input action.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>pointer~motions</term>
+ <listitem>
+ <para>
+This type of input action contains information about the motion of the
+pointer when the pointer has only moved a short distance.
+If the pointer has moved a long distance,
+the pointer jump input action is used.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>pointer~jumps</term>
+ <listitem>
+ <para>
+This type of input action contains information about the motion of the
+pointer when the pointer has moved a long distance.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>delays</term>
+ <listitem>
+ <para>
+This type of input action is used when the delay between input actions is too
+large to be held in the other input actions.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XTestGetInput</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+<para>
+An error code of <emphasis>BadAccess</emphasis> means that another client
+has already requested that user input actions be sent to it.
+</para>
+
+</sect3>
+
+<!-- .H 3 XTestStopInput -->
+<sect3 id="xteststopinput">
+<title>XTestStopInput</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestStopInput</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XTestStopInput</function>
+function tells the server to stop putting information about user input actions
+into events.
+The server will process user input actions normally (as it would
+if this extension were not in the server).
+</para>
+
+<para>
+The
+<function>XTestStopInput</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+
+<para>
+An error code of <emphasis>BadAccess</emphasis> means that a request
+was made to stop input when input has never been started.
+</para>
+
+</sect3>
+
+<!-- .H 3 XTestFakeInput -->
+<sect3 id="xtestfakeinput">
+<title>XTestFakeInput</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestFakeInput</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>char <parameter>*action_list_addr</parameter></paramdef>
+ <paramdef>int <parameter>action_list_size</parameter></paramdef>
+ <paramdef>int <parameter>ack_flag</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+<!-- .VL 18 -->
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>action_list_addr</term>
+ <listitem>
+ <para>
+Specifies the address of an list of input actions to be sent to the server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>action_list_size</term>
+ <listitem>
+ <para>
+Specifies the size (in bytes) of the list of input actions.
+It may be no larger than <emphasis>XTestMAX_ACTION_LIST_SIZE</emphasis> bytes.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>ack_flag</term>
+ <listitem>
+ <para>
+Specifies whether the server needs to send an event to indicate that its
+input action buffer is empty (one of
+<emphasis>XTestFAKE_ACK_NOT_NEEDED</emphasis> or
+<emphasis>XTestFAKE_ACK_REQUEST</emphasis>).
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XTestFakeInput</function>
+function tells the server to take the specified user input actions and process
+them as if the user had physically performed them.
+</para>
+
+<para>
+The server can only accept a limited number of input actions at one
+time. This limit can be determined by the
+<function>XTestQueryInputSize</function> function
+in this extension.
+</para>
+
+<para>
+The client should set <emphasis>ack_flag</emphasis> to
+<emphasis>XTestFAKE_ACK_NOT_NEEDED</emphasis>
+on calls to <emphasis>XTestFakeInput</emphasis> that do not reach this limit.
+</para>
+
+<para>
+The client should set <emphasis>ack_flag</emphasis> to
+<emphasis>XTestFAKE_ACK_REQUEST</emphasis>
+on the call to <emphasis>XTestFakeInput</emphasis> that reaches this limit.
+</para>
+
+<para>
+When the server sees an <emphasis>ack_flag</emphasis> value of
+<emphasis>XTestFAKE_ACK_REQUEST</emphasis>
+it finishes processing its input action buffer, then sends an event with
+type <emphasis>XTestFakeAckType</emphasis> to the client.
+When the client reads this event, it knows that it is safe to resume
+sending input actions to the server.
+</para>
+
+<para>
+Since the actual value of the event type may vary depending on how many
+extensions are included with an X11 implementation,
+<emphasis>XTestFakeAckType</emphasis> is a variable that is contained
+in the Xlib part of this extension. It may be referenced as follows:
+</para>
+
+<para>
+extern int XTestFakeAckType;
+</para>
+
+<para>
+There are four types of input actions that are passed from the client
+to the server. They are:
+</para>
+
+<variablelist>
+ <varlistentry>
+ <term>key/button~state~change</term>
+ <listitem>
+ <para>
+This type of input action contains the keycode of the key or button that
+is to change state;
+whether the key or button is to be up or down,
+and the time to delay before changing the state of the key or button.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>pointer~motions</term>
+ <listitem>
+ <para>
+This type of input action contains information about the motion of the
+pointer when the pointer is to be moved a short distance,
+and the time to delay before moving the pointer.
+If the pointer is to be moved a long distance,
+the pointer jump input action must be used.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>pointer~jumps</term>
+ <listitem>
+ <para>
+This type of input action contains information about the motion of the
+pointer when the pointer is to be moved a long distance,
+and the time to delay before moving the pointer.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>delays</term>
+ <listitem>
+ <para>
+This type of input action is used when the delay between input actions is too
+large to be held in the other input actions.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+
+<para>
+The
+<function>XTestFakeInput</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+
+<para>
+An error code of \fIBadAccess\fR means that another client has already
+sent user input actions to the server, and the server has not finished
+processing the user input actions.
+</para>
+
+</sect3>
+
+<!-- .H 3 XTestQueryInputSize -->
+<sect3 id="xtestqueryinputsize">
+<title>XTestQueryInputSize</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestQueryInputSize</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>unsigned long <parameter>size_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>size_return</term>
+ <listitem>
+ <para>
+Returns the number of input actions that the server's input action buffer can
+hold.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XTestQueryInputSize</function>
+function asks the server to return the number of input actions that it can hold
+in its input action buffer in the unsigned long pointed to by \fIsize_return\fR.
+</para>
+<para>
+The
+<function>XTestQueryInputSize</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+</sect3>
+
+<!-- .H 3 XTestReset -->
+<sect3 id="xtestreset">
+<title>XTestReset</title>
+
+<funcsynopsis>
+<funcprototype>
+ <funcdef>int <function>XTestReset</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XTestReset</function>
+function tells the server to set everything having to do with this extension
+back to its initial state. After this call the server will act as if this
+extension were not installed until one of the extension functions is called by
+a client. This function is not normally needed, but is included in case a
+client wishes to clean up the server state, such as after a serious error.
+</para>
+
+<para>
+The
+<function>XTestReset</function>
+function will return -1 if there is an error, and 0 otherwise.
+</para>
+
+</sect3>
+</sect2>
+</sect1>
+
+<!-- .H 1 'xtestext1.h'~File~Listing -->
+<!-- .so xtestext1.h -->
+<!-- .TC 1 1 4 -->
+</chapter>
+</book>
diff --git a/libXext/src/XSync.c b/libXext/src/XSync.c
index 250d10cd3..9fdb47e2f 100644
--- a/libXext/src/XSync.c
+++ b/libXext/src/XSync.c
@@ -92,21 +92,107 @@ static XExtensionHooks sync_extension_hooks = {
static char *sync_error_list[] = {
"BadCounter",
"BadAlarm",
+ "BadFence",
};
+typedef struct _SyncVersionInfoRec {
+ short major;
+ short minor;
+ int num_errors;
+} SyncVersionInfo;
+
+static /* const */ SyncVersionInfo supported_versions[] = {
+ { 3 /* major */, 0 /* minor */, 2 /* num_errors */ },
+ { 3 /* major */, 1 /* minor */, 3 /* num_errors */ },
+};
+
+#define NUM_VERSIONS (sizeof(supported_versions)/sizeof(supported_versions[0]))
+#define GET_VERSION(info) ((info) ? (const SyncVersionInfo*)(info)->data : NULL)
+#define IS_VERSION_SUPPORTED(info) (!!GET_VERSION(info))
+
static
-XEXT_GENERATE_FIND_DISPLAY(find_display, sync_info,
- sync_extension_name,
- &sync_extension_hooks,
- XSyncNumberEvents, (XPointer) NULL)
+const SyncVersionInfo* GetVersionInfo(Display *dpy)
+{
+ xSyncInitializeReply rep;
+ xSyncInitializeReq *req;
+ XExtCodes codes;
+ int i;
+
+ if (!XQueryExtension(dpy, sync_extension_name,
+ &codes.major_opcode,
+ &codes.first_event,
+ &codes.first_error))
+ return NULL;
+
+ LockDisplay(dpy);
+ GetReq(SyncInitialize, req);
+ req->reqType = codes.major_opcode;
+ req->syncReqType = X_SyncInitialize;
+ req->majorVersion = SYNC_MAJOR_VERSION;
+ req->minorVersion = SYNC_MINOR_VERSION;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ for (i = 0; i < NUM_VERSIONS; i++) {
+ if (supported_versions[i].major == rep.majorVersion &&
+ supported_versions[i].minor == rep.minorVersion) {
+ return &supported_versions[i];
+ }
+ }
+
+ return NULL;
+}
+
+static
+XExtDisplayInfo *find_display_create_optional(Display *dpy, Bool create)
+{
+ XExtDisplayInfo *dpyinfo;
+
+ if (!sync_info) {
+ if (!(sync_info = XextCreateExtension())) return NULL;
+ }
+
+ if (!(dpyinfo = XextFindDisplay (sync_info, dpy)) && create) {
+ dpyinfo = XextAddDisplay(sync_info, dpy,
+ sync_extension_name,
+ &sync_extension_hooks,
+ XSyncNumberEvents,
+ (XPointer)GetVersionInfo(dpy));
+ }
+
+ return dpyinfo;
+}
+
+static
+XExtDisplayInfo *find_display (Display *dpy)
+{
+ return find_display_create_optional(dpy, True);
+}
static
XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info)
static
-XEXT_GENERATE_ERROR_STRING(error_string, sync_extension_name,
- XSyncNumberErrors, sync_error_list)
+char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
+{
+ XExtDisplayInfo *info = find_display_create_optional(dpy, False);
+ int nerr = IS_VERSION_SUPPORTED(info) ? GET_VERSION(info)->num_errors : 0;
+ code -= codes->first_error;
+ if (code >= 0 && code < nerr) {
+ char tmp[256];
+ sprintf (tmp, "%s.%d", sync_extension_name, code);
+ XGetErrorDatabaseText (dpy, "XProtoError", tmp, sync_error_list[code], buf, n);
+ return buf;
+ }
+ return (char *)0;
+}
static Bool
wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
@@ -231,32 +317,17 @@ XSyncInitialize(
int *major_version_return, int *minor_version_return)
{
XExtDisplayInfo *info = find_display(dpy);
- xSyncInitializeReply rep;
- xSyncInitializeReq *req;
SyncCheckExtension(dpy, info, False);
- LockDisplay(dpy);
- GetReq(SyncInitialize, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncInitialize;
- req->majorVersion = SYNC_MAJOR_VERSION;
- req->minorVersion = SYNC_MINOR_VERSION;
- if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
- {
- UnlockDisplay(dpy);
- SyncHandle();
+ if (IS_VERSION_SUPPORTED(info)) {
+ *major_version_return = GET_VERSION(info)->major;
+ *minor_version_return = GET_VERSION(info)->minor;
+
+ return True;
+ } else {
return False;
}
- UnlockDisplay(dpy);
- SyncHandle();
- *major_version_return = rep.majorVersion;
- *minor_version_return = rep.minorVersion;
- return ((rep.majorVersion == SYNC_MAJOR_VERSION)
-#if SYNC_MINOR_VERSION > 0 /* avoid compiler warning */
- && (rep.minorVersion >= SYNC_MINOR_VERSION)
-#endif
- );
}
XSyncSystemCounter *
@@ -691,6 +762,139 @@ XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority)
return True;
}
+XSyncFence
+XSyncCreateFence(Display *dpy, Drawable d, Bool initially_triggered)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncCreateFenceReq *req;
+ XSyncFence id;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncCreateFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncCreateFence;
+
+ req->d = d;
+ id = req->fid = XAllocID(dpy);
+ req->initially_triggered = initially_triggered;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return id;
+}
+
+Bool
+XSyncTriggerFence(Display *dpy, XSyncFence fence)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncTriggerFenceReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncTriggerFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncTriggerFence;
+
+ req->fid = fence;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XSyncResetFence(Display *dpy, XSyncFence fence)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncResetFenceReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncResetFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncResetFence;
+
+ req->fid = fence;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XSyncDestroyFence(Display *dpy, XSyncFence fence)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncDestroyFenceReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncDestroyFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncDestroyFence;
+
+ req->fid = fence;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncQueryFenceReply rep;
+ xSyncQueryFenceReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncQueryFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncQueryFence;
+ req->fid = fence;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ if (triggered)
+ *triggered = rep.triggered;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncAwaitFenceReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncAwaitFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncAwaitFence;
+ SetReqLen(req, n_fences, n_fences);
+
+ Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
/*
* Functions corresponding to the macros for manipulating 64-bit values
*/