aboutsummaryrefslogtreecommitdiff
path: root/libXext
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-12 11:27:51 +0200
committermarha <marha@users.sourceforge.net>2011-09-12 11:27:51 +0200
commitdafebc5bb70303f0b5baf0b087cf4d9a64b5c7f0 (patch)
treebdf833cc6a4fc9035411779e10dd9e8478201885 /libXext
parent0b40f5f4b54453a77f4b09c431f8efc6875da61f (diff)
downloadvcxsrv-dafebc5bb70303f0b5baf0b087cf4d9a64b5c7f0.tar.gz
vcxsrv-dafebc5bb70303f0b5baf0b087cf4d9a64b5c7f0.tar.bz2
vcxsrv-dafebc5bb70303f0b5baf0b087cf4d9a64b5c7f0.zip
Synchronised line endinge with release branch
Diffstat (limited to 'libXext')
-rw-r--r--libXext/configure.ac102
-rw-r--r--libXext/docbook.am194
-rw-r--r--libXext/include/X11/extensions/XShm.h270
-rw-r--r--libXext/include/X11/extensions/xtestext1.h196
-rw-r--r--libXext/man/XShm.man396
-rw-r--r--libXext/specs/Makefile.am26
-rw-r--r--libXext/src/XShm.c862
-rw-r--r--libXext/src/Xge.c730
8 files changed, 1388 insertions, 1388 deletions
diff --git a/libXext/configure.ac b/libXext/configure.ac
index 60b198e80..6e6cc8b13 100644
--- a/libXext/configure.ac
+++ b/libXext/configure.ac
@@ -1,51 +1,51 @@
-
-# Initialize Autoconf
-AC_PREREQ([2.60])
-AC_INIT([libXext], [1.3.0],
- [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXext])
-AC_CONFIG_SRCDIR([Makefile.am])
-AC_CONFIG_HEADERS([config.h])
-
-# Initialize Automake
-AM_INIT_AUTOMAKE([foreign dist-bzip2])
-AM_MAINTAINER_MODE
-
-# Initialize libtool
-AC_PROG_LIBTOOL
-
-# Require xorg-macros minimum of 1.12 for DocBook external references
-m4_ifndef([XORG_MACROS_VERSION],
- [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.12)
-XORG_DEFAULT_OPTIONS
-XORG_ENABLE_SPECS
-XORG_WITH_XMLTO(0.0.22)
-XORG_WITH_FOP
-XORG_WITH_XSLTPROC
-XORG_CHECK_SGML_DOCTOOLS(1.8)
-XORG_CHECK_MALLOC_ZERO
-
-# Determine .so library version per platform
-# based on SharedXextRev in monolith xc/config/cf/*Lib.tmpl
-if test "x$XEXT_SOREV" = "x" ; then
- case $host_os in
- openbsd*) XEXT_SOREV=8:0 ;;
- solaris*) XEXT_SOREV=0 ;;
- *) XEXT_SOREV=6:4:0 ;;
- esac
-fi
-AC_SUBST(XEXT_SOREV)
-
-# Obtain compiler/linker options for depedencies
-PKG_CHECK_MODULES(XEXT, [xproto >= 7.0.13] [x11 >= 1.1.99.1] [xextproto >= 7.1.99])
-
-# Allow checking code with lint, sparse, etc.
-XORG_WITH_LINT
-XORG_LINT_LIBRARY([Xext])
-
-AC_CONFIG_FILES([Makefile
- man/Makefile
- src/Makefile
- specs/Makefile
- xext.pc])
-AC_OUTPUT
+
+# Initialize Autoconf
+AC_PREREQ([2.60])
+AC_INIT([libXext], [1.3.0],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXext])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([config.h])
+
+# Initialize Automake
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+# Initialize libtool
+AC_PROG_LIBTOOL
+
+# Require xorg-macros minimum of 1.12 for DocBook external references
+m4_ifndef([XORG_MACROS_VERSION],
+ [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.12)
+XORG_DEFAULT_OPTIONS
+XORG_ENABLE_SPECS
+XORG_WITH_XMLTO(0.0.22)
+XORG_WITH_FOP
+XORG_WITH_XSLTPROC
+XORG_CHECK_SGML_DOCTOOLS(1.8)
+XORG_CHECK_MALLOC_ZERO
+
+# Determine .so library version per platform
+# based on SharedXextRev in monolith xc/config/cf/*Lib.tmpl
+if test "x$XEXT_SOREV" = "x" ; then
+ case $host_os in
+ openbsd*) XEXT_SOREV=8:0 ;;
+ solaris*) XEXT_SOREV=0 ;;
+ *) XEXT_SOREV=6:4:0 ;;
+ esac
+fi
+AC_SUBST(XEXT_SOREV)
+
+# Obtain compiler/linker options for depedencies
+PKG_CHECK_MODULES(XEXT, [xproto >= 7.0.13] [x11 >= 1.1.99.1] [xextproto >= 7.1.99])
+
+# Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xext])
+
+AC_CONFIG_FILES([Makefile
+ man/Makefile
+ src/Makefile
+ specs/Makefile
+ xext.pc])
+AC_OUTPUT
diff --git a/libXext/docbook.am b/libXext/docbook.am
index e94e975f6..2ffb7e60a 100644
--- a/libXext/docbook.am
+++ b/libXext/docbook.am
@@ -1,97 +1,97 @@
-#
-# Generate output formats for a single DocBook/XML with/without chapters
-#
-# Variables set by the calling Makefile:
-# shelfdir: the location where the docs/specs are installed. Typically $(docdir)
-# docbook: the main DocBook/XML file, no chapters, appendix or image files
-# chapters: all files pulled in by an XInclude statement and images.
-#
-
-#
-# This makefile is intended for Users Documentation and Functional Specifications.
-# Do not use for Developer Documentation which is not installed and does not require olink.
-# Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393
-# for an explanation on documents classification.
-#
-
-# DocBook/XML generated output formats to be installed
-shelf_DATA =
-
-# DocBook/XML file with chapters, appendix and images it includes
-dist_shelf_DATA = $(docbook) $(chapters)
-
-if HAVE_XMLTO
-#
-# Generate DocBook/XML output formats with or without stylesheets
-#
-
-# Stylesheets are available if the package xorg-sgml-doctools is installed
-if HAVE_STYLESHEETS
-
-# The location where all cross reference databases are installed
-sgmldbsdir = $(XORG_SGML_PATH)/X11/dbs
-masterdb = "$(sgmldbsdir)/masterdb$(suffix $@).xml"
-XMLTO_FLAGS = \
- --searchpath "$(XORG_SGML_PATH)/X11" \
- --stringparam target.database.document=$(masterdb) \
- --stringparam current.docid="$(<:.xml=)" \
- --stringparam collect.xref.targets="no"
-
-XMLTO_XHTML_FLAGS = \
- -x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl \
- --stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
-
-XMLTO_FO_FLAGS = \
- -x $(STYLESHEET_SRCDIR)/xorg-fo.xsl
-endif HAVE_STYLESHEETS
-
-shelf_DATA += $(docbook:.xml=.html)
-%.html: %.xml $(chapters)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_XHTML_FLAGS) xhtml-nochunks $<
-
-if HAVE_FOP
-shelf_DATA += $(docbook:.xml=.pdf) $(docbook:.xml=.ps)
-%.pdf: %.xml $(chapters)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_FO_FLAGS) --with-fop pdf $<
-%.ps: %.xml $(chapters)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_FO_FLAGS) --with-fop ps $<
-endif HAVE_FOP
-
-if HAVE_XMLTO_TEXT
-shelf_DATA += $(docbook:.xml=.txt)
-%.txt: %.xml $(chapters)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_XHTML_FLAGS) txt $<
-endif HAVE_XMLTO_TEXT
-
-#
-# Generate documents cross-reference target databases
-#
-
-# This is only possible if the xorg-sgml-doctools package is installed
-if HAVE_STYLESHEETS
-if HAVE_XSLTPROC
-
-# DocBook/XML generated document cross-reference database
-shelf_DATA += $(docbook:.xml=.html.db) $(docbook:.xml=.fo.db)
-
-# Generate DocBook/XML document cross-reference database
-# Flags for the XSL Transformation processor generating xref target databases
-XSLTPROC_FLAGS = \
- --path "$(XORG_SGML_PATH)/X11" \
- --stringparam targets.filename "$@" \
- --stringparam collect.xref.targets "only" \
- --nonet --xinclude
-
-%.html.db: %.xml $(chapters)
- $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
- http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $<
-
-%.fo.db: %.xml $(chapters)
- $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
- http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $<
-
-endif HAVE_XSLTPROC
-endif HAVE_STYLESHEETS
-endif HAVE_XMLTO
-
-CLEANFILES = $(shelf_DATA)
+#
+# Generate output formats for a single DocBook/XML with/without chapters
+#
+# Variables set by the calling Makefile:
+# shelfdir: the location where the docs/specs are installed. Typically $(docdir)
+# docbook: the main DocBook/XML file, no chapters, appendix or image files
+# chapters: all files pulled in by an XInclude statement and images.
+#
+
+#
+# This makefile is intended for Users Documentation and Functional Specifications.
+# Do not use for Developer Documentation which is not installed and does not require olink.
+# Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393
+# for an explanation on documents classification.
+#
+
+# DocBook/XML generated output formats to be installed
+shelf_DATA =
+
+# DocBook/XML file with chapters, appendix and images it includes
+dist_shelf_DATA = $(docbook) $(chapters)
+
+if HAVE_XMLTO
+#
+# Generate DocBook/XML output formats with or without stylesheets
+#
+
+# Stylesheets are available if the package xorg-sgml-doctools is installed
+if HAVE_STYLESHEETS
+
+# The location where all cross reference databases are installed
+sgmldbsdir = $(XORG_SGML_PATH)/X11/dbs
+masterdb = "$(sgmldbsdir)/masterdb$(suffix $@).xml"
+XMLTO_FLAGS = \
+ --searchpath "$(XORG_SGML_PATH)/X11" \
+ --stringparam target.database.document=$(masterdb) \
+ --stringparam current.docid="$(<:.xml=)" \
+ --stringparam collect.xref.targets="no"
+
+XMLTO_XHTML_FLAGS = \
+ -x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl \
+ --stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
+
+XMLTO_FO_FLAGS = \
+ -x $(STYLESHEET_SRCDIR)/xorg-fo.xsl
+endif HAVE_STYLESHEETS
+
+shelf_DATA += $(docbook:.xml=.html)
+%.html: %.xml $(chapters)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_XHTML_FLAGS) xhtml-nochunks $<
+
+if HAVE_FOP
+shelf_DATA += $(docbook:.xml=.pdf) $(docbook:.xml=.ps)
+%.pdf: %.xml $(chapters)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_FO_FLAGS) --with-fop pdf $<
+%.ps: %.xml $(chapters)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_FO_FLAGS) --with-fop ps $<
+endif HAVE_FOP
+
+if HAVE_XMLTO_TEXT
+shelf_DATA += $(docbook:.xml=.txt)
+%.txt: %.xml $(chapters)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_XHTML_FLAGS) txt $<
+endif HAVE_XMLTO_TEXT
+
+#
+# Generate documents cross-reference target databases
+#
+
+# This is only possible if the xorg-sgml-doctools package is installed
+if HAVE_STYLESHEETS
+if HAVE_XSLTPROC
+
+# DocBook/XML generated document cross-reference database
+shelf_DATA += $(docbook:.xml=.html.db) $(docbook:.xml=.fo.db)
+
+# Generate DocBook/XML document cross-reference database
+# Flags for the XSL Transformation processor generating xref target databases
+XSLTPROC_FLAGS = \
+ --path "$(XORG_SGML_PATH)/X11" \
+ --stringparam targets.filename "$@" \
+ --stringparam collect.xref.targets "only" \
+ --nonet --xinclude
+
+%.html.db: %.xml $(chapters)
+ $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+ http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $<
+
+%.fo.db: %.xml $(chapters)
+ $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+ http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $<
+
+endif HAVE_XSLTPROC
+endif HAVE_STYLESHEETS
+endif HAVE_XMLTO
+
+CLEANFILES = $(shelf_DATA)
diff --git a/libXext/include/X11/extensions/XShm.h b/libXext/include/X11/extensions/XShm.h
index 824ab3206..23f065115 100644
--- a/libXext/include/X11/extensions/XShm.h
+++ b/libXext/include/X11/extensions/XShm.h
@@ -1,135 +1,135 @@
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-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.
-
-The above copyright notice and this permission notice 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
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
-
-#ifndef _XSHM_H_
-#define _XSHM_H_
-
-#include <X11/Xfuncproto.h>
-#include <X11/extensions/shm.h>
-
-#ifndef _XSHM_SERVER_
-typedef unsigned long ShmSeg;
-
-typedef struct {
- int type; /* of event */
- unsigned long serial; /* # of last request processed by server */
- Bool send_event; /* true if this came frome a SendEvent request */
- Display *display; /* Display the event was read from */
- Drawable drawable; /* drawable of request */
- int major_code; /* ShmReqCode */
- int minor_code; /* X_ShmPutImage */
- ShmSeg shmseg; /* the ShmSeg used in the request */
- unsigned long offset; /* the offset into ShmSeg used in the request */
-} XShmCompletionEvent;
-
-typedef struct {
- ShmSeg shmseg; /* resource id */
- int shmid; /* kernel id */
- char *shmaddr; /* address in client */
- Bool readOnly; /* how the server should attach it */
-} XShmSegmentInfo;
-
-_XFUNCPROTOBEGIN
-
-Bool XShmQueryExtension(
- Display* /* dpy */
-);
-
-int XShmGetEventBase(
- Display* /* dpy */
-);
-
-Bool XShmQueryVersion(
- Display* /* dpy */,
- int* /* majorVersion */,
- int* /* minorVersion */,
- Bool* /* sharedPixmaps */
-);
-
-int XShmPixmapFormat(
- Display* /* dpy */
-);
-
-Bool XShmAttach(
- Display* /* dpy */,
- XShmSegmentInfo* /* shminfo */
-);
-
-Bool XShmDetach(
- Display* /* dpy */,
- XShmSegmentInfo* /* shminfo */
-);
-
-Bool XShmPutImage(
- Display* /* dpy */,
- Drawable /* d */,
- GC /* gc */,
- XImage* /* image */,
- int /* src_x */,
- int /* src_y */,
- int /* dst_x */,
- int /* dst_y */,
- unsigned int /* src_width */,
- unsigned int /* src_height */,
- Bool /* send_event */
-);
-
-Bool XShmGetImage(
- Display* /* dpy */,
- Drawable /* d */,
- XImage* /* image */,
- int /* x */,
- int /* y */,
- unsigned long /* plane_mask */
-);
-
-XImage *XShmCreateImage(
- Display* /* dpy */,
- Visual* /* visual */,
- unsigned int /* depth */,
- int /* format */,
- char* /* data */,
- XShmSegmentInfo* /* shminfo */,
- unsigned int /* width */,
- unsigned int /* height */
-);
-
-Pixmap XShmCreatePixmap(
- Display* /* dpy */,
- Drawable /* d */,
- char* /* data */,
- XShmSegmentInfo* /* shminfo */,
- unsigned int /* width */,
- unsigned int /* height */,
- unsigned int /* depth */
-);
-
-_XFUNCPROTOEND
-#endif /* _XSHM_SERVER_ */
-
-#endif
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+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.
+
+The above copyright notice and this permission notice 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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _XSHM_H_
+#define _XSHM_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/shm.h>
+
+#ifndef _XSHM_SERVER_
+typedef unsigned long ShmSeg;
+
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came frome a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Drawable drawable; /* drawable of request */
+ int major_code; /* ShmReqCode */
+ int minor_code; /* X_ShmPutImage */
+ ShmSeg shmseg; /* the ShmSeg used in the request */
+ unsigned long offset; /* the offset into ShmSeg used in the request */
+} XShmCompletionEvent;
+
+typedef struct {
+ ShmSeg shmseg; /* resource id */
+ int shmid; /* kernel id */
+ char *shmaddr; /* address in client */
+ Bool readOnly; /* how the server should attach it */
+} XShmSegmentInfo;
+
+_XFUNCPROTOBEGIN
+
+Bool XShmQueryExtension(
+ Display* /* dpy */
+);
+
+int XShmGetEventBase(
+ Display* /* dpy */
+);
+
+Bool XShmQueryVersion(
+ Display* /* dpy */,
+ int* /* majorVersion */,
+ int* /* minorVersion */,
+ Bool* /* sharedPixmaps */
+);
+
+int XShmPixmapFormat(
+ Display* /* dpy */
+);
+
+Bool XShmAttach(
+ Display* /* dpy */,
+ XShmSegmentInfo* /* shminfo */
+);
+
+Bool XShmDetach(
+ Display* /* dpy */,
+ XShmSegmentInfo* /* shminfo */
+);
+
+Bool XShmPutImage(
+ Display* /* dpy */,
+ Drawable /* d */,
+ GC /* gc */,
+ XImage* /* image */,
+ int /* src_x */,
+ int /* src_y */,
+ int /* dst_x */,
+ int /* dst_y */,
+ unsigned int /* src_width */,
+ unsigned int /* src_height */,
+ Bool /* send_event */
+);
+
+Bool XShmGetImage(
+ Display* /* dpy */,
+ Drawable /* d */,
+ XImage* /* image */,
+ int /* x */,
+ int /* y */,
+ unsigned long /* plane_mask */
+);
+
+XImage *XShmCreateImage(
+ Display* /* dpy */,
+ Visual* /* visual */,
+ unsigned int /* depth */,
+ int /* format */,
+ char* /* data */,
+ XShmSegmentInfo* /* shminfo */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+Pixmap XShmCreatePixmap(
+ Display* /* dpy */,
+ Drawable /* d */,
+ char* /* data */,
+ XShmSegmentInfo* /* shminfo */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int /* depth */
+);
+
+_XFUNCPROTOEND
+#endif /* _XSHM_SERVER_ */
+
+#endif
diff --git a/libXext/include/X11/extensions/xtestext1.h b/libXext/include/X11/extensions/xtestext1.h
index 9c2876315..59cdd151d 100644
--- a/libXext/include/X11/extensions/xtestext1.h
+++ b/libXext/include/X11/extensions/xtestext1.h
@@ -1,98 +1,98 @@
-/*
- * xtestext1.h
- *
- * X11 Input Synthesis Extension include file
- */
-
-/*
-
-
-Copyright 1986, 1987, 1988, 1998 The Open Group
-
-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.
-
-The above copyright notice and this permission notice 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
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, 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 Hewlett-Packard not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-Hewlett-Packard makes no representations about the
-suitability of this software for any purpose. It is provided
-"as is" without express or implied warranty.
-
-This software is not subject to any license of the American
-Telephone and Telegraph Company or of the Regents of the
-University of California.
-
-*/
-
-#ifndef _XTESTEXT1_H
-#define _XTESTEXT1_H
-/*
- * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
- */
-
-#include <X11/extensions/xtestext1const.h>
-/*
- * This is the definition for the input action host format event structure.
- * This is the form that a client using this extension will see when
- * it receives an input action event.
- */
-typedef struct {
- int type; /* always XTestInputActionType */
- Display *display;
- Window window;
- CARD8 actions[XTestACTIONS_SIZE];
-} XTestInputActionEvent;
-
-/*
- * This is the definition for the xTestFakeAck host format event structure.
- * This is the form that a client using this extension will see when
- * it receives an XTestFakeAck event.
- */
-typedef struct {
- int type; /* always XTestFakeAckType */
- Display *display;
- Window window;
-} XTestFakeAckEvent;
-
-_XFUNCPROTOBEGIN
-
-int XTestFakeInput(register Display *dpy, char *action_list_addr, int action_list_size, int ack_flag);
-int XTestGetInput(register Display *dpy, int action_handling);
-int XTestQueryInputSize(register Display *dpy, unsigned long *size_return);
-int XTestPressKey(Display *display, int device_id, unsigned long delay, unsigned int keycode, unsigned int key_action);
-int XTestPressButton(Display * display, int device_id, unsigned long delay, unsigned int button_number, unsigned int button_action);
-int XTestMovePointer(Display *display, int device_id, unsigned long delay[], int x[], int y[], unsigned int count);
-int XTestFlush(Display *display);
-int XTestStopInput(register Display *dpy);
-int XTestReset(register Display *dpy);
-
-_XFUNCPROTOEND
-
-#endif /* _XTESTEXT1_H */
+/*
+ * xtestext1.h
+ *
+ * X11 Input Synthesis Extension include file
+ */
+
+/*
+
+
+Copyright 1986, 1987, 1988, 1998 The Open Group
+
+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.
+
+The above copyright notice and this permission notice 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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, 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 Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the
+suitability of this software for any purpose. It is provided
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#ifndef _XTESTEXT1_H
+#define _XTESTEXT1_H
+/*
+ * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
+ */
+
+#include <X11/extensions/xtestext1const.h>
+/*
+ * This is the definition for the input action host format event structure.
+ * This is the form that a client using this extension will see when
+ * it receives an input action event.
+ */
+typedef struct {
+ int type; /* always XTestInputActionType */
+ Display *display;
+ Window window;
+ CARD8 actions[XTestACTIONS_SIZE];
+} XTestInputActionEvent;
+
+/*
+ * This is the definition for the xTestFakeAck host format event structure.
+ * This is the form that a client using this extension will see when
+ * it receives an XTestFakeAck event.
+ */
+typedef struct {
+ int type; /* always XTestFakeAckType */
+ Display *display;
+ Window window;
+} XTestFakeAckEvent;
+
+_XFUNCPROTOBEGIN
+
+int XTestFakeInput(register Display *dpy, char *action_list_addr, int action_list_size, int ack_flag);
+int XTestGetInput(register Display *dpy, int action_handling);
+int XTestQueryInputSize(register Display *dpy, unsigned long *size_return);
+int XTestPressKey(Display *display, int device_id, unsigned long delay, unsigned int keycode, unsigned int key_action);
+int XTestPressButton(Display * display, int device_id, unsigned long delay, unsigned int button_number, unsigned int button_action);
+int XTestMovePointer(Display *display, int device_id, unsigned long delay[], int x[], int y[], unsigned int count);
+int XTestFlush(Display *display);
+int XTestStopInput(register Display *dpy);
+int XTestReset(register Display *dpy);
+
+_XFUNCPROTOEND
+
+#endif /* _XTESTEXT1_H */
diff --git a/libXext/man/XShm.man b/libXext/man/XShm.man
index 87e34c3ca..06284f022 100644
--- a/libXext/man/XShm.man
+++ b/libXext/man/XShm.man
@@ -1,198 +1,198 @@
-.\" Copyright (c) 1991 X Consortium
-.\"
-.\" 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 furnished to do so, subject to the following conditions:
-.\"
-.\" The above copyright notice and this permission notice 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 X CONSORTIUM 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.
-.\"
-.\" Except as contained in this notice, the name of the X Consortium shall not
-.\" be used in advertising or otherwise to promote the sale, use or other
-.\" dealing in this Software without prior written authorization from the
-.\" X Consortium.
-.\"
-.\" Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" 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.
-.\"
-.\" X Window System is a trademark of The Open Group.
-.\"
-.de ZN
-.ie t \fB\^\\$1\^\fR\\$2
-.el \fI\^\\$1\^\fP\\$2
-..
-.TH XShm __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XShmQueryExtension, XShmQueryVersion, XShmPixmapFormat, XShmAttach, XShmDetach
-XShmCreateImage, XShmPutImage, XShmGetImage, XShmCreatePixmap, XShmGetEventBase - X Shared Memory extension functions
-.SH SYNTAX
-.nf
-.LP
-\&#include <X11/Xlib.h>
-\&#include <sys/ipc.h>
-\&#include <sys/shm.h>
-\&#include <X11/extensions/XShm.h>
-.LP
-Bool XShmQueryExtension(
- Display *display);
-.LP
-Bool XShmQueryVersion(
- Display *display;
- int *major, *minor;
- Bool *pixmaps);
-.LP
-int XShmPixmapFormat(
- Display *display);
-.LP
-Bool XShmAttach(
- Display *display;
- XShmSegmentInfo *shminfo);
-.LP
-Bool XShmDetach(
- Display *display;
- XShmSegmentInfo *shminfo);
-
-.LP
-XImage *XShmCreateImage (
- Display *display;
- Visual *visual;
- unsigned int depth;
- int format;
- char *data;
- XShmSegmentInfo *shminfo;
- unsigned int width, height);
-.LP
-Bool XShmPutImage(
- Display *display;
- Drawable d;
- GC gc;
- XImage *image;
- int src_x, src_y, dest_x, dest_y;
- unsigned int width, height;
- bool send_event);
-.LP
-Bool XShmGetImage (
- Display *display;
- Drawable d;
- XImage *image;
- int x, y;
- unsigned long plane_mask);
-.LP
-Pixmap XShmCreatePixmap(
- Display *display;
- Drawable d;
- char *data;
- XShmSegmentInfo *shminfo;
- unsigned int width, height, depth);
-.LP
-Status XShmGetEventBase(
- Display *display);
-.LP
-
-.fi
-.SH STRUCTURES
-.nf
-.ta 3i
-\fIEvents:\fP
-typedef struct {
- int type; /\&* of event */
- unsigned long serial; /\&* # of last request processed by server*/
- Bool send_event; /\&* true if this came from a SendEvent request*/
- Display *display; /\&* Display the event was read from */
- Drawable drawable; /\&* drawable of request */
- int major_code; /\&* ShmReqCode */
- int minor_code; /\&* X_ShmPutImage */
- ShmSeg shmseg; /\&* the ShmSeg used in the request*/
- unsigned long offset; /\&* the offset into ShmSeg used in the request*/
-} XShmCompletionEvent;
-.LP
-\fIa structure of type XShmSegmentInfo :\fP
-
-typedef struct {
- ShmSeg shmseg; /\&* resource id */
- int shmid; /\&* kernel id */
- char *shmaddr; /\&* address in client */
- Bool readOnly; /\&* how the server should attach it */
-} XShmSegmentInfo;
-
-.SH DESCRIPTION
-.PP
-.PP
-.ZN XShmQueryExtension
-checks to see if the shared memory extensions are available for the
-specified display.
-.PP
-.ZN XShmQueryVersion
-returns the version numbers of the extension implementation. Shared
-memory pixmaps are supported if the pixmaps argument returns true.
-.PP
-.ZN XShmAttach
-tells the server to attach to your shared memory segment. If all goes
-well, you will get a non-zero status, back and your XImage is ready
-for use.
-.PP
-.ZN XShmDetach
-tells the server to detach from your shared memory segment.
-.PP
-.ZN XShmPutImage
-combines an image in memory with a shape of the specified drawable. If
-XYBitmap format is used, the depth must be one, or a ``BadMatch''
-error results. The foreground pixel in the GC defines the source for
-the one bits in the image, and the background pixel defines the source
-for the zero bits. For XYPixmap and ZPixmap, the depth must match the
-depth of the drawable, or a ``BadMatch'' error results.
-.PP
-.ZN XShmGetImage
-reads image data into a shared memory XImage where display is the
-display of interest, drawable is the source drawable, image is the
-destination XImage, x and y are offsets within the drawable, and
-plane_mask defines which planes are to be read.
-.PP
-.ZN XShmCreateImage
-allocates the memory needed for an XImage structure for the specified
-display but does not allocate space for the image itself.
-.PP
-.ZN XShmPixmapFormat
-gets the format for the server. If your application can deal with the
-server pixmap data format, a shared memory segment and shminfo
-structure are created.
-.PP
-.ZN XShmCreatePixmap
-points to a pixmap which you can manipulate in all of the usual ways,
-with the added bonus of being able to edit its contents directly
-through the shared memory segment.
-.PP
-.ZN XShmGetEventBase
-gets the completion event value.
-.PP
-.SH SEE ALSO
-\fIMIT-SHM - The MIT Shared Memory Extension \fP
+.\" Copyright (c) 1991 X Consortium
+.\"
+.\" 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 furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice 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 X CONSORTIUM 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.
+.\"
+.\" Except as contained in this notice, the name of the X Consortium shall not
+.\" be used in advertising or otherwise to promote the sale, use or other
+.\" dealing in this Software without prior written authorization from the
+.\" X Consortium.
+.\"
+.\" Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\"
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XShm __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XShmQueryExtension, XShmQueryVersion, XShmPixmapFormat, XShmAttach, XShmDetach
+XShmCreateImage, XShmPutImage, XShmGetImage, XShmCreatePixmap, XShmGetEventBase - X Shared Memory extension functions
+.SH SYNTAX
+.nf
+.LP
+\&#include <X11/Xlib.h>
+\&#include <sys/ipc.h>
+\&#include <sys/shm.h>
+\&#include <X11/extensions/XShm.h>
+.LP
+Bool XShmQueryExtension(
+ Display *display);
+.LP
+Bool XShmQueryVersion(
+ Display *display;
+ int *major, *minor;
+ Bool *pixmaps);
+.LP
+int XShmPixmapFormat(
+ Display *display);
+.LP
+Bool XShmAttach(
+ Display *display;
+ XShmSegmentInfo *shminfo);
+.LP
+Bool XShmDetach(
+ Display *display;
+ XShmSegmentInfo *shminfo);
+
+.LP
+XImage *XShmCreateImage (
+ Display *display;
+ Visual *visual;
+ unsigned int depth;
+ int format;
+ char *data;
+ XShmSegmentInfo *shminfo;
+ unsigned int width, height);
+.LP
+Bool XShmPutImage(
+ Display *display;
+ Drawable d;
+ GC gc;
+ XImage *image;
+ int src_x, src_y, dest_x, dest_y;
+ unsigned int width, height;
+ bool send_event);
+.LP
+Bool XShmGetImage (
+ Display *display;
+ Drawable d;
+ XImage *image;
+ int x, y;
+ unsigned long plane_mask);
+.LP
+Pixmap XShmCreatePixmap(
+ Display *display;
+ Drawable d;
+ char *data;
+ XShmSegmentInfo *shminfo;
+ unsigned int width, height, depth);
+.LP
+Status XShmGetEventBase(
+ Display *display);
+.LP
+
+.fi
+.SH STRUCTURES
+.nf
+.ta 3i
+\fIEvents:\fP
+typedef struct {
+ int type; /\&* of event */
+ unsigned long serial; /\&* # of last request processed by server*/
+ Bool send_event; /\&* true if this came from a SendEvent request*/
+ Display *display; /\&* Display the event was read from */
+ Drawable drawable; /\&* drawable of request */
+ int major_code; /\&* ShmReqCode */
+ int minor_code; /\&* X_ShmPutImage */
+ ShmSeg shmseg; /\&* the ShmSeg used in the request*/
+ unsigned long offset; /\&* the offset into ShmSeg used in the request*/
+} XShmCompletionEvent;
+.LP
+\fIa structure of type XShmSegmentInfo :\fP
+
+typedef struct {
+ ShmSeg shmseg; /\&* resource id */
+ int shmid; /\&* kernel id */
+ char *shmaddr; /\&* address in client */
+ Bool readOnly; /\&* how the server should attach it */
+} XShmSegmentInfo;
+
+.SH DESCRIPTION
+.PP
+.PP
+.ZN XShmQueryExtension
+checks to see if the shared memory extensions are available for the
+specified display.
+.PP
+.ZN XShmQueryVersion
+returns the version numbers of the extension implementation. Shared
+memory pixmaps are supported if the pixmaps argument returns true.
+.PP
+.ZN XShmAttach
+tells the server to attach to your shared memory segment. If all goes
+well, you will get a non-zero status, back and your XImage is ready
+for use.
+.PP
+.ZN XShmDetach
+tells the server to detach from your shared memory segment.
+.PP
+.ZN XShmPutImage
+combines an image in memory with a shape of the specified drawable. If
+XYBitmap format is used, the depth must be one, or a ``BadMatch''
+error results. The foreground pixel in the GC defines the source for
+the one bits in the image, and the background pixel defines the source
+for the zero bits. For XYPixmap and ZPixmap, the depth must match the
+depth of the drawable, or a ``BadMatch'' error results.
+.PP
+.ZN XShmGetImage
+reads image data into a shared memory XImage where display is the
+display of interest, drawable is the source drawable, image is the
+destination XImage, x and y are offsets within the drawable, and
+plane_mask defines which planes are to be read.
+.PP
+.ZN XShmCreateImage
+allocates the memory needed for an XImage structure for the specified
+display but does not allocate space for the image itself.
+.PP
+.ZN XShmPixmapFormat
+gets the format for the server. If your application can deal with the
+server pixmap data format, a shared memory segment and shminfo
+structure are created.
+.PP
+.ZN XShmCreatePixmap
+points to a pixmap which you can manipulate in all of the usual ways,
+with the added bonus of being able to edit its contents directly
+through the shared memory segment.
+.PP
+.ZN XShmGetEventBase
+gets the completion event value.
+.PP
+.SH SEE ALSO
+\fIMIT-SHM - The MIT Shared Memory Extension \fP
diff --git a/libXext/specs/Makefile.am b/libXext/specs/Makefile.am
index 09eafe24a..80fb18f81 100644
--- a/libXext/specs/Makefile.am
+++ b/libXext/specs/Makefile.am
@@ -1,13 +1,13 @@
-
-if ENABLE_SPECS
-
-# Main DocBook/XML files (DOCTYPE book)
-docbook = dbelib.xml dpmslib.xml shapelib.xml synclib.xml xtest1.xml
-
-# The location where the DocBook/XML files and their generated formats are installed
-shelfdir = $(docdir)
-
-# Generate DocBook/XML output formats with or without stylesheets
-include $(top_srcdir)/docbook.am
-
-endif ENABLE_SPECS
+
+if ENABLE_SPECS
+
+# Main DocBook/XML files (DOCTYPE book)
+docbook = dbelib.xml dpmslib.xml shapelib.xml synclib.xml xtest1.xml
+
+# The location where the DocBook/XML files and their generated formats are installed
+shelfdir = $(docdir)
+
+# Generate DocBook/XML output formats with or without stylesheets
+include $(top_srcdir)/docbook.am
+
+endif ENABLE_SPECS
diff --git a/libXext/src/XShm.c b/libXext/src/XShm.c
index e4bc1f3e0..d1f1a4d7f 100644
--- a/libXext/src/XShm.c
+++ b/libXext/src/XShm.c
@@ -1,431 +1,431 @@
-/*
- *
-Copyright 1989, 1998 The Open Group
-
-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.
-
-The above copyright notice and this permission notice 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
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
- *
- * Author: Bob Scheifler and Keith Packard, MIT X Consortium
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <X11/Xlibint.h>
-#include <X11/ImUtil.h>
-#include <X11/extensions/XShm.h>
-#include <X11/extensions/shmproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-static XExtensionInfo _shm_info_data;
-static XExtensionInfo *shm_info = &_shm_info_data;
-static /* const */ char *shm_extension_name = SHMNAME;
-
-#define ShmCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, shm_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static char *error_string(Display *dpy, int code, XExtCodes *codes,
- char *buf, int n);
-static Bool wire_to_event (Display *dpy, XEvent *re, xEvent *event);
-static Status event_to_wire (Display *dpy, XEvent *re, xEvent *event);
-static /* const */ XExtensionHooks shm_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- wire_to_event, /* wire_to_event */
- event_to_wire, /* event_to_wire */
- NULL, /* error */
- error_string, /* error_string */
-};
-
-static /* const */ char *shm_error_list[] = {
- "BadShmSeg", /* BadShmSeg */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, shm_info, shm_extension_name,
- &shm_extension_hooks, ShmNumberEvents, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shm_info)
-
-static XEXT_GENERATE_ERROR_STRING (error_string, shm_extension_name,
- ShmNumberErrors, shm_error_list)
-
-
-static Bool
-wire_to_event (Display *dpy, XEvent *re, xEvent *event)
-{
- XExtDisplayInfo *info = find_display (dpy);
- XShmCompletionEvent *se;
- xShmCompletionEvent *sevent;
-
- ShmCheckExtension (dpy, info, False);
-
- switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
- case ShmCompletion:
- se = (XShmCompletionEvent *) re;
- sevent = (xShmCompletionEvent *) event;
- se->type = sevent->type & 0x7f;
- se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
- se->send_event = (sevent->type & 0x80) != 0;
- se->display = dpy;
- se->drawable = sevent->drawable;
- se->major_code = sevent->majorEvent;
- se->minor_code = sevent->minorEvent;
- se->shmseg = sevent->shmseg;
- se->offset = sevent->offset;
- return True;
- }
- return False;
-}
-
-static Status
-event_to_wire (Display *dpy, XEvent *re, xEvent *event)
-{
- XExtDisplayInfo *info = find_display (dpy);
- XShmCompletionEvent *se;
- xShmCompletionEvent *sevent;
-
- ShmCheckExtension (dpy, info, 0);
-
- switch ((re->type & 0x7f) - info->codes->first_event) {
- case ShmCompletion:
- se = (XShmCompletionEvent *) re;
- sevent = (xShmCompletionEvent *) event;
- sevent->type = se->type | (se->send_event ? 0x80 : 0);
- sevent->sequenceNumber = se->serial & 0xffff;
- sevent->drawable = se->drawable;
- sevent->majorEvent = se->major_code;
- sevent->minorEvent = se->minor_code;
- sevent->shmseg = se->shmseg;
- sevent->offset = se->offset;
- return True;
- }
- return False;
-}
-
-/*****************************************************************************
- * *
- * public Shared Memory Extension routines *
- * *
- *****************************************************************************/
-
-Bool XShmQueryExtension (Display *dpy /* int *event_basep, *error_basep */)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
-/* *event_basep = info->codes->first_event;
- *error_basep = info->codes->error_event; */
- return True;
- } else {
- return False;
- }
-}
-
-
-int XShmGetEventBase(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- return info->codes->first_event;
- } else {
- return -1;
- }
-}
-
-
-Bool XShmQueryVersion(
- Display *dpy,
- int *majorVersion,
- int *minorVersion,
- Bool *sharedPixmaps)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xShmQueryVersionReply rep;
- register xShmQueryVersionReq *req;
-
- ShmCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(ShmQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->shmReqType = X_ShmQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- *sharedPixmaps = rep.sharedPixmaps ? True : False;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-
-int XShmPixmapFormat(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xShmQueryVersionReply rep;
- register xShmQueryVersionReq *req;
-
- ShmCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(ShmQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->shmReqType = X_ShmQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- if (rep.sharedPixmaps &&
- (rep.majorVersion > 1 || rep.minorVersion > 0))
- return rep.pixmapFormat;
- return 0;
-}
-
-
-Bool XShmAttach(Display *dpy, XShmSegmentInfo *shminfo)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShmAttachReq *req;
-
- ShmCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(ShmAttach, req);
- req->reqType = info->codes->major_opcode;
- req->shmReqType = X_ShmAttach;
- req->shmseg = shminfo->shmseg = XAllocID(dpy);
- req->shmid = shminfo->shmid;
- req->readOnly = shminfo->readOnly ? xTrue : xFalse;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-
-Bool XShmDetach(Display *dpy, XShmSegmentInfo *shminfo)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShmDetachReq *req;
-
- ShmCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(ShmDetach, req);
- req->reqType = info->codes->major_opcode;
- req->shmReqType = X_ShmDetach;
- req->shmseg = shminfo->shmseg;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-static int _XShmDestroyImage (XImage *ximage)
-{
- Xfree((char *)ximage);
- return 1;
-}
-
-#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad) - 1)) / (pad)) * (pad))
-
-XImage *XShmCreateImage (
- register Display *dpy,
- register Visual *visual,
- unsigned int depth,
- int format,
- char *data,
- XShmSegmentInfo *shminfo,
- unsigned int width,
- unsigned int height)
-{
- register XImage *image;
-
- image = (XImage *)Xcalloc(1, (unsigned)sizeof(XImage));
- if (!image)
- return image;
- image->data = data;
- image->obdata = (char *)shminfo;
- image->width = width;
- image->height = height;
- image->depth = depth;
- image->format = format;
- image->byte_order = dpy->byte_order;
- image->bitmap_unit = dpy->bitmap_unit;
- image->bitmap_bit_order = dpy->bitmap_bit_order;
- image->bitmap_pad = _XGetScanlinePad(dpy, depth);
- image->xoffset = 0;
- if (visual) {
- image->red_mask = visual->red_mask;
- image->green_mask = visual->green_mask;
- image->blue_mask = visual->blue_mask;
- } else {
- image->red_mask = image->green_mask = image->blue_mask = 0;
- }
- if (format == ZPixmap)
- image->bits_per_pixel = _XGetBitsPerPixel(dpy, (int)depth);
- else
- image->bits_per_pixel = 1;
- image->bytes_per_line = ROUNDUP((image->bits_per_pixel * width),
- image->bitmap_pad) >> 3;
- _XInitImageFuncPtrs(image);
- image->f.destroy_image = _XShmDestroyImage;
- return image;
-}
-
-Bool XShmPutImage (
- register Display *dpy,
- Drawable d,
- GC gc,
- register XImage *image,
- int src_x, int src_y, int dst_x, int dst_y,
- unsigned int src_width, unsigned int src_height,
- Bool send_event)
-{
- XExtDisplayInfo *info = find_display (dpy);
- XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata;
- register xShmPutImageReq *req;
-
- ShmCheckExtension (dpy, info, 0);
- if (!shminfo) return 0;
-
- LockDisplay(dpy);
- FlushGC(dpy, gc);
- GetReq(ShmPutImage, req);
- req->reqType = info->codes->major_opcode;
- req->shmReqType = X_ShmPutImage;
- req->drawable = d;
- req->gc = gc->gid;
- req->srcX = src_x;
- req->srcY = src_y;
- req->srcWidth = src_width;
- req->srcHeight = src_height;
- req->dstX = dst_x;
- req->dstY = dst_y;
- req->totalWidth = image->width;
- req->totalHeight = image->height;
- req->depth = image->depth;
- req->format = image->format;
- req->sendEvent = send_event;
- req->shmseg = shminfo->shmseg;
- req->offset = image->data - shminfo->shmaddr;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-
-Bool XShmGetImage(
- register Display *dpy,
- Drawable d,
- XImage *image,
- int x, int y,
- unsigned long plane_mask)
-{
- XExtDisplayInfo *info = find_display (dpy);
- XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata;
- register xShmGetImageReq *req;
- xShmGetImageReply rep;
- register Visual *visual;
-
- ShmCheckExtension (dpy, info, 0);
- if (!shminfo) return 0;
-
- LockDisplay(dpy);
- GetReq(ShmGetImage, req);
- req->reqType = info->codes->major_opcode;
- req->shmReqType = X_ShmGetImage;
- req->drawable = d;
- req->x = x;
- req->y = y;
- req->width = image->width;
- req->height = image->height;
- req->planeMask = plane_mask;
- req->format = image->format;
- req->shmseg = shminfo->shmseg;
- req->offset = image->data - shminfo->shmaddr;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
- }
- visual = _XVIDtoVisual(dpy, rep.visual);
- if (visual) {
- image->red_mask = visual->red_mask;
- image->green_mask = visual->green_mask;
- image->blue_mask = visual->blue_mask;
- } else {
- image->red_mask = image->green_mask = image->blue_mask = 0;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Pixmap XShmCreatePixmap (
- register Display *dpy,
- Drawable d,
- char *data,
- XShmSegmentInfo *shminfo,
- unsigned int width, unsigned int height, unsigned int depth)
-{
- XExtDisplayInfo *info = find_display (dpy);
- Pixmap pid;
- register xShmCreatePixmapReq *req;
-
- ShmCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(ShmCreatePixmap, req);
- req->reqType = info->codes->major_opcode;
- req->shmReqType = X_ShmCreatePixmap;
- req->drawable = d;
- req->width = width;
- req->height = height;
- req->depth = depth;
- req->shmseg = shminfo->shmseg;
- req->offset = data - shminfo->shmaddr;
- pid = req->pid = XAllocID(dpy);
- UnlockDisplay(dpy);
- SyncHandle();
- return pid;
-}
+/*
+ *
+Copyright 1989, 1998 The Open Group
+
+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.
+
+The above copyright notice and this permission notice 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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Bob Scheifler and Keith Packard, MIT X Consortium
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/ImUtil.h>
+#include <X11/extensions/XShm.h>
+#include <X11/extensions/shmproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+static XExtensionInfo _shm_info_data;
+static XExtensionInfo *shm_info = &_shm_info_data;
+static /* const */ char *shm_extension_name = SHMNAME;
+
+#define ShmCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, shm_extension_name, val)
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static char *error_string(Display *dpy, int code, XExtCodes *codes,
+ char *buf, int n);
+static Bool wire_to_event (Display *dpy, XEvent *re, xEvent *event);
+static Status event_to_wire (Display *dpy, XEvent *re, xEvent *event);
+static /* const */ XExtensionHooks shm_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ wire_to_event, /* wire_to_event */
+ event_to_wire, /* event_to_wire */
+ NULL, /* error */
+ error_string, /* error_string */
+};
+
+static /* const */ char *shm_error_list[] = {
+ "BadShmSeg", /* BadShmSeg */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, shm_info, shm_extension_name,
+ &shm_extension_hooks, ShmNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shm_info)
+
+static XEXT_GENERATE_ERROR_STRING (error_string, shm_extension_name,
+ ShmNumberErrors, shm_error_list)
+
+
+static Bool
+wire_to_event (Display *dpy, XEvent *re, xEvent *event)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ XShmCompletionEvent *se;
+ xShmCompletionEvent *sevent;
+
+ ShmCheckExtension (dpy, info, False);
+
+ switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
+ case ShmCompletion:
+ se = (XShmCompletionEvent *) re;
+ sevent = (xShmCompletionEvent *) event;
+ se->type = sevent->type & 0x7f;
+ se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
+ se->send_event = (sevent->type & 0x80) != 0;
+ se->display = dpy;
+ se->drawable = sevent->drawable;
+ se->major_code = sevent->majorEvent;
+ se->minor_code = sevent->minorEvent;
+ se->shmseg = sevent->shmseg;
+ se->offset = sevent->offset;
+ return True;
+ }
+ return False;
+}
+
+static Status
+event_to_wire (Display *dpy, XEvent *re, xEvent *event)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ XShmCompletionEvent *se;
+ xShmCompletionEvent *sevent;
+
+ ShmCheckExtension (dpy, info, 0);
+
+ switch ((re->type & 0x7f) - info->codes->first_event) {
+ case ShmCompletion:
+ se = (XShmCompletionEvent *) re;
+ sevent = (xShmCompletionEvent *) event;
+ sevent->type = se->type | (se->send_event ? 0x80 : 0);
+ sevent->sequenceNumber = se->serial & 0xffff;
+ sevent->drawable = se->drawable;
+ sevent->majorEvent = se->major_code;
+ sevent->minorEvent = se->minor_code;
+ sevent->shmseg = se->shmseg;
+ sevent->offset = se->offset;
+ return True;
+ }
+ return False;
+}
+
+/*****************************************************************************
+ * *
+ * public Shared Memory Extension routines *
+ * *
+ *****************************************************************************/
+
+Bool XShmQueryExtension (Display *dpy /* int *event_basep, *error_basep */)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension(info)) {
+/* *event_basep = info->codes->first_event;
+ *error_basep = info->codes->error_event; */
+ return True;
+ } else {
+ return False;
+ }
+}
+
+
+int XShmGetEventBase(Display *dpy)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension(info)) {
+ return info->codes->first_event;
+ } else {
+ return -1;
+ }
+}
+
+
+Bool XShmQueryVersion(
+ Display *dpy,
+ int *majorVersion,
+ int *minorVersion,
+ Bool *sharedPixmaps)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xShmQueryVersionReply rep;
+ register xShmQueryVersionReq *req;
+
+ ShmCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(ShmQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->shmReqType = X_ShmQueryVersion;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *majorVersion = rep.majorVersion;
+ *minorVersion = rep.minorVersion;
+ *sharedPixmaps = rep.sharedPixmaps ? True : False;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+
+int XShmPixmapFormat(Display *dpy)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xShmQueryVersionReply rep;
+ register xShmQueryVersionReq *req;
+
+ ShmCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(ShmQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->shmReqType = X_ShmQueryVersion;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 0;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ if (rep.sharedPixmaps &&
+ (rep.majorVersion > 1 || rep.minorVersion > 0))
+ return rep.pixmapFormat;
+ return 0;
+}
+
+
+Bool XShmAttach(Display *dpy, XShmSegmentInfo *shminfo)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShmAttachReq *req;
+
+ ShmCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq(ShmAttach, req);
+ req->reqType = info->codes->major_opcode;
+ req->shmReqType = X_ShmAttach;
+ req->shmseg = shminfo->shmseg = XAllocID(dpy);
+ req->shmid = shminfo->shmid;
+ req->readOnly = shminfo->readOnly ? xTrue : xFalse;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+
+Bool XShmDetach(Display *dpy, XShmSegmentInfo *shminfo)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShmDetachReq *req;
+
+ ShmCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq(ShmDetach, req);
+ req->reqType = info->codes->major_opcode;
+ req->shmReqType = X_ShmDetach;
+ req->shmseg = shminfo->shmseg;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+static int _XShmDestroyImage (XImage *ximage)
+{
+ Xfree((char *)ximage);
+ return 1;
+}
+
+#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad) - 1)) / (pad)) * (pad))
+
+XImage *XShmCreateImage (
+ register Display *dpy,
+ register Visual *visual,
+ unsigned int depth,
+ int format,
+ char *data,
+ XShmSegmentInfo *shminfo,
+ unsigned int width,
+ unsigned int height)
+{
+ register XImage *image;
+
+ image = (XImage *)Xcalloc(1, (unsigned)sizeof(XImage));
+ if (!image)
+ return image;
+ image->data = data;
+ image->obdata = (char *)shminfo;
+ image->width = width;
+ image->height = height;
+ image->depth = depth;
+ image->format = format;
+ image->byte_order = dpy->byte_order;
+ image->bitmap_unit = dpy->bitmap_unit;
+ image->bitmap_bit_order = dpy->bitmap_bit_order;
+ image->bitmap_pad = _XGetScanlinePad(dpy, depth);
+ image->xoffset = 0;
+ if (visual) {
+ image->red_mask = visual->red_mask;
+ image->green_mask = visual->green_mask;
+ image->blue_mask = visual->blue_mask;
+ } else {
+ image->red_mask = image->green_mask = image->blue_mask = 0;
+ }
+ if (format == ZPixmap)
+ image->bits_per_pixel = _XGetBitsPerPixel(dpy, (int)depth);
+ else
+ image->bits_per_pixel = 1;
+ image->bytes_per_line = ROUNDUP((image->bits_per_pixel * width),
+ image->bitmap_pad) >> 3;
+ _XInitImageFuncPtrs(image);
+ image->f.destroy_image = _XShmDestroyImage;
+ return image;
+}
+
+Bool XShmPutImage (
+ register Display *dpy,
+ Drawable d,
+ GC gc,
+ register XImage *image,
+ int src_x, int src_y, int dst_x, int dst_y,
+ unsigned int src_width, unsigned int src_height,
+ Bool send_event)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata;
+ register xShmPutImageReq *req;
+
+ ShmCheckExtension (dpy, info, 0);
+ if (!shminfo) return 0;
+
+ LockDisplay(dpy);
+ FlushGC(dpy, gc);
+ GetReq(ShmPutImage, req);
+ req->reqType = info->codes->major_opcode;
+ req->shmReqType = X_ShmPutImage;
+ req->drawable = d;
+ req->gc = gc->gid;
+ req->srcX = src_x;
+ req->srcY = src_y;
+ req->srcWidth = src_width;
+ req->srcHeight = src_height;
+ req->dstX = dst_x;
+ req->dstY = dst_y;
+ req->totalWidth = image->width;
+ req->totalHeight = image->height;
+ req->depth = image->depth;
+ req->format = image->format;
+ req->sendEvent = send_event;
+ req->shmseg = shminfo->shmseg;
+ req->offset = image->data - shminfo->shmaddr;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+
+Bool XShmGetImage(
+ register Display *dpy,
+ Drawable d,
+ XImage *image,
+ int x, int y,
+ unsigned long plane_mask)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata;
+ register xShmGetImageReq *req;
+ xShmGetImageReply rep;
+ register Visual *visual;
+
+ ShmCheckExtension (dpy, info, 0);
+ if (!shminfo) return 0;
+
+ LockDisplay(dpy);
+ GetReq(ShmGetImage, req);
+ req->reqType = info->codes->major_opcode;
+ req->shmReqType = X_ShmGetImage;
+ req->drawable = d;
+ req->x = x;
+ req->y = y;
+ req->width = image->width;
+ req->height = image->height;
+ req->planeMask = plane_mask;
+ req->format = image->format;
+ req->shmseg = shminfo->shmseg;
+ req->offset = image->data - shminfo->shmaddr;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 0;
+ }
+ visual = _XVIDtoVisual(dpy, rep.visual);
+ if (visual) {
+ image->red_mask = visual->red_mask;
+ image->green_mask = visual->green_mask;
+ image->blue_mask = visual->blue_mask;
+ } else {
+ image->red_mask = image->green_mask = image->blue_mask = 0;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+Pixmap XShmCreatePixmap (
+ register Display *dpy,
+ Drawable d,
+ char *data,
+ XShmSegmentInfo *shminfo,
+ unsigned int width, unsigned int height, unsigned int depth)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ Pixmap pid;
+ register xShmCreatePixmapReq *req;
+
+ ShmCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq(ShmCreatePixmap, req);
+ req->reqType = info->codes->major_opcode;
+ req->shmReqType = X_ShmCreatePixmap;
+ req->drawable = d;
+ req->width = width;
+ req->height = height;
+ req->depth = depth;
+ req->shmseg = shminfo->shmseg;
+ req->offset = data - shminfo->shmaddr;
+ pid = req->pid = XAllocID(dpy);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return pid;
+}
diff --git a/libXext/src/Xge.c b/libXext/src/Xge.c
index e029b42b9..d28a4f052 100644
--- a/libXext/src/Xge.c
+++ b/libXext/src/Xge.c
@@ -1,365 +1,365 @@
-/*
- * Copyright © 2007-2008 Peter Hutterer
- *
- * 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.
- *
- * Authors: Peter Hutterer, University of South Australia, NICTA
- */
-
-/*
- * XGE is an extension to re-use a single opcode for multiple events,
- * depending on the extension. XGE allows events >32 bytes.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/extensions/geproto.h>
-#include <X11/extensions/ge.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/Xge.h>
-
-/***********************************************************************/
-/* internal data structures */
-/***********************************************************************/
-
-typedef struct {
- int present;
- short major_version;
- short minor_version;
-} XGEVersionRec;
-
-/* NULL terminated list of registered extensions. */
-typedef struct _XGEExtNode {
- int extension;
- XExtensionHooks* hooks;
- struct _XGEExtNode* next;
-} XGEExtNode, *XGEExtList;
-
-/* Internal data for GE extension */
-typedef struct _XGEData {
- XEvent data;
- XGEVersionRec *vers;
- XGEExtList extensions;
-} XGEData;
-
-
-/* forward declarations */
-static XExtDisplayInfo* _xgeFindDisplay(Display*);
-static Bool _xgeWireToEvent(Display*, XEvent*, xEvent*);
-static Status _xgeEventToWire(Display*, XEvent*, xEvent*);
-static int _xgeDpyClose(Display*, XExtCodes*);
-static XGEVersionRec* _xgeGetExtensionVersion(Display*,
- _Xconst char*,
- XExtDisplayInfo*);
-static Bool _xgeCheckExtension(Display* dpy, XExtDisplayInfo* info);
-
-/* main extension information data */
-static XExtensionInfo *xge_info;
-static char xge_extension_name[] = GE_NAME;
-static XExtensionHooks xge_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- _xgeDpyClose, /* close_display */
- _xgeWireToEvent, /* wire_to_event */
- _xgeEventToWire, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-
-static XExtDisplayInfo *_xgeFindDisplay(Display *dpy)
-{
- XExtDisplayInfo *dpyinfo;
- if (!xge_info)
- {
- if (!(xge_info = XextCreateExtension()))
- return NULL;
- }
- if (!(dpyinfo = XextFindDisplay (xge_info, dpy)))
- {
- dpyinfo = XextAddDisplay (xge_info,
- dpy,
- xge_extension_name,
- &xge_extension_hooks,
- 0 /* no events, see below */,
- NULL);
- /* We don't use an extension opcode, so we have to set the handlers
- * directly. If GenericEvent would be > 64, the job would be done by
- * XExtAddDisplay */
- XESetWireToEvent (dpy,
- GenericEvent,
- xge_extension_hooks.wire_to_event);
- XESetEventToWire (dpy,
- GenericEvent,
- xge_extension_hooks.event_to_wire);
- }
- return dpyinfo;
-}
-
-/*
- * Check extension is set up and internal data fields are filled.
- */
-static Bool
-_xgeCheckExtInit(Display* dpy, XExtDisplayInfo* info)
-{
- LockDisplay(dpy);
- if(!_xgeCheckExtension(dpy, info))
- {
- goto cleanup;
- }
-
- if (!info->data)
- {
- XGEData* data = (XGEData*)Xmalloc(sizeof(XGEData));
- if (!data) {
- goto cleanup;
- }
- /* get version from server */
- data->vers =
- _xgeGetExtensionVersion(dpy, "Generic Event Extension", info);
- data->extensions = NULL;
- info->data = (XPointer)data;
- }
-
- UnlockDisplay(dpy);
- return True;
-
-cleanup:
- UnlockDisplay(dpy);
- return False;
-}
-
-/* Return 1 if XGE extension exists, 0 otherwise. */
-static Bool
-_xgeCheckExtension(Display* dpy, XExtDisplayInfo* info)
-{
- return XextHasExtension(info);
-}
-
-
-/* Retrieve XGE version number from server. */
-static XGEVersionRec*
-_xgeGetExtensionVersion(Display* dpy,
- _Xconst char* name,
- XExtDisplayInfo*info)
-{
- xGEQueryVersionReply rep;
- xGEQueryVersionReq *req;
- XGEVersionRec *vers;
-
- GetReq(GEQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GEQueryVersion;
- req->majorVersion = GE_MAJOR;
- req->minorVersion = GE_MINOR;
-
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue))
- {
- Xfree(info);
- return NULL;
- }
-
- vers = (XGEVersionRec*)Xmalloc(sizeof(XGEVersionRec));
- vers->major_version = rep.majorVersion;
- vers->minor_version = rep.minorVersion;
- return vers;
-}
-
-/*
- * Display closing routine.
- */
-
-static int
-_xgeDpyClose(Display* dpy, XExtCodes* codes)
-{
- XExtDisplayInfo *info = _xgeFindDisplay(dpy);
-
- if (info->data != NULL) {
- XGEData* xge_data = (XGEData*)info->data;
-
- if (xge_data->extensions)
- {
- XGEExtList current, next;
- current = xge_data->extensions;
- while(current)
- {
- next = current->next;
- Xfree(current);
- current = next;
- }
- }
-
- XFree(xge_data->vers);
- XFree(xge_data);
- }
-
- return XextRemoveDisplay(xge_info, dpy);
-}
-
-/*
- * protocol to Xlib event conversion routine.
- */
-static Bool
-_xgeWireToEvent(Display* dpy, XEvent* re, xEvent *event)
-{
- int extension;
- XGEExtList it;
- XExtDisplayInfo* info = _xgeFindDisplay(dpy);
- if (!info)
- return False;
- /*
- _xgeCheckExtInit() calls LockDisplay, leading to a SIGABRT.
- Well, I guess we don't need the data we get in CheckExtInit anyway
- if (!_xgeCheckExtInit(dpy, info))
- return False;
- */
-
- extension = ((xGenericEvent*)event)->extension;
-
- it = ((XGEData*)info->data)->extensions;
- while(it)
- {
- if (it->extension == extension)
- {
- return (it->hooks->wire_to_event(dpy, re, event));
- }
- it = it->next;
- }
-
- fprintf(stderr,
- "_xgeWireToEvent: Unknown extension %d, this should never happen.\n",
- extension);
- return False;
-}
-
-/*
- * xlib event to protocol conversion routine.
- */
-static Status
-_xgeEventToWire(Display* dpy, XEvent* re, xEvent* event)
-{
- int extension;
- XGEExtList it;
- XExtDisplayInfo* info = _xgeFindDisplay(dpy);
- if (!info)
- return 1; /* error! */
-
- extension = ((XGenericEvent*)re)->extension;
-
- it = ((XGEData*)info->data)->extensions;
- while(it)
- {
- if (it->extension == extension)
- {
- return (it->hooks->event_to_wire(dpy, re, event));
- }
- it = it->next;
- }
-
- fprintf(stderr,
- "_xgeEventToWire: Unknown extension %d, this should never happen.\n",
- extension);
-
- return Success;
-}
-
-/*
- * Extensions need to register callbacks for their events.
- */
-Bool
-_X_HIDDEN xgeExtRegister(Display* dpy, int offset, XExtensionHooks* callbacks)
-{
- XGEExtNode* newExt;
- XGEData* xge_data;
-
- XExtDisplayInfo* info = _xgeFindDisplay(dpy);
- if (!info)
- return False; /* error! */
-
- if (!_xgeCheckExtInit(dpy, info))
- return False;
-
- xge_data = (XGEData*)info->data;
-
- newExt = (XGEExtNode*)Xmalloc(sizeof(XGEExtNode));
- if (!newExt)
- {
- fprintf(stderr, "xgeExtRegister: Failed to alloc memory.\n");
- return False;
- }
-
- newExt->extension = offset;
- newExt->hooks = callbacks;
- newExt->next = xge_data->extensions;
- xge_data->extensions = newExt;
-
- return True;
-}
-
-/***********************************************************************/
-/* Client interfaces */
-/***********************************************************************/
-
-/* Set event_base and error_base to the matching values for XGE.
- * Note that since XGE doesn't use any errors and events, the actual return
- * value is of limited use.
- */
-Bool
-XGEQueryExtension(Display* dpy, int* event_base, int* error_base)
-{
- XExtDisplayInfo* info = _xgeFindDisplay(dpy);
- if (!_xgeCheckExtInit(dpy, info))
- return False;
-
- *event_base = info->codes->first_event;
- *error_base = info->codes->first_error;
- return True;
-}
-
-/* Get XGE version number.
- * Doesn't actually get it from server, that should have been done beforehand
- * already
- */
-Bool
-XGEQueryVersion(Display* dpy,
- int *major_version,
- int *minor_version)
-{
- XExtDisplayInfo* info = _xgeFindDisplay(dpy);
- if (!info)
- return False;
-
- if (!_xgeCheckExtInit(dpy, info))
- return False;
-
- *major_version = ((XGEData*)info->data)->vers->major_version;
- *minor_version = ((XGEData*)info->data)->vers->minor_version;
-
- return True;
-}
-
+/*
+ * Copyright © 2007-2008 Peter Hutterer
+ *
+ * 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.
+ *
+ * Authors: Peter Hutterer, University of South Australia, NICTA
+ */
+
+/*
+ * XGE is an extension to re-use a single opcode for multiple events,
+ * depending on the extension. XGE allows events >32 bytes.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <X11/extensions/geproto.h>
+#include <X11/extensions/ge.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xge.h>
+
+/***********************************************************************/
+/* internal data structures */
+/***********************************************************************/
+
+typedef struct {
+ int present;
+ short major_version;
+ short minor_version;
+} XGEVersionRec;
+
+/* NULL terminated list of registered extensions. */
+typedef struct _XGEExtNode {
+ int extension;
+ XExtensionHooks* hooks;
+ struct _XGEExtNode* next;
+} XGEExtNode, *XGEExtList;
+
+/* Internal data for GE extension */
+typedef struct _XGEData {
+ XEvent data;
+ XGEVersionRec *vers;
+ XGEExtList extensions;
+} XGEData;
+
+
+/* forward declarations */
+static XExtDisplayInfo* _xgeFindDisplay(Display*);
+static Bool _xgeWireToEvent(Display*, XEvent*, xEvent*);
+static Status _xgeEventToWire(Display*, XEvent*, xEvent*);
+static int _xgeDpyClose(Display*, XExtCodes*);
+static XGEVersionRec* _xgeGetExtensionVersion(Display*,
+ _Xconst char*,
+ XExtDisplayInfo*);
+static Bool _xgeCheckExtension(Display* dpy, XExtDisplayInfo* info);
+
+/* main extension information data */
+static XExtensionInfo *xge_info;
+static char xge_extension_name[] = GE_NAME;
+static XExtensionHooks xge_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ _xgeDpyClose, /* close_display */
+ _xgeWireToEvent, /* wire_to_event */
+ _xgeEventToWire, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
+};
+
+
+static XExtDisplayInfo *_xgeFindDisplay(Display *dpy)
+{
+ XExtDisplayInfo *dpyinfo;
+ if (!xge_info)
+ {
+ if (!(xge_info = XextCreateExtension()))
+ return NULL;
+ }
+ if (!(dpyinfo = XextFindDisplay (xge_info, dpy)))
+ {
+ dpyinfo = XextAddDisplay (xge_info,
+ dpy,
+ xge_extension_name,
+ &xge_extension_hooks,
+ 0 /* no events, see below */,
+ NULL);
+ /* We don't use an extension opcode, so we have to set the handlers
+ * directly. If GenericEvent would be > 64, the job would be done by
+ * XExtAddDisplay */
+ XESetWireToEvent (dpy,
+ GenericEvent,
+ xge_extension_hooks.wire_to_event);
+ XESetEventToWire (dpy,
+ GenericEvent,
+ xge_extension_hooks.event_to_wire);
+ }
+ return dpyinfo;
+}
+
+/*
+ * Check extension is set up and internal data fields are filled.
+ */
+static Bool
+_xgeCheckExtInit(Display* dpy, XExtDisplayInfo* info)
+{
+ LockDisplay(dpy);
+ if(!_xgeCheckExtension(dpy, info))
+ {
+ goto cleanup;
+ }
+
+ if (!info->data)
+ {
+ XGEData* data = (XGEData*)Xmalloc(sizeof(XGEData));
+ if (!data) {
+ goto cleanup;
+ }
+ /* get version from server */
+ data->vers =
+ _xgeGetExtensionVersion(dpy, "Generic Event Extension", info);
+ data->extensions = NULL;
+ info->data = (XPointer)data;
+ }
+
+ UnlockDisplay(dpy);
+ return True;
+
+cleanup:
+ UnlockDisplay(dpy);
+ return False;
+}
+
+/* Return 1 if XGE extension exists, 0 otherwise. */
+static Bool
+_xgeCheckExtension(Display* dpy, XExtDisplayInfo* info)
+{
+ return XextHasExtension(info);
+}
+
+
+/* Retrieve XGE version number from server. */
+static XGEVersionRec*
+_xgeGetExtensionVersion(Display* dpy,
+ _Xconst char* name,
+ XExtDisplayInfo*info)
+{
+ xGEQueryVersionReply rep;
+ xGEQueryVersionReq *req;
+ XGEVersionRec *vers;
+
+ GetReq(GEQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GEQueryVersion;
+ req->majorVersion = GE_MAJOR;
+ req->minorVersion = GE_MINOR;
+
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue))
+ {
+ Xfree(info);
+ return NULL;
+ }
+
+ vers = (XGEVersionRec*)Xmalloc(sizeof(XGEVersionRec));
+ vers->major_version = rep.majorVersion;
+ vers->minor_version = rep.minorVersion;
+ return vers;
+}
+
+/*
+ * Display closing routine.
+ */
+
+static int
+_xgeDpyClose(Display* dpy, XExtCodes* codes)
+{
+ XExtDisplayInfo *info = _xgeFindDisplay(dpy);
+
+ if (info->data != NULL) {
+ XGEData* xge_data = (XGEData*)info->data;
+
+ if (xge_data->extensions)
+ {
+ XGEExtList current, next;
+ current = xge_data->extensions;
+ while(current)
+ {
+ next = current->next;
+ Xfree(current);
+ current = next;
+ }
+ }
+
+ XFree(xge_data->vers);
+ XFree(xge_data);
+ }
+
+ return XextRemoveDisplay(xge_info, dpy);
+}
+
+/*
+ * protocol to Xlib event conversion routine.
+ */
+static Bool
+_xgeWireToEvent(Display* dpy, XEvent* re, xEvent *event)
+{
+ int extension;
+ XGEExtList it;
+ XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+ if (!info)
+ return False;
+ /*
+ _xgeCheckExtInit() calls LockDisplay, leading to a SIGABRT.
+ Well, I guess we don't need the data we get in CheckExtInit anyway
+ if (!_xgeCheckExtInit(dpy, info))
+ return False;
+ */
+
+ extension = ((xGenericEvent*)event)->extension;
+
+ it = ((XGEData*)info->data)->extensions;
+ while(it)
+ {
+ if (it->extension == extension)
+ {
+ return (it->hooks->wire_to_event(dpy, re, event));
+ }
+ it = it->next;
+ }
+
+ fprintf(stderr,
+ "_xgeWireToEvent: Unknown extension %d, this should never happen.\n",
+ extension);
+ return False;
+}
+
+/*
+ * xlib event to protocol conversion routine.
+ */
+static Status
+_xgeEventToWire(Display* dpy, XEvent* re, xEvent* event)
+{
+ int extension;
+ XGEExtList it;
+ XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+ if (!info)
+ return 1; /* error! */
+
+ extension = ((XGenericEvent*)re)->extension;
+
+ it = ((XGEData*)info->data)->extensions;
+ while(it)
+ {
+ if (it->extension == extension)
+ {
+ return (it->hooks->event_to_wire(dpy, re, event));
+ }
+ it = it->next;
+ }
+
+ fprintf(stderr,
+ "_xgeEventToWire: Unknown extension %d, this should never happen.\n",
+ extension);
+
+ return Success;
+}
+
+/*
+ * Extensions need to register callbacks for their events.
+ */
+Bool
+_X_HIDDEN xgeExtRegister(Display* dpy, int offset, XExtensionHooks* callbacks)
+{
+ XGEExtNode* newExt;
+ XGEData* xge_data;
+
+ XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+ if (!info)
+ return False; /* error! */
+
+ if (!_xgeCheckExtInit(dpy, info))
+ return False;
+
+ xge_data = (XGEData*)info->data;
+
+ newExt = (XGEExtNode*)Xmalloc(sizeof(XGEExtNode));
+ if (!newExt)
+ {
+ fprintf(stderr, "xgeExtRegister: Failed to alloc memory.\n");
+ return False;
+ }
+
+ newExt->extension = offset;
+ newExt->hooks = callbacks;
+ newExt->next = xge_data->extensions;
+ xge_data->extensions = newExt;
+
+ return True;
+}
+
+/***********************************************************************/
+/* Client interfaces */
+/***********************************************************************/
+
+/* Set event_base and error_base to the matching values for XGE.
+ * Note that since XGE doesn't use any errors and events, the actual return
+ * value is of limited use.
+ */
+Bool
+XGEQueryExtension(Display* dpy, int* event_base, int* error_base)
+{
+ XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+ if (!_xgeCheckExtInit(dpy, info))
+ return False;
+
+ *event_base = info->codes->first_event;
+ *error_base = info->codes->first_error;
+ return True;
+}
+
+/* Get XGE version number.
+ * Doesn't actually get it from server, that should have been done beforehand
+ * already
+ */
+Bool
+XGEQueryVersion(Display* dpy,
+ int *major_version,
+ int *minor_version)
+{
+ XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+ if (!info)
+ return False;
+
+ if (!_xgeCheckExtInit(dpy, info))
+ return False;
+
+ *major_version = ((XGEData*)info->data)->vers->major_version;
+ *minor_version = ((XGEData*)info->data)->vers->minor_version;
+
+ return True;
+}
+