diff options
author | marha <marha@users.sourceforge.net> | 2011-05-22 14:29:51 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-05-22 14:29:51 +0000 |
commit | 016747a04df9d4474489fe3b3d1c0f11a713148b (patch) | |
tree | 69722f37ac06c00d6674c7bf2df6597753b418e6 /libX11 | |
parent | 32a666fa1f26defd3b4e508b75f1acf6e2900a40 (diff) | |
parent | 52011cfedaa930d61d8f60b283a2051093727582 (diff) | |
download | vcxsrv-016747a04df9d4474489fe3b3d1c0f11a713148b.tar.gz vcxsrv-016747a04df9d4474489fe3b3d1c0f11a713148b.tar.bz2 vcxsrv-016747a04df9d4474489fe3b3d1c0f11a713148b.zip |
svn merge ^/branches/released .
Diffstat (limited to 'libX11')
-rw-r--r-- | libX11/specs/libX11/CH01.xml | 2 | ||||
-rw-r--r-- | libX11/specs/libX11/CH03.xml | 2 | ||||
-rw-r--r-- | libX11/specs/libX11/CH06.xml | 2 | ||||
-rw-r--r-- | libX11/specs/libX11/CH07.xml | 2 | ||||
-rw-r--r-- | libX11/specs/libX11/CH08.xml | 6 | ||||
-rw-r--r-- | libX11/specs/libX11/CH09.xml | 9 | ||||
-rw-r--r-- | libX11/specs/libX11/CH10.xml | 4 | ||||
-rw-r--r-- | libX11/specs/libX11/CH13.xml | 40 | ||||
-rw-r--r-- | libX11/specs/libX11/CH14.xml | 20 | ||||
-rw-r--r-- | libX11/src/xcb_io.c | 96 |
10 files changed, 124 insertions, 59 deletions
diff --git a/libX11/specs/libX11/CH01.xml b/libX11/specs/libX11/CH01.xml index c8d8dcc6c..a401b9a5b 100644 --- a/libX11/specs/libX11/CH01.xml +++ b/libX11/specs/libX11/CH01.xml @@ -27,7 +27,7 @@ those provided by the toolkits for X) are built on top of the Xlib library. For further information about these higher-level libraries,
see the appropriate toolkit documentation.
The <citetitle>X Window System Protocol</citetitle> provides the
-definitive word on the behavior of X.
+definitive word on the behavior of X.
Although additional information appears here, the protocol document is
the ruling document.
</para>
diff --git a/libX11/specs/libX11/CH03.xml b/libX11/specs/libX11/CH03.xml index c6f1c86a1..645960797 100644 --- a/libX11/specs/libX11/CH03.xml +++ b/libX11/specs/libX11/CH03.xml @@ -2295,7 +2295,7 @@ structure are: <!-- .LP -->
<literallayout class="monospaced">
-/* Configure window value mask bits */
+/* Configure window value mask bits */
#define CWX (1<<0)
#define CWY (1<<1)
#define CWWidth (1<<2)
diff --git a/libX11/specs/libX11/CH06.xml b/libX11/specs/libX11/CH06.xml index f60053b93..a8224d8fc 100644 --- a/libX11/specs/libX11/CH06.xml +++ b/libX11/specs/libX11/CH06.xml @@ -273,7 +273,7 @@ The following macros define standard formats. </para>
<literallayout class="monospaced">
-#define XcmsUndefinedFormat 0x00000000
+#define XcmsUndefinedFormat 0x00000000
#define XcmsCIEXYZFormat 0x00000001 /* CIE XYZ */
#define XcmsCIEuvYFormat 0x00000002 /* CIE u'v'Y */
#define XcmsCIExyYFormat 0x00000003 /* CIE xyY */
diff --git a/libX11/specs/libX11/CH07.xml b/libX11/specs/libX11/CH07.xml index 14d4bd4ed..505a565a2 100644 --- a/libX11/specs/libX11/CH07.xml +++ b/libX11/specs/libX11/CH07.xml @@ -14,7 +14,7 @@ Sharing of GCs is highly discouraged because the library may cache GC state. </para>
<para>
Graphics operations can be performed to either windows or pixmaps, which collectively are
-called drawables. Each drawable exists on a single screen. A GC is created for a specific screen
+called drawables. Each drawable exists on a single screen. A GC is created for a specific screen
and drawable depth and can only be used with drawables of matching screen and depth.
</para>
<para>
diff --git a/libX11/specs/libX11/CH08.xml b/libX11/specs/libX11/CH08.xml index de768f448..6cd6679f2 100644 --- a/libX11/specs/libX11/CH08.xml +++ b/libX11/specs/libX11/CH08.xml @@ -15,9 +15,9 @@ Once you have established a connection to a display, you can use the Xlib graphi <listitem><para>Transfer images between clients and the server</para></listitem>
</itemizedlist>
<para>
-If the same drawable and GC is used for each call, Xlib batches back-to-back calls to XDraw-
-Point, XDrawLine, XDrawRectangle, XFillArc, and XFillRectangle. Note that this reduces
-the total number of requests sent to the server.
+If the same drawable and GC is used for each call, Xlib batches back-to-back
+calls to XDrawPoint, XDrawLine, XDrawRectangle, XFillArc, and XFillRectangle.
+Note that this reduces the total number of requests sent to the server.
</para>
<sect1 id="Clearing_Areas">
<title>Clearing Areas</title>
diff --git a/libX11/specs/libX11/CH09.xml b/libX11/specs/libX11/CH09.xml index bcb7366fd..7d0f779f1 100644 --- a/libX11/specs/libX11/CH09.xml +++ b/libX11/specs/libX11/CH09.xml @@ -5,10 +5,11 @@ <title>Window and Session Manager Functions</title>
<para>
-Although it is difficult to categorize functions as exclusively for an application, a window man-
-ager, or a session manager, the functions in this chapter are most often used by window managers
-and session managers. It is not expected that these functions will be used by most application
-programs. Xlib provides management functions to:
+Although it is difficult to categorize functions as exclusively for an application,
+a window manager, or a session manager, the functions in this chapter are most
+often used by window managers and session managers. It is not expected that
+these functions will be used by most application programs. Xlib provides
+management functions to:
</para>
<itemizedlist>
diff --git a/libX11/specs/libX11/CH10.xml b/libX11/specs/libX11/CH10.xml index d94ff212b..e7b945323 100644 --- a/libX11/specs/libX11/CH10.xml +++ b/libX11/specs/libX11/CH10.xml @@ -6,8 +6,8 @@ <para>
A client application communicates with the X server through the connection you establish with
-the XOpenDisplay function. A client application sends requests to the X server over this con-
-nection. These requests are made by the Xlib functions that are called in the client application.
+the XOpenDisplay function. A client application sends requests to the X server over this
+connection. These requests are made by the Xlib functions that are called in the client application.
Many Xlib functions cause the X server to generate events, and the user’s typing or moving the
pointer can generate events asynchronously. The X server returns events to the client on the same
connection.
diff --git a/libX11/specs/libX11/CH13.xml b/libX11/specs/libX11/CH13.xml index be0918adb..e28b1b0f3 100644 --- a/libX11/specs/libX11/CH13.xml +++ b/libX11/specs/libX11/CH13.xml @@ -8,22 +8,21 @@ An internationalized application is one that is adaptable to the requirements of different native
languages, local customs, and character string encodings. The process of adapting the operation
to a particular native language, local custom, or string encoding is called localization. A goal of
-internationalization is to permit localization without program source modifications or recompila-
-tion.
+internationalization is to permit localization without program source modifications or recompilation.
</para>
<para>
-As one of the localization mechanisms, Xlib provides an X Input Method (<acronym>XIM</acronym>) functional inter-
-face for internationalized text input and an X Output Method (<acronym>XOM</acronym>) functional interface for
-internationalized text output.
+As one of the localization mechanisms, Xlib provides an X Input Method (<acronym>XIM</acronym>)
+functional interface for internationalized text input and an X Output Method
+(<acronym>XOM</acronym>) functional interface for internationalized text output.
</para>
<para>
-Internationalization in X is based on the concept of a locale. A locale defines the localized
+Internationalization in X is based on the concept of a locale. A locale defines the localized
behavior of a program at run time. Locales affect Xlib in its:
</para>
<itemizedlist>
<listitem><para>Encoding and processing of input method text</para></listitem>
- <listitem><para>Encoding of resource files and values</para></listitem>
+ <listitem><para>Encoding of resource files and values</para></listitem>
<listitem><para>Encoding and imaging of text strings</para></listitem>
<listitem><para>Encoding and decoding for inter-client text communication</para></listitem>
</itemizedlist>
@@ -32,22 +31,22 @@ behavior of a program at run time. Locales affect Xlib in its: <para>
•
Encoding and decoding for inter-client text communication
-Characters from various languages are represented in a computer using an encoding. Different
-languages have different encodings, and there are even different encodings for the same charac-
-ters in the same language.
+Characters from various languages are represented in a computer using an encoding.
+Different languages have different encodings, and there are even different
+encodings for the same characters in the same language.
</para>
<para>
-This chapter defines support for localized text imaging and text input and describes the locale
+This chapter defines support for localized text imaging and text input and describes the locale
mechanism that controls all locale-dependent Xlib functions. Sets of functions are provided for
multibyte (char *) text as well as wide character (wchar_t) text in the form supported by the host
C language environment. The multibyte and wide character functions are equivalent except for
the form of the text argument.
</para>
<para>
-The Xlib internationalization functions are not meant to provide support for multilingual applica-
-tions (mixing multiple languages within a single piece of text), but they make it possible to imple-
-ment applications that work in limited fashion with more than one language in independent con-
-texts.
+The Xlib internationalization functions are not meant to provide support for
+multilingual applications (mixing multiple languages within a single piece of text),
+but they make it possible to implement applications that work in limited
+fashion with more than one language in independent contexts.
</para>
<para>
The remainder of this chapter discusses:
@@ -55,7 +54,7 @@ The remainder of this chapter discusses: <itemizedlist>
<listitem><para>X locale management</para></listitem>
- <listitem><para>Locale and modifier dependencies</para></listitem>
+ <listitem><para>Locale and modifier dependencies</para></listitem>
<listitem><para>Variable argument lists</para></listitem>
<listitem><para>Output methods</para></listitem>
<listitem><para>Input methods</para></listitem>
@@ -9360,10 +9359,11 @@ typedef unsigned long XIMFeedback; #define XIMVisibleToBackward (1L<<9)
#define XIMVisibleToCenter (1L<<10)
-*† The values for XIMPrimary, XIMSecondary, and XIMTertiary were incorrectly defined in
-the R5 specification. The X Consortium’s X11R5 implementation correctly implemented the val-
-ues for these highlights. The value of these highlights has been corrected in this specification to
-agree with the values in the Consortium’s X11R5 and X11R6 implementations.
+*† The values for XIMPrimary, XIMSecondary, and XIMTertiary were incorrectly defined in
+the R5 specification. The X Consortium’s X11R5 implementation correctly
+implemented the values for these highlights. The value of these highlights has
+been corrected in this specification to agree with the values in the
+Consortium’s X11R5 and X11R6 implementations.
</literallayout>
diff --git a/libX11/specs/libX11/CH14.xml b/libX11/specs/libX11/CH14.xml index 9bfbc4f1b..2baf6d5bf 100644 --- a/libX11/specs/libX11/CH14.xml +++ b/libX11/specs/libX11/CH14.xml @@ -7,14 +7,14 @@ The Inter-Client Communication Conventions Manual, hereafter referred to as the <acronym>ICCCM</acronym>,
details the X Consortium approved conventions that govern inter-client communications. These
conventions ensure peer-to-peer client cooperation in the use of selections, cut buffers, and shared
-resources as well as client cooperation with window and session managers. For further informa-
-tion, see the Inter-Client Communication Conventions Manual.
+resources as well as client cooperation with window and session managers. For further information,
+see the Inter-Client Communication Conventions Manual.
</para>
<para>
-Xlib provides a number of standard properties and programming interfaces that are <acronym>ICCCM</acronym> com-
-pliant. The predefined atoms for some of these properties are defined in the <X11/Xatom.h>
-header file, where to avoid name conflicts with user symbols their #define name has an XA_ pre-
-fix. For further information about atoms and properties, see section 4.3.
+Xlib provides a number of standard properties and programming interfaces that are <acronym>ICCCM</acronym>
+compliant. The predefined atoms for some of these properties are defined in the <X11/Xatom.h>
+header file, where to avoid name conflicts with user symbols their #define name has an XA_ prefix.
+For further information about atoms and properties, see section 4.3.
</para>
<para>
Xlib’s selection and cut buffer mechanisms provide the primary programming interfaces by which
@@ -57,8 +57,7 @@ managers are: <entry>TEXT</entry>
<entry></entry>
<entry>The string name of the machine on
- which the client application is run-
- ning.
+ which the client application is running.
</entry>
</row>
<row>
@@ -74,7 +73,7 @@ managers are: <entry><property>WM_COMMAND</property></entry>
<entry>TEXT</entry>
<entry></entry>
- <entry>The command and arguments, null-
+ <entry>The command and arguments, null
separated, used to invoke the application.
</entry>
</row>
@@ -134,8 +133,7 @@ managers are: <entry><property>WM_STATE</property></entry>
<entry>32</entry>
<entry>Intended for communication
- between window and session man-
- agers only.
+ between window and session managers only.
</entry>
</row>
<row>
diff --git a/libX11/src/xcb_io.c b/libX11/src/xcb_io.c index 9f49cdd50..63be2c5a8 100644 --- a/libX11/src/xcb_io.c +++ b/libX11/src/xcb_io.c @@ -15,6 +15,7 @@ #ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -25,6 +26,28 @@ #include <X11/Xtrans/Xtrans.h>
+#define xcb_fail_assert(_message, _var) { \
+ unsigned int _var = 1; \
+ fprintf(stderr, "[xcb] Aborting, sorry about that.\n"); \
+ assert(!_var); \
+}
+
+#define throw_thread_fail_assert(_message, _var) { \
+ fprintf(stderr, "[xcb] " _message "\n"); \
+ fprintf(stderr, "[xcb] Most likely this is a multi-threaded client " \
+ "and XInitThreads has not been called\n"); \
+ xcb_fail_assert(_message, _var); \
+}
+
+/* XXX: It would probably be most useful if we stored the last-processed
+ * request, so we could find the offender from the message. */
+#define throw_extlib_fail_assert(_message, _var) { \
+ fprintf(stderr, "[xcb] " _message "\n"); \
+ fprintf(stderr, "[xcb] This is most likely caused by a broken X " \
+ "extension library\n"); \
+ xcb_fail_assert(_message, _var); \
+}
+
static void return_socket(void *closure)
{
Display *dpy = closure;
@@ -54,9 +77,14 @@ static void require_socket(Display *dpy) * happens while Xlib does not own the socket. A
* complete fix would be to make XCB's public API use
* 64-bit sequence numbers. */
- assert(!(sizeof(unsigned long) > sizeof(unsigned int)
- && dpy->xcb->event_owner == XlibOwnsEventQueue
- && (sent - dpy->last_request_read >= (UINT64_C(1) << 32))));
+ if (sizeof(unsigned long) > sizeof(unsigned int) &&
+ dpy->xcb->event_owner == XlibOwnsEventQueue &&
+ (sent - dpy->last_request_read >= (UINT64_C(1) << 32))) {
+ throw_thread_fail_assert("Sequence number wrapped "
+ "beyond 32 bits while Xlib "
+ "did not own the socket",
+ xcb_xlib_seq_number_wrapped);
+ }
dpy->xcb->last_flushed = dpy->request = sent;
dpy->bufmax = dpy->xcb->real_bufmax;
}
@@ -128,8 +156,15 @@ static PendingRequest *append_pending_request(Display *dpy, unsigned long sequen node->reply_waiter = 0;
if(dpy->xcb->pending_requests_tail)
{
- assert(XLIB_SEQUENCE_COMPARE(dpy->xcb->pending_requests_tail->sequence, <, node->sequence));
- assert(dpy->xcb->pending_requests_tail->next == NULL);
+ if (XLIB_SEQUENCE_COMPARE(dpy->xcb->pending_requests_tail->sequence,
+ >=, node->sequence))
+ throw_thread_fail_assert("Unknown sequence number "
+ "while appending request",
+ xcb_xlib_unknown_seq_number);
+ if (dpy->xcb->pending_requests_tail->next != NULL)
+ throw_thread_fail_assert("Unknown request in queue "
+ "while appending request",
+ xcb_xlib_unknown_req_pending);
dpy->xcb->pending_requests_tail->next = node;
}
else
@@ -140,15 +175,26 @@ static PendingRequest *append_pending_request(Display *dpy, unsigned long sequen static void dequeue_pending_request(Display *dpy, PendingRequest *req)
{
- assert(req == dpy->xcb->pending_requests);
+ if (req != dpy->xcb->pending_requests)
+ throw_thread_fail_assert("Unknown request in queue while "
+ "dequeuing",
+ xcb_xlib_unknown_req_in_deq);
+
dpy->xcb->pending_requests = req->next;
if(!dpy->xcb->pending_requests)
{
- assert(req == dpy->xcb->pending_requests_tail);
+ if (req != dpy->xcb->pending_requests_tail)
+ throw_thread_fail_assert("Unknown request in queue "
+ "while dequeuing",
+ xcb_xlib_unknown_req_in_deq);
dpy->xcb->pending_requests_tail = NULL;
}
- else
- assert(XLIB_SEQUENCE_COMPARE(req->sequence, <, dpy->xcb->pending_requests->sequence));
+ else if (XLIB_SEQUENCE_COMPARE(req->sequence, >=,
+ dpy->xcb->pending_requests->sequence))
+ throw_thread_fail_assert("Unknown sequence number while "
+ "dequeuing request",
+ xcb_xlib_threads_sequence_lost);
+
free(req);
}
@@ -221,7 +267,14 @@ static xcb_generic_reply_t *poll_for_event(Display *dpy) if(!req || XLIB_SEQUENCE_COMPARE(event_sequence, <, req->sequence)
|| (event->response_type != X_Error && event_sequence == req->sequence))
{
- assert(XLIB_SEQUENCE_COMPARE(event_sequence, <=, dpy->request));
+ if (XLIB_SEQUENCE_COMPARE(event_sequence, >,
+ dpy->request))
+ {
+ throw_thread_fail_assert("Unknown sequence "
+ "number while "
+ "processing queue",
+ xcb_xlib_threads_sequence_lost);
+ }
dpy->last_request_read = event_sequence;
dpy->xcb->next_event = NULL;
return (xcb_generic_reply_t *) event;
@@ -240,7 +293,12 @@ static xcb_generic_reply_t *poll_for_response(Display *dpy) !req->reply_waiter &&
xcb_poll_for_reply(dpy->xcb->connection, req->sequence, &response, &error))
{
- assert(XLIB_SEQUENCE_COMPARE(req->sequence, <=, dpy->request));
+ if(XLIB_SEQUENCE_COMPARE(req->sequence, >, dpy->request))
+ {
+ throw_thread_fail_assert("Unknown sequence number "
+ "while awaiting reply",
+ xcb_xlib_threads_sequence_lost);
+ }
dpy->last_request_read = req->sequence;
if(response)
break;
@@ -515,7 +573,9 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard) char *reply;
PendingRequest *current;
- assert(!dpy->xcb->reply_data);
+ if (dpy->xcb->reply_data)
+ throw_extlib_fail_assert("Extra reply data still left in queue",
+ xcb_xlib_extra_reply_data_left);
if(dpy->flags & XlibDisplayIOError)
return 0;
@@ -571,7 +631,11 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard) req->reply_waiter = 0;
ConditionBroadcast(dpy, dpy->xcb->reply_notify);
- assert(XLIB_SEQUENCE_COMPARE(req->sequence, <=, dpy->request));
+ if(XLIB_SEQUENCE_COMPARE(req->sequence, >, dpy->request)) {
+ throw_thread_fail_assert("Unknown sequence number "
+ "while processing reply",
+ xcb_xlib_threads_sequence_lost);
+ }
dpy->last_request_read = req->sequence;
if(!response)
dequeue_pending_request(dpy, req);
@@ -668,8 +732,10 @@ int _XRead(Display *dpy, char *data, long size) assert(size >= 0);
if(size == 0)
return 0;
- assert(dpy->xcb->reply_data != NULL);
- assert(dpy->xcb->reply_consumed + size <= dpy->xcb->reply_length);
+ if(dpy->xcb->reply_data == NULL ||
+ dpy->xcb->reply_consumed + size > dpy->xcb->reply_length)
+ throw_extlib_fail_assert("Too much data requested from _XRead",
+ xcb_xlib_too_much_data_requested);
memcpy(data, dpy->xcb->reply_data + dpy->xcb->reply_consumed, size);
dpy->xcb->reply_consumed += size;
_XFreeReplyData(dpy, False);
|