aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-10-10 17:47:40 +0200
committerReinhard Tartler <siretart@tauware.de>2011-10-10 17:47:40 +0200
commitbd433c6487a52f95e6bb949d5698dc5ea0923713 (patch)
tree9d1204522870111c81500239a1302feb03177abf /nx-X11/lib/X11
parent55a9311fb1df3b58f73efa575318e7341243392b (diff)
downloadnx-libs-bd433c6487a52f95e6bb949d5698dc5ea0923713.tar.gz
nx-libs-bd433c6487a52f95e6bb949d5698dc5ea0923713.tar.bz2
nx-libs-bd433c6487a52f95e6bb949d5698dc5ea0923713.zip
Imported nx-X11-3.3.0-6.tar.gznx-X11/3.3.0-6
Summary: Imported nx-X11-3.3.0-6.tar.gz Keywords: Imported nx-X11-3.3.0-6.tar.gz into Git repository
Diffstat (limited to 'nx-X11/lib/X11')
-rw-r--r--nx-X11/lib/X11/XlibInt.c61
-rw-r--r--nx-X11/lib/X11/XlibInt.c.NX.original61
2 files changed, 120 insertions, 2 deletions
diff --git a/nx-X11/lib/X11/XlibInt.c b/nx-X11/lib/X11/XlibInt.c
index 97758e7ab..6dcd1f0f6 100644
--- a/nx-X11/lib/X11/XlibInt.c
+++ b/nx-X11/lib/X11/XlibInt.c
@@ -877,6 +877,19 @@ int _XSeqSyncFunction(
xGetInputFocusReply rep;
register xReq *req;
+#ifdef NX_TRANS_SOCKET
+#ifdef NX_TRANS_DEBUG
+ fprintf(stderr, "_XSeqSyncFunction: Going to synchronize the display.\n");
+#endif
+ if (dpy->flags & XlibDisplayIOError)
+ {
+#ifdef NX_TRANS_DEBUG
+ fprintf(stderr, "_XSeqSyncFunction: Returning 0 with I/O error detected.\n");
+#endif
+ return 0;
+ }
+#endif
+
LockDisplay(dpy);
if ((dpy->request - dpy->last_request_read) >= (BUFSIZE / SIZEOF(xReq))) {
GetEmptyReq(GetInputFocus, req);
@@ -930,6 +943,10 @@ static void _XFlushInt(
int congestion;
#endif
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n",
+ (dpy->bufptr - dpy->buffer));
+#endif
/* This fix resets the bufptr to the front of the buffer so
* additional appends to the bufptr will not corrupt memory. Since
* the server is down, these appends are no-op's anyway but
@@ -937,6 +954,9 @@ static void _XFlushInt(
*/
if (dpy->flags & XlibDisplayIOError)
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n");
+#endif
dpy->bufptr = dpy->buffer;
dpy->last_req = (char *)&_dummy_request;
return;
@@ -1404,6 +1424,15 @@ void _XReadEvents(
dpy->flags |= XlibDisplayReadEvents;
i = _XRead (dpy, read_buf, (long) len);
dpy->flags &= ~XlibDisplayReadEvents;
+#ifdef NX_TRANS_SOCKET
+ if (dpy->flags & XlibDisplayIOError)
+ {
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n");
+#endif
+ return;
+ }
+#endif
if (i == -2) {
/* special flag from _XRead to say that internal connection has
done XPutBackEvent. Which we can use so we're done. */
@@ -1841,10 +1870,17 @@ _XSend (
#endif
#ifdef NX_TRANS_SOCKET
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n",
+ (dpy->bufptr - dpy->buffer));
+#endif
if (!size || (dpy->flags & XlibDisplayIOError))
{
if (dpy->flags & XlibDisplayIOError)
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XSend: Returning with I/O error detected.\n");
+#endif
dpy->bufptr = dpy->buffer;
dpy->last_req = (char *)&_dummy_request;
}
@@ -2222,8 +2258,18 @@ _XReply (
fprintf(stderr, "_XReply: Going to wait for an X reply.\n");
#endif
+#ifdef NX_TRANS_SOCKET
+ if (dpy->flags & XlibDisplayIOError)
+ {
+#ifdef NX_TRANS_DEBUG
+ fprintf(stderr, "_XReply: Returning 0 with I/O error detected.\n");
+#endif
+ return 0;
+ }
+#else
if (dpy->flags & XlibDisplayIOError)
return 0;
+#endif
#ifdef XTHREADS
/* create our condition variable and append to list */
@@ -2239,6 +2285,9 @@ _XReply (
XThread_Self(), cvl);
#endif
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XReply: Going to flush the display buffer.\n");
+#endif
_XFlushInt(dpy, cvl ? cvl->cv : NULL);
/* if it is not our turn to read a reply off the wire,
* wait til we're at head of list. if there is an event waiter,
@@ -3583,11 +3632,21 @@ _XIOError (
*/
#ifdef NX_TRANS_TEST
- fprintf(stderr, "_XIOError: Resetting the display buffers.\n");
+ fprintf(stderr, "_XIOError: Resetting the display buffer.\n");
#endif
dpy->bufptr = dpy->buffer;
dpy->last_req = (char *) &_dummy_request;
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_XIOError: Resetting the display flags.\n");
+#endif
+
+ dpy->flags &= ~XlibDisplayProcConni;
+ dpy->flags &= ~XlibDisplayPrivSync;
+ dpy->flags &= ~XlibDisplayReadEvents;
+ dpy->flags &= ~XlibDisplayWriting;
+ dpy->flags &= ~XlibDisplayReply;
#else
exit (1);
#endif
diff --git a/nx-X11/lib/X11/XlibInt.c.NX.original b/nx-X11/lib/X11/XlibInt.c.NX.original
index 97758e7ab..6dcd1f0f6 100644
--- a/nx-X11/lib/X11/XlibInt.c.NX.original
+++ b/nx-X11/lib/X11/XlibInt.c.NX.original
@@ -877,6 +877,19 @@ int _XSeqSyncFunction(
xGetInputFocusReply rep;
register xReq *req;
+#ifdef NX_TRANS_SOCKET
+#ifdef NX_TRANS_DEBUG
+ fprintf(stderr, "_XSeqSyncFunction: Going to synchronize the display.\n");
+#endif
+ if (dpy->flags & XlibDisplayIOError)
+ {
+#ifdef NX_TRANS_DEBUG
+ fprintf(stderr, "_XSeqSyncFunction: Returning 0 with I/O error detected.\n");
+#endif
+ return 0;
+ }
+#endif
+
LockDisplay(dpy);
if ((dpy->request - dpy->last_request_read) >= (BUFSIZE / SIZEOF(xReq))) {
GetEmptyReq(GetInputFocus, req);
@@ -930,6 +943,10 @@ static void _XFlushInt(
int congestion;
#endif
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n",
+ (dpy->bufptr - dpy->buffer));
+#endif
/* This fix resets the bufptr to the front of the buffer so
* additional appends to the bufptr will not corrupt memory. Since
* the server is down, these appends are no-op's anyway but
@@ -937,6 +954,9 @@ static void _XFlushInt(
*/
if (dpy->flags & XlibDisplayIOError)
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n");
+#endif
dpy->bufptr = dpy->buffer;
dpy->last_req = (char *)&_dummy_request;
return;
@@ -1404,6 +1424,15 @@ void _XReadEvents(
dpy->flags |= XlibDisplayReadEvents;
i = _XRead (dpy, read_buf, (long) len);
dpy->flags &= ~XlibDisplayReadEvents;
+#ifdef NX_TRANS_SOCKET
+ if (dpy->flags & XlibDisplayIOError)
+ {
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n");
+#endif
+ return;
+ }
+#endif
if (i == -2) {
/* special flag from _XRead to say that internal connection has
done XPutBackEvent. Which we can use so we're done. */
@@ -1841,10 +1870,17 @@ _XSend (
#endif
#ifdef NX_TRANS_SOCKET
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n",
+ (dpy->bufptr - dpy->buffer));
+#endif
if (!size || (dpy->flags & XlibDisplayIOError))
{
if (dpy->flags & XlibDisplayIOError)
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XSend: Returning with I/O error detected.\n");
+#endif
dpy->bufptr = dpy->buffer;
dpy->last_req = (char *)&_dummy_request;
}
@@ -2222,8 +2258,18 @@ _XReply (
fprintf(stderr, "_XReply: Going to wait for an X reply.\n");
#endif
+#ifdef NX_TRANS_SOCKET
+ if (dpy->flags & XlibDisplayIOError)
+ {
+#ifdef NX_TRANS_DEBUG
+ fprintf(stderr, "_XReply: Returning 0 with I/O error detected.\n");
+#endif
+ return 0;
+ }
+#else
if (dpy->flags & XlibDisplayIOError)
return 0;
+#endif
#ifdef XTHREADS
/* create our condition variable and append to list */
@@ -2239,6 +2285,9 @@ _XReply (
XThread_Self(), cvl);
#endif
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "_XReply: Going to flush the display buffer.\n");
+#endif
_XFlushInt(dpy, cvl ? cvl->cv : NULL);
/* if it is not our turn to read a reply off the wire,
* wait til we're at head of list. if there is an event waiter,
@@ -3583,11 +3632,21 @@ _XIOError (
*/
#ifdef NX_TRANS_TEST
- fprintf(stderr, "_XIOError: Resetting the display buffers.\n");
+ fprintf(stderr, "_XIOError: Resetting the display buffer.\n");
#endif
dpy->bufptr = dpy->buffer;
dpy->last_req = (char *) &_dummy_request;
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_XIOError: Resetting the display flags.\n");
+#endif
+
+ dpy->flags &= ~XlibDisplayProcConni;
+ dpy->flags &= ~XlibDisplayPrivSync;
+ dpy->flags &= ~XlibDisplayReadEvents;
+ dpy->flags &= ~XlibDisplayWriting;
+ dpy->flags &= ~XlibDisplayReply;
#else
exit (1);
#endif