[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libx11: Changes to 'upstream-experimental'



 .gitignore                       |   20 +
 AUTHORS                          |    2 
 Makefile.am                      |    1 
 acinclude.m4                     |  206 +++++++++++++
 configure.ac                     |   91 +++---
 include/X11/XKBlib.h             |   26 -
 include/X11/Xcms.h               |    8 
 include/X11/Xlib.h               |  104 ++++---
 include/X11/XlibConf.h.in        |    2 
 include/X11/Xlibint.h            |   47 +--
 include/X11/Xregion.h            |   18 -
 include/X11/Xresource.h          |   14 
 include/X11/Xutil.h              |   28 -
 man/xkb/XkbGetIndicatorState.man |    4 
 modules/im/ximcp/imCallbk.c      |  138 ++++-----
 modules/im/ximcp/imDefFlt.c      |   16 -
 modules/im/ximcp/imDefIc.c       |    8 
 modules/im/ximcp/imDefIm.c       |   24 -
 modules/im/ximcp/imDefLkup.c     |    8 
 modules/im/ximcp/imDispch.c      |    4 
 modules/im/ximcp/imEvToWire.c    |   32 +-
 modules/im/ximcp/imExten.c       |   10 
 modules/im/ximcp/imImSw.c        |   18 -
 modules/im/ximcp/imInt.c         |   10 
 modules/im/ximcp/imLcFlt.c       |    4 
 modules/im/ximcp/imLcGIc.c       |    4 
 modules/im/ximcp/imLcIc.c        |    4 
 modules/im/ximcp/imLcIm.c        |   28 -
 modules/im/ximcp/imLcLkup.c      |    8 
 modules/im/ximcp/imLcPrs.c       |    4 
 modules/im/ximcp/imLcSIc.c       |    4 
 modules/im/ximcp/imRm.c          |   40 +-
 modules/im/ximcp/imRmAttr.c      |    6 
 modules/im/ximcp/imThaiFlt.c     |  102 +++---
 modules/im/ximcp/imThaiIc.c      |   18 -
 modules/im/ximcp/imThaiIm.c      |   26 +
 modules/im/ximcp/imTrX.c         |   16 -
 modules/im/ximcp/imTrans.c       |    9 
 modules/im/ximcp/imTransR.c      |    4 
 modules/lc/gen/lcGenConv.c       |  102 +++---
 modules/lc/xlocale/lcEuc.c       |   26 -
 modules/lc/xlocale/lcJis.c       |   24 -
 modules/lc/xlocale/lcSjis.c      |   30 +-
 modules/om/generic/omGeneric.c   |  107 +++----
 modules/om/generic/omText.c      |    6 
 modules/om/generic/omTextEsc.c   |    2 
 modules/om/generic/omTextPer.c   |    2 
 modules/om/generic/omXChar.c     |   12 
 nls/am_ET.UTF-8/Compose.pre      |  575 ++++++++++++++++++++-------------------
 nls/el_GR.UTF-8/Compose.pre      |   30 ++
 nls/en_US.UTF-8/Compose.pre      |  120 ++++++++
 nls/iso8859-1/Compose.pre        |    4 
 nls/iso8859-13/Compose.pre       |   20 +
 nls/iso8859-14/Compose.pre       |    4 
 nls/iso8859-15/Compose.pre       |    4 
 nls/iso8859-3/Compose.pre        |    4 
 nls/iso8859-4/Compose.pre        |   20 +
 nls/iso8859-9/Compose.pre        |    4 
 nls/iso8859-9e/Compose.pre       |    4 
 nls/locale.alias.pre             |    5 
 nls/pt_BR.UTF-8/Compose.pre      |   77 +++++
 src/AllPlanes.c                  |   10 
 src/ChClMode.c                   |    2 
 src/ChKeyCon.c                   |    2 
 src/ChProp.c                     |    2 
 src/ChkIfEv.c                    |    2 
 src/ChkMaskEv.c                  |    2 
 src/ChkTypEv.c                   |    2 
 src/ChkTypWEv.c                  |    2 
 src/ChkWinEv.c                   |    2 
 src/ClDisplay.c                  |    2 
 src/ClearArea.c                  |    2 
 src/ConnDis.c                    |  262 ++++++++---------
 src/Context.c                    |   12 
 src/ConvSel.c                    |    2 
 src/CopyArea.c                   |    2 
 src/CopyCmap.c                   |    2 
 src/CopyGC.c                     |   20 -
 src/CopyPlane.c                  |    4 
 src/CrBFData.c                   |    6 
 src/CrCursor.c                   |    8 
 src/CrGC.c                       |   12 
 src/CrGlCur.c                    |    6 
 src/CrPFBData.c                  |    8 
 src/CrWindow.c                   |    4 
 src/Cursor.c                     |    4 
 src/Depths.c                     |    2 
 src/DisName.c                    |    6 
 src/DrArc.c                      |    4 
 src/DrLine.c                     |    4 
 src/DrRect.c                     |    2 
 src/ErrDes.c                     |   12 
 src/ErrHndlr.c                   |   10 
 src/EvToWire.c                   |    6 
 src/FSWrap.c                     |   14 
 src/FetchName.c                  |    4 
 src/FillPoly.c                   |    2 
 src/FillRct.c                    |    4 
 src/FillRcts.c                   |    2 
 src/FilterEv.c                   |    4 
 src/Font.c                       |   10 
 src/FontInfo.c                   |    8 
 src/FontNames.c                  |    4 
 src/FreeEData.c                  |    2 
 src/FreeGC.c                     |    2 
 src/FreePix.c                    |    4 
 src/Geom.c                       |   12 
 src/GetAtomNm.c                  |    4 
 src/GetDflt.c                    |   16 -
 src/GetFProp.c                   |    6 
 src/GetGeom.c                    |    4 
 src/GetHints.c                   |   24 -
 src/GetIFocus.c                  |    2 
 src/GetImage.c                   |   10 
 src/GetKCnt.c                    |    2 
 src/GetMoEv.c                    |    8 
 src/GetNrmHint.c                 |   26 -
 src/GetPCnt.c                    |    2 
 src/GetPntMap.c                  |    4 
 src/GetProp.c                    |   14 
 src/GetRGBCMap.c                 |    6 
 src/GetSSaver.c                  |    4 
 src/GetStCmap.c                  |   12 
 src/GetTxtProp.c                 |    8 
 src/GetWAttrs.c                  |    4 
 src/GetWMCMapW.c                 |    8 
 src/GetWMProto.c                 |    8 
 src/GrButton.c                   |    2 
 src/GrKey.c                      |    2 
 src/GrKeybd.c                    |    2 
 src/GrPointer.c                  |    2 
 src/Host.c                       |    4 
 src/Iconify.c                    |    8 
 src/IfEvent.c                    |    4 
 src/ImText.c                     |    4 
 src/ImText16.c                   |    4 
 src/ImUtil.c                     |   84 ++---
 src/InitExt.c                    |    6 
 src/IntAtom.c                    |    2 
 src/KeyBind.c                    |  148 +++++-----
 src/KeysymStr.c                  |    2 
 src/LiHosts.c                    |   14 
 src/LiICmaps.c                   |    2 
 src/LoadFont.c                   |    2 
 src/LockDis.c                    |    2 
 src/Macros.c                     |   32 +-
 src/Makefile.am                  |    2 
 src/MaskEvent.c                  |    2 
 src/ModMap.c                     |    4 
 src/MoveWin.c                    |    2 
 src/NextEvent.c                  |    6 
 src/OMWrap.c                     |    2 
 src/OpenDis.c                    |   58 +--
 src/ParseCmd.c                   |   20 -
 src/ParseGeom.c                  |   12 
 src/PeekEvent.c                  |    2 
 src/PolyReg.c                    |   78 ++---
 src/PolyTxt.c                    |   34 +-
 src/PolyTxt16.c                  |   30 +-
 src/PropAlloc.c                  |    2 
 src/PutBEvent.c                  |    4 
 src/PutImage.c                   |   18 -
 src/QuBest.c                     |    2 
 src/QuCurShp.c                   |    6 
 src/QuExt.c                      |    2 
 src/QuKeybd.c                    |    4 
 src/QuPntr.c                     |    6 
 src/QuStipShp.c                  |    2 
 src/QuTileShp.c                  |    4 
 src/QuTree.c                     |    2 
 src/Quarks.c                     |   10 
 src/RdBitF.c                     |   16 -
 src/RecolorC.c                   |    2 
 src/ReconfWin.c                  |    2 
 src/Region.c                     |  104 +++----
 src/RegstFlt.c                   |    4 
 src/RepWindow.c                  |    4 
 src/RestackWs.c                  |    4 
 src/RotProp.c                    |    2 
 src/SetCRects.c                  |    4 
 src/SetClOrig.c                  |    2 
 src/SetDashes.c                  |    2 
 src/SetHints.c                   |   42 +-
 src/SetIFocus.c                  |    2 
 src/SetLocale.c                  |   16 -
 src/SetNrmHint.c                 |    4 
 src/SetPMask.c                   |    2 
 src/SetPntMap.c                  |    4 
 src/SetRGBCMap.c                 |    2 
 src/SetSSaver.c                  |    2 
 src/SetStCmap.c                  |   10 
 src/SetTxtProp.c                 |    8 
 src/SetWMCMapW.c                 |   12 
 src/SetWMProto.c                 |   12 
 src/StBytes.c                    |    8 
 src/StColors.c                   |    4 
 src/StName.c                     |    4 
 src/StrToText.c                  |    4 
 src/Text.c                       |   22 -
 src/Text16.c                     |   22 -
 src/TextExt.c                    |    8 
 src/TextExt16.c                  |    8 
 src/TextToStr.c                  |    2 
 src/TrCoords.c                   |    6 
 src/UIThrStubs.c                 |   14 
 src/UnldFont.c                   |    2 
 src/VisUtil.c                    |   18 -
 src/WMGeom.c                     |   14 
 src/WMProps.c                    |   16 -
 src/WarpPtr.c                    |    2 
 src/WinEvent.c                   |    2 
 src/Window.c                     |   12 
 src/Withdraw.c                   |    8 
 src/WrBitF.c                     |    2 
 src/XKeysymDB                    |   20 +
 src/Xatomtype.h                  |    8 
 src/XlibAsync.c                  |    4 
 src/XlibInt.c                    |  212 ++++++++------
 src/XomGeneric.h                 |    2 
 src/Xprivate.h                   |   15 +
 src/Xrm.c                        |   56 +--
 src/XrmI.h                       |    4 
 src/Xxcbint.h                    |   34 --
 src/globals.c                    |   14 
 src/imConv.c                     |   20 -
 src/locking.c                    |   10 
 src/locking.h                    |    2 
 src/os2Stubs.c                   |   42 +-
 src/poly.h                       |   12 
 src/udcInf.c                     |   22 -
 src/util/Makefile.am             |    3 
 src/util/makekeys.c              |    2 
 src/x11_trans.c                  |    4 
 src/xcb_disp.c                   |    4 
 src/xcb_io.c                     |  284 ++++++++++++-------
 src/xcb_lock.c                   |  235 ---------------
 src/xcms/AddDIC.c                |    6 
 src/xcms/AddSF.c                 |    6 
 src/xcms/CCC.c                   |   12 
 src/xcms/CvColW.c                |    6 
 src/xcms/CvCols.c                |   16 -
 src/xcms/HVC.c                   |   20 -
 src/xcms/HVCGcC.c                |   18 -
 src/xcms/HVCGcV.c                |   20 -
 src/xcms/HVCGcVC.c               |   22 -
 src/xcms/HVCMnV.c                |   12 
 src/xcms/HVCMxC.c                |   16 -
 src/xcms/HVCMxV.c                |   16 -
 src/xcms/HVCMxVC.c               |   34 +-
 src/xcms/HVCMxVs.c               |   12 
 src/xcms/HVCWpAj.c               |   10 
 src/xcms/IdOfPr.c                |    6 
 src/xcms/LRGB.c                  |   50 +--
 src/xcms/Lab.c                   |    6 
 src/xcms/LabGcC.c                |   12 
 src/xcms/LabGcL.c                |   12 
 src/xcms/LabGcLC.c               |   14 
 src/xcms/LabMnL.c                |   22 -
 src/xcms/LabMxC.c                |   12 
 src/xcms/LabMxL.c                |   20 -
 src/xcms/LabMxLC.c               |   34 +-
 src/xcms/LabWpAj.c               |    6 
 src/xcms/Luv.c                   |   10 
 src/xcms/LuvGcC.c                |   12 
 src/xcms/LuvGcL.c                |   12 
 src/xcms/LuvGcLC.c               |   14 
 src/xcms/LuvMnL.c                |   22 -
 src/xcms/LuvMxC.c                |   14 
 src/xcms/LuvMxL.c                |   20 -
 src/xcms/LuvMxLC.c               |   32 +-
 src/xcms/LuvWpAj.c               |    6 
 src/xcms/OfCCC.c                 |    6 
 src/xcms/PrOfId.c                |    6 
 src/xcms/QBlack.c                |    6 
 src/xcms/QBlue.c                 |    6 
 src/xcms/QGreen.c                |    6 
 src/xcms/QRed.c                  |    6 
 src/xcms/QWhite.c                |    6 
 src/xcms/QuCol.c                 |    6 
 src/xcms/QuCols.c                |    6 
 src/xcms/SetCCC.c                |    6 
 src/xcms/SetGetCols.c            |   10 
 src/xcms/StCol.c                 |    6 
 src/xcms/StCols.c                |    6 
 src/xcms/UNDEFINED.c             |    6 
 src/xcms/XRGB.c                  |   10 
 src/xcms/XYZ.c                   |    6 
 src/xcms/Xcmsint.h               |    6 
 src/xcms/cmsAllCol.c             |    6 
 src/xcms/cmsAllNCol.c            |    8 
 src/xcms/cmsCmap.c               |    8 
 src/xcms/cmsColNm.c              |   23 +
 src/xcms/cmsGlobls.c             |    6 
 src/xcms/cmsInt.c                |   10 
 src/xcms/cmsLkCol.c              |    8 
 src/xcms/cmsMath.c               |    4 
 src/xcms/cmsProp.c               |   16 -
 src/xcms/cmsTrig.c               |   16 -
 src/xcms/uvY.c                   |    6 
 src/xcms/xyY.c                   |    8 
 src/xkb/XKB.c                    |   24 -
 src/xkb/XKBAlloc.c               |   28 -
 src/xkb/XKBBell.c                |   18 -
 src/xkb/XKBBind.c                |   26 -
 src/xkb/XKBCompat.c              |   20 -
 src/xkb/XKBCtrls.c               |   36 +-
 src/xkb/XKBCvt.c                 |   22 -
 src/xkb/XKBExtDev.c              |   30 +-
 src/xkb/XKBGAlloc.c              |   42 +-
 src/xkb/XKBGeom.c                |   22 -
 src/xkb/XKBGetByName.c           |   16 -
 src/xkb/XKBGetMap.c              |   22 -
 src/xkb/XKBList.c                |   18 -
 src/xkb/XKBMAlloc.c              |   30 +-
 src/xkb/XKBMisc.c                |   32 +-
 src/xkb/XKBNames.c               |   28 -
 src/xkb/XKBRdBuf.c               |   18 -
 src/xkb/XKBSetGeom.c             |   24 -
 src/xkb/XKBSetMap.c              |   18 -
 src/xkb/XKBUse.c                 |   20 -
 src/xkb/XKBleds.c                |   24 -
 src/xkb/XKBlibint.h              |   22 -
 src/xlibi18n/ICWrap.c            |   26 -
 src/xlibi18n/IMWrap.c            |   20 -
 src/xlibi18n/XDefaultIMIF.c      |    4 
 src/xlibi18n/XDefaultOMIF.c      |   34 +-
 src/xlibi18n/Xaixlcint.h         |    2 
 src/xlibi18n/XimImSw.h           |    4 
 src/xlibi18n/XimProto.h          |    4 
 src/xlibi18n/XimThai.h           |   30 +-
 src/xlibi18n/XimTrX.h            |    2 
 src/xlibi18n/XimTrans.h          |    2 
 src/xlibi18n/Ximint.h            |   16 -
 src/xlibi18n/XimintL.h           |   18 -
 src/xlibi18n/XimintP.h           |    4 
 src/xlibi18n/XlcDL.c             |   12 
 src/xlibi18n/XlcGeneric.h        |    4 
 src/xlibi18n/XlcPubI.h           |    2 
 src/xlibi18n/Xlcint.h            |   38 +-
 src/xlibi18n/imKStoUCS.c         |    6 
 src/xlibi18n/lcCT.c              |   10 
 src/xlibi18n/lcCharSet.c         |    8 
 src/xlibi18n/lcConv.c            |    4 
 src/xlibi18n/lcDB.c              |   10 
 src/xlibi18n/lcFile.c            |   38 +-
 src/xlibi18n/lcGeneric.c         |   30 +-
 src/xlibi18n/lcInit.c            |    2 
 src/xlibi18n/lcPrTxt.c           |    4 
 src/xlibi18n/lcPubWrap.c         |    8 
 src/xlibi18n/lcPublic.c          |    8 
 src/xlibi18n/lcStd.c             |    4 
 src/xlibi18n/lcTxtPr.c           |    4 
 src/xlibi18n/lcUtil.c            |    4 
 src/xlibi18n/lcWrap.c            |   46 +--
 src/xlibi18n/mbWrap.c            |   14 
 src/xlibi18n/utf8Wrap.c          |   14 
 src/xlibi18n/wcWrap.c            |   14 
 src/xlibi18n/xim_trans.c         |    2 
 358 files changed, 3630 insertions(+), 3212 deletions(-)

New commits:
commit ae23c25b9349ab1d7ff81f3075c000cf35fc442b
Author: Julien Cristau <jcristau@debian.org>
Date:   Wed Nov 5 22:09:37 2008 +0100

    Bump to 1.1.99.2

diff --git a/configure.ac b/configure.ac
index 9a254ad..a90e384 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([libX11],
-        1.1.99.1,
+        1.1.99.2,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         libX11)
 AC_CONFIG_SRCDIR([Makefile.am])

commit d31e644c65c52828ea3e7abd94a8cf9aee12265c
Author: Julien Cristau <jcristau@debian.org>
Date:   Wed Nov 5 21:33:13 2008 +0100

    Fix distcheck

diff --git a/Makefile.am b/Makefile.am
index 944aaa0..5baa6c8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,6 +14,7 @@ endif
 EXTRA_DIST=x11.pc.in x11-xcb.pc.in ChangeLog autogen.sh
 
 MAINTAINERCLEANFILES=ChangeLog
+DISTCLEANFILES = doltcompile doltlibtool
 
 .PHONY: ChangeLog
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 3380f81..86a846e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -310,6 +310,7 @@ libX11_la_SOURCES = \
                   Xintconn.h \
                   XlibAsync.c \
                   XlibInt.c \
+                  Xprivate.h \
                   XomGeneric.h \
                   Xresinternal.h \
                   Xrm.c \

commit e6a7b70cdb2ae8b713012839a0a0bbb93817b8ef
Author: Jamey Sharp <jamey@minilop.net>
Date:   Wed Oct 29 14:00:33 2008 -0700

    Support multiple independent internal sync handlers
    
    Xlib has several independent tasks that need to be performed with the
    display unlocked. It does this by replacing the existing sync handler with
    one of a variety of internal sync handlers. However, if multiple internal
    sync handlers need to run, then the last one registering wins and
    previously registered internal sync handlers are never invoked. This
    manifested as a bug with DRI applications on Xlib/XCB as that requires
    both an XID handler after every XID allocation, and the periodic sequence
    number handler. The XID handler would win, and the sequence number handler
    would never be invoked.
    
    Fix this by unifying the internal sync handler mechanism into a single
    function that calls all of the known internal sync handlers. They all need
    to deal with being called when not strictly necessary now.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Jamey Sharp <jamey@minilop.net>
    Signed-off-by: Josh Triplett <josh@freedesktop.org>

diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index 5abf5d5..c9c12f5 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -959,9 +959,6 @@ extern void _XGetAsyncData(
     int		/* datalen */,
     int		/* discardtotal */
 );
-extern void _XSetSeqSyncFunction(
-    Display*	/* dpy */
-);
 extern void _XFlush(
     Display*	/* dpy */
 );
diff --git a/src/XlibInt.c b/src/XlibInt.c
index 3a1f96f..7947faf 100644
--- a/src/XlibInt.c
+++ b/src/XlibInt.c
@@ -42,11 +42,13 @@ from The Open Group.
 #include <config.h>
 #endif
 #include "Xlibint.h"
+#include "Xprivate.h"
 #include <X11/Xpoll.h>
 #if !USE_XCB
 #include <X11/Xtrans/Xtrans.h>
 #include <X11/extensions/xcmiscstr.h>
 #endif /* !USE_XCB */
+#include <assert.h>
 #include <stdio.h>
 #ifdef WIN32
 #include <direct.h>
@@ -583,28 +585,42 @@ int _XSeqSyncFunction(
 	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 && !sync_hazard(dpy)) {
-	dpy->synchandler = dpy->savedsynchandler;
-	dpy->flags &= ~XlibDisplayPrivSync;
-    }
+    } else if (sync_hazard(dpy))
+	_XSetPrivSyncFunction(dpy);
     UnlockDisplay(dpy);
     if (sent_sync)
         SyncHandle();
     return 0;
 }
 
-void _XSetSeqSyncFunction(
-    register Display *dpy)
+static int
+_XPrivSyncFunction (Display *dpy)
+{
+    assert(dpy->synchandler == _XPrivSyncFunction);
+    assert((dpy->flags & XlibDisplayPrivSync) != 0);
+    dpy->synchandler = dpy->savedsynchandler;
+    dpy->savedsynchandler = NULL;
+    dpy->flags &= ~XlibDisplayPrivSync;
+    _XIDHandler(dpy);
+    _XSeqSyncFunction(dpy);
+    return 0;
+}
+
+void _XSetPrivSyncFunction(Display *dpy)
 {
-    if (!(dpy->flags & XlibDisplayPrivSync) && sync_hazard(dpy)) {
+    if (!(dpy->flags & XlibDisplayPrivSync)) {
 	dpy->savedsynchandler = dpy->synchandler;
-	dpy->synchandler = _XSeqSyncFunction;
+	dpy->synchandler = _XPrivSyncFunction;
 	dpy->flags |= XlibDisplayPrivSync;
     }
 }
 
+void _XSetSeqSyncFunction(Display *dpy)
+{
+    if (sync_hazard(dpy))
+	_XSetPrivSyncFunction (dpy);
+}
+
 #if !USE_XCB
 #ifdef XTHREADS
 static void _XFlushInt(
@@ -1526,34 +1542,35 @@ _XGetMiscCode(
     }
 }
 
-static int
+int
 _XIDHandler(
     register Display *dpy)
 {
     xXCMiscGetXIDRangeReply grep;
     register xXCMiscGetXIDRangeReq *greq;
+    int sent_req = 0;
 
     LockDisplay(dpy);
-    _XGetMiscCode(dpy);
-    if (dpy->xcmisc_opcode > 0) {
-	GetReq(XCMiscGetXIDRange, greq);
-	greq->reqType = dpy->xcmisc_opcode;
-	greq->miscReqType = X_XCMiscGetXIDRange;
-	if (_XReply (dpy, (xReply *)&grep, 0, xTrue) && grep.count) {
-	    dpy->resource_id = ((grep.start_id - dpy->resource_base) >>
-				dpy->resource_shift);
-	    dpy->resource_max = dpy->resource_id;
-	    if (grep.count > 5)
-		dpy->resource_max += grep.count - 6;
-	    dpy->resource_max <<= dpy->resource_shift;
+    if (dpy->resource_max == dpy->resource_mask + 1) {
+	_XGetMiscCode(dpy);
+	if (dpy->xcmisc_opcode > 0) {
+	    GetReq(XCMiscGetXIDRange, greq);
+	    greq->reqType = dpy->xcmisc_opcode;
+	    greq->miscReqType = X_XCMiscGetXIDRange;
+	    if (_XReply (dpy, (xReply *)&grep, 0, xTrue) && grep.count) {
+		dpy->resource_id = ((grep.start_id - dpy->resource_base) >>
+				    dpy->resource_shift);
+		dpy->resource_max = dpy->resource_id;
+		if (grep.count > 5)
+		    dpy->resource_max += grep.count - 6;
+		dpy->resource_max <<= dpy->resource_shift;
+	    }
+	    sent_req = 1;
 	}
     }
-    if (dpy->flags & XlibDisplayPrivSync) {
-	dpy->synchandler = dpy->savedsynchandler;
-	dpy->flags &= ~XlibDisplayPrivSync;
-    }
     UnlockDisplay(dpy);
-    SyncHandle();
+    if (sent_req)
+	SyncHandle();
     return 0;
 }
 
@@ -1567,11 +1584,7 @@ XID _XAllocID(
 
    id = dpy->resource_id << dpy->resource_shift;
    if (id >= dpy->resource_max) {
-       if (!(dpy->flags & XlibDisplayPrivSync)) {
-	   dpy->savedsynchandler = dpy->synchandler;
-	   dpy->flags |= XlibDisplayPrivSync;
-       }
-       dpy->synchandler = _XIDHandler;
+	_XSetPrivSyncFunction(dpy);
        dpy->resource_max = dpy->resource_mask + 1;
    }
    if (id <= dpy->resource_mask) {
@@ -1627,11 +1640,7 @@ void _XAllocIDs(
 		    dpy->resource_id = id;
 	    }
 	    if (id >= dpy->resource_max) {
-		if (!(dpy->flags & XlibDisplayPrivSync)) {
-		    dpy->savedsynchandler = dpy->synchandler;
-		    dpy->flags |= XlibDisplayPrivSync;
-		}
-		dpy->synchandler = _XIDHandler;
+		_XSetPrivSyncFunction(dpy);
 		dpy->resource_max = dpy->resource_mask + 1;
 	    }
 	}
diff --git a/src/Xprivate.h b/src/Xprivate.h
new file mode 100644
index 0000000..c2c7a07
--- /dev/null
+++ b/src/Xprivate.h
@@ -0,0 +1,15 @@
+/* Copyright (C) 2008 Jamey Sharp, Josh Triplett
+ * This file is licensed under the MIT license. See the file COPYING.
+ *
+ * As Xlibint.h has long become effectively public API, this header exists
+ * for new private functions that nothing outside of libX11 should call.
+ */
+
+#ifndef XPRIVATE_H
+#define XPRIVATE_H
+
+extern int _XIDHandler(Display *dpy);
+extern void _XSetPrivSyncFunction(Display *dpy);
+extern void _XSetSeqSyncFunction(Display *dpy);
+
+#endif /* XPRIVATE_H */
diff --git a/src/xcb_io.c b/src/xcb_io.c
index 1fa62ec..73822b2 100644
--- a/src/xcb_io.c
+++ b/src/xcb_io.c
@@ -3,6 +3,7 @@
 
 #include "Xlibint.h"
 #include "locking.h"
+#include "Xprivate.h"
 #include "Xxcbint.h"
 #include <xcb/xcbext.h>
 
@@ -350,43 +351,37 @@ void _XFlush(Display *dpy)
 	_XEventsQueued(dpy, QueuedAfterReading);
 }
 
-static int
-_XIDHandler(Display *dpy)
+static const XID inval_id = ~0UL;
+
+int _XIDHandler(Display *dpy)
 {
-	XID next = xcb_generate_id(dpy->xcb->connection);
+	XID next;
+
+	if (dpy->xcb->next_xid != inval_id)
+	    return 0;
+
+	next = xcb_generate_id(dpy->xcb->connection);
 	LockDisplay(dpy);
+	dpy->xcb->next_xid = next;
 #ifdef XTHREADS
 	if (dpy->lock)
 		(*dpy->lock->user_unlock_display)(dpy);
 #endif
-	dpy->xcb->next_xid = next;
-	if(dpy->flags & XlibDisplayPrivSync)
-	{
-		dpy->synchandler = dpy->savedsynchandler;
-		dpy->flags &= ~XlibDisplayPrivSync;
-	}
 	UnlockDisplay(dpy);
-	SyncHandle();
 	return 0;
 }
 
 /* _XAllocID - resource ID allocation routine. */
 XID _XAllocID(Display *dpy)
 {
-	const XID inval = ~0UL;
 	XID ret = dpy->xcb->next_xid;
+	assert (ret != inval_id);
 #ifdef XTHREADS
-	if (ret != inval && dpy->lock)
+	if (dpy->lock)
 		(*dpy->lock->user_lock_display)(dpy);
 #endif
-	dpy->xcb->next_xid = inval;
-
-	if(!(dpy->flags & XlibDisplayPrivSync))
-	{
-		dpy->savedsynchandler = dpy->synchandler;
-		dpy->flags |= XlibDisplayPrivSync;
-	}
-	dpy->synchandler = _XIDHandler;
+	dpy->xcb->next_xid = inval_id;
+	_XSetPrivSyncFunction(dpy);
 	return ret;
 }
 

commit 2dbaaab9c4e3894b33dcae850551dee5473431d5
Author: Keith Packard <keithp@keithp.com>
Date:   Sat Oct 11 21:44:21 2008 -0700

    Ensure that _XReadEvents always leaves an event in the queue on return
    
    XNextEvent assumes that the event queue will be non-empty on return from
    _XReadEvents, but with multiple event readers running, the previous change
    could leave the queue empty on return from process_responses. Re-invoke
    process_responses until the queue is non-empty.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/src/xcb_io.c b/src/xcb_io.c
index de5525b..1fa62ec 100644
--- a/src/xcb_io.c
+++ b/src/xcb_io.c
@@ -267,7 +267,9 @@ void _XReadEvents(Display *dpy)
 	if(dpy->xcb->event_owner != XlibOwnsEventQueue)
 		return;
 	check_internal_connections(dpy);
-	process_responses(dpy, 1, 0, 0);
+	do {
+		process_responses(dpy, 1, 0, 0);
+	} while (dpy->qlen == 0);
 }
 
 /*

commit bedfe68259037c5564fe52758c92b9c97729640a
Author: Keith Packard <keithp@keithp.com>
Date:   Sat Oct 11 21:10:23 2008 -0700

    Permit only one Xlib thread to block waiting for events
    
    As Xlib queues events internally, we must prevent multiple Xlib threads from
    entering XCB to wait for an event in case the queued event is to be
    delivered to the thread which didn't manage to read it. In other words, let
    only one Xlib thread into xcb_wait_for_event at a time.
    
    Jamey Sharp looked over my shoulder while making this fix and, while hating
    my whitespace conventions, appears happy enough with the actual code.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/src/Xxcbint.h b/src/Xxcbint.h
index 1b3137b..f6afa18 100644
--- a/src/Xxcbint.h
+++ b/src/Xxcbint.h
@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include <X11/Xlibint.h>
 #include <X11/Xlib-xcb.h>
+#include "locking.h"
 
 #define XLIB_SEQUENCE_COMPARE(a,op,b)	(((long) (a) - (long) (b)) op 0)
 
@@ -29,6 +30,12 @@ typedef struct _X11XCBPrivate {
 	uint64_t last_flushed;
 	enum XEventQueueOwner event_owner;
 	XID next_xid;
+
+	/* handle simultaneous threads waiting for events,
+	 * used in wait_or_poll_for_event
+	 */
+	xcondition_t event_notify;
+	int event_waiter;
 } _X11XCBPrivate;
 
 /* xcb_disp.c */
diff --git a/src/xcb_disp.c b/src/xcb_disp.c
index dfd6803..628c654 100644
--- a/src/xcb_disp.c
+++ b/src/xcb_disp.c
@@ -93,6 +93,7 @@ int _XConnectXCB(Display *dpy, _Xconst char *display, char **fullnamep, int *scr
 	dpy->xcb->pending_requests_tail = &dpy->xcb->pending_requests;
 	dpy->xcb->next_xid = xcb_generate_id(dpy->xcb->connection);
 
+	dpy->xcb->event_notify = xcondition_malloc();
 	return !xcb_connection_has_error(c);
 }
 
@@ -106,5 +107,6 @@ void _XFreeX11XCBStructure(Display *dpy)
 		dpy->xcb->pending_requests = tmp->next;
 		free(tmp);
 	}
+	xcondition_free(dpy->xcb->event_notify);
 	Xfree(dpy->xcb);
 }
diff --git a/src/xcb_io.c b/src/xcb_io.c
index d0abf4c..de5525b 100644
--- a/src/xcb_io.c
+++ b/src/xcb_io.c
@@ -125,9 +125,20 @@ static xcb_generic_event_t * wait_or_poll_for_event(Display *dpy, int wait)
 	xcb_generic_event_t *event;
 	if(wait)
 	{
-		UnlockDisplay(dpy);
-		event = xcb_wait_for_event(c);
-		LockDisplay(dpy);
+		if(dpy->xcb->event_waiter)
+		{
+			ConditionWait(dpy, dpy->xcb->event_notify);
+			event = xcb_poll_for_event(c);
+		}
+		else
+		{
+			dpy->xcb->event_waiter = 1;
+			UnlockDisplay(dpy);
+			event = xcb_wait_for_event(c);
+			LockDisplay(dpy);
+			dpy->xcb->event_waiter = 0;
+			ConditionBroadcast(dpy, dpy->xcb->event_notify);
+		}
 	}
 	else
 		event = xcb_poll_for_event(c);
@@ -228,7 +239,6 @@ static void process_responses(Display *dpy, int wait_for_first_event, xcb_generi
 		_XIOError(dpy);
 
 	assert(XLIB_SEQUENCE_COMPARE(dpy->last_request_read, <=, dpy->request));
-	assert(!wait_for_first_event);
 }
 
 int _XEventsQueued(Display *dpy, int mode)

commit cc19618d2eb3ed92a0b574aee26a7da8b4aed5d2
Author: Jamey Sharp <jamey@minilop.net>
Date:   Sun Mar 23 16:33:50 2008 -0700

    Fix XAllocID race: hold the user display lock until we have a new XID.
    
    Xlib built --without-xcb is also vulnerable to this race, and a similar
    fix might work there too.
    
    Also, use an XID that's truly invalid while waiting for the next XID to be
    requested.

diff --git a/src/xcb_io.c b/src/xcb_io.c
index 830ddb9..d0abf4c 100644
--- a/src/xcb_io.c
+++ b/src/xcb_io.c
@@ -343,6 +343,10 @@ _XIDHandler(Display *dpy)
 {
 	XID next = xcb_generate_id(dpy->xcb->connection);
 	LockDisplay(dpy);
+#ifdef XTHREADS
+	if (dpy->lock)
+		(*dpy->lock->user_unlock_display)(dpy);
+#endif
 	dpy->xcb->next_xid = next;
 	if(dpy->flags & XlibDisplayPrivSync)
 	{
@@ -357,8 +361,13 @@ _XIDHandler(Display *dpy)
 /* _XAllocID - resource ID allocation routine. */
 XID _XAllocID(Display *dpy)
 {
+	const XID inval = ~0UL;
 	XID ret = dpy->xcb->next_xid;
-	dpy->xcb->next_xid = 0;
+#ifdef XTHREADS
+	if (ret != inval && dpy->lock)
+		(*dpy->lock->user_lock_display)(dpy);
+#endif
+	dpy->xcb->next_xid = inval;
 
 	if(!(dpy->flags & XlibDisplayPrivSync))
 	{

commit 54e5c0941b0ded1628d559a9f0a3451ea96c299b
Author: Josh Triplett <josh@freedesktop.org>
Date:   Sat Mar 15 17:22:23 2008 -0700

    Use XCB's new socket handoff mechanism rather than the old XCB Xlib lock.
    
    Previously, Xlib/XCB used XCB's Xlib lock to prevent XCB from sending
    requests between calls to Xlib's LockDisplay and UnlockDisplay macros.
    Xlib/XCB then sent all of its requests using XCB's xcb_send_request, and
    had to flush its requests when unlocking the display.
    
    XCB 1.2 adds a new socket handoff mechanism, xcb_take_socket.  Replace
    much of the existing Xlib/XCB implementation with the use of
    xcb_take_socket to take ownership of the write side of the X connection
    socket, and a return_socket callback which writes any outstanding requests
    with xcb_writev.  This approach allows Xlib/XCB to use the same buffering
    as traditional Xlib did.  In particular, programs which use Xlib/XCB and
    never make XCB calls will never need to hand the socket back to XCB, and
    vice versa.
    
    This allows us to discard large quantities of synchronization code from
    Xlib/XCB, together with the synchronization bugs present in that code.
    Several test cases which previously failed now work perfectly, including
    multi-threaded ico.  In addition, the infamous locking correctness
    assertions, triggered when double-locking or when unlocking without a
    previous lock, no longer exist, because Xlib/XCB no longer has any reason
    to care more about application locking than traditional Xlib does.
    
    Furthermore, the handoff approach provides great improvements to
    performance.  Results from x11perf's XNoOp test, which represented the
    worst case for the lock-based Xlib/XCB:
    
    Traditional Xlib:       average 19100000/sec
    Lock-based Xlib/XCB:    average  3350000/sec
    Handoff-based Xlib/XCB: average 17400000/sec
    
    Thus, for no-ops, the handoff mechanism provides more than a 4x speedup to
    Xlib/XCB, bringing Xlib/XCB within 9% of traditional Xlib no-op
    performance.  Of course, real-world workloads do not use no-op, so your
    mileage may vary.  In particular, since no-ops represent the worst case,
    we expect real workloads to more closely match the performance of
    traditional Xlib.
    
    While removing synchronization code, we changed _XReply to not drop any
    locks when calling xcb_wait_for_reply; previously, we had to carefully
    avoid a deadlock between the Display lock and the XCB Xlib lock. Holding
    the locks reduces implementation complexity and should not impact
    applications.
    
    Commit by Jamey Sharp and Josh Triplett.
    XCB's handoff mechanism inspired by Keith Packard.

diff --git a/configure.ac b/configure.ac
index 73bf00f..9a254ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,8 @@ no)
 	AC_DEFINE(USE_XCB, 0, [Use XCB for low-level protocol implementation])
 	;;
 *)
+	X11_REQUIRES="xcb >= 1.1.92"
+	X11_EXTRA_DEPS="xcb >= 1.1.92"
 	xdmauth="no" # XCB handles all auth
 	AC_DEFINE(USE_XCB, 1, [Use XCB for low-level protocol implementation])
 	;;
diff --git a/src/Makefile.am b/src/Makefile.am
index 564e03f..3380f81 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -342,7 +342,6 @@ EXTRA_DIST = \
 
 if XCB
 libX11_la_SOURCES += \
-                  xcb_lock.c \
                   xcb_disp.c \
                   xcb_io.c \
                   Xxcbint.h
diff --git a/src/OpenDis.c b/src/OpenDis.c
index d5089e8..aa2541f 100644
--- a/src/OpenDis.c
+++ b/src/OpenDis.c
@@ -261,13 +261,6 @@ XOpenDisplay (
 		return(NULL);
 	}
 
-#if USE_XCB
-	if (!_XCBInitDisplayLock(dpy)) {
-	        OutOfMemory (dpy, setup);
-		return(NULL);
-	}
-#endif
-
 	if (!_XPollfdCacheInit(dpy)) {
 	        OutOfMemory (dpy, setup);
 		return(NULL);
@@ -292,6 +285,10 @@ XOpenDisplay (
          return(NULL);
     }
     dpy->bufmax = dpy->buffer + conn_buf_size;
+#if USE_XCB
+    dpy->xcb->real_bufmax = dpy->bufmax;
+    dpy->bufmax = dpy->buffer;
+#endif
 
 	/* Set up the input event queue and input event queue parameters. */
 	dpy->head = dpy->tail = NULL;
@@ -652,6 +649,12 @@ XOpenDisplay (
 	UnlockDisplay(dpy);
 #endif /* !USE_XCB */
 
+#if USE_XCB
+	dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection);
+	if(dpy->bigreq_size <= dpy->max_request_size)
+		dpy->bigreq_size = 0;
+#endif /* USE_XCB */
+
 /*
  * Set up other stuff clients are always going to use.
  */
@@ -673,12 +676,6 @@ XOpenDisplay (
  */
 	(void) XSynchronize(dpy, _Xdebug);
 
-#if USE_XCB
-	dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection);
-	if(dpy->bigreq_size <= dpy->max_request_size)
-		dpy->bigreq_size = 0;
-#endif /* USE_XCB */
-
 /*
  * get availability of large requests, and
  * get the resource manager database off the root window.
@@ -883,10 +880,6 @@ void _XFreeDisplayStructure(dpy)
  	    Xfree (dpy->scratch_buffer);
 	FreeDisplayLock(dpy);
 
-#if USE_XCB
-	_XCBShutdownDisplayLock(dpy);


Reply to: