[xlibs-commit] Xfixes Region.c,1.1,1.2 ChangeLog,1.1,1.2 Cursor.c,1.2,1.3 Makefile.am,1.1,1.2 SaveSet.c,1.2,1.3 Selection.c,1.2,1.3 Xfixes.c,1.2,1.3 Xfixes.h,1.2,1.3 Xfixesint.h,1.3,1.4 configure.ac,1.2,1.3 xfixes.pc.in,1.1,1.2

Keith Packard xlibs-commit@pdx.freedesktop.org
Sun, 02 Nov 2003 18:24:35 -0800


Committed by: keithp

Update of /cvs/xlibs/Xfixes
In directory pdx:/tmp/cvs-serv1052

Modified Files:
	ChangeLog Cursor.c Makefile.am SaveSet.c Selection.c Xfixes.c 
	Xfixes.h Xfixesint.h configure.ac xfixes.pc.in 
Added Files:
	Region.c 
Log Message:
	Merge in xfixes_2_branch



Index: ChangeLog
===================================================================
RCS file: /cvs/xlibs/Xfixes/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ChangeLog	9 Oct 2003 01:47:40 -0000	1.1
+++ ChangeLog	3 Nov 2003 02:24:32 -0000	1.2
@@ -1,3 +1,44 @@
+2003-11-02  Keith Packard  <keithp@keithp.com>
+
+	* Cursor.c: (XFixesSelectCursorInput), (XFixesGetCursorImage),
+	(XFixesSetCursorName), (XFixesGetCursorName), (XFixesChangeCursor),
+	(XFixesChangeCursorByName):
+	* Makefile.am:
+	* Region.c: (XFixesCreateRegion), (XFixesCreateRegionFromBitmap),
+	(XFixesCreateRegionFromWindow), (XFixesCreateRegionFromGC),
+	(XFixesCreateRegionFromPicture), (XFixesDestroyRegion),
+	(XFixesSetRegion), (XFixesUnionRegion), (XFixesIntersectRegion),
+	(XFixesSubtractRegion), (XFixesInvertRegion),
+	(XFixesRegionExtents), (XFixesFetchRegion),
+	(XFixesSetGCClipRegion), (XFixesSetWindowShapeRegion),
+	(XFixesSetPictureClipRegion):
+	* SaveSet.c: (XFixesChangeSaveSet):
+	* Selection.c: (XFixesSelectSelectionInput):
+	* Xfixes.c: (XFixesExtAddDisplay), (XFixesExtRemoveDisplay),
+	(XFixesExtFindDisplay), (XFixesFindDisplay), (XFixesCloseDisplay),
+	(XFixesWireToEvent), (XFixesEventToWire), (XFixesQueryExtension),
+	(XFixesQueryVersion):
+	* Xfixes.h:
+	* Xfixesint.h:
+	* configure.ac:
+	* xfixes.pc.in:
+	Merge in xfixes_2_branch
+
+2003-10-19	Keith Packard	<keithp@keithp.com>
+
+	* Cursor.c
+	* Region.c
+	* Makefile.am
+	* SaveSet.c
+	* Selection.c
+	* Xfixes.c
+	* Xfixes.h
+	* Xfixesint.h
+	* configure.ac
+	* xfixes.pc.in
+	Eliminate dependency on libXext by in-lining trivial code.
+	Switch to Xfixes 2.0, adding region and cursor name functions
+	
 2003-09-16  Anders Carlsson  <andersca@gnome.org>
 
 	* configure.ac:

Index: Cursor.c
===================================================================
RCS file: /cvs/xlibs/Xfixes/Cursor.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Cursor.c	12 Jan 2003 02:44:26 -0000	1.2
+++ Cursor.c	3 Nov 2003 02:24:32 -0000	1.3
@@ -29,7 +29,7 @@
 			 Window		win,
 			 unsigned long	eventMask)
 {
-    XExtDisplayInfo		    *info = XFixesFindDisplay (dpy);
+    XFixesExtDisplayInfo	    *info = XFixesFindDisplay (dpy);
     xXFixesSelectCursorInputReq	    *req;
 
     XFixesSimpleCheckExtension (dpy, info);
@@ -47,31 +47,43 @@
 XFixesCursorImage *
 XFixesGetCursorImage (Display *dpy)
 {
-    XExtDisplayInfo		    *info = XFixesFindDisplay (dpy);
-    xXFixesGetCursorImageReq	    *req;
-    xXFixesGetCursorImageReply	    rep;
-    int				    npixels;
-    int				    nbytes, nread, rlength;
-    XFixesCursorImage		    *image;
+    XFixesExtDisplayInfo		*info = XFixesFindDisplay (dpy);
+    xXFixesGetCursorImageAndNameReq	*req;
+    xXFixesGetCursorImageAndNameReply	rep;
+    int					npixels;
+    int					nbytes_name;
+    int					nbytes, nread, rlength;
+    XFixesCursorImage			*image;
 
     XFixesCheckExtension (dpy, info, 0);
     LockDisplay (dpy);
-    GetReq (XFixesGetCursorImage, req);
+    GetReq (XFixesGetCursorImageAndName, req);
     req->reqType = info->codes->major_opcode;
-    req->xfixesReqType = X_XFixesGetCursorImage;
+    if (info->major_version >= 2)
+	req->xfixesReqType = X_XFixesGetCursorImageAndName;
+    else
+	req->xfixesReqType = X_XFixesGetCursorImage;
     if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
     {
 	UnlockDisplay (dpy);
 	SyncHandle ();
 	return 0;
     }
+    if (info->major_version < 2)
+    {
+	rep.cursorName = None;
+	rep.nbytes = 0;
+    }
     npixels = rep.width * rep.height;
+    nbytes_name = rep.nbytes;
     /* reply data length */
     nbytes = (long) rep.length << 2;
     /* bytes of actual data in the reply */
-    nread = (npixels) << 2;
+    nread = (npixels << 2) + nbytes_name;
     /* size of data returned to application */
-    rlength = sizeof (XFixesCursorImage) + npixels * sizeof (unsigned long);
+    rlength = (sizeof (XFixesCursorImage) + 
+	       npixels * sizeof (unsigned long) +
+	       nbytes_name + 1);
 
     image = (XFixesCursorImage *) Xmalloc (rlength);
     if (!image)
@@ -89,7 +101,11 @@
     image->yhot = rep.yhot;
     image->cursor_serial = rep.cursorSerial;
     image->pixels = (unsigned long *) (image + 1);
-    _XRead32 (dpy, image->pixels, nread);
+    image->atom = rep.cursorName;
+    image->name = (char *) (image->pixels + npixels);
+    _XRead32 (dpy, image->pixels, npixels << 2);
+    _XRead (dpy, image->name, nbytes_name);
+    image->name[nbytes_name] = '\0';	/* null-terminate */
     /* skip any padding */
     if(nbytes > nread)
     {
@@ -99,3 +115,101 @@
     SyncHandle ();
     return image;
 }
+
+void
+XFixesSetCursorName (Display *dpy, Cursor cursor, char *name)
+{
+    XFixesExtDisplayInfo	*info = XFixesFindDisplay (dpy);
+    xXFixesSetCursorNameReq	*req;
+    int				nbytes = strlen (name);
+
+    XFixesSimpleCheckExtension (dpy, info);
+    if (info->major_version < 2)
+	return;
+    LockDisplay (dpy);
+    GetReq (XFixesSetCursorName, req);
+    req->reqType = info->codes->major_opcode;
+    req->xfixesReqType = X_XFixesSetCursorName;
+    req->cursor = cursor;
+    req->nbytes = nbytes;
+    req->length += (nbytes + 3) >> 2;
+    Data (dpy, name, nbytes);
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+char *
+XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom)
+{
+    XFixesExtDisplayInfo	*info = XFixesFindDisplay (dpy);
+    xXFixesGetCursorNameReq	*req;
+    xXFixesGetCursorNameReply	rep;
+    char			*name;
+
+    XFixesCheckExtension (dpy, info, 0);
+    if (info->major_version < 2)
+	return 0;
+    LockDisplay (dpy);
+    GetReq (XFixesGetCursorName, req);
+    req->reqType = info->codes->major_opcode;
+    req->xfixesReqType = X_XFixesGetCursorName;
+    req->cursor = cursor;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+	UnlockDisplay (dpy);
+	SyncHandle ();
+	return 0;
+    }
+    *atom = rep.atom;
+    if ((name = (char *) Xmalloc(rep.nbytes+1))) {
+	_XReadPad(dpy, name, (long)rep.nbytes);
+	name[rep.nbytes] = '\0';
+    } else {
+	_XEatData(dpy, (unsigned long) (rep.nbytes + 3) & ~3);
+	name = (char *) NULL;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return(name);
+}
+
+void
+XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination)
+{
+    XFixesExtDisplayInfo	*info = XFixesFindDisplay (dpy);
+    xXFixesChangeCursorReq	*req;
+
+    XFixesSimpleCheckExtension (dpy, info);
+    if (info->major_version < 2)
+	return;
+    LockDisplay (dpy);
+    GetReq (XFixesChangeCursor, req);
+    req->reqType = info->codes->major_opcode;
+    req->xfixesReqType = X_XFixesChangeCursor;
+    req->source = source;
+    req->destination = destination;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void
+XFixesChangeCursorByName (Display *dpy, Cursor source, char *name)
+{
+    XFixesExtDisplayInfo	    *info = XFixesFindDisplay (dpy);
+    xXFixesChangeCursorByNameReq    *req;
+    int				    nbytes = strlen (name);
+
+    XFixesSimpleCheckExtension (dpy, info);
+    if (info->major_version < 2)
+	return;
+    LockDisplay (dpy);
+    GetReq (XFixesChangeCursorByName, req);
+    req->reqType = info->codes->major_opcode;
+    req->xfixesReqType = X_XFixesChangeCursorByName;
+    req->source = source;
+    req->nbytes = nbytes;
+    req->length += (nbytes + 3) >> 2;
+    Data (dpy, name, nbytes);
+    UnlockDisplay(dpy);
+    SyncHandle();
+}

Index: Makefile.am
===================================================================
RCS file: /cvs/xlibs/Xfixes/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am	9 Oct 2003 01:47:40 -0000	1.1
+++ Makefile.am	3 Nov 2003 02:24:32 -0000	1.2
@@ -27,6 +27,7 @@
 
 libXfixes_la_SOURCES = 	\
 	Cursor.c	\
+	Region.c	\
 	SaveSet.c	\
 	Selection.c	\
 	Xfixes.c	\
@@ -38,7 +39,13 @@
 # Library version info.  Check the libtool docs for
 # instructions on when and how to change this value
 #
-libXfixes_la_LDFLAGS = -version-info 0:0:0
+# bump when the ABI changes
+XFIXES_CURRENT=1
+# bump for non-ABI changes, reset to zero when CURRENT changes
+XFIXES_REVISION=0
+# bump when the ABI changes in backward-compatible fashion
+XFIXES_AGE=1
+libXfixes_la_LDFLAGS = -version-info ${XFIXES_CURRENT}:${XFIXES_REVISION}:${XFIXES_AGE}
 
 libXfixesincludedir = $(includedir)/X11/extensions
 libXfixesinclude_HEADERS = Xfixes.h 

Index: SaveSet.c
===================================================================
RCS file: /cvs/xlibs/Xfixes/SaveSet.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SaveSet.c	12 Jan 2003 02:44:26 -0000	1.2
+++ SaveSet.c	3 Nov 2003 02:24:32 -0000	1.3
@@ -27,7 +27,7 @@
 void 
 XFixesChangeSaveSet (Display *dpy, Window win, int mode, int target, int map)
 {
-    XExtDisplayInfo		*info = XFixesFindDisplay (dpy);
+    XFixesExtDisplayInfo	*info = XFixesFindDisplay (dpy);
     xXFixesChangeSaveSetReq	*req;
 
     XFixesSimpleCheckExtension (dpy, info);

Index: Selection.c
===================================================================
RCS file: /cvs/xlibs/Xfixes/Selection.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Selection.c	12 Jan 2003 02:44:26 -0000	1.2
+++ Selection.c	3 Nov 2003 02:24:32 -0000	1.3
@@ -30,7 +30,7 @@
 			    Atom	    selection, 
 			    unsigned long   eventMask)
 {
-    XExtDisplayInfo		    *info = XFixesFindDisplay (dpy);
+    XFixesExtDisplayInfo	    *info = XFixesFindDisplay (dpy);
     xXFixesSelectSelectionInputReq  *req;
 
     XFixesSimpleCheckExtension (dpy, info);

Index: Xfixes.c
===================================================================
RCS file: /cvs/xlibs/Xfixes/Xfixes.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Xfixes.c	12 Jan 2003 02:44:26 -0000	1.2
+++ Xfixes.c	3 Nov 2003 02:24:32 -0000	1.3
@@ -24,7 +24,7 @@
 
 #include "Xfixesint.h"
 
-XExtensionInfo XFixesExtensionInfo;
+XFixesExtInfo XFixesExtensionInfo;
 char XFixesExtensionName[] = XFIXES_NAME;
 
 static int
@@ -36,52 +36,179 @@
 static Status
 XFixesEventToWire(Display *dpy, XEvent *event, xEvent *wire);
 
-static /* const */ XExtensionHooks xfixes_extension_hooks = {
-    NULL,				/* create_gc */
-    NULL,				/* copy_gc */
-    NULL,				/* flush_gc */
-    NULL,				/* free_gc */
-    NULL,				/* create_font */
-    NULL,				/* free_font */
-    XFixesCloseDisplay,			/* close_display */
-    XFixesWireToEvent,			/* wire_to_event */
-    XFixesEventToWire,			/* event_to_wire */
-    NULL,				/* error */
-    NULL,				/* error_string */
-};
-
-XExtDisplayInfo *
-XFixesFindDisplay (Display *dpy)
+/*
+ * XFixesExtAddDisplay - add a display to this extension. (Replaces
+ * XextAddDisplay)
+ */
+static XFixesExtDisplayInfo *
+XFixesExtAddDisplay (XFixesExtInfo *extinfo,
+                      Display        *dpy,
+                      char           *ext_name)
 {
-    XExtDisplayInfo *dpyinfo;
-    XFixesInfo	    *xfi;
+    XFixesExtDisplayInfo    *info;
+    int			    ev;
 
-    dpyinfo = XextFindDisplay (&XFixesExtensionInfo, dpy);
-    if (!dpyinfo)
-    {
-	dpyinfo = XextAddDisplay (&XFixesExtensionInfo, dpy, 
-				  XFixesExtensionName,
-				  &xfixes_extension_hooks,
-				  XFixesNumberEvents, 0);
-	xfi = Xmalloc (sizeof (XFixesInfo));
-	if (!xfi)
+    info = (XFixesExtDisplayInfo *) Xmalloc (sizeof (XFixesExtDisplayInfo));
+    if (!info) return NULL;
+    info->display = dpy;
+
+    info->codes = XInitExtension (dpy, ext_name);
+
+    /*
+     * if the server has the extension, then we can initialize the 
+     * appropriate function vectors
+     */
+    if (info->codes) {
+	xXFixesQueryVersionReply	rep;
+	xXFixesQueryVersionReq	*req;
+        XESetCloseDisplay (dpy, info->codes->extension, 
+                           XFixesCloseDisplay);
+	for (ev = info->codes->first_event;
+	     ev < info->codes->first_event + XFixesNumberEvents;
+	     ev++)
+	{
+	    XESetWireToEvent (dpy, ev, XFixesWireToEvent);
+	    XESetEventToWire (dpy, ev, XFixesEventToWire);
+	}
+	/*
+	 * Get the version info
+	 */
+	LockDisplay (dpy);
+	GetReq (XFixesQueryVersion, req);
+	req->reqType = info->codes->major_opcode;
+	req->xfixesReqType = X_XFixesQueryVersion;
+	req->majorVersion = XFIXES_MAJOR;
+	req->minorVersion = XFIXES_MINOR;
+	if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) 
+	{
+	    UnlockDisplay (dpy);
+	    SyncHandle ();
 	    return 0;
-	xfi->major_version = -1;
-	dpyinfo->data = (char *) xfi;
+	}
+	info->major_version = rep.majorVersion;
+	info->minor_version = rep.minorVersion;
+	UnlockDisplay (dpy);
+    } else {
+	/* The server doesn't have this extension.
+	 * Use a private Xlib-internal extension to hang the close_display
+	 * hook on so that the "cache" (extinfo->cur) is properly cleaned.
+	 * (XBUG 7955)
+	 */
+	XExtCodes *codes = XAddExtension(dpy);
+	if (!codes) {
+	    XFree(info);
+	    return NULL;
+	}
+        XESetCloseDisplay (dpy, codes->extension, XFixesCloseDisplay);
     }
-    return dpyinfo;
+
+    /*
+     * now, chain it onto the list
+     */
+    _XLockMutex(_Xglobal_lock);
+    info->next = extinfo->head;
+    extinfo->head = info;
+    extinfo->cur = info;
+    extinfo->ndisplays++;
+    _XUnlockMutex(_Xglobal_lock);
+    return info;
+}
+
+
+/*
+ * XFixesExtRemoveDisplay - remove the indicated display from the
+ * extension object. (Replaces XextRemoveDisplay.)
+ */
+static int 
+XFixesExtRemoveDisplay (XFixesExtInfo *extinfo, Display *dpy)
+{
+    XFixesExtDisplayInfo *info, *prev;
+
+    /*
+     * locate this display and its back link so that it can be removed
+     */
+    _XLockMutex(_Xglobal_lock);
+    prev = NULL;
+    for (info = extinfo->head; info; info = info->next) {
+	if (info->display == dpy) break;
+	prev = info;
+    }
+    if (!info) {
+	_XUnlockMutex(_Xglobal_lock);
+	return 0;		/* hmm, actually an error */
+    }
+
+    /*
+     * remove the display from the list; handles going to zero
+     */
+    if (prev)
+	prev->next = info->next;
+    else
+	extinfo->head = info->next;
+
+    extinfo->ndisplays--;
+    if (info == extinfo->cur) extinfo->cur = NULL;  /* flush cache */
+    _XUnlockMutex(_Xglobal_lock);
+
+    Xfree ((char *) info);
+    return 1;
+}
+
+/*
+ * XFixesExtFindDisplay - look for a display in this extension; keeps a
+ * cache of the most-recently used for efficiency. (Replaces
+ * XextFindDisplay.)
+ */
+static XFixesExtDisplayInfo *
+XFixesExtFindDisplay (XFixesExtInfo *extinfo, 
+		      Display	    *dpy)
+{
+    XFixesExtDisplayInfo *info;
+
+    /*
+     * see if this was the most recently accessed display
+     */
+    if ((info = extinfo->cur) && info->display == dpy) 
+	return info;
+
+    /*
+     * look for display in list
+     */
+    _XLockMutex(_Xglobal_lock);
+    for (info = extinfo->head; info; info = info->next) {
+	if (info->display == dpy) {
+	    extinfo->cur = info;     /* cache most recently used */
+	    _XUnlockMutex(_Xglobal_lock);
+	    return info;
+	}
+    }
+    _XUnlockMutex(_Xglobal_lock);
+
+    return NULL;
+}
+
+XFixesExtDisplayInfo *
+XFixesFindDisplay (Display *dpy)
+{
+    XFixesExtDisplayInfo *info;
+
+    info = XFixesExtFindDisplay (&XFixesExtensionInfo, dpy);
+    if (!info)
+	info = XFixesExtAddDisplay (&XFixesExtensionInfo, dpy, 
+				    XFixesExtensionName);
+    return info;
 }
     
 static int
 XFixesCloseDisplay (Display *dpy, XExtCodes *codes)
 {
-    return XextRemoveDisplay (&XFixesExtensionInfo, dpy);
+    return XFixesExtRemoveDisplay (&XFixesExtensionInfo, dpy);
 }
 
 static Bool
 XFixesWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
-    XExtDisplayInfo *info = XFixesFindDisplay(dpy);
+    XFixesExtDisplayInfo *info = XFixesFindDisplay(dpy);
 
     XFixesCheckExtension(dpy, info, False);
 
@@ -119,6 +246,7 @@
 	aevent->window = awire->window;
 	aevent->cursor_serial = awire->cursorSerial;
 	aevent->timestamp = awire->timestamp;
+	aevent->cursor_name = awire->name;
 	return True;
     }
     }
@@ -128,7 +256,7 @@
 static Status
 XFixesEventToWire(Display *dpy, XEvent *event, xEvent *wire)
 {
-    XExtDisplayInfo *info = XFixesFindDisplay(dpy);
+    XFixesExtDisplayInfo *info = XFixesFindDisplay(dpy);
 
     XFixesCheckExtension(dpy, info, False);
 
@@ -158,6 +286,7 @@
 	awire->window = aevent->window;
 	awire->timestamp = aevent->timestamp;
 	awire->cursorSerial = aevent->cursor_serial;
+	awire->name = aevent->cursor_name;
     }
     }
     return False;
@@ -166,9 +295,9 @@
 Bool 
 XFixesQueryExtension (Display *dpy, int *event_basep, int *error_basep)
 {
-    XExtDisplayInfo *info = XFixesFindDisplay (dpy);
+    XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
 
-    if (XextHasExtension(info)) 
+    if (XFixesHasExtension(info)) 
     {
 	*event_basep = info->codes->first_event;
 	*error_basep = info->codes->first_error;
@@ -183,38 +312,12 @@
 		    int	    *major_versionp,
 		    int	    *minor_versionp)
 {
-    XExtDisplayInfo		*info = XFixesFindDisplay (dpy);
-    xXFixesQueryVersionReply	rep;
-    xXFixesQueryVersionReq	*req;
-    XFixesInfo			*xfi;
+    XFixesExtDisplayInfo	*info = XFixesFindDisplay (dpy);
 
     XFixesCheckExtension (dpy, info, 0);
 
-    xfi = (XFixesInfo *) info->data;
-
-    /*
-     * only get the version information from the server if we don't have it
-     * already
-     */
-    if (xfi->major_version == -1) 
-    {
-	LockDisplay (dpy);
-	GetReq (XFixesQueryVersion, req);
-	req->reqType = info->codes->major_opcode;
-	req->xfixesReqType = X_XFixesQueryVersion;
-	req->majorVersion = XFIXES_MAJOR;
-	req->minorVersion = XFIXES_MINOR;
-	if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) 
-	{
-	    UnlockDisplay (dpy);
-	    SyncHandle ();
-	    return 0;
-	}
-	xfi->major_version = rep.majorVersion;
-	xfi->minor_version = rep.minorVersion;
-    }
-    *major_versionp = xfi->major_version;
-    *minor_versionp = xfi->minor_version;
+    *major_versionp = info->major_version;
+    *minor_versionp = info->minor_version;
     UnlockDisplay (dpy);
     SyncHandle ();
     return 1;

Index: Xfixes.h
===================================================================
RCS file: /cvs/xlibs/Xfixes/Xfixes.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Xfixes.h	12 Jan 2003 02:44:26 -0000	1.2
+++ Xfixes.h	3 Nov 2003 02:24:32 -0000	1.3
@@ -51,6 +51,7 @@
     int subtype;
     unsigned long cursor_serial;
     Time timestamp;
+    Atom cursor_name;
 } XFixesCursorNotifyEvent;
 
 typedef struct {
@@ -59,8 +60,29 @@
     unsigned short  xhot, yhot;
     unsigned long   cursor_serial;
     unsigned long   *pixels;
+#if XFIXES_MAJOR >= 2
+    Atom	    atom;		    /* Version >= 2 only */
+    char	    *name;		    /* Version >= 2 only */
+#endif
 } XFixesCursorImage;
 
+#if XFIXES_MAJOR >= 2
+/* Version 2 types */
+
+typedef XID XserverRegion;
+
+typedef struct {
+    short	    x, y;
+    unsigned short  width, height;
+    unsigned short  xhot, yhot;
+    unsigned long   cursor_serial;
+    unsigned long   *pixels;
+    Atom	    atom;
+    char	    *name;
+} XFixesCursorImageAndName;
+
+#endif
+
 _XFUNCPROTOBEGIN
 
 Bool XFixesQueryExtension (Display *dpy, int *event_basep, int *error_basep);
@@ -89,6 +111,85 @@
 XFixesCursorImage *
 XFixesGetCursorImage (Display *dpy);
 
+#if XFIXES_MAJOR >= 2
+/* Version 2 functions */
+
+XserverRegion
+XFixesCreateRegion (Display *dpy, XRectangle *rectangles, int nrectangles);
+
+XserverRegion
+XFixesCreateRegionFromBitmap (Display *dpy, Pixmap bitmap);
+
+XserverRegion
+XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind);
+
+XserverRegion
+XFixesCreateRegionFromGC (Display *dpy, GC gc);
+
+XserverRegion
+XFixesCreateRegionFromPicture (Display *dpy, XID picture);
+
+void
+XFixesDestroyRegion (Display *dpy, XserverRegion region);
+
+void
+XFixesSetRegion (Display *dpy, XserverRegion region,
+		 XRectangle *rectangles, int nrectangles);
+
+void
+XFixesUnionRegion (Display *dpy, XserverRegion dst,
+		   XserverRegion src1, int xOff1, int yOff1,
+		   XserverRegion src2, int xOff2, int yOff2);
+
+void
+XFixesIntersectRegion (Display *dpy, XserverRegion dst,
+		       XserverRegion src1, int xOff1, int yOff1,
+		       XserverRegion src2, int xOff2, int yOff2);
+
+void
+XFixesSubtractRegion (Display *dpy, XserverRegion dst,
+		      XserverRegion src1, int xOff1, int yOff1,
+		      XserverRegion src2, int xOff2, int yOff2);
+
+void
+XFixesInvertRegion (Display *dpy, XserverRegion dst,
+		    XRectangle *rect, XserverRegion src,
+		    int xOff, int yOff);
+
+void
+XFixesRegionExtents (Display *dpy, XserverRegion dst, XserverRegion src);
+
+XRectangle *
+XFixesFetchRegion (Display *dpy, XserverRegion region, int *nrectanglesRet);
+
+void
+XFixesSetGCClipRegion (Display *dpy, GC gc, 
+		       int clip_x_origin, int clip_y_origin,
+		       XserverRegion region);
+
+void
+XFixesSetWindowShapeRegion (Display *dpy, Window win, int shape_kind,
+			    int x_off, int y_off, XserverRegion region);
+
+void
+XFixesSetPictureClipRegion (Display *dpy, XID picture,
+			    int clip_x_origin, int clip_y_origin,
+			    XserverRegion region);
+
+void
+XFixesSetCursorName (Display *dpy, Cursor cursor, char *name);
+
+char *
+XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom);
+
+void
+XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination);
+
+void
+XFixesChangeCursorByName (Display *dpy, Cursor source, char *name);
+
+#endif
+
 _XFUNCPROTOEND
 
 #endif /* _XFIXES_H_ */

Index: Xfixesint.h
===================================================================
RCS file: /cvs/xlibs/Xfixes/Xfixesint.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Xfixesint.h	9 Oct 2003 01:47:40 -0000	1.3
+++ Xfixesint.h	3 Nov 2003 02:24:32 -0000	1.4
@@ -31,26 +31,38 @@
 #include <X11/Xlib.h>
 #include <X11/Xlibint.h>
 #include <X11/Xutil.h>
-#include <X11/extensions/Xext.h>			/* in ../include */
-#include <X11/extensions/extutil.h>			/* in ../include */
 #include "Xfixes.h"
 #include <X11/extensions/xfixesproto.h>
 
-extern XExtensionInfo XFixesExtensionInfo;
 extern char XFixesExtensionName[];
 
-#define XFixesCheckExtension(dpy,i,val) \
-  XextCheckExtension (dpy, i, XFixesExtensionName, val)
-#define XFixesSimpleCheckExtension(dpy,i) \
-  XextSimpleCheckExtension (dpy, i, XFixesExtensionName)
+typedef struct _XFixesExtDisplayInfo {
+    struct _XFixesExtDisplayInfo  *next;    /* keep a linked list */
+    Display                 *display;	    /* which display this is */
+    XExtCodes               *codes;	    /* the extension protocol codes */
+    int			    major_version;  /* -1 means we don't know */
+    int			    minor_version;  /* -1 means we don't know */
+} XFixesExtDisplayInfo;
 
-XExtDisplayInfo *XFixesFindDisplay (Display *dpy);
+/* replaces XExtensionInfo */
+typedef struct _XFixesExtInfo {
+    XFixesExtDisplayInfo    *head;          /* start of the list */
+    XFixesExtDisplayInfo    *cur;           /* most recently used */
+    int                     ndisplays;      /* number of displays */
+} XFixesExtInfo;
 
-/* cache version info */
+extern XFixesExtInfo XFixesExtensionInfo;
+extern char XFixesExtensionName[];
 
-typedef struct _XFixesInfo {
-    int major_version;	    /* -1 means we don't know */
-    int	minor_version;	
-} XFixesInfo;
+XFixesExtDisplayInfo *
+XFixesFindDisplay (Display *dpy);
+
+#define XFixesHasExtension(i) ((i) && ((i)->codes))
+
+#define XFixesCheckExtension(dpy,i,val) \
+  if (!XFixesHasExtension(i)) { return val; }
+
+#define XFixesSimpleCheckExtension(dpy,i) \
+  if (!XFixesHasExtension(i)) { return; }
 
 #endif /* _XFIXESINT_H_ */

Index: configure.ac
===================================================================
RCS file: /cvs/xlibs/Xfixes/configure.ac,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- configure.ac	1 Nov 2003 09:11:49 -0000	1.2
+++ configure.ac	3 Nov 2003 02:24:32 -0000	1.3
@@ -26,13 +26,13 @@
 AC_PREREQ([2.57])
 
 dnl
-dnl Version should match the current Render version. XRenderQueryVersion
-dnl returns the version from render.h, NOT the version we set here. But we
+dnl Version should match the current XFixes version. XFixesQueryVersion
+dnl returns the version from xfixeswire.h, NOT the version we set here. But we
 dnl try to keep these the same.  Note that the library has an extra
 dnl digit in the version number to track changes which don't affect the
-dnl protocol, so Xrender version l.n.m corresponds to protocol version l.n
+dnl protocol, so Xfixes version l.n.m corresponds to protocol version l.n
 dnl
-AC_INIT(libXfixes, 1.0.1, [keithp@keithp.com], libXfixes)
+AC_INIT(libXfixes, 2.0.0, [keithp@keithp.com], libXfixes)
 AM_INIT_AUTOMAKE([dist-bzip2])
 AM_MAINTAINER_MODE
 
@@ -86,7 +86,7 @@
 # find the required protocol version
 
 FIXESEXT_VERSION=[`echo $VERSION | sed 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
-PKG_CHECK_MODULES(FIXESEXT, [fixesext >= $FIXESEXT_VERSION xext])
+PKG_CHECK_MODULES(FIXESEXT, [fixesext >= $FIXESEXT_VERSION])
 
 AC_OUTPUT([Makefile
            xfixes.pc])

Index: xfixes.pc.in
===================================================================
RCS file: /cvs/xlibs/Xfixes/xfixes.pc.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xfixes.pc.in	9 Oct 2003 01:47:40 -0000	1.1
+++ xfixes.pc.in	3 Nov 2003 02:24:32 -0000	1.2
@@ -3,7 +3,8 @@
 libdir=@libdir@
 includedir=@includedir@
 
-Name: RandR
-Description: RandR extension headers
+Name: Xfixes
+Description: X Fixes  Library
 Version: @PACKAGE_VERSION@
-Cflags: -I${includedir}
+Cflags: -I${includedir} @X_CFLAGS@
+Libs: -L${libdir} -lXfixes @X_LIBS@