aboutsummaryrefslogtreecommitdiff
path: root/libXfixes/src
diff options
context:
space:
mode:
Diffstat (limited to 'libXfixes/src')
-rw-r--r--libXfixes/src/Cursor.c336
-rw-r--r--libXfixes/src/Makefile.am20
-rw-r--r--libXfixes/src/Makefile.in602
-rw-r--r--libXfixes/src/Region.c444
-rw-r--r--libXfixes/src/SaveSet.c47
-rw-r--r--libXfixes/src/Selection.c49
-rw-r--r--libXfixes/src/Xfixes.c334
-rw-r--r--libXfixes/src/Xfixesint.h65
-rwxr-xr-xlibXfixes/src/makefile10
9 files changed, 1907 insertions, 0 deletions
diff --git a/libXfixes/src/Cursor.c b/libXfixes/src/Cursor.c
new file mode 100644
index 000000000..0d656f7ad
--- /dev/null
+++ b/libXfixes/src/Cursor.c
@@ -0,0 +1,336 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "Xfixesint.h"
+
+void
+XFixesSelectCursorInput (Display *dpy,
+ Window win,
+ unsigned long eventMask)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesSelectCursorInputReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ GetReq (XFixesSelectCursorInput, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesSelectCursorInput;
+ req->window = win;
+ req->eventMask = eventMask;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+}
+
+XFixesCursorImage *
+XFixesGetCursorImage (Display *dpy)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesGetCursorImageAndNameReq *req;
+ xXFixesGetCursorImageAndNameReply rep;
+ int npixels;
+ int nbytes_name;
+ int nbytes, nread, rlength;
+ XFixesCursorImage *image;
+ char *name;
+
+ XFixesCheckExtension (dpy, info, NULL);
+ LockDisplay (dpy);
+ GetReq (XFixesGetCursorImageAndName, req);
+ req->reqType = info->codes->major_opcode;
+ 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 NULL;
+ }
+ 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) + nbytes_name;
+ /* size of data returned to application */
+ rlength = (sizeof (XFixesCursorImage) +
+ npixels * sizeof (unsigned long) +
+ nbytes_name + 1);
+
+ image = (XFixesCursorImage *) Xmalloc (rlength);
+ if (!image)
+ {
+ _XEatData (dpy, nbytes);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+ image->x = rep.x;
+ image->y = rep.y;
+ image->width = rep.width;
+ image->height = rep.height;
+ image->xhot = rep.xhot;
+ image->yhot = rep.yhot;
+ image->cursor_serial = rep.cursorSerial;
+ image->pixels = (unsigned long *) (image + 1);
+ image->atom = rep.cursorName;
+ name = (char *) (image->pixels + npixels);
+ image->name = name;
+ _XRead32 (dpy, (long *) image->pixels, npixels << 2);
+ _XRead (dpy, name, nbytes_name);
+ name[nbytes_name] = '\0'; /* null-terminate */
+ /* skip any padding */
+ if(nbytes > nread)
+ {
+ _XEatData (dpy, (unsigned long) (nbytes - nread));
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return image;
+}
+
+void
+XFixesSetCursorName (Display *dpy, Cursor cursor, const 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 ();
+}
+
+const char *
+XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesGetCursorNameReq *req;
+ xXFixesGetCursorNameReply rep;
+ char *name;
+
+ XFixesCheckExtension (dpy, info, NULL);
+ if (info->major_version < 2)
+ return NULL;
+ 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 NULL;
+ }
+ *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, const 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();
+}
+
+void
+XFixesHideCursor (Display *dpy, Window win)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesHideCursorReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ if (info->major_version < 4)
+ return;
+ LockDisplay (dpy);
+ GetReq (XFixesHideCursor, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesHideCursor;
+ req->window = win;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+}
+
+void
+XFixesShowCursor (Display *dpy, Window win)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesShowCursorReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ if (info->major_version < 4)
+ return;
+ LockDisplay (dpy);
+ GetReq (XFixesShowCursor, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesShowCursor;
+ req->window = win;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+}
+
+PointerBarrier
+XFixesCreatePointerBarrier(Display *dpy, Window w, int x1, int y1,
+ int x2, int y2, int directions,
+ int num_devices, int *devices)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesCreatePointerBarrierReq *req;
+ PointerBarrier barrier;
+ int extra = 0;
+
+ XFixesCheckExtension (dpy, info, 0);
+ if (info->major_version < 5)
+ return 0;
+
+ if (num_devices)
+ extra = (((2 * num_devices) + 3) / 4) * 4;
+
+ LockDisplay (dpy);
+ GetReqExtra (XFixesCreatePointerBarrier, extra, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesCreatePointerBarrier;
+ barrier = req->barrier = XAllocID (dpy);
+ req->window = w;
+ req->x1 = x1;
+ req->y1 = y1;
+ req->x2 = x2;
+ req->y2 = y2;
+ req->directions = directions;
+ if ((req->num_devices = num_devices)) {
+ int i;
+ CARD16 *devs = (CARD16 *)(req + 1);
+ for (i = 0; i < num_devices; i++)
+ devs[i] = (CARD16)(devices[i]);
+ }
+
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return barrier;
+}
+
+void
+XFixesDestroyPointerBarrier(Display *dpy, PointerBarrier b)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesDestroyPointerBarrierReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ if (info->major_version < 5)
+ return;
+
+ LockDisplay (dpy);
+ GetReq (XFixesDestroyPointerBarrier, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesDestroyPointerBarrier;
+ req->barrier = b;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
diff --git a/libXfixes/src/Makefile.am b/libXfixes/src/Makefile.am
new file mode 100644
index 000000000..544230fe0
--- /dev/null
+++ b/libXfixes/src/Makefile.am
@@ -0,0 +1,20 @@
+lib_LTLIBRARIES = libXfixes.la
+
+libXfixes_la_SOURCES = \
+ Cursor.c \
+ Region.c \
+ SaveSet.c \
+ Selection.c \
+ Xfixes.c \
+ Xfixesint.h
+
+libXfixes_la_LIBADD = @FIXESEXT_LIBS@
+AM_CFLAGS = $(CWARNFLAGS) @FIXESEXT_CFLAGS@
+
+INCLUDES = -I$(top_srcdir)/include/X11/extensions
+
+libXfixes_la_LDFLAGS = -version-number 3:1:0 -no-undefined
+
+libXfixesincludedir = $(includedir)/X11/extensions
+libXfixesinclude_HEADERS = $(top_srcdir)/include/X11/extensions/Xfixes.h
+
diff --git a/libXfixes/src/Makefile.in b/libXfixes/src/Makefile.in
new file mode 100644
index 000000000..904f02350
--- /dev/null
+++ b/libXfixes/src/Makefile.in
@@ -0,0 +1,602 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src
+DIST_COMMON = $(libXfixesinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(libdir)" \
+ "$(DESTDIR)$(libXfixesincludedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libXfixes_la_DEPENDENCIES =
+am_libXfixes_la_OBJECTS = Cursor.lo Region.lo SaveSet.lo Selection.lo \
+ Xfixes.lo
+libXfixes_la_OBJECTS = $(am_libXfixes_la_OBJECTS)
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+libXfixes_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libXfixes_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(libXfixes_la_SOURCES)
+DIST_SOURCES = $(libXfixes_la_SOURCES)
+HEADERS = $(libXfixesinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FIXESEXT_CFLAGS = @FIXESEXT_CFLAGS@
+FIXESEXT_LIBS = @FIXESEXT_LIBS@
+FIXESEXT_VERSION = @FIXESEXT_VERSION@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_CMD = @INSTALL_CMD@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN_SUBSTS = @MAN_SUBSTS@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XORG_MAN_PAGE = @XORG_MAN_PAGE@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+lib_LTLIBRARIES = libXfixes.la
+libXfixes_la_SOURCES = \
+ Cursor.c \
+ Region.c \
+ SaveSet.c \
+ Selection.c \
+ Xfixes.c \
+ Xfixesint.h
+
+libXfixes_la_LIBADD = @FIXESEXT_LIBS@
+AM_CFLAGS = $(CWARNFLAGS) @FIXESEXT_CFLAGS@
+INCLUDES = -I$(top_srcdir)/include/X11/extensions
+libXfixes_la_LDFLAGS = -version-number 3:1:0 -no-undefined
+libXfixesincludedir = $(includedir)/X11/extensions
+libXfixesinclude_HEADERS = $(top_srcdir)/include/X11/extensions/Xfixes.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libXfixes.la: $(libXfixes_la_OBJECTS) $(libXfixes_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libXfixes_la_LINK) -rpath $(libdir) $(libXfixes_la_OBJECTS) $(libXfixes_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cursor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Region.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SaveSet.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Selection.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xfixes.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-libXfixesincludeHEADERS: $(libXfixesinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(libXfixesincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libXfixesincludedir)"
+ @list='$(libXfixesinclude_HEADERS)'; test -n "$(libXfixesincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libXfixesincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(libXfixesincludedir)" || exit $$?; \
+ done
+
+uninstall-libXfixesincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libXfixesinclude_HEADERS)'; test -n "$(libXfixesincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(libXfixesincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libXfixesincludedir)" && rm -f $$files
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libXfixesincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libXfixesincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES \
+ uninstall-libXfixesincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-libXfixesincludeHEADERS \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-libLTLIBRARIES \
+ uninstall-libXfixesincludeHEADERS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libXfixes/src/Region.c b/libXfixes/src/Region.c
new file mode 100644
index 000000000..842da06bc
--- /dev/null
+++ b/libXfixes/src/Region.c
@@ -0,0 +1,444 @@
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "Xfixesint.h"
+
+XserverRegion
+XFixesCreateRegion (Display *dpy, XRectangle *rectangles, int nrectangles)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesCreateRegionReq *req;
+ long len;
+ XserverRegion region;
+
+ XFixesCheckExtension (dpy, info, 0);
+ LockDisplay (dpy);
+ GetReq (XFixesCreateRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesCreateRegion;
+ region = req->region = XAllocID (dpy);
+ len = ((long) nrectangles) << 1;
+ SetReqLen (req, len, len);
+ len <<= 2;
+ Data16 (dpy, (short *) rectangles, len);
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return region;
+}
+
+XserverRegion
+XFixesCreateRegionFromBitmap (Display *dpy, Pixmap bitmap)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesCreateRegionFromBitmapReq *req;
+ XserverRegion region;
+
+ XFixesCheckExtension (dpy, info, 0);
+ LockDisplay (dpy);
+ GetReq (XFixesCreateRegionFromBitmap, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesCreateRegionFromBitmap;
+ region = req->region = XAllocID (dpy);
+ req->bitmap = bitmap;
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return region;
+}
+
+XserverRegion
+XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesCreateRegionFromWindowReq *req;
+ XserverRegion region;
+
+ XFixesCheckExtension (dpy, info, 0);
+ LockDisplay (dpy);
+ GetReq (XFixesCreateRegionFromWindow, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesCreateRegionFromWindow;
+ region = req->region = XAllocID (dpy);
+ req->window = window;
+ req->kind = kind;
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return region;
+}
+
+XserverRegion
+XFixesCreateRegionFromGC (Display *dpy, GC gc)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesCreateRegionFromGCReq *req;
+ XserverRegion region;
+
+ XFixesCheckExtension (dpy, info, 0);
+ LockDisplay (dpy);
+ GetReq (XFixesCreateRegionFromGC, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesCreateRegionFromGC;
+ region = req->region = XAllocID (dpy);
+ req->gc = gc->gid;
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return region;
+}
+
+XserverRegion
+XFixesCreateRegionFromPicture (Display *dpy, XID picture)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesCreateRegionFromPictureReq *req;
+ XserverRegion region;
+
+ XFixesCheckExtension (dpy, info, 0);
+ LockDisplay (dpy);
+ GetReq (XFixesCreateRegionFromPicture, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesCreateRegionFromPicture;
+ region = req->region = XAllocID (dpy);
+ req->picture = picture;
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return region;
+}
+
+void
+XFixesDestroyRegion (Display *dpy, XserverRegion region)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesDestroyRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesDestroyRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesDestroyRegion;
+ req->region = region;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesSetRegion (Display *dpy, XserverRegion region,
+ XRectangle *rectangles, int nrectangles)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesSetRegionReq *req;
+ long len;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesSetRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesSetRegion;
+ req->region = region;
+ len = ((long) nrectangles) << 1;
+ SetReqLen (req, len, len);
+ len <<= 2;
+ Data16 (dpy, (short *) rectangles, len);
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesCopyRegion (Display *dpy, XserverRegion dst, XserverRegion src)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesCopyRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesCopyRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesCopyRegion;
+ req->source = src;
+ req->destination = dst;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesUnionRegion (Display *dpy, XserverRegion dst,
+ XserverRegion src1, XserverRegion src2)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesUnionRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesUnionRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesUnionRegion;
+ req->source1 = src1;
+ req->source2 = src2;
+ req->destination = dst;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesIntersectRegion (Display *dpy, XserverRegion dst,
+ XserverRegion src1, XserverRegion src2)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesIntersectRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesIntersectRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesIntersectRegion;
+ req->source1 = src1;
+ req->source2 = src2;
+ req->destination = dst;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesSubtractRegion (Display *dpy, XserverRegion dst,
+ XserverRegion src1, XserverRegion src2)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesSubtractRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesSubtractRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesSubtractRegion;
+ req->source1 = src1;
+ req->source2 = src2;
+ req->destination = dst;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesInvertRegion (Display *dpy, XserverRegion dst,
+ XRectangle *rect, XserverRegion src)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesInvertRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesInvertRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesInvertRegion;
+ req->x = rect->x;
+ req->y = rect->y;
+ req->width = rect->width;
+ req->height = rect->height;
+ req->source = src;
+ req->destination = dst;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesTranslateRegion (Display *dpy, XserverRegion region, int dx, int dy)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesTranslateRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesTranslateRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesTranslateRegion;
+ req->region = region;
+ req->dx = dx;
+ req->dy = dy;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesRegionExtents (Display *dpy, XserverRegion dst, XserverRegion src)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesRegionExtentsReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesRegionExtents, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesRegionExtents;
+ req->source = src;
+ req->destination = dst;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+XRectangle *
+XFixesFetchRegion (Display *dpy, XserverRegion region, int *nrectanglesRet)
+{
+ XRectangle bounds;
+
+ return XFixesFetchRegionAndBounds (dpy, region, nrectanglesRet, &bounds);
+}
+
+XRectangle *
+XFixesFetchRegionAndBounds (Display *dpy,
+ XserverRegion region,
+ int *nrectanglesRet,
+ XRectangle *bounds)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesFetchRegionReq *req;
+ xXFixesFetchRegionReply rep;
+ XRectangle *rects;
+ int nrects;
+ long nbytes;
+ long nread;
+
+ XFixesCheckExtension (dpy, info, NULL);
+ LockDisplay (dpy);
+ GetReq (XFixesFetchRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesFetchRegion;
+ req->region = region;
+ *nrectanglesRet = 0;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+ {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+ bounds->x = rep.x;
+ bounds->y = rep.y;
+ bounds->width = rep.width;
+ bounds->height = rep.height;
+ nbytes = (long) rep.length << 2;
+ nrects = rep.length >> 1;
+ nread = nrects << 3;
+ rects = Xmalloc (nrects * sizeof (XRectangle));
+ if (!rects)
+ {
+ _XEatData (dpy, nbytes);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+ _XRead16 (dpy, (short *) rects, nrects << 3);
+ /* skip any padding */
+ if(nbytes > nread)
+ {
+ _XEatData (dpy, (unsigned long) (nbytes - nread));
+ }
+ UnlockDisplay (dpy);
+ SyncHandle();
+ *nrectanglesRet = nrects;
+ return rects;
+}
+
+void
+XFixesSetGCClipRegion (Display *dpy, GC gc,
+ int clip_x_origin, int clip_y_origin,
+ XserverRegion region)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesSetGCClipRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesSetGCClipRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesSetGCClipRegion;
+ req->gc = gc->gid;
+ req->region = region;
+ req->xOrigin = clip_x_origin;
+ req->yOrigin = clip_y_origin;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesSetWindowShapeRegion (Display *dpy, Window win, int shape_kind,
+ int x_off, int y_off, XserverRegion region)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesSetWindowShapeRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesSetWindowShapeRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesSetWindowShapeRegion;
+ req->dest = win;
+ req->destKind = shape_kind;
+ req->xOff = x_off;
+ req->yOff = y_off;
+ req->region = region;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesSetPictureClipRegion (Display *dpy, XID picture,
+ int clip_x_origin, int clip_y_origin,
+ XserverRegion region)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesSetPictureClipRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesSetPictureClipRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesSetPictureClipRegion;
+ req->picture = picture;
+ req->region = region;
+ req->xOrigin = clip_x_origin;
+ req->yOrigin = clip_y_origin;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+void
+XFixesExpandRegion (Display *dpy, XserverRegion dst, XserverRegion src,
+ unsigned left, unsigned right,
+ unsigned top, unsigned bottom)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesExpandRegionReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+ LockDisplay (dpy);
+ GetReq (XFixesExpandRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesExpandRegion;
+ req->source = src;
+ req->destination = dst;
+ req->left = left;
+ req->right = right;
+ req->top = top;
+ req->bottom = bottom;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
diff --git a/libXfixes/src/SaveSet.c b/libXfixes/src/SaveSet.c
new file mode 100644
index 000000000..c57ae7321
--- /dev/null
+++ b/libXfixes/src/SaveSet.c
@@ -0,0 +1,47 @@
+/*
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "Xfixesint.h"
+
+void
+XFixesChangeSaveSet (Display *dpy, Window win, int mode, int target, int map)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesChangeSaveSetReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ GetReq (XFixesChangeSaveSet, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesChangeSaveSet;
+ req->mode = mode;
+ req->target = target;
+ req->map = map;
+ req->window = win;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+}
diff --git a/libXfixes/src/Selection.c b/libXfixes/src/Selection.c
new file mode 100644
index 000000000..708d58350
--- /dev/null
+++ b/libXfixes/src/Selection.c
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "Xfixesint.h"
+
+void
+XFixesSelectSelectionInput (Display *dpy,
+ Window win,
+ Atom selection,
+ unsigned long eventMask)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesSelectSelectionInputReq *req;
+
+ XFixesSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ GetReq (XFixesSelectSelectionInput, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesSelectSelectionInput;
+ req->window = win;
+ req->selection = selection;
+ req->eventMask = eventMask;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+}
diff --git a/libXfixes/src/Xfixes.c b/libXfixes/src/Xfixes.c
new file mode 100644
index 000000000..7d3af84df
--- /dev/null
+++ b/libXfixes/src/Xfixes.c
@@ -0,0 +1,334 @@
+/*
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "Xfixesint.h"
+
+XFixesExtInfo XFixesExtensionInfo;
+char XFixesExtensionName[] = XFIXES_NAME;
+
+static int
+XFixesCloseDisplay (Display *dpy, XExtCodes *codes);
+
+static Bool
+XFixesWireToEvent(Display *dpy, XEvent *event, xEvent *wire);
+
+static Status
+XFixesEventToWire(Display *dpy, XEvent *event, xEvent *wire);
+
+/*
+ * XFixesExtAddDisplay - add a display to this extension. (Replaces
+ * XextAddDisplay)
+ */
+static XFixesExtDisplayInfo *
+XFixesExtAddDisplay (XFixesExtInfo *extinfo,
+ Display *dpy,
+ char *ext_name)
+{
+ XFixesExtDisplayInfo *info;
+ int ev;
+
+ 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 ();
+ Xfree(info);
+ return NULL;
+ }
+ info->major_version = rep.majorVersion;
+ info->minor_version = rep.minorVersion;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ } 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);
+ }
+
+ /*
+ * 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 XFixesExtRemoveDisplay (&XFixesExtensionInfo, dpy);
+}
+
+static Bool
+XFixesWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay(dpy);
+
+ XFixesCheckExtension(dpy, info, False);
+
+ switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
+ {
+ case XFixesSelectionNotify: {
+ XFixesSelectionNotifyEvent *aevent;
+ xXFixesSelectionNotifyEvent *awire;
+ awire = (xXFixesSelectionNotifyEvent *) wire;
+ aevent = (XFixesSelectionNotifyEvent *) event;
+ aevent->type = awire->type & 0x7F;
+ aevent->subtype = awire->subtype;
+ aevent->serial = _XSetLastRequestRead(dpy,
+ (xGenericReply *) wire);
+ aevent->send_event = (awire->type & 0x80) != 0;
+ aevent->display = dpy;
+ aevent->window = awire->window;
+ aevent->owner = awire->owner;
+ aevent->selection = awire->selection;
+ aevent->timestamp = awire->timestamp;
+ aevent->selection_timestamp = awire->selectionTimestamp;
+ return True;
+ }
+ case XFixesCursorNotify: {
+ XFixesCursorNotifyEvent *aevent;
+ xXFixesCursorNotifyEvent *awire;
+ awire = (xXFixesCursorNotifyEvent *) wire;
+ aevent = (XFixesCursorNotifyEvent *) event;
+ aevent->type = awire->type & 0x7F;
+ aevent->subtype = awire->subtype;
+ aevent->serial = _XSetLastRequestRead(dpy,
+ (xGenericReply *) wire);
+ aevent->send_event = (awire->type & 0x80) != 0;
+ aevent->display = dpy;
+ aevent->window = awire->window;
+ aevent->cursor_serial = awire->cursorSerial;
+ aevent->timestamp = awire->timestamp;
+ aevent->cursor_name = awire->name;
+ return True;
+ }
+ }
+ return False;
+}
+
+static Status
+XFixesEventToWire(Display *dpy, XEvent *event, xEvent *wire)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay(dpy);
+
+ XFixesCheckExtension(dpy, info, False);
+
+ switch ((event->type & 0x7F) - info->codes->first_event)
+ {
+ case XFixesSelectionNotify: {
+ XFixesSelectionNotifyEvent *aevent;
+ xXFixesSelectionNotifyEvent *awire;
+ awire = (xXFixesSelectionNotifyEvent *) wire;
+ aevent = (XFixesSelectionNotifyEvent *) event;
+ awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
+ awire->subtype = aevent->subtype;
+ awire->window = aevent->window;
+ awire->owner = aevent->owner;
+ awire->selection = aevent->selection;
+ awire->timestamp = aevent->timestamp;
+ awire->selectionTimestamp = aevent->selection_timestamp;
+ return True;
+ }
+ case XFixesCursorNotify: {
+ XFixesCursorNotifyEvent *aevent;
+ xXFixesCursorNotifyEvent *awire;
+ awire = (xXFixesCursorNotifyEvent *) wire;
+ aevent = (XFixesCursorNotifyEvent *) event;
+ awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
+ awire->subtype = aevent->subtype;
+ awire->window = aevent->window;
+ awire->timestamp = aevent->timestamp;
+ awire->cursorSerial = aevent->cursor_serial;
+ awire->name = aevent->cursor_name;
+ }
+ }
+ return False;
+}
+
+Bool
+XFixesQueryExtension (Display *dpy,
+ int *event_base_return,
+ int *error_base_return)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+
+ if (XFixesHasExtension(info))
+ {
+ *event_base_return = info->codes->first_event;
+ *error_base_return = info->codes->first_error;
+ return True;
+ }
+ else
+ return False;
+}
+
+Status
+XFixesQueryVersion (Display *dpy,
+ int *major_version_return,
+ int *minor_version_return)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+
+ XFixesCheckExtension (dpy, info, 0);
+
+ *major_version_return = info->major_version;
+ *minor_version_return = info->minor_version;
+ return 1;
+}
+
+int
+XFixesVersion (void)
+{
+ return XFIXES_VERSION;
+}
diff --git a/libXfixes/src/Xfixesint.h b/libXfixes/src/Xfixesint.h
new file mode 100644
index 000000000..efea799f2
--- /dev/null
+++ b/libXfixes/src/Xfixesint.h
@@ -0,0 +1,65 @@
+/*
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFIXESINT_H_
+#define _XFIXESINT_H_
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/xfixesproto.h>
+
+extern char 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;
+
+/* replaces XExtensionInfo */
+typedef struct _XFixesExtInfo {
+ XFixesExtDisplayInfo *head; /* start of the list */
+ XFixesExtDisplayInfo *cur; /* most recently used */
+ int ndisplays; /* number of displays */
+} XFixesExtInfo;
+
+extern XFixesExtInfo XFixesExtensionInfo;
+extern char XFixesExtensionName[];
+
+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_ */
diff --git a/libXfixes/src/makefile b/libXfixes/src/makefile
new file mode 100755
index 000000000..26876467f
--- /dev/null
+++ b/libXfixes/src/makefile
@@ -0,0 +1,10 @@
+LIBRARY = libXfixes
+
+CSRCS = \
+ Cursor.c \
+ Region.c \
+ SaveSet.c \
+ Selection.c \
+ Xfixes.c
+
+