diff options
Diffstat (limited to 'x11/libX11/patches/patch-ah')
-rw-r--r-- | x11/libX11/patches/patch-ah | 74 |
1 files changed, 58 insertions, 16 deletions
diff --git a/x11/libX11/patches/patch-ah b/x11/libX11/patches/patch-ah index 4f339156304..fbf72e43ae1 100644 --- a/x11/libX11/patches/patch-ah +++ b/x11/libX11/patches/patch-ah @@ -1,18 +1,60 @@ -$NetBSD: patch-ah,v 1.2 2008/01/14 07:12:53 tnn Exp $ +$NetBSD: patch-ah,v 1.3 2008/07/24 01:07:31 bjs Exp $ ---- src/XlibInt.c.orig 2007-07-21 10:45:39.000000000 +0200 +--- src/XlibInt.c.orig 2008-07-23 01:53:49.000000000 -0400 +++ src/XlibInt.c -@@ -138,8 +138,13 @@ xthread_t (*_Xthread_self_fn)(void) = NU - #ifdef ISC - #define ECHECK(err) ((errno == err) || ETEST()) - #else -+#ifdef __hpux -+#define ECHECK(err) ((errno == err) || ETEST()) -+#define SUNSYSV 1 -+#else - #define ECHECK(err) (errno == err) - #endif -+#endif - #define ESET(val) errno = val - #endif - #endif +@@ -206,8 +206,6 @@ static char *_XAsyncReply( + Bool discard); + #endif /* !USE_XCB */ + +-#define SEQLIMIT (65535 - (BUFSIZE / SIZEOF(xReq)) - 10) +- + /* + * The following routines are internal routines used by Xlib for protocol + * packet transmission and reception. +@@ -570,24 +568,34 @@ _XWaitForReadable( + } + #endif /* !USE_XCB */ + ++static int sync_hazard(Display *dpy) ++{ ++ unsigned long span = dpy->request - dpy->last_request_read; ++ unsigned long hazard = min((dpy->bufmax - dpy->buffer) / SIZEOF(xReq), 65535 - 10); ++ return span >= 65535 - hazard - 10; ++} ++ + static + int _XSeqSyncFunction( + register Display *dpy) + { + xGetInputFocusReply rep; + register xReq *req; ++ int sent_sync = 0; + + LockDisplay(dpy); +- if ((dpy->request - dpy->last_request_read) >= (BUFSIZE / SIZEOF(xReq))) { ++ if ((dpy->request - dpy->last_request_read) >= (65535 - BUFSIZE/SIZEOF(xReq))) { + GetEmptyReq(GetInputFocus, req); + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); ++ sent_sync = 1; + } + /* could get XID handler while waiting for reply in MT env */ +- if (dpy->synchandler == _XSeqSyncFunction) { ++ if (dpy->synchandler == _XSeqSyncFunction && !sync_hazard(dpy)) { + dpy->synchandler = dpy->savedsynchandler; + dpy->flags &= ~XlibDisplayPrivSync; + } + UnlockDisplay(dpy); ++ if (sent_sync) + SyncHandle(); + return 0; + } +@@ -595,8 +603,7 @@ int _XSeqSyncFunction( + void _XSetSeqSyncFunction( + register Display *dpy) + { +- if ((dpy->request - dpy->last_request_read) >= SEQLIMIT && +- !(dpy->flags & XlibDisplayPrivSync)) { ++ if (!(dpy->flags & XlibDisplayPrivSync) && sync_hazard(dpy)) { + dpy->savedsynchandler = dpy->synchandler; + dpy->synchandler = _XSeqSyncFunction; + dpy->flags |= XlibDisplayPrivSync; |