aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-19 13:39:03 +0200
committermarha <marha@users.sourceforge.net>2011-09-19 13:39:03 +0200
commit1678a69116d1c6ce900fe15f7813613bb28416dd (patch)
tree9589536f6b4bd60b34f90cf5ed20240d40bbb38c
parent9d911bc1246139019e555f443e934677a067bc0a (diff)
parentb2c925e360e2c366526de15b44603f855f94139c (diff)
downloadvcxsrv-1678a69116d1c6ce900fe15f7813613bb28416dd.tar.gz
vcxsrv-1678a69116d1c6ce900fe15f7813613bb28416dd.tar.bz2
vcxsrv-1678a69116d1c6ce900fe15f7813613bb28416dd.zip
Merge remote-tracking branch 'origin/released'
Conflicts: libfontenc/src/fontenc.c
-rw-r--r--X11/xtrans/Xtrans.c48
-rw-r--r--X11/xtrans/Xtrans.h6
-rw-r--r--X11/xtrans/Xtransint.h12
-rw-r--r--X11/xtrans/Xtranslcl.c52
-rw-r--r--X11/xtrans/Xtranssock.c118
-rw-r--r--X11/xtrans/Xtranstli.c316
-rw-r--r--X11/xtrans/Xtransutil.c30
-rw-r--r--X11/xtrans/configure.ac2
-rw-r--r--X11/xtrans/xtrans.m416
-rw-r--r--libX11/specs/XKB/xkblib.xml10
-rw-r--r--libX11/specs/i18n/framework/framework.xml6
-rw-r--r--libX11/specs/i18n/trans/trans.xml9
-rw-r--r--libX11/specs/libX11/libX11.xml14
-rw-r--r--libXau/AuLock.c234
-rw-r--r--libXau/README6
-rw-r--r--libXau/configure.ac2
-rw-r--r--libXdmcp/Wraphelp.c990
-rw-r--r--libXdmcp/include/X11/Xdmcp.h362
-rw-r--r--libXext/AUTHORS6
-rw-r--r--libXext/COPYING392
-rw-r--r--libXext/configure.ac2
-rw-r--r--libXext/include/X11/extensions/XLbx.h100
-rw-r--r--libXext/include/X11/extensions/Xdbe.h276
-rw-r--r--libXext/include/X11/extensions/Xge.h2
-rw-r--r--libXext/include/X11/extensions/dpms.h106
-rw-r--r--libXext/include/X11/extensions/extutil.h380
-rw-r--r--libXext/include/X11/extensions/sync.h750
-rw-r--r--libXext/include/X11/extensions/xtestext1.h4
-rw-r--r--libXext/man/DBE.man626
-rw-r--r--libXext/man/DPMSCapable.man130
-rw-r--r--libXext/man/DPMSDisable.man130
-rw-r--r--libXext/man/DPMSEnable.man154
-rw-r--r--libXext/man/DPMSForceLevel.man166
-rw-r--r--libXext/man/DPMSGetTimeouts.man204
-rw-r--r--libXext/man/DPMSGetVersion.man174
-rw-r--r--libXext/man/DPMSInfo.man172
-rw-r--r--libXext/man/DPMSQueryExtension.man208
-rw-r--r--libXext/man/DPMSSetTimeouts.man256
-rw-r--r--libXext/man/XShape.man348
-rw-r--r--libXext/man/XShm.man30
-rw-r--r--libXext/man/XcupGetReservedColormapEntries.man146
-rw-r--r--libXext/man/XcupQueryVersion.man148
-rw-r--r--libXext/man/XcupStoreColors.man158
-rw-r--r--libXext/man/XdbeAllocateBackBufferName.man134
-rw-r--r--libXext/man/XdbeBeginIdiom.man92
-rw-r--r--libXext/man/XdbeDeallocateBackBufferName.man106
-rw-r--r--libXext/man/XdbeEndIdiom.man92
-rw-r--r--libXext/man/XdbeFreeVisualInfo.man96
-rw-r--r--libXext/man/XdbeGetBackBufferAttributes.man130
-rw-r--r--libXext/man/XdbeGetVisualInfo.man250
-rw-r--r--libXext/man/XdbeQueryExtension.man122
-rw-r--r--libXext/man/XdbeSwapBuffers.man192
-rw-r--r--libXext/man/Xevi.man322
-rw-r--r--libXext/man/Xmbuf.man686
-rw-r--r--libXext/specs/dbelib.xml21
-rw-r--r--libXext/src/DPMS.c580
-rw-r--r--libXext/src/MITMisc.c260
-rw-r--r--libXext/src/Makefile.am130
-rw-r--r--libXext/src/XAppgroup.c776
-rw-r--r--libXext/src/XLbx.c248
-rw-r--r--libXext/src/XMultibuf.c1422
-rw-r--r--libXext/src/XShape.c976
-rw-r--r--libXext/src/XShm.c2
-rw-r--r--libXext/src/XSync.c1998
-rw-r--r--libXext/src/XTestExt1.c2634
-rw-r--r--libXext/src/Xcup.c524
-rw-r--r--libXext/src/Xdbe.c936
-rw-r--r--libXext/src/extutil.c560
-rw-r--r--libXext/src/globals.c174
-rw-r--r--libXft/configure.ac12
-rw-r--r--libXft/include/X11/Xft/Xft.h.in42
-rw-r--r--libXft/src/xftcolor.c6
-rw-r--r--libXft/src/xftcore.c86
-rw-r--r--libXft/src/xftdpy.c36
-rw-r--r--libXft/src/xftdraw.c44
-rw-r--r--libXft/src/xftextent.c14
-rw-r--r--libXft/src/xftfont.c16
-rw-r--r--libXft/src/xftfreetype.c116
-rw-r--r--libXft/src/xftglyphs.c52
-rw-r--r--libXft/src/xftint.h10
-rw-r--r--libXft/src/xftlist.c6
-rw-r--r--libXft/src/xftname.c8
-rw-r--r--libXft/src/xftrender.c54
-rw-r--r--libXft/src/xftswap.c2
-rw-r--r--libXft/src/xftxlfd.c28
-rw-r--r--libXinerama/Makefile.am84
-rw-r--r--libXinerama/configure.ac2
-rw-r--r--libXinerama/include/X11/extensions/Xinerama.h6
-rw-r--r--libXinerama/include/X11/extensions/panoramiXext.h170
-rw-r--r--libXinerama/man/Xinerama.man246
-rw-r--r--libXinerama/src/Xinerama.c626
-rw-r--r--libXmu/COPYING8
-rw-r--r--libXmu/include/X11/Xmu/Atoms.h2
-rw-r--r--libXmu/include/X11/Xmu/CharSet.h2
-rw-r--r--libXmu/include/X11/Xmu/CloseHook.h2
-rw-r--r--libXmu/include/X11/Xmu/Converters.h2
-rw-r--r--libXmu/include/X11/Xmu/CurUtil.h2
-rw-r--r--libXmu/include/X11/Xmu/CvtCache.h4
-rw-r--r--libXmu/include/X11/Xmu/DisplayQue.h22
-rw-r--r--libXmu/include/X11/Xmu/Drawing.h2
-rw-r--r--libXmu/include/X11/Xmu/EditresP.h52
-rw-r--r--libXmu/include/X11/Xmu/Error.h2
-rw-r--r--libXmu/include/X11/Xmu/Initer.h2
-rw-r--r--libXmu/include/X11/Xmu/Misc.h8
-rw-r--r--libXmu/include/X11/Xmu/StdCmap.h2
-rw-r--r--libXmu/include/X11/Xmu/StdSel.h2
-rw-r--r--libXmu/include/X11/Xmu/WinUtil.h2
-rw-r--r--libXmu/include/X11/Xmu/Xmu.h8
-rw-r--r--libXmu/src/AllCmap.c20
-rw-r--r--libXmu/src/Atoms.c2
-rw-r--r--libXmu/src/ClientWin.c4
-rw-r--r--libXmu/src/Clip.c2
-rw-r--r--libXmu/src/CloseHook.c18
-rw-r--r--libXmu/src/CmapAlloc.c24
-rw-r--r--libXmu/src/CrCmap.c42
-rw-r--r--libXmu/src/CursorName.c4
-rw-r--r--libXmu/src/CvtCache.c6
-rw-r--r--libXmu/src/CvtStdSel.c4
-rw-r--r--libXmu/src/DefErrMsg.c12
-rw-r--r--libXmu/src/DelCmap.c4
-rw-r--r--libXmu/src/DisplayQue.c4
-rw-r--r--libXmu/src/DrawLogo.c16
-rw-r--r--libXmu/src/ExtAgent.c2
-rw-r--r--libXmu/src/FToCback.c4
-rw-r--r--libXmu/src/GrayPixmap.c10
-rw-r--r--libXmu/src/Initer.c14
-rw-r--r--libXmu/src/LocBitmap.c18
-rw-r--r--libXmu/src/Lookup.c4
-rw-r--r--libXmu/src/LookupCmap.c32
-rw-r--r--libXmu/src/Lower.c4
-rw-r--r--libXmu/src/Makefile.am4
-rw-r--r--libXmu/src/RdBitF.c18
-rw-r--r--libXmu/src/ShapeWidg.c6
-rw-r--r--libXmu/src/StdCmap.c14
-rw-r--r--libXmu/src/StrToBS.c4
-rw-r--r--libXmu/src/StrToBmap.c10
-rw-r--r--libXmu/src/StrToCurs.c22
-rw-r--r--libXmu/src/StrToGrav.c4
-rw-r--r--libXmu/src/StrToJust.c4
-rw-r--r--libXmu/src/StrToLong.c2
-rw-r--r--libXmu/src/StrToOrnt.c4
-rw-r--r--libXmu/src/StrToShap.c4
-rw-r--r--libXmu/src/UpdMapHint.c2
-rw-r--r--libXmu/src/VisCmap.c6
-rw-r--r--libXmu/src/WidgetNode.c6
-rw-r--r--libXmu/src/Xct.c4
-rw-r--r--libfontenc/Makefile.am84
-rw-r--r--libfontenc/src/encparse.c34
-rw-r--r--libfontenc/src/fontenc.c1872
-rw-r--r--mesalib/src/SConscript2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c44
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.h6
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_clear.h118
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.c4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.h180
-rw-r--r--mesalib/src/mesa/SConscript2
-rw-r--r--mesalib/src/mesa/drivers/common/driverfuncs.c6
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c6
-rw-r--r--mesalib/src/mesa/main/dd.h10
-rw-r--r--mesalib/src/mesa/main/format_unpack.c8
-rw-r--r--mesalib/src/mesa/main/mipmap.c20
-rw-r--r--mesalib/src/mesa/main/mtypes.h34
-rw-r--r--mesalib/src/mesa/main/texcompress.c9
-rw-r--r--mesalib/src/mesa/main/texcompress_fxt1.c3303
-rw-r--r--mesalib/src/mesa/main/texcompress_fxt1.h124
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.c922
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.h18
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.c39
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.h220
-rw-r--r--mesalib/src/mesa/main/teximage.c12
-rw-r--r--mesalib/src/mesa/main/texobj.c2
-rw-r--r--mesalib/src/mesa/main/texparam.c2
-rw-r--r--mesalib/src/mesa/main/texstore.c46
-rw-r--r--mesalib/src/mesa/sources.mak2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_clear.c22
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c15
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.h1
-rw-r--r--mesalib/src/mesa/swrast/s_context.c8
-rw-r--r--mesalib/src/mesa/swrast/s_context.h67
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c (renamed from mesalib/src/mesa/main/texfetch.c)46
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.h (renamed from mesalib/src/mesa/main/texfetch.h)86
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch_tmp.h (renamed from mesalib/src/mesa/main/texfetch_tmp.h)378
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c92
-rw-r--r--mesalib/src/mesa/swrast/s_texrender.c31
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c65
-rw-r--r--mesalib/src/mesa/swrast/swrast.h17
186 files changed, 15513 insertions, 15362 deletions
diff --git a/X11/xtrans/Xtrans.c b/X11/xtrans/Xtrans.c
index 895b707f1..948e2831c 100644
--- a/X11/xtrans/Xtrans.c
+++ b/X11/xtrans/Xtrans.c
@@ -220,7 +220,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
strcpy (mybuf, address);
/* Parse the string to get each component */
-
+
/* Get the protocol part */
_protocol = mybuf;
@@ -297,9 +297,9 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
}
#if defined(IPv6) && defined(AF_INET6)
/* hostname in IPv6 [numeric_addr]:0 form? */
- else if ( (_host_len > 3) &&
+ else if ( (_host_len > 3) &&
((strcmp(_protocol, "tcp") == 0) || (strcmp(_protocol, "inet6") == 0))
- && (*_host == '[') && (*(_host + _host_len - 1) == ']') ) {
+ && (*_host == '[') && (*(_host + _host_len - 1) == ']') ) {
struct sockaddr_in6 sin6;
*(_host + _host_len - 1) = '\0';
@@ -411,7 +411,7 @@ TRANS(Open) (int type, char *address)
PRMSG (2,"Open(%d,%s)\n", type, address, 0);
-#if defined(WIN32) && defined(TCPCONN)
+#if defined(WIN32) && defined(TCPCONN)
if (TRANS(WSAStartup)())
{
PRMSG (1,"Open: WSAStartup failed\n", 0, 0, 0);
@@ -470,7 +470,7 @@ TRANS(Open) (int type, char *address)
if (ciptr == NULL)
{
- if (!(thistrans->flags & TRANS_DISABLED))
+ if (!(thistrans->flags & TRANS_DISABLED))
{
PRMSG (1,"Open: transport open failed for %s/%s:%s\n",
protocol, host, port);
@@ -644,7 +644,7 @@ TRANS(ReopenCLTSServer) (int trans_id, int fd, char *port)
int
-TRANS(GetReopenInfo) (XtransConnInfo ciptr,
+TRANS(GetReopenInfo) (XtransConnInfo ciptr,
int *trans_id, int *fd, char **port)
{
@@ -700,7 +700,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
break;
case 1: /* Set to non-blocking mode */
-#if defined(O_NONBLOCK) && !defined(SCO325)
+#if defined(O_NONBLOCK) && !defined(SCO325)
ret = fcntl (fd, F_GETFL, 0);
if (ret != -1)
ret = fcntl (fd, F_SETFL, ret | O_NONBLOCK);
@@ -712,7 +712,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
ret = ioctl (fd, FIOSNBIO, &arg);
}
#else
-#if defined(WIN32)
+#if defined(WIN32)
{
#ifdef WIN32
unsigned long arg;
@@ -750,7 +750,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
#endif /* F_SETFD */
break;
}
-
+
return ret;
}
@@ -765,14 +765,14 @@ TRANS(CreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
int
TRANS(NoListen) (char * protocol)
-
+
{
Xtransport *trans;
int i = 0, ret = 0;
-
- if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
+
+ if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
{
- PRMSG (1,"TransNoListen: unable to find transport: %s\n",
+ PRMSG (1,"TransNoListen: unable to find transport: %s\n",
protocol, 0, 0);
return -1;
@@ -857,7 +857,7 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address)
if (protocol) xfree (protocol);
if (host) xfree (host);
if (port) xfree (port);
-
+
return ret;
}
@@ -945,7 +945,7 @@ TRANS(IsLocal) (XtransConnInfo ciptr)
int
-TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
+TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
Xtransaddr **addrp)
{
@@ -965,7 +965,7 @@ TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
}
int
-TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
+TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
Xtransaddr **addrp)
{
@@ -1034,7 +1034,7 @@ extern int xquartz_launchd_fd;
#endif
int
-TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
+TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
XtransConnInfo **ciptrs_ret)
{
@@ -1056,7 +1056,7 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
if((ciptr = TRANS(ReopenCOTSServer(TRANS_SOCKET_LOCAL_INDEX,
xquartz_launchd_fd, getenv("DISPLAY"))))==NULL)
fprintf(stderr,"Got NULL while trying to Reopen launchd port\n");
- else
+ else
temp_ciptrs[(*count_ret)++] = ciptr;
}
#endif
@@ -1127,7 +1127,7 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
if (Xtransports[i].transport_id == TRANS_SOCKET_INET6_INDEX)
ipv6_succ = 1;
#endif
-
+
PRMSG (5,
"MakeAllCOTSServerListeners: opened listener for %s, %d\n",
trans->TransName, ciptr->fd, 0);
@@ -1157,12 +1157,12 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
}
else
*ciptrs_ret = NULL;
-
+
return 0;
}
int
-TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
+TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
XtransConnInfo **ciptrs_ret)
{
@@ -1256,7 +1256,7 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
}
else
*ciptrs_ret = NULL;
-
+
return 0;
}
@@ -1270,7 +1270,7 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
*/
-#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
+#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
/*
* emulate readv
@@ -1302,7 +1302,7 @@ static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
#endif /* SYSV && __i386__ || WIN32 || __sxg__ */
-#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
+#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
/*
* emulate writev
diff --git a/X11/xtrans/Xtrans.h b/X11/xtrans/Xtrans.h
index 5eac908d0..6f8f909c8 100644
--- a/X11/xtrans/Xtrans.h
+++ b/X11/xtrans/Xtrans.h
@@ -162,7 +162,7 @@ typedef long BytesReadable_t;
#endif
-#if defined(WIN32) || defined(USG)
+#if defined(WIN32) || defined(USG)
/*
* TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
@@ -437,13 +437,13 @@ TRANS(GetPeerNetworkId)(
#endif /* ICE_t */
-int
+int
TRANS(GetHostname) (
char * /* buf */,
int /* maxlen */
);
-#if defined(WIN32) && defined(TCPCONN)
+#if defined(WIN32) && defined(TCPCONN)
int TRANS(WSAStartup)();
#endif
diff --git a/X11/xtrans/Xtransint.h b/X11/xtrans/Xtransint.h
index ff3fd0b03..787d72124 100644
--- a/X11/xtrans/Xtransint.h
+++ b/X11/xtrans/Xtransint.h
@@ -51,10 +51,10 @@ from The Open Group.
#define _XTRANSINT_H_
/*
- * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport
- * Interface code. Each use of the PRMSG macro has a level associated with
- * it. XTRANSDEBUG is defined to be a level. If the invocation level is =<
- * the value of XTRANSDEBUG, then the message will be printed out to stderr.
+ * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport
+ * Interface code. Each use of the PRMSG macro has a level associated with
+ * it. XTRANSDEBUG is defined to be a level. If the invocation level is =<
+ * the value of XTRANSDEBUG, then the message will be printed out to stderr.
* Recommended levels are:
*
* XTRANSDEBUG=1 Error messages
@@ -318,7 +318,7 @@ typedef struct _Xtransport_table {
* systems, so they may be emulated.
*/
-#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
+#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
#define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt)
@@ -335,7 +335,7 @@ static int TRANS(ReadV)(
#endif /* CRAY || (SYSV && __i386__) || WIN32 || __sxg__ || */
-#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
+#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
#define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt)
diff --git a/X11/xtrans/Xtranslcl.c b/X11/xtrans/Xtranslcl.c
index 8d579a5d8..59762da1b 100644
--- a/X11/xtrans/Xtranslcl.c
+++ b/X11/xtrans/Xtranslcl.c
@@ -49,7 +49,7 @@ from The Open Group.
/*
*
- * The connection code/ideas in lib/X and server/os for SVR4/Intel
+ * The connection code/ideas in lib/X and server/os for SVR4/Intel
* environments was contributed by the following companies/groups:
*
* MetroLink Inc
@@ -61,12 +61,12 @@ from The Open Group.
*
* The goal is to have common connection code among all SVR4/Intel vendors.
*
- * ALL THE ABOVE COMPANIES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL THESE COMPANIES * 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
+ * ALL THE ABOVE COMPANIES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
+ * IN NO EVENT SHALL THESE COMPANIES * 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.
*/
@@ -172,7 +172,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
return 0;
}
strcpy (sunaddr->sun_path, sun_path);
-#if defined(BSD44SOCKETS)
+#if defined(BSD44SOCKETS)
sunaddr->sun_len = strlen (sunaddr->sun_path);
#endif
@@ -200,7 +200,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
return 0;
}
strcpy (p_sunaddr->sun_path, peer_sun_path);
-#if defined(BSD44SOCKETS)
+#if defined(BSD44SOCKETS)
p_sunaddr->sun_len = strlen (p_sunaddr->sun_path);
#endif
@@ -214,7 +214,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
#ifdef LOCAL_TRANS_PTS
/* PTS */
-#if defined(SYSV) && !defined(__SCO__)
+#if defined(SYSV) && !defined(__SCO__)
#define SIGNAL_T int
#else
#define SIGNAL_T void
@@ -640,7 +640,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
sunaddr->sun_family=AF_UNIX;
strcpy(sunaddr->sun_path,buf);
-#if defined(BSD44SOCKETS)
+#if defined(BSD44SOCKETS)
sunaddr->sun_len=strlen(sunaddr->sun_path);
#endif
@@ -669,7 +669,7 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
int fd;
char server_path[64];
struct stat filestat;
-# ifndef sun
+# ifndef sun
extern int isastream(int);
# endif
#endif
@@ -704,7 +704,7 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
if ((filestat.st_mode & S_IFMT) != S_IFIFO) {
PRMSG(1,"NAMEDOpenClient: Device %s is not a FIFO\n", server_path, 0,0 );
/* Is this really a failure? */
- (void) close(fd);
+ (void) close(fd);
return -1;
}
@@ -747,10 +747,10 @@ TRANS(NAMEDOpenPipe)(const char *server_path)
int fd, pipefd[2];
struct stat sbuf;
int mode;
-
+
#if defined(sun) && defined(X11_t)
mode = 0775; /* Solaris requires uid or gid 0 to create X11 pipes */
-#else
+#else
#ifdef HAS_STICKY_DIR_BIT
mode = 01777;
#else
@@ -833,7 +833,7 @@ TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port)
if (fd < 0) {
return -1;
}
-
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
@@ -857,9 +857,9 @@ TRANS(NAMEDResetListener) (XtransConnInfo ciptr)
int status = TRANS_RESET_NOOP;
struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr;
struct stat statb;
-
+
PRMSG(2,"NAMEDResetListener(%p, %d)\n", ciptr, ciptr->fd, 0 );
-
+
if (ciptr->fd != -1) {
/*
* see if the pipe has disappeared
@@ -2004,7 +2004,7 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol,
char *host, char *port)
{
@@ -2019,7 +2019,7 @@ TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
char *host, char *port)
{
@@ -2063,7 +2063,7 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
char *host, char *port)
{
@@ -2078,7 +2078,7 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(LocalOpenCLTSServer)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCLTSServer)(Xtransport *thistrans, char *protocol,
char *host, char *port)
{
@@ -2170,7 +2170,7 @@ TRANS(LocalResetListener)(XtransConnInfo ciptr)
{
LOCALtrans2dev *transptr;
-
+
PRMSG(2,"LocalResetListener(%x)\n",ciptr,0,0);
transptr=(LOCALtrans2dev *)ciptr->priv;
@@ -2334,7 +2334,7 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
* MakeAllCOTSServerListeners() will go through the entire Xtransports[]
* array defined in Xtrans.c and try to OpenCOTSServer() for each entry.
* We will add duplicate entries to that table so that the OpenCOTSServer()
- * function will get called once for each type of local transport.
+ * function will get called once for each type of local transport.
*
* The TransName is in lowercase, so it will never match during a normal
* call to SelectTransport() in Xtrans.c.
@@ -2348,8 +2348,8 @@ static char * local_aliases[] = {
"named",
# ifdef sun
"pipe", /* compatibility with Solaris Xlib */
-# endif
-# ifdef LOCAL_TRANS_SCO
+# endif
+# ifdef LOCAL_TRANS_SCO
"sco",
# endif
NULL };
diff --git a/X11/xtrans/Xtranssock.c b/X11/xtrans/Xtranssock.c
index d6e8384e0..08a763ea7 100644
--- a/X11/xtrans/Xtranssock.c
+++ b/X11/xtrans/Xtranssock.c
@@ -97,7 +97,7 @@ from the copyright holders.
#ifndef NO_TCP_H
-#if defined(linux) || defined(__GLIBC__)
+#if defined(linux) || defined(__GLIBC__)
#include <sys/param.h>
#endif /* osf */
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
@@ -114,11 +114,11 @@ from the copyright holders.
#if (defined(__i386__) && defined(SYSV)) && !defined(SCO325) && !defined(sun)
#include <net/errno.h>
-#endif
+#endif
-#if defined(__i386__) && defined(SYSV)
+#if defined(__i386__) && defined(SYSV)
#include <sys/stropts.h>
-#endif
+#endif
#include <unistd.h>
@@ -175,7 +175,7 @@ from the copyright holders.
*
*/
-typedef struct _Sockettrans2dev {
+typedef struct _Sockettrans2dev {
char *transname;
int family;
int devcotsname;
@@ -252,7 +252,7 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
# define SOCKLEN_T socklen_t
#endif
#elif defined(SVR4) || defined(__SVR4) || defined(__SCO__)
-# define SOCKLEN_T size_t
+# define SOCKLEN_T size_t
#else
# define SOCKLEN_T int
#endif
@@ -307,7 +307,7 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
#endif
bzero(socknamePtr, namelen);
-
+
if (getsockname (ciptr->fd,(struct sockaddr *) socknamePtr,
(void *)&namelen) < 0)
{
@@ -373,7 +373,7 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
}
bzero(socknamePtr, namelen);
-
+
PRMSG (3,"SocketINETGetPeerAddr(%p)\n", ciptr, 0, 0);
if (getpeername (ciptr->fd, (struct sockaddr *) socknamePtr,
@@ -582,7 +582,7 @@ TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol,
}
static XtransConnInfo
-TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol,
+TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol,
char *host, char *port)
{
return TRANS(SocketOpenCOTSClientBase)(
@@ -596,7 +596,7 @@ TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
+TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
char *host, char *port)
{
@@ -663,7 +663,7 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
+TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
char *host, char *port)
{
@@ -702,7 +702,7 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
+TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
char *host, char *port)
{
@@ -858,7 +858,7 @@ set_sun_path(const char *port, const char *upath, char *path, int abstract)
#ifdef TRANS_SERVER
static int
-TRANS(SocketCreateListener) (XtransConnInfo ciptr,
+TRANS(SocketCreateListener) (XtransConnInfo ciptr,
struct sockaddr *sockname,
int socknamelen, unsigned int flags)
@@ -886,7 +886,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
else
return TRANS_ADDR_IN_USE;
}
-
+
if (retry-- == 0) {
PRMSG (1, "SocketCreateListener: failed to bind listener\n",
0, 0, 0);
@@ -924,7 +924,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
close (fd);
return TRANS_CREATE_LISTENER_FAILED;
}
-
+
/* Set a flag to indicate that this connection is a listener */
ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS);
@@ -954,7 +954,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
#ifdef X11_t
char portbuf[PORTBUFSIZE];
#endif
-
+
PRMSG (2, "SocketINETCreateListener(%s)\n", port, 0, 0);
#ifdef X11_t
@@ -995,11 +995,11 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
else
{
tmpport = strtol (port, (char**)NULL, 10);
- /*
+ /*
* check that somehow the port address isn't negative or in
* the range of reserved port addresses. This can happen and
- * be very bad if the server is suid-root and the user does
- * something (dumb) like `X :60049`.
+ * be very bad if the server is suid-root and the user does
+ * something (dumb) like `X :60049`.
*/
if (tmpport < 1024 || tmpport > USHRT_MAX)
return TRANS_CREATE_LISTENER_FAILED;
@@ -1113,7 +1113,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
return TRANS_CREATE_LISTENER_FAILED;
}
-#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__))
+#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__))
sockname.sun_len = strlen(sockname.sun_path);
#endif
@@ -1301,7 +1301,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
#endif
/*
- * Get this address again because the transport may give a more
+ * Get this address again because the transport may give a more
* specific address now that a connection is established.
*/
@@ -1400,7 +1400,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
-
+
newciptr->peeraddrlen = ciptr->addrlen;
memcpy (newciptr->peeraddr, ciptr->addr, newciptr->addrlen);
@@ -1423,7 +1423,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
#if defined(IPv6) && defined(AF_INET6)
struct addrlist {
struct addrinfo * addr;
- struct addrinfo * firstaddr;
+ struct addrinfo * firstaddr;
char port[PORTBUFSIZE];
char host[MAXHOSTNAMELEN];
};
@@ -1525,7 +1525,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
while (socketaddr == NULL) {
if (addrlist->addr == NULL) {
- if (resetonce) {
+ if (resetonce) {
/* Already checked entire list - no usable addresses */
PRMSG (1, "SocketINETConnect() no usable address "
"for %s:%s\n", host, port, 0);
@@ -1535,7 +1535,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
resetonce = 1;
addrlist->addr = addrlist->firstaddr;
}
- }
+ }
socketaddr = addrlist->addr->ai_addr;
socketaddrlen = addrlist->addr->ai_addrlen;
@@ -1545,10 +1545,10 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
PRMSG (4,"SocketINETConnect() sockname.sin_addr = %s\n",
inet_ntop(addrlist->addr->ai_family,&sin->sin_addr,
- ntopbuf,sizeof(ntopbuf)), 0, 0);
+ ntopbuf,sizeof(ntopbuf)), 0, 0);
PRMSG (4,"SocketINETConnect() sockname.sin_port = %d\n",
- ntohs(sin->sin_port), 0, 0);
+ ntohs(sin->sin_port), 0, 0);
if (Sockettrans2devtab[ciptr->index].family == AF_INET6) {
if (strcmp(Sockettrans2devtab[ciptr->index].transname,
@@ -1583,13 +1583,13 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
}
} else if (addrlist->addr->ai_family == AF_INET6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr;
-
+
PRMSG (4,"SocketINETConnect() sockname.sin6_addr = %s\n",
inet_ntop(addrlist->addr->ai_family,
&sin6->sin6_addr,ntopbuf,sizeof(ntopbuf)),
- 0, 0);
+ 0, 0);
PRMSG (4,"SocketINETConnect() sockname.sin6_port = %d\n",
- ntohs(sin6->sin6_port), 0, 0);
+ ntohs(sin6->sin6_port), 0, 0);
if (Sockettrans2devtab[ciptr->index].family == AF_INET) {
if (strcmp(Sockettrans2devtab[ciptr->index].transname,
@@ -1627,7 +1627,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (socketaddr == NULL) {
addrlist->addr = addrlist->addr->ai_next;
}
- }
+ }
}
#else
{
@@ -1670,7 +1670,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
ESET(EPROTOTYPE);
return TRANS_CONNECT_FAILED;
}
-
+
memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr,
sizeof (sockname.sin_addr));
@@ -1749,7 +1749,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
* number of errors that made us quit before, since those
* could be caused by trying to use an IPv6 address to contact
* a machine with an IPv4-only server or other reasons that
- * only affect one of a set of addresses.
+ * only affect one of a set of addresses.
*/
if (olderrno == ECONNREFUSED || olderrno == EINTR
@@ -1772,16 +1772,16 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
PRMSG (2,"SocketINETConnect: Can't connect: errno = %d\n",
olderrno,0, 0);
- res = TRANS_CONNECT_FAILED;
+ res = TRANS_CONNECT_FAILED;
}
} else {
res = 0;
-
+
/*
* Sync up the address fields of ciptr.
*/
-
+
if (TRANS(SocketINETGetAddr) (ciptr) < 0)
{
PRMSG (1,
@@ -1847,7 +1847,7 @@ UnixHostReallyLocal (char *host)
for (j = otherhostaddr; j != NULL && equiv == 0; j = j->ai_next) {
if (i->ai_family == j->ai_family) {
if (i->ai_family == AF_INET) {
- struct sockaddr_in *sinA
+ struct sockaddr_in *sinA
= (struct sockaddr_in *) i->ai_addr;
struct sockaddr_in *sinB
= (struct sockaddr_in *) j->ai_addr;
@@ -1858,9 +1858,9 @@ UnixHostReallyLocal (char *host)
equiv = 1;
}
} else if (i->ai_family == AF_INET6) {
- struct sockaddr_in6 *sinA
+ struct sockaddr_in6 *sinA
= (struct sockaddr_in6 *) i->ai_addr;
- struct sockaddr_in6 *sinB
+ struct sockaddr_in6 *sinB
= (struct sockaddr_in6 *) j->ai_addr;
struct in6_addr *A = &sinA->sin6_addr;
struct in6_addr *B = &sinB->sin6_addr;
@@ -1872,7 +1872,7 @@ UnixHostReallyLocal (char *host)
}
}
}
-
+
freeaddrinfo(localhostaddr);
freeaddrinfo(otherhostaddr);
return equiv;
@@ -1902,13 +1902,13 @@ UnixHostReallyLocal (char *host)
* from the 1st call, so we must save the address list.
*/
- specified_local_addr_list[scount][0] =
+ specified_local_addr_list[scount][0] =
hostp->h_addr_list[scount][0];
- specified_local_addr_list[scount][1] =
+ specified_local_addr_list[scount][1] =
hostp->h_addr_list[scount][1];
- specified_local_addr_list[scount][2] =
+ specified_local_addr_list[scount][2] =
hostp->h_addr_list[scount][2];
- specified_local_addr_list[scount][3] =
+ specified_local_addr_list[scount][3] =
hostp->h_addr_list[scount][3];
scount++;
}
@@ -1924,17 +1924,17 @@ UnixHostReallyLocal (char *host)
while (hostp->h_addr_list[j])
{
- if ((specified_local_addr_list[i][0] ==
+ if ((specified_local_addr_list[i][0] ==
hostp->h_addr_list[j][0]) &&
- (specified_local_addr_list[i][1] ==
+ (specified_local_addr_list[i][1] ==
hostp->h_addr_list[j][1]) &&
- (specified_local_addr_list[i][2] ==
+ (specified_local_addr_list[i][2] ==
hostp->h_addr_list[j][2]) &&
- (specified_local_addr_list[i][3] ==
+ (specified_local_addr_list[i][3] ==
hostp->h_addr_list[j][3]))
{
/* They're equal, so we're done */
-
+
equiv = 1;
break;
}
@@ -1963,7 +1963,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
#endif
PRMSG (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port);
-
+
/*
* Make sure 'host' is really local. If not, we return failure.
* The reason we make this check is because a process may advertise
@@ -1995,7 +1995,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
/*
* Build the socket name.
*/
-
+
sockname.sun_family = AF_UNIX;
if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) {
@@ -2003,7 +2003,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
return TRANS_CONNECT_FAILED;
}
-#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__))
+#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__))
sockname.sun_len = strlen (sockname.sun_path);
#endif
@@ -2032,11 +2032,11 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
{
int olderrno = errno;
int connected = 0;
-
+
if (!connected)
{
errno = olderrno;
-
+
/*
* If the error was ENOENT, the server may be starting up; we used
* to suggest to try again in this case with
@@ -2118,7 +2118,7 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend)
return ret;
}
#else
-#if defined(__i386__) && defined(SYSV) && !defined(SCO325)
+#if defined(__i386__) && defined(SYSV) && !defined(SCO325)
return ioctl (ciptr->fd, I_NREAD, (char *) pend);
#else
return ioctl (ciptr->fd, FIONREAD, (char *) pend);
@@ -2133,7 +2133,7 @@ TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size)
{
PRMSG (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size);
-#if defined(WIN32)
+#if defined(WIN32)
{
int ret = recv ((SOCKET)ciptr->fd, buf, size, 0);
#ifdef WIN32
@@ -2153,7 +2153,7 @@ TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size)
{
PRMSG (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size);
-#if defined(WIN32)
+#if defined(WIN32)
{
int ret = send ((SOCKET)ciptr->fd, buf, size, 0);
#ifdef WIN32
@@ -2194,7 +2194,7 @@ TRANS(SocketDisconnect) (XtransConnInfo ciptr)
PRMSG (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd, 0);
#ifdef WIN32
- {
+ {
int ret = shutdown (ciptr->fd, 2);
if (ret == SOCKET_ERROR) errno = WSAGetLastError();
return ret;
@@ -2461,7 +2461,7 @@ Xtransport TRANS(SocketLocalFuncs) = {
static char* unix_nolisten[] = { "local" , NULL };
# endif
# endif
-
+
Xtransport TRANS(SocketUNIXFuncs) = {
/* Socket Interface */
"unix",
diff --git a/X11/xtrans/Xtranstli.c b/X11/xtrans/Xtranstli.c
index a9dfc21da..f35214c6f 100644
--- a/X11/xtrans/Xtranstli.c
+++ b/X11/xtrans/Xtranstli.c
@@ -75,33 +75,33 @@ static TLItrans2dev TLItrans2devtab[] = {
};
#define NUMTLIFAMILIES (sizeof(TLItrans2devtab)/sizeof(TLItrans2dev))
-
+
/*
* The local TLI connection, is a form of a local connection, so use a
* sockaddr_un for the address so that it will be treated just like the other
* local transports such as UNIX domain sockets, pts, and named.
*/
-
+
#if defined(X11_t)
#define TLINODENAME "TLI:xserver"
#endif
-
+
#if defined(XIM_t)
#define TLINODENAME "TLI:xim"
#endif
-
+
#if defined(FS_t) || defined(FONT_t)
#define TLINODENAME "TLI:fontserver"
#endif
-
+
#if defined(ICE_t)
#define TLINODENAME "TLI:ICE"
#endif
-
+
#if defined(TEST_t)
#define TLINODENAME "TLI:test"
#endif
-
+
#ifndef PORTBUFSIZE
#ifdef TRANS_SERVER
#define PORTBUFSIZE 64
@@ -122,9 +122,9 @@ TRANS(TLISelectFamily)(char *family)
{
int i;
-
+
PRMSG(3,"TLISelectFamily(%s)\n", family, 0,0 );
-
+
for(i=0;i<NUMTLIFAMILIES;i++)
{
if( !strcmp(family,TLItrans2devtab[i].transname) )
@@ -145,41 +145,41 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr)
{
Xtransaddr sockname;
struct netbuf netbuf;
-
+
PRMSG(3,"TLIGetAddr(%x)\n", ciptr, 0,0 );
-
+
netbuf.buf=(char *)&sockname;
netbuf.len=sizeof(sockname);
netbuf.maxlen=sizeof(sockname);
-
+
if( t_getname(ciptr->fd,&netbuf,LOCALNAME) < 0 )
{
PRMSG(1,"TLIGetAddr: t_getname(LOCALNAME) failed: %d\n",
errno, 0,0 );
return -1;
}
-
+
PRMSG(4,"TLIGetAddr: got family %d len %d\n",
((struct sockaddr *) &sockname)->sa_family ,netbuf.len, 0 );
-
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
+
if( ciptr->addr )
xfree(ciptr->addr);
-
+
if( (ciptr->addr=(char *)xalloc(netbuf.len)) == NULL )
{
PRMSG(1, "TLIGetAddr: Can't allocate space for the addr\n",
0,0,0);
return -1;
}
-
+
ciptr->family=((struct sockaddr *) &sockname)->sa_family;
ciptr->addrlen=netbuf.len;
memcpy(ciptr->addr,&sockname,ciptr->addrlen);
-
+
return 0;
}
@@ -195,30 +195,30 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr)
{
Xtransaddr sockname;
struct netbuf netbuf;
-
+
PRMSG(3,"TLIGetPeerAddr(%x)\n", ciptr, 0,0 );
-
+
netbuf.buf=(char *)&sockname;
netbuf.len=sizeof(sockname);
netbuf.maxlen=sizeof(sockname);
-
+
if( t_getname(ciptr->fd,&netbuf,REMOTENAME) < 0 )
{
PRMSG(1,"TLIGetPeerAddr: t_getname(REMOTENAME) failed: %d\n",
errno, 0,0 );
return -1;
}
-
+
PRMSG(4,"TLIGetPeerAddr: got family %d len %d\n",
((struct sockaddr *) &sockname)->sa_family ,netbuf.len, 0 );
-
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
+
if( ciptr->peeraddr )
xfree(ciptr->peeraddr);
-
+
if( (ciptr->peeraddr=(char *)xalloc(netbuf.len)) == NULL )
{
PRMSG(1,
@@ -226,10 +226,10 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr)
0,0,0);
return -1;
}
-
+
ciptr->peeraddrlen=netbuf.len;
memcpy(ciptr->peeraddr,&sockname,ciptr->peeraddrlen);
-
+
return 0;
}
@@ -250,9 +250,9 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
{
struct sockaddr_un *sunaddr=NULL;
struct t_bind *req=NULL;
-
+
PRMSG(2, "TLITLIBindLocal(%d,%d,%s)\n", fd, family, port);
-
+
if( family == AF_UNIX )
{
if( (req=(struct t_bind *)t_alloc(fd,T_BIND,0)) == NULL )
@@ -262,7 +262,7 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
0,0,0 );
return -1;
}
-
+
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
@@ -272,9 +272,9 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
t_free((char *)req,T_BIND);
return -1;
}
-
+
sunaddr->sun_family=AF_UNIX;
-
+
#ifdef nuke
if( *port == '/' ) { /* A full pathname */
(void) strcpy(sunaddr->sun_path, port);
@@ -282,18 +282,18 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
(void) sprintf(sunaddr->sun_path,"%s%s", TLINODENAME, port );
}
#endif /*NUKE*/
-
+
(void) sprintf(sunaddr->sun_path,"%s%d",
TLINODENAME, getpid()^time(NULL) );
-
+
PRMSG(4, "TLITLIBindLocal: binding to %s\n",
sunaddr->sun_path, 0,0);
-
+
req->addr.buf=(char *)sunaddr;
req->addr.len=sizeof(*sunaddr);
req->addr.maxlen=sizeof(*sunaddr);
}
-
+
if( t_bind(fd, req, NULL) < 0 )
{
PRMSG(1,
@@ -313,22 +313,22 @@ TRANS(TLIOpen)(char *device)
{
XtransConnInfo ciptr;
-
+
PRMSG(3,"TLIOpen(%s)\n", device, 0,0 );
-
+
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1, "TLIOpen: calloc failed\n", 0,0,0 );
return NULL;
}
-
+
if( (ciptr->fd=t_open( device, O_RDWR, NULL )) < 0 )
{
PRMSG(1, "TLIOpen: t_open failed for %s\n", device, 0,0 );
free(ciptr);
return NULL;
}
-
+
return ciptr;
}
@@ -340,9 +340,9 @@ TRANS(TLIReopen)(char *device, int fd, char *port)
{
XtransConnInfo ciptr;
-
+
PRMSG(3,"TLIReopen(%s,%d, %s)\n", device, fd, port );
-
+
if (t_sync (fd) < 0)
{
PRMSG(1, "TLIReopen: t_sync failed\n", 0,0,0 );
@@ -354,9 +354,9 @@ TRANS(TLIReopen)(char *device, int fd, char *port)
PRMSG(1, "TLIReopen: calloc failed\n", 0,0,0 );
return NULL;
}
-
+
ciptr->fd = fd;
-
+
return ciptr;
}
@@ -364,7 +364,7 @@ TRANS(TLIReopen)(char *device, int fd, char *port)
static int
-TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
+TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
struct netbuf *netbufp)
{
@@ -373,23 +373,23 @@ TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
struct nd_addrlist *nd_addrlistp = NULL;
void *handlep;
long lport;
-
+
PRMSG(3,"TLIAddrToNetbuf(%d,%s,%s)\n", tlifamily, host, port );
-
+
if( (handlep=setnetconfig()) == NULL )
return -1;
lport = strtol (port, (char**)NULL, 10);
if (lport < 1024 || lport > USHRT_MAX)
return -1;
-
+
nd_hostserv.h_host = host;
if( port && *port ) {
nd_hostserv.h_serv = port;
} else {
nd_hostserv.h_serv = NULL;
}
-
+
while( (netconfigp=getnetconfig(handlep)) != NULL )
{
if( strcmp(netconfigp->nc_protofmly,
@@ -400,11 +400,11 @@ TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
if( netdir_getbyname(netconfigp,&nd_hostserv, &nd_addrlistp) == 0 )
{
/* we have at least one address to use */
-
+
PRMSG(5, "TLIAddrToNetbuf: found address for %s.%s\n", host, port, 0 );
PRMSG(5, "TLIAddrToNetbuf: %s\n",taddr2uaddr(netconfigp,nd_addrlistp->n_addrs),
0,0 );
-
+
memcpy(netbufp->buf,nd_addrlistp->n_addrs->buf,
nd_addrlistp->n_addrs->len);
netbufp->len=nd_addrlistp->n_addrs->len;
@@ -413,7 +413,7 @@ TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
}
}
endnetconfig(handlep);
-
+
return -1;
}
@@ -424,29 +424,29 @@ TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol,
+TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol,
char *host, char *port)
{
XtransConnInfo ciptr;
int i;
-
+
PRMSG(2,"TLIOpenCOTSClient(%s,%s,%s)\n", protocol, host, port );
-
+
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,"TLIOpenCOTSClient: Unable to determine device for %s\n",
thistrans->TransName, 0,0 );
return NULL;
}
-
+
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
PRMSG(1,"TLIOpenCOTSClient: Unable to open device for %s\n",
thistrans->TransName, 0,0 );
return NULL;
}
-
+
if( TRANS(TLITLIBindLocal)(ciptr->fd,TLItrans2devtab[i].family,port) < 0 )
{
PRMSG(1,
@@ -456,7 +456,7 @@ TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol,
xfree(ciptr);
return NULL;
}
-
+
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
PRMSG(1,
@@ -466,10 +466,10 @@ TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol,
xfree(ciptr);
return NULL;
}
-
+
/* Save the TLIFamily for later use in TLIAddrToNetbuf() lookups */
ciptr->index = i;
-
+
return ciptr;
}
@@ -479,15 +479,15 @@ TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(TLIOpenCOTSServer)(Xtransport *thistrans, char *protocol,
+TRANS(TLIOpenCOTSServer)(Xtransport *thistrans, char *protocol,
char *host, char *port)
{
XtransConnInfo ciptr;
int i;
-
+
PRMSG(2,"TLIOpenCOTSServer(%s,%s,%s)\n", protocol, host, port );
-
+
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
@@ -495,7 +495,7 @@ TRANS(TLIOpenCOTSServer)(Xtransport *thistrans, char *protocol,
thistrans->TransName, 0,0 );
return NULL;
}
-
+
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
PRMSG(1,
@@ -503,16 +503,16 @@ TRANS(TLIOpenCOTSServer)(Xtransport *thistrans, char *protocol,
thistrans->TransName, 0,0 );
return NULL;
}
-
+
/* Set the family type */
ciptr->family = TLItrans2devtab[i].family;
/* Save the TLIFamily for later use in TLIAddrToNetbuf() lookups */
-
+
ciptr->index = i;
-
+
return ciptr;
}
@@ -522,15 +522,15 @@ TRANS(TLIOpenCOTSServer)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
+TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
char *host, char *port)
{
XtransConnInfo ciptr;
int i;
-
+
PRMSG(2,"TLIOpenCLTSClient(%s,%s,%s)\n", protocol, host, port );
-
+
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
@@ -538,7 +538,7 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
thistrans->TransName, 0,0 );
return NULL;
}
-
+
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcltsname)) == NULL )
{
PRMSG(1,
@@ -546,7 +546,7 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
thistrans->TransName, 0,0 );
return NULL;
}
-
+
if( TRANS(TLITLIBindLocal)(ciptr->fd,TLItrans2devtab[i].family,port) < 0 )
{
PRMSG(1,
@@ -556,7 +556,7 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
xfree(ciptr);
return NULL;
}
-
+
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
PRMSG(1,
@@ -566,9 +566,9 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
xfree(ciptr);
return NULL;
}
-
+
return ciptr;
-}
+}
#endif /* TRANS_CLIENT */
@@ -576,15 +576,15 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(TLIOpenCLTSServer)(Xtransport *thistrans, char *protocol,
+TRANS(TLIOpenCLTSServer)(Xtransport *thistrans, char *protocol,
char *host, char *port)
{
XtransConnInfo ciptr;
int i;
-
+
PRMSG(2,"TLIOpenCLTSServer(%s,%s,%s)\n", protocol, host, port );
-
+
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
@@ -592,7 +592,7 @@ TRANS(TLIOpenCLTSServer)(Xtransport *thistrans, char *protocol,
thistrans->TransName, 0,0 );
return NULL;
}
-
+
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcltsname)) == NULL )
{
PRMSG(1,
@@ -600,9 +600,9 @@ TRANS(TLIOpenCLTSServer)(Xtransport *thistrans, char *protocol,
thistrans->TransName, 0,0 );
return NULL;
}
-
+
return ciptr;
-}
+}
#endif /* TRANS_SERVER */
@@ -615,9 +615,9 @@ TRANS(TLIReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
{
XtransConnInfo ciptr;
int i;
-
+
PRMSG(2,"TLIReopenCOTSServer(%d, %s)\n", fd, port, 0 );
-
+
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
@@ -634,11 +634,11 @@ TRANS(TLIReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
thistrans->TransName, 0,0 );
return NULL;
}
-
+
/* Save the TLIFamily for later use in TLIAddrToNetbuf() lookups */
-
+
ciptr->index = i;
-
+
return ciptr;
}
@@ -649,9 +649,9 @@ TRANS(TLIReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
{
XtransConnInfo ciptr;
int i;
-
+
PRMSG(2,"TLIReopenCLTSServer(%d, %s)\n", fd, port, 0 );
-
+
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
@@ -668,11 +668,11 @@ TRANS(TLIReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
thistrans->TransName, 0,0 );
return NULL;
}
-
+
ciptr->index = i;
return ciptr;
-}
+}
#endif /* TRANS_REOPEN */
@@ -682,7 +682,7 @@ TRANS(TLISetOption)(XtransConnInfo ciptr, int option, int arg)
{
PRMSG(2,"TLISetOption(%d,%d,%d)\n", ciptr->fd, option, arg );
-
+
return -1;
}
@@ -694,9 +694,9 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
{
struct t_bind *ret;
-
+
PRMSG(2,"TLICreateListener(%x->%d,%x)\n", ciptr, ciptr->fd, req );
-
+
if( (ret=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,T_ALL)) == NULL )
{
PRMSG(1, "TLICreateListener: failed to allocate a t_bind\n",
@@ -704,7 +704,7 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
t_free((char *)req,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
-
+
if( t_bind(ciptr->fd, req, ret) < 0 )
{
PRMSG(1, "TLICreateListener: t_bind failed\n", 0,0,0 );
@@ -712,7 +712,7 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
t_free((char *)ret,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
-
+
if( memcmp(req->addr.buf,ret->addr.buf,req->addr.len) != 0 )
{
PRMSG(1, "TLICreateListener: unable to bind to %x\n",
@@ -721,11 +721,11 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
t_free((char *)ret,T_BIND);
return TRANS_ADDR_IN_USE;
}
-
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
+
if( (ciptr->addr=(char *)xalloc(ret->addr.len)) == NULL )
{
PRMSG(1,
@@ -735,13 +735,13 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
t_free((char *)ret, T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
-
+
ciptr->addrlen=ret->addr.len;
memcpy(ciptr->addr,ret->addr.buf,ret->addr.len);
-
+
t_free((char *)req,T_BIND);
t_free((char *)ret, T_BIND);
-
+
return 0;
}
@@ -754,10 +754,10 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flag
struct t_bind *req;
struct sockaddr_in *sinaddr;
long tmpport;
-
+
PRMSG(2,"TLIINETCreateListener(%x->%d,%s)\n", ciptr,
ciptr->fd, port ? port : "NULL" );
-
+
#ifdef X11_t
/*
* X has a well known port, that is transport dependent. It is easier
@@ -767,7 +767,7 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flag
* The port that is passed here is really a string containing the idisplay
* from ConnectDisplay().
*/
-
+
if (is_numeric (port))
{
tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
@@ -775,7 +775,7 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flag
port = portbuf;
}
#endif
-
+
if( (req=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,T_ALL)) == NULL )
{
PRMSG(1,
@@ -803,7 +803,7 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flag
/* Set the qlen */
req->qlen=1;
-
+
return TRANS(TLICreateListener)(ciptr, req);
}
@@ -815,10 +815,10 @@ TRANS(TLITLICreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags
struct t_bind *req;
struct sockaddr_un *sunaddr;
int ret_value;
-
+
PRMSG(2,"TLITLICreateListener(%x->%d,%s)\n", ciptr, ciptr->fd,
port ? port : "NULL");
-
+
if( (req=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,0)) == NULL )
{
PRMSG(1,
@@ -826,7 +826,7 @@ TRANS(TLITLICreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags
0,0,0 );
return TRANS_CREATE_LISTENER_FAILED;
}
-
+
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
@@ -836,7 +836,7 @@ TRANS(TLITLICreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags
t_free((char *)req,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
-
+
sunaddr->sun_family=AF_UNIX;
if( port && *port ) {
if( *port == '/' ) { /* A full pathname */
@@ -847,15 +847,15 @@ TRANS(TLITLICreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags
} else {
(void) sprintf(sunaddr->sun_path,"%s%d", TLINODENAME, getpid());
}
-
+
req->addr.buf=(char *)sunaddr;
req->addr.len=sizeof(*sunaddr);
req->addr.maxlen=sizeof(*sunaddr);
-
+
/* Set the qlen */
-
+
req->qlen=1;
-
+
ret_value = TRANS(TLICreateListener)(ciptr, req);
free((char *) sunaddr);
@@ -871,16 +871,16 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
struct t_call *call;
XtransConnInfo newciptr;
int i;
-
+
PRMSG(2,"TLIAccept(%x->%d)\n", ciptr, ciptr->fd, 0 );
-
+
if( (call=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_ALL)) == NULL )
{
PRMSG(1, "TLIAccept() failed to allocate a t_call\n", 0,0,0 );
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
-
+
if( t_listen(ciptr->fd,call) < 0 )
{
extern char *t_errlist[];
@@ -891,13 +891,13 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
-
+
/*
* Now we need to set up the new endpoint for the incoming connection.
*/
-
+
i=ciptr->index; /* Makes the next line more readable */
-
+
if( (newciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
PRMSG(1, "TLIAccept() failed to open a new endpoint\n", 0,0,0 );
@@ -905,7 +905,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
-
+
if( TRANS(TLITLIBindLocal)(newciptr->fd,TLItrans2devtab[i].family,"") < 0 )
{
PRMSG(1,
@@ -917,8 +917,8 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
-
-
+
+
if( t_accept(ciptr->fd,newciptr->fd,call) < 0 )
{
extern char *t_errlist[];
@@ -948,9 +948,9 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_FAILED;
return NULL;
}
-
+
t_free((char *)call,T_CALL);
-
+
if( TRANS(TLIGetAddr)(newciptr) < 0 )
{
PRMSG(1,
@@ -961,7 +961,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
-
+
if( TRANS(TLIGetPeerAddr)(newciptr) < 0 )
{
PRMSG(1,
@@ -973,7 +973,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
-
+
if( ioctl(newciptr->fd, I_POP,"timod") < 0 )
{
PRMSG(1, "TLIAccept() ioctl(I_POP, \"timod\") failed %d\n",
@@ -984,7 +984,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
-
+
if( ioctl(newciptr->fd, I_PUSH,"tirdwr") < 0 )
{
PRMSG(1, "TLIAccept() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
@@ -995,7 +995,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
-
+
*status = 0;
return newciptr;
@@ -1011,7 +1011,7 @@ TRANS(TLIConnect)(XtransConnInfo ciptr, struct t_call *sndcall )
{
PRMSG(2, "TLIConnect(%x->%d,%x)\n", ciptr, ciptr->fd, sndcall);
-
+
if( t_connect(ciptr->fd,sndcall,NULL) < 0 )
{
extern char *t_errlist[];
@@ -1027,13 +1027,13 @@ TRANS(TLIConnect)(XtransConnInfo ciptr, struct t_call *sndcall )
else
return TRANS_CONNECT_FAILED;
}
-
+
t_free((char *)sndcall,T_CALL);
-
+
/*
* Sync up the address fields of ciptr.
*/
-
+
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
PRMSG(1,
@@ -1041,7 +1041,7 @@ TRANS(TLIConnect)(XtransConnInfo ciptr, struct t_call *sndcall )
errno, 0,0 );
return TRANS_CONNECT_FAILED;
}
-
+
if( TRANS(TLIGetPeerAddr)(ciptr) < 0 )
{
PRMSG(1,
@@ -1049,21 +1049,21 @@ TRANS(TLIConnect)(XtransConnInfo ciptr, struct t_call *sndcall )
errno, 0,0 );
return TRANS_CONNECT_FAILED;
}
-
+
if( ioctl(ciptr->fd, I_POP,"timod") < 0 )
{
PRMSG(1, "TLIConnect() ioctl(I_POP,\"timod\") failed %d\n",
errno,0,0 );
return TRANS_CONNECT_FAILED;
}
-
+
if( ioctl(ciptr->fd, I_PUSH,"tirdwr") < 0 )
{
PRMSG(1, "TLIConnect() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
errno,0,0 );
return TRANS_CONNECT_FAILED;
}
-
+
return 0;
}
@@ -1072,12 +1072,12 @@ static int
TRANS(TLIINETConnect)(XtransConnInfo ciptr, char *host, char *port)
{
- char portbuf[PORTBUFSIZE];
+ char portbuf[PORTBUFSIZE];
struct t_call *sndcall;
long tmpport;
-
+
PRMSG(2, "TLIINETConnect(%s,%s)\n", host, port, 0);
-
+
#ifdef X11_t
/*
* X has a well known port, that is transport dependant. It is easier
@@ -1087,7 +1087,7 @@ TRANS(TLIINETConnect)(XtransConnInfo ciptr, char *host, char *port)
* The port that is passed here is really a string containing the idisplay
* from ConnectDisplay().
*/
-
+
if (is_numeric (port))
{
tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
@@ -1095,13 +1095,13 @@ TRANS(TLIINETConnect)(XtransConnInfo ciptr, char *host, char *port)
port = portbuf;
}
#endif
-
+
if( (sndcall=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_ALL)) == NULL )
{
PRMSG(1, "TLIINETConnect() failed to allocate a t_call\n", 0,0,0 );
return TRANS_CONNECT_FAILED;
}
-
+
if( TRANS(TLIAddrToNetbuf)(ciptr->index, host, port, &(sndcall->addr) ) < 0 )
{
PRMSG(1, "TLIINETConnect() unable to resolve name:%s.%s\n",
@@ -1109,7 +1109,7 @@ TRANS(TLIINETConnect)(XtransConnInfo ciptr, char *host, char *port)
t_free((char *)sndcall,T_CALL);
return TRANS_CONNECT_FAILED;
}
-
+
return TRANS(TLIConnect)(ciptr, sndcall );
}
@@ -1121,15 +1121,15 @@ TRANS(TLITLIConnect)(XtransConnInfo ciptr, char *host, char *port)
struct t_call *sndcall;
struct sockaddr_un *sunaddr;
int ret_value;
-
+
PRMSG(2, "TLITLIConnect(%s,%s)\n", host, port, 0);
-
+
if( (sndcall=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_OPT|T_UDATA)) == NULL )
{
PRMSG(1, "TLITLIConnect() failed to allocate a t_call\n", 0,0,0 );
return TRANS_CONNECT_FAILED;
}
-
+
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
@@ -1139,7 +1139,7 @@ TRANS(TLITLIConnect)(XtransConnInfo ciptr, char *host, char *port)
t_free((char *)sndcall,T_CALL);
return TRANS_CONNECT_FAILED;
}
-
+
sunaddr->sun_family=AF_UNIX;
if( *port == '/' ||
strncmp (port, TLINODENAME, strlen (TLINODENAME)) == 0) {
@@ -1152,7 +1152,7 @@ TRANS(TLITLIConnect)(XtransConnInfo ciptr, char *host, char *port)
sndcall->addr.buf=(char *)sunaddr;
sndcall->addr.len=sizeof(*sunaddr);
sndcall->addr.maxlen=sizeof(*sunaddr);
-
+
ret_value = TRANS(TLIConnect)(ciptr, sndcall );
free((char *) sunaddr);
@@ -1178,7 +1178,7 @@ TRANS(TLIBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend)
* streams head, and ioctl(N_READ) keeps returning 0 because there is
* no data available. The hangup goes undetected, and the client hangs.
*/
-
+
ret=ioctl(ciptr->fd, I_NREAD, (char *)pend);
if( ret != 0 )
@@ -1191,7 +1191,7 @@ TRANS(TLIBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend)
filedes.events=POLLIN;
ret=poll(&filedes, 1, 0);
-
+
if( ret == 0 ) {
*pend=0;
return 0; /* Really, no data */
@@ -1213,7 +1213,7 @@ TRANS(TLIRead)(XtransConnInfo ciptr, char *buf, int size)
{
PRMSG(2, "TLIRead(%d,%x,%d)\n", ciptr->fd, buf, size );
-
+
return read(ciptr->fd,buf,size);
}
@@ -1223,7 +1223,7 @@ TRANS(TLIWrite)(XtransConnInfo ciptr, char *buf, int size)
{
PRMSG(2, "TLIWrite(%d,%x,%d)\n", ciptr->fd, buf, size );
-
+
return write(ciptr->fd,buf,size);
}
@@ -1233,7 +1233,7 @@ TRANS(TLIReadv)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
PRMSG(2, "TLIReadv(%d,%x,%d)\n", ciptr->fd, buf, size );
-
+
return READV(ciptr,buf,size);
}
@@ -1243,7 +1243,7 @@ TRANS(TLIWritev)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
PRMSG(2, "TLIWritev(%d,%x,%d)\n", ciptr->fd, buf, size );
-
+
return WRITEV(ciptr,buf,size);
}
@@ -1253,7 +1253,7 @@ TRANS(TLIDisconnect)(XtransConnInfo ciptr)
{
PRMSG(2, "TLIDisconnect(%x->%d)\n", ciptr, ciptr->fd, 0 );
-
+
/*
* Restore the TLI modules so that the connection can be properly shutdown.
* This avoids the situation where a connection goes into the TIME_WAIT
@@ -1263,7 +1263,7 @@ TRANS(TLIDisconnect)(XtransConnInfo ciptr)
ioctl(ciptr->fd, I_PUSH,"timod");
t_snddis(ciptr->fd,NULL);
-
+
return 0;
}
@@ -1273,7 +1273,7 @@ TRANS(TLIClose)(XtransConnInfo ciptr)
{
PRMSG(2, "TLIClose(%x->%d)\n", ciptr, ciptr->fd, 0 );
-
+
t_unbind(ciptr->fd);
return (t_close(ciptr->fd));
@@ -1289,7 +1289,7 @@ TRANS(TLICloseForCloning)(XtransConnInfo ciptr)
*/
PRMSG(2, "TLICloseForCloning(%x->%d)\n", ciptr, ciptr->fd, 0 );
-
+
return (t_close(ciptr->fd));
}
diff --git a/X11/xtrans/Xtransutil.c b/X11/xtrans/Xtransutil.c
index 42f09c4d1..56f01583a 100644
--- a/X11/xtrans/Xtransutil.c
+++ b/X11/xtrans/Xtransutil.c
@@ -142,7 +142,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
{
*familyp=FamilyLocal;
}
- else
+ else
{
*familyp=FamilyInternet;
*addrlenp = sizeof (struct in_addr);
@@ -161,7 +161,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
#endif /* defined(TCPCONN) || defined(STREAMSCONN) */
-#if defined(UNIXCONN) || defined(LOCALCONN)
+#if defined(UNIXCONN) || defined(LOCALCONN)
case AF_UNIX:
{
*familyp=FamilyLocal;
@@ -190,7 +190,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
* In the case of a local connection, we need to get the
* host name for authentication.
*/
-
+
char hostnamebuf[256];
int len = TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf);
@@ -251,7 +251,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
switch (family)
{
-#if defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN)
+#if defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN)
case AF_UNIX:
{
struct sockaddr_un *saddr = (struct sockaddr_un *) addr;
@@ -341,7 +341,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
switch (family)
{
case AF_UNSPEC:
-#if defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN)
+#if defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN)
case AF_UNIX:
{
if (gethostname (addrbuf, sizeof (addrbuf)) == 0)
@@ -386,7 +386,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
* Assume that if it does not respond in NAMESERVER_TIMEOUT seconds
* that something is wrong and do not make the user wait.
* gethostbyaddr will continue after a signal, so we have to
- * jump out of it.
+ * jump out of it.
*/
nameserver_timedout = 0;
@@ -431,7 +431,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
#endif /* ICE_t */
-#if defined(WIN32) && defined(TCPCONN)
+#if defined(WIN32) && defined(TCPCONN)
int
TRANS(WSAStartup) (void)
{
@@ -478,7 +478,7 @@ is_numeric (const char *str)
* it's not save if the directory has non-root ownership or the sticky
* bit cannot be set and fail.
*/
-static int
+static int
trans_mkdir(const char *path, int mode)
{
struct stat buf;
@@ -501,7 +501,7 @@ trans_mkdir(const char *path, int mode)
if (mode & 01000) {
PRMSG(1, "mkdir: ERROR: euid != 0,"
"directory %s will not be created.\n",
- path, 0, 0);
+ path, 0, 0);
#ifdef FAIL_HARD
return -1;
#endif
@@ -531,7 +531,7 @@ trans_mkdir(const char *path, int mode)
}
return 0;
-
+
} else {
if (S_ISDIR(buf.st_mode)) {
int updateOwner = 0;
@@ -550,7 +550,7 @@ trans_mkdir(const char *path, int mode)
*/
if ((~mode) & 0077 & buf.st_mode)
updateMode = 1;
-
+
/*
* If the directory is not writeable not everybody may
* be able to create sockets. Therefore warn if mode
@@ -560,7 +560,7 @@ trans_mkdir(const char *path, int mode)
updateMode = 1;
status |= WARN_NO_ACCESS;
}
-
+
/*
* If 'sticky' bit is requested fail if owner isn't root
* as we assume the caller makes certain security implications
@@ -572,7 +572,7 @@ trans_mkdir(const char *path, int mode)
updateMode = 1;
}
}
-
+
#ifdef HAS_FCHOWN
/*
* If fchown(2) and fchmod(2) are available, try to correct the
@@ -607,7 +607,7 @@ trans_mkdir(const char *path, int mode)
}
}
#endif
-
+
if (updateOwner && !updatedOwner) {
#ifdef FAIL_HARD
if (status & FAIL_IF_NOT_ROOT) {
@@ -621,7 +621,7 @@ trans_mkdir(const char *path, int mode)
path, 0, 0);
#endif
}
-
+
if (updateMode && !updatedMode) {
#ifdef FAIL_HARD
if (status & FAIL_IF_NOMODE) {
diff --git a/X11/xtrans/configure.ac b/X11/xtrans/configure.ac
index 3b38d29de..5f1743c75 100644
--- a/X11/xtrans/configure.ac
+++ b/X11/xtrans/configure.ac
@@ -51,7 +51,7 @@ AC_SUBST(fchown_define)
# sticky bit
#
-# if any system exists without sticky dir bits this
+# if any system exists without sticky dir bits this
# needs to be redone with a real autoconf test
sticky_bit_define="-DHAS_STICKY_DIR_BIT"
diff --git a/X11/xtrans/xtrans.m4 b/X11/xtrans/xtrans.m4
index da35a759d..91c6f9d2f 100644
--- a/X11/xtrans/xtrans.m4
+++ b/X11/xtrans/xtrans.m4
@@ -33,9 +33,9 @@ AC_DEFUN([XTRANS_TCP_FLAGS],[
fi
# Needs to come after above checks for libsocket & libnsl for SVR4 systems
- AC_ARG_ENABLE(ipv6,
+ AC_ARG_ENABLE(ipv6,
AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
- [IPV6CONN=$enableval],
+ [IPV6CONN=$enableval],
[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
AC_MSG_CHECKING([if IPv6 support should be built])
if test "$IPV6CONN" = "yes"; then
@@ -44,7 +44,7 @@ AC_DEFUN([XTRANS_TCP_FLAGS],[
AC_MSG_RESULT($IPV6CONN)
# 4.3BSD-Reno added a new member to struct sockaddr_in
- AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
+ AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
AC_DEFINE([BSD44SOCKETS],1,
[Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
#include <sys/types.h>
@@ -56,7 +56,7 @@ AC_DEFUN([XTRANS_TCP_FLAGS],[
AC_CHECK_TYPES([socklen_t], [], [], [
AC_INCLUDES_DEFAULT
#include <sys/socket.h>])
-
+
]) # XTRANS_TCP_FLAGS
# XTRANS_CONNECTION_FLAGS()
@@ -78,7 +78,7 @@ AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
fi
AC_MSG_RESULT($UNIXCONN)
- AC_ARG_ENABLE(tcp-transport,
+ AC_ARG_ENABLE(tcp-transport,
AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
[TCPCONN=$enableval], [TCPCONN=yes])
AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
@@ -99,7 +99,7 @@ AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
if test "$LOCALCONN" = "yes"; then
AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
fi
-
+
]) # XTRANS_CONNECTION_FLAGS
@@ -109,7 +109,7 @@ AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
# so that any necessary networking libraries are already found
AC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
[AC_REQUIRE([XTRANS_TCP_FLAGS])
- AC_ARG_ENABLE(secure-rpc,
+ AC_ARG_ENABLE(secure-rpc,
AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
[SECURE_RPC=$enableval], [SECURE_RPC="try"])
@@ -120,7 +120,7 @@ AC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
if test "x$FOUND_SECURE_RPC" = "xno" ; then
if test "x$SECURE_RPC" = "xyes" ; then
AC_MSG_ERROR([Secure RPC requested, but required functions not found])
- fi
+ fi
SECURE_RPC="no"
else
dnl FreeBSD keeps getsecretkey in librpcsvc
diff --git a/libX11/specs/XKB/xkblib.xml b/libX11/specs/XKB/xkblib.xml
index e45841c98..1ca6f3e58 100644
--- a/libX11/specs/XKB/xkblib.xml
+++ b/libX11/specs/XKB/xkblib.xml
@@ -43,10 +43,12 @@
<affiliation><orgname>Digital Equipment Corporation</orgname></affiliation>
</author>
</authorgroup>
- <copyright><year>1995</year><year>1996</year><holder>X Consortium Inc.</holder></copyright>
- <copyright><year>1995</year><year>1996</year><holder>Silicon Graphics Inc.</holder></copyright>
- <copyright><year>1995</year><year>1996</year><holder>Hewlett-Packard Company</holder></copyright>
- <copyright><year>1995</year><year>1996</year><holder>Digital Equipment Corporation</holder></copyright>
+ <copyright><year>1995</year><year>1996</year>
+ <holder>X Consortium Inc.</holder>
+ <holder>Silicon Graphics Inc.</holder>
+ <holder>Hewlett-Packard Company</holder>
+ <holder>Digital Equipment Corporation</holder>
+ </copyright>
<legalnotice>
<para>
diff --git a/libX11/specs/i18n/framework/framework.xml b/libX11/specs/i18n/framework/framework.xml
index 4d87d4736..fd88688bc 100644
--- a/libX11/specs/i18n/framework/framework.xml
+++ b/libX11/specs/i18n/framework/framework.xml
@@ -20,8 +20,10 @@
<affiliation><orgname>IBM Japan</orgname></affiliation>
</othercredit>
</authorgroup>
- <copyright><year>1994</year><holder>TOSHIBA Corporation</holder></copyright>
- <copyright><year>1994</year><holder>IBM Corporation</holder></copyright>
+ <copyright><year>1994</year>
+ <holder>TOSHIBA Corporation</holder>
+ <holder>IBM Corporation</holder>
+ </copyright>
<legalnotice>
diff --git a/libX11/specs/i18n/trans/trans.xml b/libX11/specs/i18n/trans/trans.xml
index 8e38e8963..6f1a15c50 100644
--- a/libX11/specs/i18n/trans/trans.xml
+++ b/libX11/specs/i18n/trans/trans.xml
@@ -17,12 +17,15 @@
<affiliation><orgname>FUJITSU LIMITED</orgname></affiliation>
</author>
</authorgroup>
- <copyright><year>1994</year><holder>FUJITSU LIMITED</holder></copyright>
- <copyright><year>1994</year><holder>X Consortium</holder></copyright>
-
+ <copyright>
+ <year>1994</year>
+ <holder>FUJITSU LIMITED</holder>
+ <holder>X Consortium</holder>
+ </copyright>
<abstract>
+<title>Abstract</title>
<para>
This specification describes the transport layer interfaces between Xlib and IM Server,
which makes various channels usable such as X protocol or TCP/IP, DECnet and etc.
diff --git a/libX11/specs/libX11/libX11.xml b/libX11/specs/libX11/libX11.xml
index 30d73b8f0..782c14ffa 100644
--- a/libX11/specs/libX11/libX11.xml
+++ b/libX11/specs/libX11/libX11.xml
@@ -60,17 +60,12 @@
<affiliation><orgname>Fujitsu OSSI</orgname></affiliation>
</othercredit>
</authorgroup>
- <copyright><year>1985</year><year>1986</year><year>1987</year>
- <year>1988</year><year>1989</year><year>1991</year><year>1994</year>
- <year>1996</year><year>2002</year><holder>The Open Group</holder>
- </copyright>
- <copyright><year>1985</year><year>1986</year><year>1987</year>
- <year>1988</year><year>1989</year><year>1991</year>
- <holder>Digital Equipment Corporation</holder>
- </copyright>
<legalnotice>
+<formalpara>
+<title>Copyright © 1985, 1986, 1987, 1988, 1989, 1991, 1994, 1996, 2002 The Open Group</title>
+<para></para></formalpara>
<para>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files
@@ -102,6 +97,9 @@ 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.
</para>
+<formalpara>
+<title>Copyright © 1985, 1986, 1987, 1988, 1989, 1991 Digital Equipment Corporation</title>
+<para></para></formalpara>
<para>
Permission to use, copy, modify and distribute this documentation for any
purpose and without fee is hereby granted, provided that the above copyright
diff --git a/libXau/AuLock.c b/libXau/AuLock.c
index 45d6b71a3..1eab79ae4 100644
--- a/libXau/AuLock.c
+++ b/libXau/AuLock.c
@@ -1,117 +1,117 @@
-/*
-
-Copyright 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.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xauth.h>
-#include <X11/Xos.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <time.h>
-#define Time_t time_t
-#ifndef X_NOT_POSIX
-#include <unistd.h>
-#else
-#ifndef WIN32
-extern unsigned sleep ();
-#else
-#include <X11/Xwindows.h>
-#define link rename
-#endif
-#endif
-#ifdef __UNIXOS2__
-#define link rename
-#endif
-
-int
-XauLockAuth (
-_Xconst char *file_name,
-int retries,
-int timeout,
-long dead)
-{
- char creat_name[1025], link_name[1025];
- struct stat statb;
- Time_t now;
- int creat_fd = -1;
-
- if (strlen (file_name) > 1022)
- return LOCK_ERROR;
- (void) strcpy (creat_name, file_name);
- (void) strcat (creat_name, "-c");
- (void) strcpy (link_name, file_name);
- (void) strcat (link_name, "-l");
- if (stat (creat_name, &statb) != -1) {
- now = time ((Time_t *) 0);
- /*
- * NFS may cause ctime to be before now, special
- * case a 0 deadtime to force lock removal
- */
- if (dead == 0 || now - statb.st_ctime > dead) {
- (void) unlink (creat_name);
- (void) unlink (link_name);
- }
- }
-
- while (retries > 0) {
- if (creat_fd == -1) {
- creat_fd = open (creat_name, O_WRONLY | O_CREAT | O_EXCL, 0600);
- if (creat_fd == -1) {
- if (errno != EACCES)
- return LOCK_ERROR;
- } else
- (void) close (creat_fd);
- }
- if (creat_fd != -1) {
-#ifndef X_NOT_POSIX
- /* The file system may not support hard links, and pathconf should tell us that. */
- if (1 == pathconf(creat_name, _PC_LINK_MAX)) {
- if (-1 == rename(creat_name, link_name)) {
- /* Is this good enough? Perhaps we should retry. TEST */
- return LOCK_ERROR;
- } else {
- return LOCK_SUCCESS;
- }
- } else {
-#endif
- if (link (creat_name, link_name) != -1)
- return LOCK_SUCCESS;
- if (errno == ENOENT) {
- creat_fd = -1; /* force re-creat next time around */
- continue;
- }
- if (errno != EEXIST)
- return LOCK_ERROR;
-#ifndef X_NOT_POSIX
- }
-#endif
- }
- (void) sleep ((unsigned) timeout);
- --retries;
- }
- return LOCK_TIMEOUT;
-}
+/*
+
+Copyright 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.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xauth.h>
+#include <X11/Xos.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <time.h>
+#define Time_t time_t
+#ifndef X_NOT_POSIX
+#include <unistd.h>
+#else
+#ifndef WIN32
+extern unsigned sleep ();
+#else
+#include <X11/Xwindows.h>
+#define link rename
+#endif
+#endif
+#ifdef __UNIXOS2__
+#define link rename
+#endif
+
+int
+XauLockAuth (
+_Xconst char *file_name,
+int retries,
+int timeout,
+long dead)
+{
+ char creat_name[1025], link_name[1025];
+ struct stat statb;
+ Time_t now;
+ int creat_fd = -1;
+
+ if (strlen (file_name) > 1022)
+ return LOCK_ERROR;
+ (void) strcpy (creat_name, file_name);
+ (void) strcat (creat_name, "-c");
+ (void) strcpy (link_name, file_name);
+ (void) strcat (link_name, "-l");
+ if (stat (creat_name, &statb) != -1) {
+ now = time ((Time_t *) 0);
+ /*
+ * NFS may cause ctime to be before now, special
+ * case a 0 deadtime to force lock removal
+ */
+ if (dead == 0 || now - statb.st_ctime > dead) {
+ (void) unlink (creat_name);
+ (void) unlink (link_name);
+ }
+ }
+
+ while (retries > 0) {
+ if (creat_fd == -1) {
+ creat_fd = open (creat_name, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ if (creat_fd == -1) {
+ if (errno != EACCES)
+ return LOCK_ERROR;
+ } else
+ (void) close (creat_fd);
+ }
+ if (creat_fd != -1) {
+#ifndef X_NOT_POSIX
+ /* The file system may not support hard links, and pathconf should tell us that. */
+ if (1 == pathconf(creat_name, _PC_LINK_MAX)) {
+ if (-1 == rename(creat_name, link_name)) {
+ /* Is this good enough? Perhaps we should retry. TEST */
+ return LOCK_ERROR;
+ } else {
+ return LOCK_SUCCESS;
+ }
+ } else {
+#endif
+ if (link (creat_name, link_name) != -1)
+ return LOCK_SUCCESS;
+ if (errno == ENOENT) {
+ creat_fd = -1; /* force re-creat next time around */
+ continue;
+ }
+ if (errno != EEXIST)
+ return LOCK_ERROR;
+#ifndef X_NOT_POSIX
+ }
+#endif
+ }
+ (void) sleep ((unsigned) timeout);
+ --retries;
+ }
+ return LOCK_TIMEOUT;
+}
diff --git a/libXau/README b/libXau/README
index 9ee12e704..249a1a7a6 100644
--- a/libXau/README
+++ b/libXau/README
@@ -38,7 +38,7 @@ This scheme involves changes to the following parts of the sample release:
- add entries to user's auth file
- remove entries from user's auth file
-This mechanism assumes that the superuser and the transport layer between
+This mechanism assumes that the superuser and the transport layer between
the client and the server is secure.
@@ -46,7 +46,7 @@ Description
The sample implementation will use the xdm Display Manager to set up and
control the server's authorization file. Sites that do not run xdm will
-need to build their own mechanisms.
+need to build their own mechanisms.
Xdm uses a random key (seeded by the system time and check sum of /dev/kmem)
to generate a unique sequence of characters at 16 bytes long. This sequence
@@ -130,7 +130,7 @@ There are three types of input:
name non-NULL, data NULL - use the named authorization; get
data from that mechanism's default.
name non-NULL, data non-NULL - use the given authorization and data.
-
+
This interface is used by xdm and might also be used by any other
applications that wish to explicitly set the authorization information.
diff --git a/libXau/configure.ac b/libXau/configure.ac
index 09a872e05..c21fbcdb2 100644
--- a/libXau/configure.ac
+++ b/libXau/configure.ac
@@ -59,7 +59,7 @@ if test "x$xthreads" = "xyes" ; then
AC_CHECK_LIB(nsl, gethostbyname_r, [mtsafe=yes])
fi
if test "x$mtsafe" = "xyes" ; then
- AC_DEFINE(XUSE_MTSAFE_API, 1,
+ AC_DEFINE(XUSE_MTSAFE_API, 1,
[Whether libXau needs to use MT safe API's])
fi
diff --git a/libXdmcp/Wraphelp.c b/libXdmcp/Wraphelp.c
index 22da82cb1..99effdb0c 100644
--- a/libXdmcp/Wraphelp.c
+++ b/libXdmcp/Wraphelp.c
@@ -1,495 +1,495 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/types.h>
-#include <X11/Xmd.h>
-#include "Wrap.h"
-
-/* des routines for non-usa - eay 10/9/1991 eay@psych.psy.uq.oz.au
- * These routines were written for speed not size so they are bigger than
- * needed. I have removed some of the loop unrolling, this will reduce
- * code size at the expense of some speed.
- * 25/9/1991 eay - much faster _XdmcpAuthSetup (4 times faster).
- * 19/9/1991 eay - cleaned up the IP and FP code.
- * 10/9/1991 eay - first release.
- * The des routines this file has been made from can be found in
- * ftp.psy.uq.oz.au /pub/DES
- * This particular version derived from OpenBSD Revsion 1.3.
- */
-
-/*
- *
- * Export Requirements.
- * You may not export or re-export this software or any copy or
- * adaptation in violation of any applicable laws or regulations.
- *
- * Without limiting the generality of the foregoing, hardware, software,
- * technology or services provided under this license agreement may not
- * be exported, reexported, transferred or downloaded to or within (or to
- * a national resident of) countries under U.S. economic embargo
- * including the following countries:
- *
- * Cuba, Iran, Libya, North Korea, Sudan and Syria. This list is subject
- * to change.
- *
- * Hardware, software, technology or services may not be exported,
- * reexported, transferred or downloaded to persons or entities listed on
- * the U.S. Department of Commerce Denied Persons List, Entity List of
- * proliferation concern or on any U.S. Treasury Department Designated
- * Nationals exclusion list, or to parties directly or indirectly
- * involved in the development or production of nuclear, chemical,
- * biological weapons or in missile technology programs as specified in
- * the U.S. Export Administration Regulations (15 CFR 744).
- *
- * By accepting this license agreement you confirm that you are not
- * located in (or a national resident of) any country under U.S. economic
- * embargo, not identified on any U.S. Department of Commerce Denied
- * Persons List, Entity List or Treasury Department Designated Nationals
- * exclusion list, and not directly or indirectly involved in the
- * development or production of nuclear, chemical, biological weapons or
- * in missile technology programs as specified in the U.S. Export
- * Administration Regulations.
- *
- *
- * Local Country Import Requirements. The software you are about to
- * download contains cryptography technology. Some countries regulate the
- * import, use and/or export of certain products with cryptography. The
- * X.org Foundation makes no claims as to the applicability of local
- * country import, use and/or export regulations in relation to the
- * download of this product. If you are located outside the U.S. and
- * Canada you are advised to consult your local country regulations to
- * insure compliance.
- */
-
-static const CARD32 skb[8][64] = {
- /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
- { 0x00000000,0x00000010,0x20000000,0x20000010,
- 0x00010000,0x00010010,0x20010000,0x20010010,
- 0x00000800,0x00000810,0x20000800,0x20000810,
- 0x00010800,0x00010810,0x20010800,0x20010810,
- 0x00000020,0x00000030,0x20000020,0x20000030,
- 0x00010020,0x00010030,0x20010020,0x20010030,
- 0x00000820,0x00000830,0x20000820,0x20000830,
- 0x00010820,0x00010830,0x20010820,0x20010830,
- 0x00080000,0x00080010,0x20080000,0x20080010,
- 0x00090000,0x00090010,0x20090000,0x20090010,
- 0x00080800,0x00080810,0x20080800,0x20080810,
- 0x00090800,0x00090810,0x20090800,0x20090810,
- 0x00080020,0x00080030,0x20080020,0x20080030,
- 0x00090020,0x00090030,0x20090020,0x20090030,
- 0x00080820,0x00080830,0x20080820,0x20080830,
- 0x00090820,0x00090830,0x20090820,0x20090830 },
- /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */
- { 0x00000000,0x02000000,0x00002000,0x02002000,
- 0x00200000,0x02200000,0x00202000,0x02202000,
- 0x00000004,0x02000004,0x00002004,0x02002004,
- 0x00200004,0x02200004,0x00202004,0x02202004,
- 0x00000400,0x02000400,0x00002400,0x02002400,
- 0x00200400,0x02200400,0x00202400,0x02202400,
- 0x00000404,0x02000404,0x00002404,0x02002404,
- 0x00200404,0x02200404,0x00202404,0x02202404,
- 0x10000000,0x12000000,0x10002000,0x12002000,
- 0x10200000,0x12200000,0x10202000,0x12202000,
- 0x10000004,0x12000004,0x10002004,0x12002004,
- 0x10200004,0x12200004,0x10202004,0x12202004,
- 0x10000400,0x12000400,0x10002400,0x12002400,
- 0x10200400,0x12200400,0x10202400,0x12202400,
- 0x10000404,0x12000404,0x10002404,0x12002404,
- 0x10200404,0x12200404,0x10202404,0x12202404 },
- /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */
- { 0x00000000,0x00000001,0x00040000,0x00040001,
- 0x01000000,0x01000001,0x01040000,0x01040001,
- 0x00000002,0x00000003,0x00040002,0x00040003,
- 0x01000002,0x01000003,0x01040002,0x01040003,
- 0x00000200,0x00000201,0x00040200,0x00040201,
- 0x01000200,0x01000201,0x01040200,0x01040201,
- 0x00000202,0x00000203,0x00040202,0x00040203,
- 0x01000202,0x01000203,0x01040202,0x01040203,
- 0x08000000,0x08000001,0x08040000,0x08040001,
- 0x09000000,0x09000001,0x09040000,0x09040001,
- 0x08000002,0x08000003,0x08040002,0x08040003,
- 0x09000002,0x09000003,0x09040002,0x09040003,
- 0x08000200,0x08000201,0x08040200,0x08040201,
- 0x09000200,0x09000201,0x09040200,0x09040201,
- 0x08000202,0x08000203,0x08040202,0x08040203,
- 0x09000202,0x09000203,0x09040202,0x09040203 },
- /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */
- { 0x00000000,0x00100000,0x00000100,0x00100100,
- 0x00000008,0x00100008,0x00000108,0x00100108,
- 0x00001000,0x00101000,0x00001100,0x00101100,
- 0x00001008,0x00101008,0x00001108,0x00101108,
- 0x04000000,0x04100000,0x04000100,0x04100100,
- 0x04000008,0x04100008,0x04000108,0x04100108,
- 0x04001000,0x04101000,0x04001100,0x04101100,
- 0x04001008,0x04101008,0x04001108,0x04101108,
- 0x00020000,0x00120000,0x00020100,0x00120100,
- 0x00020008,0x00120008,0x00020108,0x00120108,
- 0x00021000,0x00121000,0x00021100,0x00121100,
- 0x00021008,0x00121008,0x00021108,0x00121108,
- 0x04020000,0x04120000,0x04020100,0x04120100,
- 0x04020008,0x04120008,0x04020108,0x04120108,
- 0x04021000,0x04121000,0x04021100,0x04121100,
- 0x04021008,0x04121008,0x04021108,0x04121108 },
- /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
- { 0x00000000,0x10000000,0x00010000,0x10010000,
- 0x00000004,0x10000004,0x00010004,0x10010004,
- 0x20000000,0x30000000,0x20010000,0x30010000,
- 0x20000004,0x30000004,0x20010004,0x30010004,
- 0x00100000,0x10100000,0x00110000,0x10110000,
- 0x00100004,0x10100004,0x00110004,0x10110004,
- 0x20100000,0x30100000,0x20110000,0x30110000,
- 0x20100004,0x30100004,0x20110004,0x30110004,
- 0x00001000,0x10001000,0x00011000,0x10011000,
- 0x00001004,0x10001004,0x00011004,0x10011004,
- 0x20001000,0x30001000,0x20011000,0x30011000,
- 0x20001004,0x30001004,0x20011004,0x30011004,
- 0x00101000,0x10101000,0x00111000,0x10111000,
- 0x00101004,0x10101004,0x00111004,0x10111004,
- 0x20101000,0x30101000,0x20111000,0x30111000,
- 0x20101004,0x30101004,0x20111004,0x30111004 },
- /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */
- { 0x00000000,0x08000000,0x00000008,0x08000008,
- 0x00000400,0x08000400,0x00000408,0x08000408,
- 0x00020000,0x08020000,0x00020008,0x08020008,
- 0x00020400,0x08020400,0x00020408,0x08020408,
- 0x00000001,0x08000001,0x00000009,0x08000009,
- 0x00000401,0x08000401,0x00000409,0x08000409,
- 0x00020001,0x08020001,0x00020009,0x08020009,
- 0x00020401,0x08020401,0x00020409,0x08020409,
- 0x02000000,0x0A000000,0x02000008,0x0A000008,
- 0x02000400,0x0A000400,0x02000408,0x0A000408,
- 0x02020000,0x0A020000,0x02020008,0x0A020008,
- 0x02020400,0x0A020400,0x02020408,0x0A020408,
- 0x02000001,0x0A000001,0x02000009,0x0A000009,
- 0x02000401,0x0A000401,0x02000409,0x0A000409,
- 0x02020001,0x0A020001,0x02020009,0x0A020009,
- 0x02020401,0x0A020401,0x02020409,0x0A020409 },
- /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */
- { 0x00000000,0x00000100,0x00080000,0x00080100,
- 0x01000000,0x01000100,0x01080000,0x01080100,
- 0x00000010,0x00000110,0x00080010,0x00080110,
- 0x01000010,0x01000110,0x01080010,0x01080110,
- 0x00200000,0x00200100,0x00280000,0x00280100,
- 0x01200000,0x01200100,0x01280000,0x01280100,
- 0x00200010,0x00200110,0x00280010,0x00280110,
- 0x01200010,0x01200110,0x01280010,0x01280110,
- 0x00000200,0x00000300,0x00080200,0x00080300,
- 0x01000200,0x01000300,0x01080200,0x01080300,
- 0x00000210,0x00000310,0x00080210,0x00080310,
- 0x01000210,0x01000310,0x01080210,0x01080310,
- 0x00200200,0x00200300,0x00280200,0x00280300,
- 0x01200200,0x01200300,0x01280200,0x01280300,
- 0x00200210,0x00200310,0x00280210,0x00280310,
- 0x01200210,0x01200310,0x01280210,0x01280310 },
- /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */
- { 0x00000000,0x04000000,0x00040000,0x04040000,
- 0x00000002,0x04000002,0x00040002,0x04040002,
- 0x00002000,0x04002000,0x00042000,0x04042000,
- 0x00002002,0x04002002,0x00042002,0x04042002,
- 0x00000020,0x04000020,0x00040020,0x04040020,
- 0x00000022,0x04000022,0x00040022,0x04040022,
- 0x00002020,0x04002020,0x00042020,0x04042020,
- 0x00002022,0x04002022,0x00042022,0x04042022,
- 0x00000800,0x04000800,0x00040800,0x04040800,
- 0x00000802,0x04000802,0x00040802,0x04040802,
- 0x00002800,0x04002800,0x00042800,0x04042800,
- 0x00002802,0x04002802,0x00042802,0x04042802,
- 0x00000820,0x04000820,0x00040820,0x04040820,
- 0x00000822,0x04000822,0x00040822,0x04040822,
- 0x00002820,0x04002820,0x00042820,0x04042820,
- 0x00002822,0x04002822,0x00042822,0x04042822 }
-};
-
-
-static const CARD32 SPtrans[8][64] = {
- /* nibble 0 */
- { 0x00410100, 0x00010000, 0x40400000, 0x40410100,
- 0x00400000, 0x40010100, 0x40010000, 0x40400000,
- 0x40010100, 0x00410100, 0x00410000, 0x40000100,
- 0x40400100, 0x00400000, 0x00000000, 0x40010000,
- 0x00010000, 0x40000000, 0x00400100, 0x00010100,
- 0x40410100, 0x00410000, 0x40000100, 0x00400100,
- 0x40000000, 0x00000100, 0x00010100, 0x40410000,
- 0x00000100, 0x40400100, 0x40410000, 0x00000000,
- 0x00000000, 0x40410100, 0x00400100, 0x40010000,
- 0x00410100, 0x00010000, 0x40000100, 0x00400100,
- 0x40410000, 0x00000100, 0x00010100, 0x40400000,
- 0x40010100, 0x40000000, 0x40400000, 0x00410000,
- 0x40410100, 0x00010100, 0x00410000, 0x40400100,
- 0x00400000, 0x40000100, 0x40010000, 0x00000000,
- 0x00010000, 0x00400000, 0x40400100, 0x00410100,
- 0x40000000, 0x40410000, 0x00000100, 0x40010100 },
-
- /* nibble 1 */
- { 0x08021002, 0x00000000, 0x00021000, 0x08020000,
- 0x08000002, 0x00001002, 0x08001000, 0x00021000,
- 0x00001000, 0x08020002, 0x00000002, 0x08001000,
- 0x00020002, 0x08021000, 0x08020000, 0x00000002,
- 0x00020000, 0x08001002, 0x08020002, 0x00001000,
- 0x00021002, 0x08000000, 0x00000000, 0x00020002,
- 0x08001002, 0x00021002, 0x08021000, 0x08000002,
- 0x08000000, 0x00020000, 0x00001002, 0x08021002,
- 0x00020002, 0x08021000, 0x08001000, 0x00021002,
- 0x08021002, 0x00020002, 0x08000002, 0x00000000,
- 0x08000000, 0x00001002, 0x00020000, 0x08020002,
- 0x00001000, 0x08000000, 0x00021002, 0x08001002,
- 0x08021000, 0x00001000, 0x00000000, 0x08000002,
- 0x00000002, 0x08021002, 0x00021000, 0x08020000,
- 0x08020002, 0x00020000, 0x00001002, 0x08001000,
- 0x08001002, 0x00000002, 0x08020000, 0x00021000 },
-
- /* nibble 2 */
- { 0x20800000, 0x00808020, 0x00000020, 0x20800020,
- 0x20008000, 0x00800000, 0x20800020, 0x00008020,
- 0x00800020, 0x00008000, 0x00808000, 0x20000000,
- 0x20808020, 0x20000020, 0x20000000, 0x20808000,
- 0x00000000, 0x20008000, 0x00808020, 0x00000020,
- 0x20000020, 0x20808020, 0x00008000, 0x20800000,
- 0x20808000, 0x00800020, 0x20008020, 0x00808000,
- 0x00008020, 0x00000000, 0x00800000, 0x20008020,
- 0x00808020, 0x00000020, 0x20000000, 0x00008000,
- 0x20000020, 0x20008000, 0x00808000, 0x20800020,
- 0x00000000, 0x00808020, 0x00008020, 0x20808000,
- 0x20008000, 0x00800000, 0x20808020, 0x20000000,
- 0x20008020, 0x20800000, 0x00800000, 0x20808020,
- 0x00008000, 0x00800020, 0x20800020, 0x00008020,
- 0x00800020, 0x00000000, 0x20808000, 0x20000020,
- 0x20800000, 0x20008020, 0x00000020, 0x00808000 },
-
- /* nibble 3 */
- { 0x00080201, 0x02000200, 0x00000001, 0x02080201,
- 0x00000000, 0x02080000, 0x02000201, 0x00080001,
- 0x02080200, 0x02000001, 0x02000000, 0x00000201,
- 0x02000001, 0x00080201, 0x00080000, 0x02000000,
- 0x02080001, 0x00080200, 0x00000200, 0x00000001,
- 0x00080200, 0x02000201, 0x02080000, 0x00000200,
- 0x00000201, 0x00000000, 0x00080001, 0x02080200,
- 0x02000200, 0x02080001, 0x02080201, 0x00080000,
- 0x02080001, 0x00000201, 0x00080000, 0x02000001,
- 0x00080200, 0x02000200, 0x00000001, 0x02080000,
- 0x02000201, 0x00000000, 0x00000200, 0x00080001,
- 0x00000000, 0x02080001, 0x02080200, 0x00000200,
- 0x02000000, 0x02080201, 0x00080201, 0x00080000,
- 0x02080201, 0x00000001, 0x02000200, 0x00080201,
- 0x00080001, 0x00080200, 0x02080000, 0x02000201,
- 0x00000201, 0x02000000, 0x02000001, 0x02080200 },
-
- /* nibble 4 */
- { 0x01000000, 0x00002000, 0x00000080, 0x01002084,
- 0x01002004, 0x01000080, 0x00002084, 0x01002000,
- 0x00002000, 0x00000004, 0x01000004, 0x00002080,
- 0x01000084, 0x01002004, 0x01002080, 0x00000000,
- 0x00002080, 0x01000000, 0x00002004, 0x00000084,
- 0x01000080, 0x00002084, 0x00000000, 0x01000004,
- 0x00000004, 0x01000084, 0x01002084, 0x00002004,
- 0x01002000, 0x00000080, 0x00000084, 0x01002080,
- 0x01002080, 0x01000084, 0x00002004, 0x01002000,
- 0x00002000, 0x00000004, 0x01000004, 0x01000080,
- 0x01000000, 0x00002080, 0x01002084, 0x00000000,
- 0x00002084, 0x01000000, 0x00000080, 0x00002004,
- 0x01000084, 0x00000080, 0x00000000, 0x01002084,
- 0x01002004, 0x01002080, 0x00000084, 0x00002000,
- 0x00002080, 0x01002004, 0x01000080, 0x00000084,
- 0x00000004, 0x00002084, 0x01002000, 0x01000004 },
-
- /* nibble 5 */
- { 0x10000008, 0x00040008, 0x00000000, 0x10040400,
- 0x00040008, 0x00000400, 0x10000408, 0x00040000,
- 0x00000408, 0x10040408, 0x00040400, 0x10000000,
- 0x10000400, 0x10000008, 0x10040000, 0x00040408,
- 0x00040000, 0x10000408, 0x10040008, 0x00000000,
- 0x00000400, 0x00000008, 0x10040400, 0x10040008,
- 0x10040408, 0x10040000, 0x10000000, 0x00000408,
- 0x00000008, 0x00040400, 0x00040408, 0x10000400,
- 0x00000408, 0x10000000, 0x10000400, 0x00040408,
- 0x10040400, 0x00040008, 0x00000000, 0x10000400,
- 0x10000000, 0x00000400, 0x10040008, 0x00040000,
- 0x00040008, 0x10040408, 0x00040400, 0x00000008,
- 0x10040408, 0x00040400, 0x00040000, 0x10000408,
- 0x10000008, 0x10040000, 0x00040408, 0x00000000,
- 0x00000400, 0x10000008, 0x10000408, 0x10040400,
- 0x10040000, 0x00000408, 0x00000008, 0x10040008 },
-
- /* nibble 6 */
- { 0x00000800, 0x00000040, 0x00200040, 0x80200000,
- 0x80200840, 0x80000800, 0x00000840, 0x00000000,
- 0x00200000, 0x80200040, 0x80000040, 0x00200800,
- 0x80000000, 0x00200840, 0x00200800, 0x80000040,
- 0x80200040, 0x00000800, 0x80000800, 0x80200840,
- 0x00000000, 0x00200040, 0x80200000, 0x00000840,
- 0x80200800, 0x80000840, 0x00200840, 0x80000000,
- 0x80000840, 0x80200800, 0x00000040, 0x00200000,
- 0x80000840, 0x00200800, 0x80200800, 0x80000040,
- 0x00000800, 0x00000040, 0x00200000, 0x80200800,
- 0x80200040, 0x80000840, 0x00000840, 0x00000000,
- 0x00000040, 0x80200000, 0x80000000, 0x00200040,
- 0x00000000, 0x80200040, 0x00200040, 0x00000840,
- 0x80000040, 0x00000800, 0x80200840, 0x00200000,
- 0x00200840, 0x80000000, 0x80000800, 0x80200840,
- 0x80200000, 0x00200840, 0x00200800, 0x80000800 },
-
- /* nibble 7 */
- { 0x04100010, 0x04104000, 0x00004010, 0x00000000,
- 0x04004000, 0x00100010, 0x04100000, 0x04104010,
- 0x00000010, 0x04000000, 0x00104000, 0x00004010,
- 0x00104010, 0x04004010, 0x04000010, 0x04100000,
- 0x00004000, 0x00104010, 0x00100010, 0x04004000,
- 0x04104010, 0x04000010, 0x00000000, 0x00104000,
- 0x04000000, 0x00100000, 0x04004010, 0x04100010,
- 0x00100000, 0x00004000, 0x04104000, 0x00000010,
- 0x00100000, 0x00004000, 0x04000010, 0x04104010,
- 0x00004010, 0x04000000, 0x00000000, 0x00104000,
- 0x04100010, 0x04004010, 0x04004000, 0x00100010,
- 0x04104000, 0x00000010, 0x00100010, 0x04004000,
- 0x04104010, 0x00100000, 0x04100000, 0x04000010,
- 0x00104000, 0x00004010, 0x04004010, 0x04100000,
- 0x00000010, 0x04104000, 0x00104010, 0x00000000,
- 0x04000000, 0x04100010, 0x00004000, 0x00104010}
-};
-
-#define ITERATIONS 16
-#define HALF_ITERATIONS 8
-
-#define c2l(c,l) (l =((CARD32)(*((c)++))) , \
- l|=((CARD32)(*((c)++)))<< 8, \
- l|=((CARD32)(*((c)++)))<<16, \
- l|=((CARD32)(*((c)++)))<<24)
-
-#define l2c(l,c) (*((c)++)=(CARD8)(((l) )&0xff), \
- *((c)++)=(CARD8)(((l)>> 8)&0xff), \
- *((c)++)=(CARD8)(((l)>>16)&0xff), \
- *((c)++)=(CARD8)(((l)>>24)&0xff))
-
-#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\
- (b)^=(t),\
- (a)^=((t)<<(n)))
-
-#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\
- (a)=(a)^(t)^(t>>(16-(n))))\
-
-static const char shifts2[16] = {0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
-
-void _XdmcpAuthSetup(auth_cblock key, auth_wrapper_schedule schedule)
-{
- CARD32 c,d,t,s;
- CARD8 *in;
- CARD32 *k;
- int i;
-
- k=(CARD32 *)schedule;
- in=(CARD8 *)key;
-
- c2l(in,c);
- c2l(in,d);
-
- /* do PC1 in 60 simple operations */
- PERM_OP(d,c,t,4,0x0f0f0f0f);
- HPERM_OP(c,t,-2, 0xcccc0000);
- HPERM_OP(c,t,-1, 0xaaaa0000);
- HPERM_OP(c,t, 8, 0x00ff0000);
- HPERM_OP(c,t,-1, 0xaaaa0000);
- HPERM_OP(d,t,-8, 0xff000000);
- HPERM_OP(d,t, 8, 0x00ff0000);
- HPERM_OP(d,t, 2, 0x33330000);
- d=((d&0x00aa00aa)<<7)|((d&0x55005500)>>7)|(d&0xaa55aa55);
- d=(d>>8)|((c&0xf0000000)>>4);
- c&=0x0fffffff;
-
- for (i=0; i<ITERATIONS; i++) {
- if (shifts2[i]) {
- c=((c>>2)|(c<<26)); d=((d>>2)|(d<<26));
- } else {
- c=((c>>1)|(c<<27)); d=((d>>1)|(d<<27));
- }
- c&=0x0fffffff;
- d&=0x0fffffff;
- /* could be a few less shifts but I am to lazy at this
- * point in time to investigate */
- s= skb[0][ (c )&0x3f ]|
- skb[1][((c>> 6)&0x03)|((c>> 7)&0x3c)]|
- skb[2][((c>>13)&0x0f)|((c>>14)&0x30)]|
- skb[3][((c>>20)&0x01)|((c>>21)&0x06) |
- ((c>>22)&0x38)];
- t= skb[4][ (d )&0x3f ]|
- skb[5][((d>> 7)&0x03)|((d>> 8)&0x3c)]|
- skb[6][ (d>>15)&0x3f ]|
- skb[7][((d>>21)&0x0f)|((d>>22)&0x30)];
-
- /* table contained 0213 4657 */
- *(k++)=((t<<16)|(s&0x0000ffff));
- s= ((s>>16)|(t&0xffff0000));
-
- s=(s<<4)|(s>>28);
- *(k++)=s;
- }
- return;
-}
-
-#define D_ENCRYPT(L,R,S) \
- t=(R<<1)|(R>>31); \
- u=(t^s[S ]); \
- t=(t^s[S+1]); \
- t=(t>>4)|(t<<28); \
- L^= SPtrans[1][(t )&0x3f]| \
- SPtrans[3][(t>> 8)&0x3f]| \
- SPtrans[5][(t>>16)&0x3f]| \
- SPtrans[7][(t>>24)&0x3f]| \
- SPtrans[0][(u )&0x3f]| \
- SPtrans[2][(u>> 8)&0x3f]| \
- SPtrans[4][(u>>16)&0x3f]| \
- SPtrans[6][(u>>24)&0x3f];
-
-
-void _XdmcpAuthDoIt(auth_cblock input, auth_cblock output,
- auth_wrapper_schedule ks, int encrypt)
-{
- CARD32 l,r,t,u;
- CARD32 *s;
- CARD8 *in,*out;
- int i;
-
- in=(CARD8 *)input;
- out=(CARD8 *)output;
- c2l(in,l);
- c2l(in,r);
-
- /* do IP */
- PERM_OP(r,l,t, 4,0x0f0f0f0f);
- PERM_OP(l,r,t,16,0x0000ffff);
- PERM_OP(r,l,t, 2,0x33333333);
- PERM_OP(l,r,t, 8,0x00ff00ff);
- PERM_OP(r,l,t, 1,0x55555555);
- /* r and l are reversed - remember that :-) */
- t=l;
- l=r;
- r=t;
-
- s=(CARD32 *)ks;
-
- if (encrypt) {
- for (i=0; i<(ITERATIONS*2); i+=4) {
- D_ENCRYPT(l,r, i); /* 1 */
- D_ENCRYPT(r,l, i+2); /* 2 */
- }
- } else {
- for (i=(ITERATIONS*2)-2; i >= 0; i-=4) {
- D_ENCRYPT(l,r, i); /* 1 */
- D_ENCRYPT(r,l, i-2); /* 2 */
- }
- }
-
- /* swap l and r
- * we will not do the swap so just remember they are
- * reversed for the rest of the subroutine
- * luckily by FP fixes this problem :-) */
-
- PERM_OP(r,l,t, 1,0x55555555);
- PERM_OP(l,r,t, 8,0x00ff00ff);
- PERM_OP(r,l,t, 2,0x33333333);
- PERM_OP(l,r,t,16,0x0000ffff);
- PERM_OP(r,l,t, 4,0x0f0f0f0f);
-
- l2c(l,out);
- l2c(r,out);
- return;
-}
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <sys/types.h>
+#include <X11/Xmd.h>
+#include "Wrap.h"
+
+/* des routines for non-usa - eay 10/9/1991 eay@psych.psy.uq.oz.au
+ * These routines were written for speed not size so they are bigger than
+ * needed. I have removed some of the loop unrolling, this will reduce
+ * code size at the expense of some speed.
+ * 25/9/1991 eay - much faster _XdmcpAuthSetup (4 times faster).
+ * 19/9/1991 eay - cleaned up the IP and FP code.
+ * 10/9/1991 eay - first release.
+ * The des routines this file has been made from can be found in
+ * ftp.psy.uq.oz.au /pub/DES
+ * This particular version derived from OpenBSD Revsion 1.3.
+ */
+
+/*
+ *
+ * Export Requirements.
+ * You may not export or re-export this software or any copy or
+ * adaptation in violation of any applicable laws or regulations.
+ *
+ * Without limiting the generality of the foregoing, hardware, software,
+ * technology or services provided under this license agreement may not
+ * be exported, reexported, transferred or downloaded to or within (or to
+ * a national resident of) countries under U.S. economic embargo
+ * including the following countries:
+ *
+ * Cuba, Iran, Libya, North Korea, Sudan and Syria. This list is subject
+ * to change.
+ *
+ * Hardware, software, technology or services may not be exported,
+ * reexported, transferred or downloaded to persons or entities listed on
+ * the U.S. Department of Commerce Denied Persons List, Entity List of
+ * proliferation concern or on any U.S. Treasury Department Designated
+ * Nationals exclusion list, or to parties directly or indirectly
+ * involved in the development or production of nuclear, chemical,
+ * biological weapons or in missile technology programs as specified in
+ * the U.S. Export Administration Regulations (15 CFR 744).
+ *
+ * By accepting this license agreement you confirm that you are not
+ * located in (or a national resident of) any country under U.S. economic
+ * embargo, not identified on any U.S. Department of Commerce Denied
+ * Persons List, Entity List or Treasury Department Designated Nationals
+ * exclusion list, and not directly or indirectly involved in the
+ * development or production of nuclear, chemical, biological weapons or
+ * in missile technology programs as specified in the U.S. Export
+ * Administration Regulations.
+ *
+ *
+ * Local Country Import Requirements. The software you are about to
+ * download contains cryptography technology. Some countries regulate the
+ * import, use and/or export of certain products with cryptography. The
+ * X.org Foundation makes no claims as to the applicability of local
+ * country import, use and/or export regulations in relation to the
+ * download of this product. If you are located outside the U.S. and
+ * Canada you are advised to consult your local country regulations to
+ * insure compliance.
+ */
+
+static const CARD32 skb[8][64] = {
+ /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
+ { 0x00000000,0x00000010,0x20000000,0x20000010,
+ 0x00010000,0x00010010,0x20010000,0x20010010,
+ 0x00000800,0x00000810,0x20000800,0x20000810,
+ 0x00010800,0x00010810,0x20010800,0x20010810,
+ 0x00000020,0x00000030,0x20000020,0x20000030,
+ 0x00010020,0x00010030,0x20010020,0x20010030,
+ 0x00000820,0x00000830,0x20000820,0x20000830,
+ 0x00010820,0x00010830,0x20010820,0x20010830,
+ 0x00080000,0x00080010,0x20080000,0x20080010,
+ 0x00090000,0x00090010,0x20090000,0x20090010,
+ 0x00080800,0x00080810,0x20080800,0x20080810,
+ 0x00090800,0x00090810,0x20090800,0x20090810,
+ 0x00080020,0x00080030,0x20080020,0x20080030,
+ 0x00090020,0x00090030,0x20090020,0x20090030,
+ 0x00080820,0x00080830,0x20080820,0x20080830,
+ 0x00090820,0x00090830,0x20090820,0x20090830 },
+ /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */
+ { 0x00000000,0x02000000,0x00002000,0x02002000,
+ 0x00200000,0x02200000,0x00202000,0x02202000,
+ 0x00000004,0x02000004,0x00002004,0x02002004,
+ 0x00200004,0x02200004,0x00202004,0x02202004,
+ 0x00000400,0x02000400,0x00002400,0x02002400,
+ 0x00200400,0x02200400,0x00202400,0x02202400,
+ 0x00000404,0x02000404,0x00002404,0x02002404,
+ 0x00200404,0x02200404,0x00202404,0x02202404,
+ 0x10000000,0x12000000,0x10002000,0x12002000,
+ 0x10200000,0x12200000,0x10202000,0x12202000,
+ 0x10000004,0x12000004,0x10002004,0x12002004,
+ 0x10200004,0x12200004,0x10202004,0x12202004,
+ 0x10000400,0x12000400,0x10002400,0x12002400,
+ 0x10200400,0x12200400,0x10202400,0x12202400,
+ 0x10000404,0x12000404,0x10002404,0x12002404,
+ 0x10200404,0x12200404,0x10202404,0x12202404 },
+ /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */
+ { 0x00000000,0x00000001,0x00040000,0x00040001,
+ 0x01000000,0x01000001,0x01040000,0x01040001,
+ 0x00000002,0x00000003,0x00040002,0x00040003,
+ 0x01000002,0x01000003,0x01040002,0x01040003,
+ 0x00000200,0x00000201,0x00040200,0x00040201,
+ 0x01000200,0x01000201,0x01040200,0x01040201,
+ 0x00000202,0x00000203,0x00040202,0x00040203,
+ 0x01000202,0x01000203,0x01040202,0x01040203,
+ 0x08000000,0x08000001,0x08040000,0x08040001,
+ 0x09000000,0x09000001,0x09040000,0x09040001,
+ 0x08000002,0x08000003,0x08040002,0x08040003,
+ 0x09000002,0x09000003,0x09040002,0x09040003,
+ 0x08000200,0x08000201,0x08040200,0x08040201,
+ 0x09000200,0x09000201,0x09040200,0x09040201,
+ 0x08000202,0x08000203,0x08040202,0x08040203,
+ 0x09000202,0x09000203,0x09040202,0x09040203 },
+ /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */
+ { 0x00000000,0x00100000,0x00000100,0x00100100,
+ 0x00000008,0x00100008,0x00000108,0x00100108,
+ 0x00001000,0x00101000,0x00001100,0x00101100,
+ 0x00001008,0x00101008,0x00001108,0x00101108,
+ 0x04000000,0x04100000,0x04000100,0x04100100,
+ 0x04000008,0x04100008,0x04000108,0x04100108,
+ 0x04001000,0x04101000,0x04001100,0x04101100,
+ 0x04001008,0x04101008,0x04001108,0x04101108,
+ 0x00020000,0x00120000,0x00020100,0x00120100,
+ 0x00020008,0x00120008,0x00020108,0x00120108,
+ 0x00021000,0x00121000,0x00021100,0x00121100,
+ 0x00021008,0x00121008,0x00021108,0x00121108,
+ 0x04020000,0x04120000,0x04020100,0x04120100,
+ 0x04020008,0x04120008,0x04020108,0x04120108,
+ 0x04021000,0x04121000,0x04021100,0x04121100,
+ 0x04021008,0x04121008,0x04021108,0x04121108 },
+ /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
+ { 0x00000000,0x10000000,0x00010000,0x10010000,
+ 0x00000004,0x10000004,0x00010004,0x10010004,
+ 0x20000000,0x30000000,0x20010000,0x30010000,
+ 0x20000004,0x30000004,0x20010004,0x30010004,
+ 0x00100000,0x10100000,0x00110000,0x10110000,
+ 0x00100004,0x10100004,0x00110004,0x10110004,
+ 0x20100000,0x30100000,0x20110000,0x30110000,
+ 0x20100004,0x30100004,0x20110004,0x30110004,
+ 0x00001000,0x10001000,0x00011000,0x10011000,
+ 0x00001004,0x10001004,0x00011004,0x10011004,
+ 0x20001000,0x30001000,0x20011000,0x30011000,
+ 0x20001004,0x30001004,0x20011004,0x30011004,
+ 0x00101000,0x10101000,0x00111000,0x10111000,
+ 0x00101004,0x10101004,0x00111004,0x10111004,
+ 0x20101000,0x30101000,0x20111000,0x30111000,
+ 0x20101004,0x30101004,0x20111004,0x30111004 },
+ /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */
+ { 0x00000000,0x08000000,0x00000008,0x08000008,
+ 0x00000400,0x08000400,0x00000408,0x08000408,
+ 0x00020000,0x08020000,0x00020008,0x08020008,
+ 0x00020400,0x08020400,0x00020408,0x08020408,
+ 0x00000001,0x08000001,0x00000009,0x08000009,
+ 0x00000401,0x08000401,0x00000409,0x08000409,
+ 0x00020001,0x08020001,0x00020009,0x08020009,
+ 0x00020401,0x08020401,0x00020409,0x08020409,
+ 0x02000000,0x0A000000,0x02000008,0x0A000008,
+ 0x02000400,0x0A000400,0x02000408,0x0A000408,
+ 0x02020000,0x0A020000,0x02020008,0x0A020008,
+ 0x02020400,0x0A020400,0x02020408,0x0A020408,
+ 0x02000001,0x0A000001,0x02000009,0x0A000009,
+ 0x02000401,0x0A000401,0x02000409,0x0A000409,
+ 0x02020001,0x0A020001,0x02020009,0x0A020009,
+ 0x02020401,0x0A020401,0x02020409,0x0A020409 },
+ /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */
+ { 0x00000000,0x00000100,0x00080000,0x00080100,
+ 0x01000000,0x01000100,0x01080000,0x01080100,
+ 0x00000010,0x00000110,0x00080010,0x00080110,
+ 0x01000010,0x01000110,0x01080010,0x01080110,
+ 0x00200000,0x00200100,0x00280000,0x00280100,
+ 0x01200000,0x01200100,0x01280000,0x01280100,
+ 0x00200010,0x00200110,0x00280010,0x00280110,
+ 0x01200010,0x01200110,0x01280010,0x01280110,
+ 0x00000200,0x00000300,0x00080200,0x00080300,
+ 0x01000200,0x01000300,0x01080200,0x01080300,
+ 0x00000210,0x00000310,0x00080210,0x00080310,
+ 0x01000210,0x01000310,0x01080210,0x01080310,
+ 0x00200200,0x00200300,0x00280200,0x00280300,
+ 0x01200200,0x01200300,0x01280200,0x01280300,
+ 0x00200210,0x00200310,0x00280210,0x00280310,
+ 0x01200210,0x01200310,0x01280210,0x01280310 },
+ /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */
+ { 0x00000000,0x04000000,0x00040000,0x04040000,
+ 0x00000002,0x04000002,0x00040002,0x04040002,
+ 0x00002000,0x04002000,0x00042000,0x04042000,
+ 0x00002002,0x04002002,0x00042002,0x04042002,
+ 0x00000020,0x04000020,0x00040020,0x04040020,
+ 0x00000022,0x04000022,0x00040022,0x04040022,
+ 0x00002020,0x04002020,0x00042020,0x04042020,
+ 0x00002022,0x04002022,0x00042022,0x04042022,
+ 0x00000800,0x04000800,0x00040800,0x04040800,
+ 0x00000802,0x04000802,0x00040802,0x04040802,
+ 0x00002800,0x04002800,0x00042800,0x04042800,
+ 0x00002802,0x04002802,0x00042802,0x04042802,
+ 0x00000820,0x04000820,0x00040820,0x04040820,
+ 0x00000822,0x04000822,0x00040822,0x04040822,
+ 0x00002820,0x04002820,0x00042820,0x04042820,
+ 0x00002822,0x04002822,0x00042822,0x04042822 }
+};
+
+
+static const CARD32 SPtrans[8][64] = {
+ /* nibble 0 */
+ { 0x00410100, 0x00010000, 0x40400000, 0x40410100,
+ 0x00400000, 0x40010100, 0x40010000, 0x40400000,
+ 0x40010100, 0x00410100, 0x00410000, 0x40000100,
+ 0x40400100, 0x00400000, 0x00000000, 0x40010000,
+ 0x00010000, 0x40000000, 0x00400100, 0x00010100,
+ 0x40410100, 0x00410000, 0x40000100, 0x00400100,
+ 0x40000000, 0x00000100, 0x00010100, 0x40410000,
+ 0x00000100, 0x40400100, 0x40410000, 0x00000000,
+ 0x00000000, 0x40410100, 0x00400100, 0x40010000,
+ 0x00410100, 0x00010000, 0x40000100, 0x00400100,
+ 0x40410000, 0x00000100, 0x00010100, 0x40400000,
+ 0x40010100, 0x40000000, 0x40400000, 0x00410000,
+ 0x40410100, 0x00010100, 0x00410000, 0x40400100,
+ 0x00400000, 0x40000100, 0x40010000, 0x00000000,
+ 0x00010000, 0x00400000, 0x40400100, 0x00410100,
+ 0x40000000, 0x40410000, 0x00000100, 0x40010100 },
+
+ /* nibble 1 */
+ { 0x08021002, 0x00000000, 0x00021000, 0x08020000,
+ 0x08000002, 0x00001002, 0x08001000, 0x00021000,
+ 0x00001000, 0x08020002, 0x00000002, 0x08001000,
+ 0x00020002, 0x08021000, 0x08020000, 0x00000002,
+ 0x00020000, 0x08001002, 0x08020002, 0x00001000,
+ 0x00021002, 0x08000000, 0x00000000, 0x00020002,
+ 0x08001002, 0x00021002, 0x08021000, 0x08000002,
+ 0x08000000, 0x00020000, 0x00001002, 0x08021002,
+ 0x00020002, 0x08021000, 0x08001000, 0x00021002,
+ 0x08021002, 0x00020002, 0x08000002, 0x00000000,
+ 0x08000000, 0x00001002, 0x00020000, 0x08020002,
+ 0x00001000, 0x08000000, 0x00021002, 0x08001002,
+ 0x08021000, 0x00001000, 0x00000000, 0x08000002,
+ 0x00000002, 0x08021002, 0x00021000, 0x08020000,
+ 0x08020002, 0x00020000, 0x00001002, 0x08001000,
+ 0x08001002, 0x00000002, 0x08020000, 0x00021000 },
+
+ /* nibble 2 */
+ { 0x20800000, 0x00808020, 0x00000020, 0x20800020,
+ 0x20008000, 0x00800000, 0x20800020, 0x00008020,
+ 0x00800020, 0x00008000, 0x00808000, 0x20000000,
+ 0x20808020, 0x20000020, 0x20000000, 0x20808000,
+ 0x00000000, 0x20008000, 0x00808020, 0x00000020,
+ 0x20000020, 0x20808020, 0x00008000, 0x20800000,
+ 0x20808000, 0x00800020, 0x20008020, 0x00808000,
+ 0x00008020, 0x00000000, 0x00800000, 0x20008020,
+ 0x00808020, 0x00000020, 0x20000000, 0x00008000,
+ 0x20000020, 0x20008000, 0x00808000, 0x20800020,
+ 0x00000000, 0x00808020, 0x00008020, 0x20808000,
+ 0x20008000, 0x00800000, 0x20808020, 0x20000000,
+ 0x20008020, 0x20800000, 0x00800000, 0x20808020,
+ 0x00008000, 0x00800020, 0x20800020, 0x00008020,
+ 0x00800020, 0x00000000, 0x20808000, 0x20000020,
+ 0x20800000, 0x20008020, 0x00000020, 0x00808000 },
+
+ /* nibble 3 */
+ { 0x00080201, 0x02000200, 0x00000001, 0x02080201,
+ 0x00000000, 0x02080000, 0x02000201, 0x00080001,
+ 0x02080200, 0x02000001, 0x02000000, 0x00000201,
+ 0x02000001, 0x00080201, 0x00080000, 0x02000000,
+ 0x02080001, 0x00080200, 0x00000200, 0x00000001,
+ 0x00080200, 0x02000201, 0x02080000, 0x00000200,
+ 0x00000201, 0x00000000, 0x00080001, 0x02080200,
+ 0x02000200, 0x02080001, 0x02080201, 0x00080000,
+ 0x02080001, 0x00000201, 0x00080000, 0x02000001,
+ 0x00080200, 0x02000200, 0x00000001, 0x02080000,
+ 0x02000201, 0x00000000, 0x00000200, 0x00080001,
+ 0x00000000, 0x02080001, 0x02080200, 0x00000200,
+ 0x02000000, 0x02080201, 0x00080201, 0x00080000,
+ 0x02080201, 0x00000001, 0x02000200, 0x00080201,
+ 0x00080001, 0x00080200, 0x02080000, 0x02000201,
+ 0x00000201, 0x02000000, 0x02000001, 0x02080200 },
+
+ /* nibble 4 */
+ { 0x01000000, 0x00002000, 0x00000080, 0x01002084,
+ 0x01002004, 0x01000080, 0x00002084, 0x01002000,
+ 0x00002000, 0x00000004, 0x01000004, 0x00002080,
+ 0x01000084, 0x01002004, 0x01002080, 0x00000000,
+ 0x00002080, 0x01000000, 0x00002004, 0x00000084,
+ 0x01000080, 0x00002084, 0x00000000, 0x01000004,
+ 0x00000004, 0x01000084, 0x01002084, 0x00002004,
+ 0x01002000, 0x00000080, 0x00000084, 0x01002080,
+ 0x01002080, 0x01000084, 0x00002004, 0x01002000,
+ 0x00002000, 0x00000004, 0x01000004, 0x01000080,
+ 0x01000000, 0x00002080, 0x01002084, 0x00000000,
+ 0x00002084, 0x01000000, 0x00000080, 0x00002004,
+ 0x01000084, 0x00000080, 0x00000000, 0x01002084,
+ 0x01002004, 0x01002080, 0x00000084, 0x00002000,
+ 0x00002080, 0x01002004, 0x01000080, 0x00000084,
+ 0x00000004, 0x00002084, 0x01002000, 0x01000004 },
+
+ /* nibble 5 */
+ { 0x10000008, 0x00040008, 0x00000000, 0x10040400,
+ 0x00040008, 0x00000400, 0x10000408, 0x00040000,
+ 0x00000408, 0x10040408, 0x00040400, 0x10000000,
+ 0x10000400, 0x10000008, 0x10040000, 0x00040408,
+ 0x00040000, 0x10000408, 0x10040008, 0x00000000,
+ 0x00000400, 0x00000008, 0x10040400, 0x10040008,
+ 0x10040408, 0x10040000, 0x10000000, 0x00000408,
+ 0x00000008, 0x00040400, 0x00040408, 0x10000400,
+ 0x00000408, 0x10000000, 0x10000400, 0x00040408,
+ 0x10040400, 0x00040008, 0x00000000, 0x10000400,
+ 0x10000000, 0x00000400, 0x10040008, 0x00040000,
+ 0x00040008, 0x10040408, 0x00040400, 0x00000008,
+ 0x10040408, 0x00040400, 0x00040000, 0x10000408,
+ 0x10000008, 0x10040000, 0x00040408, 0x00000000,
+ 0x00000400, 0x10000008, 0x10000408, 0x10040400,
+ 0x10040000, 0x00000408, 0x00000008, 0x10040008 },
+
+ /* nibble 6 */
+ { 0x00000800, 0x00000040, 0x00200040, 0x80200000,
+ 0x80200840, 0x80000800, 0x00000840, 0x00000000,
+ 0x00200000, 0x80200040, 0x80000040, 0x00200800,
+ 0x80000000, 0x00200840, 0x00200800, 0x80000040,
+ 0x80200040, 0x00000800, 0x80000800, 0x80200840,
+ 0x00000000, 0x00200040, 0x80200000, 0x00000840,
+ 0x80200800, 0x80000840, 0x00200840, 0x80000000,
+ 0x80000840, 0x80200800, 0x00000040, 0x00200000,
+ 0x80000840, 0x00200800, 0x80200800, 0x80000040,
+ 0x00000800, 0x00000040, 0x00200000, 0x80200800,
+ 0x80200040, 0x80000840, 0x00000840, 0x00000000,
+ 0x00000040, 0x80200000, 0x80000000, 0x00200040,
+ 0x00000000, 0x80200040, 0x00200040, 0x00000840,
+ 0x80000040, 0x00000800, 0x80200840, 0x00200000,
+ 0x00200840, 0x80000000, 0x80000800, 0x80200840,
+ 0x80200000, 0x00200840, 0x00200800, 0x80000800 },
+
+ /* nibble 7 */
+ { 0x04100010, 0x04104000, 0x00004010, 0x00000000,
+ 0x04004000, 0x00100010, 0x04100000, 0x04104010,
+ 0x00000010, 0x04000000, 0x00104000, 0x00004010,
+ 0x00104010, 0x04004010, 0x04000010, 0x04100000,
+ 0x00004000, 0x00104010, 0x00100010, 0x04004000,
+ 0x04104010, 0x04000010, 0x00000000, 0x00104000,
+ 0x04000000, 0x00100000, 0x04004010, 0x04100010,
+ 0x00100000, 0x00004000, 0x04104000, 0x00000010,
+ 0x00100000, 0x00004000, 0x04000010, 0x04104010,
+ 0x00004010, 0x04000000, 0x00000000, 0x00104000,
+ 0x04100010, 0x04004010, 0x04004000, 0x00100010,
+ 0x04104000, 0x00000010, 0x00100010, 0x04004000,
+ 0x04104010, 0x00100000, 0x04100000, 0x04000010,
+ 0x00104000, 0x00004010, 0x04004010, 0x04100000,
+ 0x00000010, 0x04104000, 0x00104010, 0x00000000,
+ 0x04000000, 0x04100010, 0x00004000, 0x00104010}
+};
+
+#define ITERATIONS 16
+#define HALF_ITERATIONS 8
+
+#define c2l(c,l) (l =((CARD32)(*((c)++))) , \
+ l|=((CARD32)(*((c)++)))<< 8, \
+ l|=((CARD32)(*((c)++)))<<16, \
+ l|=((CARD32)(*((c)++)))<<24)
+
+#define l2c(l,c) (*((c)++)=(CARD8)(((l) )&0xff), \
+ *((c)++)=(CARD8)(((l)>> 8)&0xff), \
+ *((c)++)=(CARD8)(((l)>>16)&0xff), \
+ *((c)++)=(CARD8)(((l)>>24)&0xff))
+
+#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\
+ (b)^=(t),\
+ (a)^=((t)<<(n)))
+
+#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\
+ (a)=(a)^(t)^(t>>(16-(n))))\
+
+static const char shifts2[16] = {0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
+
+void _XdmcpAuthSetup(auth_cblock key, auth_wrapper_schedule schedule)
+{
+ CARD32 c,d,t,s;
+ CARD8 *in;
+ CARD32 *k;
+ int i;
+
+ k=(CARD32 *)schedule;
+ in=(CARD8 *)key;
+
+ c2l(in,c);
+ c2l(in,d);
+
+ /* do PC1 in 60 simple operations */
+ PERM_OP(d,c,t,4,0x0f0f0f0f);
+ HPERM_OP(c,t,-2, 0xcccc0000);
+ HPERM_OP(c,t,-1, 0xaaaa0000);
+ HPERM_OP(c,t, 8, 0x00ff0000);
+ HPERM_OP(c,t,-1, 0xaaaa0000);
+ HPERM_OP(d,t,-8, 0xff000000);
+ HPERM_OP(d,t, 8, 0x00ff0000);
+ HPERM_OP(d,t, 2, 0x33330000);
+ d=((d&0x00aa00aa)<<7)|((d&0x55005500)>>7)|(d&0xaa55aa55);
+ d=(d>>8)|((c&0xf0000000)>>4);
+ c&=0x0fffffff;
+
+ for (i=0; i<ITERATIONS; i++) {
+ if (shifts2[i]) {
+ c=((c>>2)|(c<<26)); d=((d>>2)|(d<<26));
+ } else {
+ c=((c>>1)|(c<<27)); d=((d>>1)|(d<<27));
+ }
+ c&=0x0fffffff;
+ d&=0x0fffffff;
+ /* could be a few less shifts but I am to lazy at this
+ * point in time to investigate */
+ s= skb[0][ (c )&0x3f ]|
+ skb[1][((c>> 6)&0x03)|((c>> 7)&0x3c)]|
+ skb[2][((c>>13)&0x0f)|((c>>14)&0x30)]|
+ skb[3][((c>>20)&0x01)|((c>>21)&0x06) |
+ ((c>>22)&0x38)];
+ t= skb[4][ (d )&0x3f ]|
+ skb[5][((d>> 7)&0x03)|((d>> 8)&0x3c)]|
+ skb[6][ (d>>15)&0x3f ]|
+ skb[7][((d>>21)&0x0f)|((d>>22)&0x30)];
+
+ /* table contained 0213 4657 */
+ *(k++)=((t<<16)|(s&0x0000ffff));
+ s= ((s>>16)|(t&0xffff0000));
+
+ s=(s<<4)|(s>>28);
+ *(k++)=s;
+ }
+ return;
+}
+
+#define D_ENCRYPT(L,R,S) \
+ t=(R<<1)|(R>>31); \
+ u=(t^s[S ]); \
+ t=(t^s[S+1]); \
+ t=(t>>4)|(t<<28); \
+ L^= SPtrans[1][(t )&0x3f]| \
+ SPtrans[3][(t>> 8)&0x3f]| \
+ SPtrans[5][(t>>16)&0x3f]| \
+ SPtrans[7][(t>>24)&0x3f]| \
+ SPtrans[0][(u )&0x3f]| \
+ SPtrans[2][(u>> 8)&0x3f]| \
+ SPtrans[4][(u>>16)&0x3f]| \
+ SPtrans[6][(u>>24)&0x3f];
+
+
+void _XdmcpAuthDoIt(auth_cblock input, auth_cblock output,
+ auth_wrapper_schedule ks, int encrypt)
+{
+ CARD32 l,r,t,u;
+ CARD32 *s;
+ CARD8 *in,*out;
+ int i;
+
+ in=(CARD8 *)input;
+ out=(CARD8 *)output;
+ c2l(in,l);
+ c2l(in,r);
+
+ /* do IP */
+ PERM_OP(r,l,t, 4,0x0f0f0f0f);
+ PERM_OP(l,r,t,16,0x0000ffff);
+ PERM_OP(r,l,t, 2,0x33333333);
+ PERM_OP(l,r,t, 8,0x00ff00ff);
+ PERM_OP(r,l,t, 1,0x55555555);
+ /* r and l are reversed - remember that :-) */
+ t=l;
+ l=r;
+ r=t;
+
+ s=(CARD32 *)ks;
+
+ if (encrypt) {
+ for (i=0; i<(ITERATIONS*2); i+=4) {
+ D_ENCRYPT(l,r, i); /* 1 */
+ D_ENCRYPT(r,l, i+2); /* 2 */
+ }
+ } else {
+ for (i=(ITERATIONS*2)-2; i >= 0; i-=4) {
+ D_ENCRYPT(l,r, i); /* 1 */
+ D_ENCRYPT(r,l, i-2); /* 2 */
+ }
+ }
+
+ /* swap l and r
+ * we will not do the swap so just remember they are
+ * reversed for the rest of the subroutine
+ * luckily by FP fixes this problem :-) */
+
+ PERM_OP(r,l,t, 1,0x55555555);
+ PERM_OP(l,r,t, 8,0x00ff00ff);
+ PERM_OP(r,l,t, 2,0x33333333);
+ PERM_OP(l,r,t,16,0x0000ffff);
+ PERM_OP(r,l,t, 4,0x0f0f0f0f);
+
+ l2c(l,out);
+ l2c(r,out);
+ return;
+}
diff --git a/libXdmcp/include/X11/Xdmcp.h b/libXdmcp/include/X11/Xdmcp.h
index b01c03e81..99a5f9520 100644
--- a/libXdmcp/include/X11/Xdmcp.h
+++ b/libXdmcp/include/X11/Xdmcp.h
@@ -1,181 +1,181 @@
-/*
- * Copyright 1989 Network Computing Devices, Inc., Mountain View, California.
- *
- * 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 N.C.D. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. N.C.D. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- */
-
-#ifndef _XDMCP_H_
-#define _XDMCP_H_
-
-#include <X11/Xmd.h>
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-#define XDM_PROTOCOL_VERSION 1
-#define XDM_UDP_PORT 177
-
-/* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned
- * multicast addresses for XDMCP, where X in the prefix may be replaced
- * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local,
- * 5 for Site-Local, and so on. We set the default here to the Link-Local
- * version to most closely match the old IPv4 subnet broadcast behavior.
- * Both xdm and X -query allow specifying a different address if a different
- * scope is defined.
- */
-#define XDM_DEFAULT_MCAST_ADDR6 "ff02:0:0:0:0:0:0:12b"
-
-#define XDM_MAX_MSGLEN 8192
-#define XDM_MIN_RTX 2
-#define XDM_MAX_RTX 32
-#define XDM_RTX_LIMIT 7
-#define XDM_KA_RTX_LIMIT 4
-#define XDM_DEF_DORMANCY (3 * 60) /* 3 minutes */
-#define XDM_MAX_DORMANCY (24 * 60 * 60) /* 24 hours */
-
-typedef enum {
- BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY,
- WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE,
- FAILED, KEEPALIVE, ALIVE
-} xdmOpCode;
-
-typedef enum {
- XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY,
- XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY,
- XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE,
- XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF,
- XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE,
-#if defined(IPv6) && defined(AF_INET6)
- XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY,
-#endif
- XDM_KEEP_ME_LAST
-} xdmcp_states;
-
-#ifdef NOTDEF
-/* table of hosts */
-
-#define XDM_MAX_STR_LEN 21
-#define XDM_MAX_HOSTS 20
-struct xdm_host_table {
- struct sockaddr_in sockaddr;
- char name[XDM_MAX_STR_LEN];
- char status[XDM_MAX_STR_LEN];
-};
-#endif /* NOTDEF */
-
-typedef CARD8 *CARD8Ptr;
-typedef CARD16 *CARD16Ptr;
-typedef CARD32 *CARD32Ptr;
-
-typedef struct _ARRAY8 {
- CARD16 length;
- CARD8Ptr data;
-} ARRAY8, *ARRAY8Ptr;
-
-typedef struct _ARRAY16 {
- CARD8 length;
- CARD16Ptr data;
-} ARRAY16, *ARRAY16Ptr;
-
-typedef struct _ARRAY32 {
- CARD8 length;
- CARD32Ptr data;
-} ARRAY32, *ARRAY32Ptr;
-
-typedef struct _ARRAYofARRAY8 {
- CARD8 length;
- ARRAY8Ptr data;
-} ARRAYofARRAY8, *ARRAYofARRAY8Ptr;
-
-typedef struct _XdmcpHeader {
- CARD16 version, opcode, length;
-} XdmcpHeader, *XdmcpHeaderPtr;
-
-typedef struct _XdmcpBuffer {
- BYTE *data;
- int size; /* size of buffer pointed by to data */
- int pointer; /* current index into data */
- int count; /* bytes read from network into data */
-} XdmcpBuffer, *XdmcpBufferPtr;
-
-typedef struct _XdmAuthKey {
- BYTE data[8];
-} XdmAuthKeyRec, *XdmAuthKeyPtr;
-
-
-/* implementation-independent network address structure.
- Equiv to sockaddr* for sockets and netbuf* for STREAMS. */
-
-typedef char *XdmcpNetaddr;
-
-extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, const ARRAY16Ptr array);
-extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, const ARRAY32Ptr array);
-extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, const ARRAY8Ptr array);
-extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, const ARRAYofARRAY8Ptr array);
-extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value);
-extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value);
-extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value);
-extern int XdmcpWriteHeader(XdmcpBufferPtr buffer, const XdmcpHeaderPtr header);
-
-extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen);
-
-extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array);
-extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array);
-extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array);
-extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array);
-extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep);
-extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep);
-extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep);
-extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header);
-
-extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen);
-
-extern int XdmcpReadRemaining(const XdmcpBufferPtr buffer);
-
-extern void XdmcpDisposeARRAY8(ARRAY8Ptr array);
-extern void XdmcpDisposeARRAY16(ARRAY16Ptr array);
-extern void XdmcpDisposeARRAY32(ARRAY32Ptr array);
-extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array);
-
-extern int XdmcpCopyARRAY8(const ARRAY8Ptr src, ARRAY8Ptr dst);
-
-extern int XdmcpARRAY8Equal(const ARRAY8Ptr array1, const ARRAY8Ptr array2);
-
-extern void XdmcpGenerateKey (XdmAuthKeyPtr key);
-extern void XdmcpIncrementKey (XdmAuthKeyPtr key);
-extern void XdmcpDecrementKey (XdmAuthKeyPtr key);
-#ifdef HASXDMAUTH
-extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
-extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-extern int XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b);
-
-extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length);
-extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length);
-extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length);
-extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
-
-extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length);
-extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length);
-extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length);
-extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
-
-_XFUNCPROTOEND
-
-#endif /* _XDMCP_H_ */
+/*
+ * Copyright 1989 Network Computing Devices, Inc., Mountain View, California.
+ *
+ * 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 N.C.D. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. N.C.D. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ */
+
+#ifndef _XDMCP_H_
+#define _XDMCP_H_
+
+#include <X11/Xmd.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+#define XDM_PROTOCOL_VERSION 1
+#define XDM_UDP_PORT 177
+
+/* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned
+ * multicast addresses for XDMCP, where X in the prefix may be replaced
+ * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local,
+ * 5 for Site-Local, and so on. We set the default here to the Link-Local
+ * version to most closely match the old IPv4 subnet broadcast behavior.
+ * Both xdm and X -query allow specifying a different address if a different
+ * scope is defined.
+ */
+#define XDM_DEFAULT_MCAST_ADDR6 "ff02:0:0:0:0:0:0:12b"
+
+#define XDM_MAX_MSGLEN 8192
+#define XDM_MIN_RTX 2
+#define XDM_MAX_RTX 32
+#define XDM_RTX_LIMIT 7
+#define XDM_KA_RTX_LIMIT 4
+#define XDM_DEF_DORMANCY (3 * 60) /* 3 minutes */
+#define XDM_MAX_DORMANCY (24 * 60 * 60) /* 24 hours */
+
+typedef enum {
+ BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY,
+ WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE,
+ FAILED, KEEPALIVE, ALIVE
+} xdmOpCode;
+
+typedef enum {
+ XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY,
+ XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY,
+ XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE,
+ XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF,
+ XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE,
+#if defined(IPv6) && defined(AF_INET6)
+ XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY,
+#endif
+ XDM_KEEP_ME_LAST
+} xdmcp_states;
+
+#ifdef NOTDEF
+/* table of hosts */
+
+#define XDM_MAX_STR_LEN 21
+#define XDM_MAX_HOSTS 20
+struct xdm_host_table {
+ struct sockaddr_in sockaddr;
+ char name[XDM_MAX_STR_LEN];
+ char status[XDM_MAX_STR_LEN];
+};
+#endif /* NOTDEF */
+
+typedef CARD8 *CARD8Ptr;
+typedef CARD16 *CARD16Ptr;
+typedef CARD32 *CARD32Ptr;
+
+typedef struct _ARRAY8 {
+ CARD16 length;
+ CARD8Ptr data;
+} ARRAY8, *ARRAY8Ptr;
+
+typedef struct _ARRAY16 {
+ CARD8 length;
+ CARD16Ptr data;
+} ARRAY16, *ARRAY16Ptr;
+
+typedef struct _ARRAY32 {
+ CARD8 length;
+ CARD32Ptr data;
+} ARRAY32, *ARRAY32Ptr;
+
+typedef struct _ARRAYofARRAY8 {
+ CARD8 length;
+ ARRAY8Ptr data;
+} ARRAYofARRAY8, *ARRAYofARRAY8Ptr;
+
+typedef struct _XdmcpHeader {
+ CARD16 version, opcode, length;
+} XdmcpHeader, *XdmcpHeaderPtr;
+
+typedef struct _XdmcpBuffer {
+ BYTE *data;
+ int size; /* size of buffer pointed by to data */
+ int pointer; /* current index into data */
+ int count; /* bytes read from network into data */
+} XdmcpBuffer, *XdmcpBufferPtr;
+
+typedef struct _XdmAuthKey {
+ BYTE data[8];
+} XdmAuthKeyRec, *XdmAuthKeyPtr;
+
+
+/* implementation-independent network address structure.
+ Equiv to sockaddr* for sockets and netbuf* for STREAMS. */
+
+typedef char *XdmcpNetaddr;
+
+extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, const ARRAY16Ptr array);
+extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, const ARRAY32Ptr array);
+extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, const ARRAY8Ptr array);
+extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, const ARRAYofARRAY8Ptr array);
+extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteHeader(XdmcpBufferPtr buffer, const XdmcpHeaderPtr header);
+
+extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen);
+
+extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array);
+extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array);
+extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array);
+extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array);
+extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep);
+extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep);
+extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep);
+extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header);
+
+extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen);
+
+extern int XdmcpReadRemaining(const XdmcpBufferPtr buffer);
+
+extern void XdmcpDisposeARRAY8(ARRAY8Ptr array);
+extern void XdmcpDisposeARRAY16(ARRAY16Ptr array);
+extern void XdmcpDisposeARRAY32(ARRAY32Ptr array);
+extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array);
+
+extern int XdmcpCopyARRAY8(const ARRAY8Ptr src, ARRAY8Ptr dst);
+
+extern int XdmcpARRAY8Equal(const ARRAY8Ptr array1, const ARRAY8Ptr array2);
+
+extern void XdmcpGenerateKey (XdmAuthKeyPtr key);
+extern void XdmcpIncrementKey (XdmAuthKeyPtr key);
+extern void XdmcpDecrementKey (XdmAuthKeyPtr key);
+#ifdef HASXDMAUTH
+extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
+extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+extern int XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b);
+
+extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length);
+extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length);
+extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length);
+extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
+
+extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length);
+extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length);
+extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length);
+extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
+
+_XFUNCPROTOEND
+
+#endif /* _XDMCP_H_ */
diff --git a/libXext/AUTHORS b/libXext/AUTHORS
index 00e1f42cf..6e545c006 100644
--- a/libXext/AUTHORS
+++ b/libXext/AUTHORS
@@ -6,14 +6,14 @@ XAppgroup: Kaleb S. Keithley, X Consortium
Xcup: Kaleb S, Keithley, The Open Group
Xdbe: Ian Elliot, Hewlett-Packard, David Wiggens, X Consortium
XEVI: Peter Daifuku, Silicon Graphics
-XLbx: D. Converse, J Fulton, C. Kantarjiev, D. Lemke, R. Mor,
- Keith Packard, NCD (who now believes lbx should be nuked),
+XLbx: D. Converse, J Fulton, C. Kantarjiev, D. Lemke, R. Mor,
+ Keith Packard, NCD (who now believes lbx should be nuked),
R. Tice, D. Tonogai
XMultibuf: Jeffrey Friedberg, Larry Seiler, Jeff Vroom, Digital Equipment
XSecurity: Dave Wiggens, X Consortium
XShape: Jonathan Corbet, NCAR, Keith Packard, MIT X Consortium
Xshm: Bob Scheifler and Keith Packard, MIT X Consortium
-XSync: Tim Glauert, Olivetti Research, DAve Carver, Jim Gettys,
+XSync: Tim Glauert, Olivetti Research, DAve Carver, Jim Gettys,
Digital Equipment, Dave Wiggens, X Consortium
XTestExt: Kieron Drake, UniSoft, Ltd.
diff --git a/libXext/COPYING b/libXext/COPYING
index e8ba287bb..80622a057 100644
--- a/libXext/COPYING
+++ b/libXext/COPYING
@@ -1,196 +1,196 @@
-Copyright 1986, 1987, 1988, 1989, 1994, 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 (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
-
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
-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 Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS 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.
-
-Copyright 1992 Network Computing Devices
-
-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 NCD. not be used in advertising or
-publicity pertaining to distribution of the software without specific,
-written prior permission. NCD. makes no representations about the
-suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
-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.
-
-Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
-and Olivetti Research Limited, Cambridge, England.
-
- All Rights Reserved
-
-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 names of Digital or Olivetti
-not be used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL THEY 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.
-
-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.
-
-Copyright (c) 1994, 1995 Hewlett-Packard Company
-
-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 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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
-Company 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 Hewlett-Packard Company.
-
-Copyright Digital Equipment Corporation, 1996
-
-Permission to use, copy, modify, distribute, and sell this
-documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice and this permission
-notice appear in all copies. Digital Equipment Corporation
-makes no representations about the suitability for any purpose
-of the information in this document. This documentation is
-provided ``as is'' without express or implied warranty.
-
-Copyright (c) 1999, 2005, 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.
-
-Copyright (c) 1989 X Consortium, Inc. and Digital Equipment Corporation.
-Copyright (c) 1992 X Consortium, Inc. and Intergraph Corporation.
-Copyright (c) 1993 X Consortium, Inc. and Silicon Graphics, Inc.
-Copyright (c) 1994, 1995 X Consortium, Inc. and Hewlett-Packard Company.
-
-Permission to use, copy, modify, and distribute this documentation for
-any purpose and without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-Digital Equipment Corporation, Intergraph Corporation, Silicon
-Graphics, Hewlett-Packard, and the X Consortium make no
-representations about the suitability for any purpose of the
-information in this document. This documentation is provided ``as is''
-without express or implied warranty.
+Copyright 1986, 1987, 1988, 1989, 1994, 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 (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+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 Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS 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.
+
+Copyright 1992 Network Computing Devices
+
+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 NCD. not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission. NCD. makes no representations about the
+suitability of this software for any purpose. It is provided "as is"
+without express or implied warranty.
+
+NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+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.
+
+Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+ All Rights Reserved
+
+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 names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY 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.
+
+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.
+
+Copyright (c) 1994, 1995 Hewlett-Packard Company
+
+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 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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
+Company 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 Hewlett-Packard Company.
+
+Copyright Digital Equipment Corporation, 1996
+
+Permission to use, copy, modify, distribute, and sell this
+documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice and this permission
+notice appear in all copies. Digital Equipment Corporation
+makes no representations about the suitability for any purpose
+of the information in this document. This documentation is
+provided ``as is'' without express or implied warranty.
+
+Copyright (c) 1999, 2005, 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.
+
+Copyright (c) 1989 X Consortium, Inc. and Digital Equipment Corporation.
+Copyright (c) 1992 X Consortium, Inc. and Intergraph Corporation.
+Copyright (c) 1993 X Consortium, Inc. and Silicon Graphics, Inc.
+Copyright (c) 1994, 1995 X Consortium, Inc. and Hewlett-Packard Company.
+
+Permission to use, copy, modify, and distribute this documentation for
+any purpose and without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+Digital Equipment Corporation, Intergraph Corporation, Silicon
+Graphics, Hewlett-Packard, and the X Consortium make no
+representations about the suitability for any purpose of the
+information in this document. This documentation is provided ``as is''
+without express or implied warranty.
diff --git a/libXext/configure.ac b/libXext/configure.ac
index 6e6cc8b13..dd9788abe 100644
--- a/libXext/configure.ac
+++ b/libXext/configure.ac
@@ -25,7 +25,7 @@ XORG_WITH_XSLTPROC
XORG_CHECK_SGML_DOCTOOLS(1.8)
XORG_CHECK_MALLOC_ZERO
-# Determine .so library version per platform
+# 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
diff --git a/libXext/include/X11/extensions/XLbx.h b/libXext/include/X11/extensions/XLbx.h
index 94153343a..1af4f9ce2 100644
--- a/libXext/include/X11/extensions/XLbx.h
+++ b/libXext/include/X11/extensions/XLbx.h
@@ -1,50 +1,50 @@
-/*
- * Copyright 1992 Network Computing Devices
- *
- * 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 NCD. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. NCD. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
- * 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 _XLBX_H_
-#define _XLBX_H_
-
-#include <X11/Xfuncproto.h>
-#include <X11/Xdefs.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/lbx.h>
-
-_XFUNCPROTOBEGIN
-
-Bool XLbxQueryExtension(
- Display* /* dpy */,
- int* /* requestp */,
- int* /* event_basep */,
- int* /* error_basep */
-);
-
-Bool XLbxQueryVersion(
- Display* /* dpy */,
- int* /* majorVersion */,
- int* /* minorVersion */
-);
-
-int XLbxGetEventBase(Display *dpy);
-
-_XFUNCPROTOEND
-
-#endif
+/*
+ * Copyright 1992 Network Computing Devices
+ *
+ * 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 NCD. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. NCD. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+ * 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 _XLBX_H_
+#define _XLBX_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xdefs.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/lbx.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XLbxQueryExtension(
+ Display* /* dpy */,
+ int* /* requestp */,
+ int* /* event_basep */,
+ int* /* error_basep */
+);
+
+Bool XLbxQueryVersion(
+ Display* /* dpy */,
+ int* /* majorVersion */,
+ int* /* minorVersion */
+);
+
+int XLbxGetEventBase(Display *dpy);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/libXext/include/X11/extensions/Xdbe.h b/libXext/include/X11/extensions/Xdbe.h
index 5ac72aa82..5c842a445 100644
--- a/libXext/include/X11/extensions/Xdbe.h
+++ b/libXext/include/X11/extensions/Xdbe.h
@@ -1,138 +1,138 @@
-/******************************************************************************
- *
- * Copyright (c) 1994, 1995 Hewlett-Packard Company
- *
- * 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 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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
- * Company 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 Hewlett-Packard Company.
- *
- * Header file for Xlib-related DBE
- *
- *****************************************************************************/
-
-#ifndef XDBE_H
-#define XDBE_H
-
-#include <X11/Xfuncproto.h>
-#include <X11/extensions/dbe.h>
-
-typedef struct
-{
- VisualID visual; /* one visual ID that supports double-buffering */
- int depth; /* depth of visual in bits */
- int perflevel; /* performance level of visual */
-}
-XdbeVisualInfo;
-
-typedef struct
-{
- int count; /* number of items in visual_depth */
- XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
-}
-XdbeScreenVisualInfo;
-
-
-typedef Drawable XdbeBackBuffer;
-
-typedef unsigned char XdbeSwapAction;
-
-typedef struct
-{
- Window swap_window; /* window for which to swap buffers */
- XdbeSwapAction swap_action; /* swap action to use for swap_window */
-}
-XdbeSwapInfo;
-
-typedef struct
-{
- Window window; /* window that buffer belongs to */
-}
-XdbeBackBufferAttributes;
-
-typedef struct
-{
- int type;
- Display *display; /* display the event was read from */
- XdbeBackBuffer buffer; /* resource id */
- unsigned long serial; /* serial number of failed request */
- unsigned char error_code; /* error base + XdbeBadBuffer */
- unsigned char request_code; /* major opcode of failed request */
- unsigned char minor_code; /* minor opcode of failed request */
-}
-XdbeBufferError;
-
-/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops
- * (for non-C++ builds) in X11/Xfuncproto.h.
- */
-_XFUNCPROTOBEGIN
-
-extern Status XdbeQueryExtension(
- Display* /* dpy */,
- int* /* major_version_return */,
- int* /* minor_version_return */
-);
-
-extern XdbeBackBuffer XdbeAllocateBackBufferName(
- Display* /* dpy */,
- Window /* window */,
- XdbeSwapAction /* swap_action */
-);
-
-extern Status XdbeDeallocateBackBufferName(
- Display* /* dpy */,
- XdbeBackBuffer /* buffer */
-);
-
-extern Status XdbeSwapBuffers(
- Display* /* dpy */,
- XdbeSwapInfo* /* swap_info */,
- int /* num_windows */
-);
-
-extern Status XdbeBeginIdiom(
- Display* /* dpy */
-);
-
-extern Status XdbeEndIdiom(
- Display* /* dpy */
-);
-
-extern XdbeScreenVisualInfo *XdbeGetVisualInfo(
- Display* /* dpy */,
- Drawable* /* screen_specifiers */,
- int* /* num_screens */
-);
-
-extern void XdbeFreeVisualInfo(
- XdbeScreenVisualInfo* /* visual_info */
-);
-
-extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
- Display* /* dpy */,
- XdbeBackBuffer /* buffer */
-);
-
-_XFUNCPROTOEND
-
-#endif /* XDBE_H */
-
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * 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 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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
+ * Company 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 Hewlett-Packard Company.
+ *
+ * Header file for Xlib-related DBE
+ *
+ *****************************************************************************/
+
+#ifndef XDBE_H
+#define XDBE_H
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/dbe.h>
+
+typedef struct
+{
+ VisualID visual; /* one visual ID that supports double-buffering */
+ int depth; /* depth of visual in bits */
+ int perflevel; /* performance level of visual */
+}
+XdbeVisualInfo;
+
+typedef struct
+{
+ int count; /* number of items in visual_depth */
+ XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
+}
+XdbeScreenVisualInfo;
+
+
+typedef Drawable XdbeBackBuffer;
+
+typedef unsigned char XdbeSwapAction;
+
+typedef struct
+{
+ Window swap_window; /* window for which to swap buffers */
+ XdbeSwapAction swap_action; /* swap action to use for swap_window */
+}
+XdbeSwapInfo;
+
+typedef struct
+{
+ Window window; /* window that buffer belongs to */
+}
+XdbeBackBufferAttributes;
+
+typedef struct
+{
+ int type;
+ Display *display; /* display the event was read from */
+ XdbeBackBuffer buffer; /* resource id */
+ unsigned long serial; /* serial number of failed request */
+ unsigned char error_code; /* error base + XdbeBadBuffer */
+ unsigned char request_code; /* major opcode of failed request */
+ unsigned char minor_code; /* minor opcode of failed request */
+}
+XdbeBufferError;
+
+/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops
+ * (for non-C++ builds) in X11/Xfuncproto.h.
+ */
+_XFUNCPROTOBEGIN
+
+extern Status XdbeQueryExtension(
+ Display* /* dpy */,
+ int* /* major_version_return */,
+ int* /* minor_version_return */
+);
+
+extern XdbeBackBuffer XdbeAllocateBackBufferName(
+ Display* /* dpy */,
+ Window /* window */,
+ XdbeSwapAction /* swap_action */
+);
+
+extern Status XdbeDeallocateBackBufferName(
+ Display* /* dpy */,
+ XdbeBackBuffer /* buffer */
+);
+
+extern Status XdbeSwapBuffers(
+ Display* /* dpy */,
+ XdbeSwapInfo* /* swap_info */,
+ int /* num_windows */
+);
+
+extern Status XdbeBeginIdiom(
+ Display* /* dpy */
+);
+
+extern Status XdbeEndIdiom(
+ Display* /* dpy */
+);
+
+extern XdbeScreenVisualInfo *XdbeGetVisualInfo(
+ Display* /* dpy */,
+ Drawable* /* screen_specifiers */,
+ int* /* num_screens */
+);
+
+extern void XdbeFreeVisualInfo(
+ XdbeScreenVisualInfo* /* visual_info */
+);
+
+extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
+ Display* /* dpy */,
+ XdbeBackBuffer /* buffer */
+);
+
+_XFUNCPROTOEND
+
+#endif /* XDBE_H */
+
diff --git a/libXext/include/X11/extensions/Xge.h b/libXext/include/X11/extensions/Xge.h
index 51382ffd0..76b5a6a01 100644
--- a/libXext/include/X11/extensions/Xge.h
+++ b/libXext/include/X11/extensions/Xge.h
@@ -36,7 +36,7 @@
_XFUNCPROTOBEGIN
/**
- * Generic Event mask.
+ * Generic Event mask.
* To be used whenever a list of masks per extension has to be provided.
*
* But, don't actually use the CARD{8,16,32} types. We can't get them them
diff --git a/libXext/include/X11/extensions/dpms.h b/libXext/include/X11/extensions/dpms.h
index b57007bda..f85e6a725 100644
--- a/libXext/include/X11/extensions/dpms.h
+++ b/libXext/include/X11/extensions/dpms.h
@@ -1,53 +1,53 @@
-/*****************************************************************
-
-Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
-
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-
-#ifndef _X11_EXTENSIONS_DPMS_H
-#define _X11_EXTENSIONS_DPMS_H 1
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/extensions/dpmsconst.h>
-
-#ifndef DPMS_SERVER
-_XFUNCPROTOBEGIN
-
-extern Bool DPMSQueryExtension(Display *, int *, int *);
-extern Status DPMSGetVersion(Display *, int *, int *);
-extern Bool DPMSCapable(Display *);
-extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16);
-extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *);
-extern Status DPMSEnable(Display *);
-extern Status DPMSDisable(Display *);
-extern Status DPMSForceLevel(Display *, CARD16);
-extern Status DPMSInfo(Display *, CARD16 *, BOOL *);
-
-_XFUNCPROTOEND
-#endif
-
-#endif /* !_X11_EXTENSIONS_DPMS_H */
-
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+#ifndef _X11_EXTENSIONS_DPMS_H
+#define _X11_EXTENSIONS_DPMS_H 1
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/extensions/dpmsconst.h>
+
+#ifndef DPMS_SERVER
+_XFUNCPROTOBEGIN
+
+extern Bool DPMSQueryExtension(Display *, int *, int *);
+extern Status DPMSGetVersion(Display *, int *, int *);
+extern Bool DPMSCapable(Display *);
+extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16);
+extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *);
+extern Status DPMSEnable(Display *);
+extern Status DPMSDisable(Display *);
+extern Status DPMSForceLevel(Display *, CARD16);
+extern Status DPMSInfo(Display *, CARD16 *, BOOL *);
+
+_XFUNCPROTOEND
+#endif
+
+#endif /* !_X11_EXTENSIONS_DPMS_H */
+
diff --git a/libXext/include/X11/extensions/extutil.h b/libXext/include/X11/extensions/extutil.h
index dd05a6580..7f05affd8 100644
--- a/libXext/include/X11/extensions/extutil.h
+++ b/libXext/include/X11/extensions/extutil.h
@@ -1,190 +1,190 @@
-/*
- *
-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: Jim Fulton, MIT The Open Group
- *
- * Xlib Extension-Writing Utilities
- *
- * This package contains utilities for writing the client API for various
- * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
- * ARE SUBJECT TO CHANGE!
- */
-
-#ifndef _EXTUTIL_H_
-#define _EXTUTIL_H_
-
-#include <X11/extensions/Xext.h>
-
-/*
- * We need to keep a list of open displays since the Xlib display list isn't
- * public. We also have to per-display info in a separate block since it isn't
- * stored directly in the Display structure.
- */
-typedef struct _XExtDisplayInfo {
- struct _XExtDisplayInfo *next; /* keep a linked list */
- Display *display; /* which display this is */
- XExtCodes *codes; /* the extension protocol codes */
- XPointer data; /* extra data for extension to use */
-} XExtDisplayInfo;
-
-typedef struct _XExtensionInfo {
- XExtDisplayInfo *head; /* start of list */
- XExtDisplayInfo *cur; /* most recently used */
- int ndisplays; /* number of displays */
-} XExtensionInfo;
-
-typedef struct _XExtensionHooks {
- int (*create_gc)(
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-);
- int (*copy_gc)(
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-);
- int (*flush_gc)(
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-);
- int (*free_gc)(
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-);
- int (*create_font)(
- Display* /* display */,
- XFontStruct* /* fs */,
- XExtCodes* /* codes */
-);
- int (*free_font)(
- Display* /* display */,
- XFontStruct* /* fs */,
- XExtCodes* /* codes */
-);
- int (*close_display)(
- Display* /* display */,
- XExtCodes* /* codes */
-);
- Bool (*wire_to_event)(
- Display* /* display */,
- XEvent* /* re */,
- xEvent* /* event */
-);
- Status (*event_to_wire)(
- Display* /* display */,
- XEvent* /* re */,
- xEvent* /* event */
-);
- int (*error)(
- Display* /* display */,
- xError* /* err */,
- XExtCodes* /* codes */,
- int* /* ret_code */
-);
- char *(*error_string)(
- Display* /* display */,
- int /* code */,
- XExtCodes* /* codes */,
- char* /* buffer */,
- int /* nbytes */
-);
-} XExtensionHooks;
-
-extern XExtensionInfo *XextCreateExtension(
- void
-);
-extern void XextDestroyExtension(
- XExtensionInfo* /* info */
-);
-extern XExtDisplayInfo *XextAddDisplay(
- XExtensionInfo* /* extinfo */,
- Display* /* dpy */,
- char* /* ext_name */,
- XExtensionHooks* /* hooks */,
- int /* nevents */,
- XPointer /* data */
-);
-extern int XextRemoveDisplay(
- XExtensionInfo* /* extinfo */,
- Display* /* dpy */
-);
-extern XExtDisplayInfo *XextFindDisplay(
- XExtensionInfo* /* extinfo */,
- Display* /* dpy */
-);
-
-#define XextHasExtension(i) ((i) && ((i)->codes))
-#define XextCheckExtension(dpy,i,name,val) \
- if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
-#define XextSimpleCheckExtension(dpy,i,name) \
- if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
-
-
-/*
- * helper macros to generate code that is common to all extensions; caller
- * should prefix it with static if extension source is in one file; this
- * could be a utility function, but have to stack 6 unused arguments for
- * something that is called many, many times would be bad.
- */
-#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \
-XExtDisplayInfo *proc (Display *dpy) \
-{ \
- XExtDisplayInfo *dpyinfo; \
- if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
- if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
- dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
- return dpyinfo; \
-}
-
-#define XEXT_FIND_DISPLAY_PROTO(proc) \
- XExtDisplayInfo *proc(Display *dpy)
-
-#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
-int proc (Display *dpy, XExtCodes *codes) \
-{ \
- return XextRemoveDisplay (extinfo, dpy); \
-}
-
-#define XEXT_CLOSE_DISPLAY_PROTO(proc) \
- int proc(Display *dpy, XExtCodes *codes)
-
-#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
-char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
-{ \
- code -= codes->first_error; \
- if (code >= 0 && code < nerr) { \
- char tmp[256]; \
- sprintf (tmp, "%s.%d", extname, code); \
- XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
- return buf; \
- } \
- return (char *)0; \
-}
-
-#define XEXT_ERROR_STRING_PROTO(proc) \
- char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
-#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.
+ *
+ * Author: Jim Fulton, MIT The Open Group
+ *
+ * Xlib Extension-Writing Utilities
+ *
+ * This package contains utilities for writing the client API for various
+ * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
+ * ARE SUBJECT TO CHANGE!
+ */
+
+#ifndef _EXTUTIL_H_
+#define _EXTUTIL_H_
+
+#include <X11/extensions/Xext.h>
+
+/*
+ * We need to keep a list of open displays since the Xlib display list isn't
+ * public. We also have to per-display info in a separate block since it isn't
+ * stored directly in the Display structure.
+ */
+typedef struct _XExtDisplayInfo {
+ struct _XExtDisplayInfo *next; /* keep a linked list */
+ Display *display; /* which display this is */
+ XExtCodes *codes; /* the extension protocol codes */
+ XPointer data; /* extra data for extension to use */
+} XExtDisplayInfo;
+
+typedef struct _XExtensionInfo {
+ XExtDisplayInfo *head; /* start of list */
+ XExtDisplayInfo *cur; /* most recently used */
+ int ndisplays; /* number of displays */
+} XExtensionInfo;
+
+typedef struct _XExtensionHooks {
+ int (*create_gc)(
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+);
+ int (*copy_gc)(
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+);
+ int (*flush_gc)(
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+);
+ int (*free_gc)(
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+);
+ int (*create_font)(
+ Display* /* display */,
+ XFontStruct* /* fs */,
+ XExtCodes* /* codes */
+);
+ int (*free_font)(
+ Display* /* display */,
+ XFontStruct* /* fs */,
+ XExtCodes* /* codes */
+);
+ int (*close_display)(
+ Display* /* display */,
+ XExtCodes* /* codes */
+);
+ Bool (*wire_to_event)(
+ Display* /* display */,
+ XEvent* /* re */,
+ xEvent* /* event */
+);
+ Status (*event_to_wire)(
+ Display* /* display */,
+ XEvent* /* re */,
+ xEvent* /* event */
+);
+ int (*error)(
+ Display* /* display */,
+ xError* /* err */,
+ XExtCodes* /* codes */,
+ int* /* ret_code */
+);
+ char *(*error_string)(
+ Display* /* display */,
+ int /* code */,
+ XExtCodes* /* codes */,
+ char* /* buffer */,
+ int /* nbytes */
+);
+} XExtensionHooks;
+
+extern XExtensionInfo *XextCreateExtension(
+ void
+);
+extern void XextDestroyExtension(
+ XExtensionInfo* /* info */
+);
+extern XExtDisplayInfo *XextAddDisplay(
+ XExtensionInfo* /* extinfo */,
+ Display* /* dpy */,
+ char* /* ext_name */,
+ XExtensionHooks* /* hooks */,
+ int /* nevents */,
+ XPointer /* data */
+);
+extern int XextRemoveDisplay(
+ XExtensionInfo* /* extinfo */,
+ Display* /* dpy */
+);
+extern XExtDisplayInfo *XextFindDisplay(
+ XExtensionInfo* /* extinfo */,
+ Display* /* dpy */
+);
+
+#define XextHasExtension(i) ((i) && ((i)->codes))
+#define XextCheckExtension(dpy,i,name,val) \
+ if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
+#define XextSimpleCheckExtension(dpy,i,name) \
+ if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
+
+
+/*
+ * helper macros to generate code that is common to all extensions; caller
+ * should prefix it with static if extension source is in one file; this
+ * could be a utility function, but have to stack 6 unused arguments for
+ * something that is called many, many times would be bad.
+ */
+#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \
+XExtDisplayInfo *proc (Display *dpy) \
+{ \
+ XExtDisplayInfo *dpyinfo; \
+ if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
+ if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
+ dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
+ return dpyinfo; \
+}
+
+#define XEXT_FIND_DISPLAY_PROTO(proc) \
+ XExtDisplayInfo *proc(Display *dpy)
+
+#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
+int proc (Display *dpy, XExtCodes *codes) \
+{ \
+ return XextRemoveDisplay (extinfo, dpy); \
+}
+
+#define XEXT_CLOSE_DISPLAY_PROTO(proc) \
+ int proc(Display *dpy, XExtCodes *codes)
+
+#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
+char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
+{ \
+ code -= codes->first_error; \
+ if (code >= 0 && code < nerr) { \
+ char tmp[256]; \
+ sprintf (tmp, "%s.%d", extname, code); \
+ XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
+ return buf; \
+ } \
+ return (char *)0; \
+}
+
+#define XEXT_ERROR_STRING_PROTO(proc) \
+ char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
+#endif
diff --git a/libXext/include/X11/extensions/sync.h b/libXext/include/X11/extensions/sync.h
index 0ed5b728d..d3a239f66 100644
--- a/libXext/include/X11/extensions/sync.h
+++ b/libXext/include/X11/extensions/sync.h
@@ -1,375 +1,375 @@
-/*
-
-Copyright 1991, 1993, 1994, 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 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
-and Olivetti Research Limited, Cambridge, England.
-
- All Rights Reserved
-
-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 names of Digital or Olivetti
-not be used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL THEY 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 _SYNC_H_
-#define _SYNC_H_
-
-#include <X11/Xfuncproto.h>
-#include <X11/extensions/syncconst.h>
-
-#ifdef _SYNC_SERVER
-#include <X11/extensions/syncproto.h>
-#else
-
-_XFUNCPROTOBEGIN
-/* get rid of macros so we can define corresponding functions */
-#undef XSyncIntToValue
-#undef XSyncIntsToValue
-#undef XSyncValueGreaterThan
-#undef XSyncValueLessThan
-#undef XSyncValueGreaterOrEqual
-#undef XSyncValueLessOrEqual
-#undef XSyncValueEqual
-#undef XSyncValueIsNegative
-#undef XSyncValueIsZero
-#undef XSyncValueIsPositive
-#undef XSyncValueLow32
-#undef XSyncValueHigh32
-#undef XSyncValueAdd
-#undef XSyncValueSubtract
-#undef XSyncMaxValue
-#undef XSyncMinValue
-
-extern void XSyncIntToValue(
- XSyncValue* /*pv*/,
- int /*i*/
-);
-
-extern void XSyncIntsToValue(
- XSyncValue* /*pv*/,
- unsigned int /*l*/,
- int /*h*/
-);
-
-extern Bool XSyncValueGreaterThan(
- XSyncValue /*a*/,
- XSyncValue /*b*/
-);
-
-extern Bool XSyncValueLessThan(
- XSyncValue /*a*/,
- XSyncValue /*b*/
-);
-
-extern Bool XSyncValueGreaterOrEqual(
- XSyncValue /*a*/,
- XSyncValue /*b*/
-);
-
-extern Bool XSyncValueLessOrEqual(
- XSyncValue /*a*/,
- XSyncValue /*b*/
-);
-
-extern Bool XSyncValueEqual(
- XSyncValue /*a*/,
- XSyncValue /*b*/
-);
-
-extern Bool XSyncValueIsNegative(
- XSyncValue /*v*/
-);
-
-extern Bool XSyncValueIsZero(
- XSyncValue /*a*/
-);
-
-extern Bool XSyncValueIsPositive(
- XSyncValue /*v*/
-);
-
-extern unsigned int XSyncValueLow32(
- XSyncValue /*v*/
-);
-
-extern int XSyncValueHigh32(
- XSyncValue /*v*/
-);
-
-extern void XSyncValueAdd(
- XSyncValue* /*presult*/,
- XSyncValue /*a*/,
- XSyncValue /*b*/,
- int* /*poverflow*/
-);
-
-extern void XSyncValueSubtract(
- XSyncValue* /*presult*/,
- XSyncValue /*a*/,
- XSyncValue /*b*/,
- int* /*poverflow*/
-);
-
-extern void XSyncMaxValue(
- XSyncValue* /*pv*/
-);
-
-extern void XSyncMinValue(
- XSyncValue* /*pv*/
-);
-
-_XFUNCPROTOEND
-
-
-typedef struct _XSyncSystemCounter {
- char *name; /* null-terminated name of system counter */
- XSyncCounter counter; /* counter id of this system counter */
- XSyncValue resolution; /* resolution of this system counter */
-} XSyncSystemCounter;
-
-
-typedef struct {
- XSyncCounter counter; /* counter to trigger on */
- XSyncValueType value_type; /* absolute/relative */
- XSyncValue wait_value; /* value to compare counter to */
- XSyncTestType test_type; /* pos/neg comparison/transtion */
-} XSyncTrigger;
-
-typedef struct {
- XSyncTrigger trigger; /* trigger for await */
- XSyncValue event_threshold; /* send event if past threshold */
-} XSyncWaitCondition;
-
-
-typedef struct {
- XSyncTrigger trigger;
- XSyncValue delta;
- Bool events;
- XSyncAlarmState state;
-} XSyncAlarmAttributes;
-
-/*
- * Events
- */
-
-typedef struct {
- int type; /* event base + XSyncCounterNotify */
- 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 */
- XSyncCounter counter; /* counter involved in await */
- XSyncValue wait_value; /* value being waited for */
- XSyncValue counter_value; /* counter value when this event was sent */
- Time time; /* milliseconds */
- int count; /* how many more events to come */
- Bool destroyed; /* True if counter was destroyed */
-} XSyncCounterNotifyEvent;
-
-typedef struct {
- int type; /* event base + XSyncCounterNotify */
- 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 */
- XSyncAlarm alarm; /* alarm that triggered */
- XSyncValue counter_value; /* value that triggered the alarm */
- XSyncValue alarm_value; /* test value of trigger in alarm */
- Time time; /* milliseconds */
- XSyncAlarmState state; /* new state of alarm */
-} XSyncAlarmNotifyEvent;
-
-/*
- * Errors
- */
-
-typedef struct {
- int type;
- Display *display; /* Display the event was read from */
- XSyncAlarm alarm; /* resource id */
- unsigned long serial; /* serial number of failed request */
- unsigned char error_code; /* error base + XSyncBadAlarm */
- unsigned char request_code; /* Major op-code of failed request */
- unsigned char minor_code; /* Minor op-code of failed request */
-} XSyncAlarmError;
-
-typedef struct {
- int type;
- Display *display; /* Display the event was read from */
- XSyncCounter counter; /* resource id */
- unsigned long serial; /* serial number of failed request */
- unsigned char error_code; /* error base + XSyncBadCounter */
- unsigned char request_code; /* Major op-code of failed request */
- unsigned char minor_code; /* Minor op-code of failed request */
-} XSyncCounterError;
-
-/*
- * Prototypes
- */
-
-_XFUNCPROTOBEGIN
-
-extern Status XSyncQueryExtension(
- Display* /*dpy*/,
- int* /*event_base_return*/,
- int* /*error_base_return*/
-);
-
-extern Status XSyncInitialize(
- Display* /*dpy*/,
- int* /*major_version_return*/,
- int* /*minor_version_return*/
-);
-
-extern XSyncSystemCounter *XSyncListSystemCounters(
- Display* /*dpy*/,
- int* /*n_counters_return*/
-);
-
-extern void XSyncFreeSystemCounterList(
- XSyncSystemCounter* /*list*/
-);
-
-extern XSyncCounter XSyncCreateCounter(
- Display* /*dpy*/,
- XSyncValue /*initial_value*/
-);
-
-extern Status XSyncSetCounter(
- Display* /*dpy*/,
- XSyncCounter /*counter*/,
- XSyncValue /*value*/
-);
-
-extern Status XSyncChangeCounter(
- Display* /*dpy*/,
- XSyncCounter /*counter*/,
- XSyncValue /*value*/
-);
-
-extern Status XSyncDestroyCounter(
- Display* /*dpy*/,
- XSyncCounter /*counter*/
-);
-
-extern Status XSyncQueryCounter(
- Display* /*dpy*/,
- XSyncCounter /*counter*/,
- XSyncValue* /*value_return*/
-);
-
-extern Status XSyncAwait(
- Display* /*dpy*/,
- XSyncWaitCondition* /*wait_list*/,
- int /*n_conditions*/
-);
-
-extern XSyncAlarm XSyncCreateAlarm(
- Display* /*dpy*/,
- unsigned long /*values_mask*/,
- XSyncAlarmAttributes* /*values*/
-);
-
-extern Status XSyncDestroyAlarm(
- Display* /*dpy*/,
- XSyncAlarm /*alarm*/
-);
-
-extern Status XSyncQueryAlarm(
- Display* /*dpy*/,
- XSyncAlarm /*alarm*/,
- XSyncAlarmAttributes* /*values_return*/
-);
-
-extern Status XSyncChangeAlarm(
- Display* /*dpy*/,
- XSyncAlarm /*alarm*/,
- unsigned long /*values_mask*/,
- XSyncAlarmAttributes* /*values*/
-);
-
-extern Status XSyncSetPriority(
- Display* /*dpy*/,
- XID /*client_resource_id*/,
- int /*priority*/
-);
-
-extern Status XSyncGetPriority(
- Display* /*dpy*/,
- XID /*client_resource_id*/,
- int* /*return_priority*/
-);
-
-extern XSyncFence XSyncCreateFence(
- Display* /*dpy*/,
- Drawable /*d*/,
- Bool /*initially_triggered*/
-);
-
-extern Bool XSyncTriggerFence(
- Display* /*dpy*/,
- XSyncFence /*fence*/
-);
-
-extern Bool XSyncResetFence(
- Display* /*dpy*/,
- XSyncFence /*fence*/
-);
-
-extern Bool XSyncDestroyFence(
- Display* /*dpy*/,
- XSyncFence /*fence*/
-);
-
-extern Bool XSyncQueryFence(
- Display* /*dpy*/,
- XSyncFence /*fence*/,
- Bool* /*triggered*/
-);
-
-extern Bool XSyncAwaitFence(
- Display* /*dpy*/,
- const XSyncFence* /*fence_list*/,
- int /*n_fences*/
-);
-
-_XFUNCPROTOEND
-
-#endif /* _SYNC_SERVER */
-
-#endif /* _SYNC_H_ */
+/*
+
+Copyright 1991, 1993, 1994, 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 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+ All Rights Reserved
+
+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 names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY 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 _SYNC_H_
+#define _SYNC_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/syncconst.h>
+
+#ifdef _SYNC_SERVER
+#include <X11/extensions/syncproto.h>
+#else
+
+_XFUNCPROTOBEGIN
+/* get rid of macros so we can define corresponding functions */
+#undef XSyncIntToValue
+#undef XSyncIntsToValue
+#undef XSyncValueGreaterThan
+#undef XSyncValueLessThan
+#undef XSyncValueGreaterOrEqual
+#undef XSyncValueLessOrEqual
+#undef XSyncValueEqual
+#undef XSyncValueIsNegative
+#undef XSyncValueIsZero
+#undef XSyncValueIsPositive
+#undef XSyncValueLow32
+#undef XSyncValueHigh32
+#undef XSyncValueAdd
+#undef XSyncValueSubtract
+#undef XSyncMaxValue
+#undef XSyncMinValue
+
+extern void XSyncIntToValue(
+ XSyncValue* /*pv*/,
+ int /*i*/
+);
+
+extern void XSyncIntsToValue(
+ XSyncValue* /*pv*/,
+ unsigned int /*l*/,
+ int /*h*/
+);
+
+extern Bool XSyncValueGreaterThan(
+ XSyncValue /*a*/,
+ XSyncValue /*b*/
+);
+
+extern Bool XSyncValueLessThan(
+ XSyncValue /*a*/,
+ XSyncValue /*b*/
+);
+
+extern Bool XSyncValueGreaterOrEqual(
+ XSyncValue /*a*/,
+ XSyncValue /*b*/
+);
+
+extern Bool XSyncValueLessOrEqual(
+ XSyncValue /*a*/,
+ XSyncValue /*b*/
+);
+
+extern Bool XSyncValueEqual(
+ XSyncValue /*a*/,
+ XSyncValue /*b*/
+);
+
+extern Bool XSyncValueIsNegative(
+ XSyncValue /*v*/
+);
+
+extern Bool XSyncValueIsZero(
+ XSyncValue /*a*/
+);
+
+extern Bool XSyncValueIsPositive(
+ XSyncValue /*v*/
+);
+
+extern unsigned int XSyncValueLow32(
+ XSyncValue /*v*/
+);
+
+extern int XSyncValueHigh32(
+ XSyncValue /*v*/
+);
+
+extern void XSyncValueAdd(
+ XSyncValue* /*presult*/,
+ XSyncValue /*a*/,
+ XSyncValue /*b*/,
+ int* /*poverflow*/
+);
+
+extern void XSyncValueSubtract(
+ XSyncValue* /*presult*/,
+ XSyncValue /*a*/,
+ XSyncValue /*b*/,
+ int* /*poverflow*/
+);
+
+extern void XSyncMaxValue(
+ XSyncValue* /*pv*/
+);
+
+extern void XSyncMinValue(
+ XSyncValue* /*pv*/
+);
+
+_XFUNCPROTOEND
+
+
+typedef struct _XSyncSystemCounter {
+ char *name; /* null-terminated name of system counter */
+ XSyncCounter counter; /* counter id of this system counter */
+ XSyncValue resolution; /* resolution of this system counter */
+} XSyncSystemCounter;
+
+
+typedef struct {
+ XSyncCounter counter; /* counter to trigger on */
+ XSyncValueType value_type; /* absolute/relative */
+ XSyncValue wait_value; /* value to compare counter to */
+ XSyncTestType test_type; /* pos/neg comparison/transtion */
+} XSyncTrigger;
+
+typedef struct {
+ XSyncTrigger trigger; /* trigger for await */
+ XSyncValue event_threshold; /* send event if past threshold */
+} XSyncWaitCondition;
+
+
+typedef struct {
+ XSyncTrigger trigger;
+ XSyncValue delta;
+ Bool events;
+ XSyncAlarmState state;
+} XSyncAlarmAttributes;
+
+/*
+ * Events
+ */
+
+typedef struct {
+ int type; /* event base + XSyncCounterNotify */
+ 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 */
+ XSyncCounter counter; /* counter involved in await */
+ XSyncValue wait_value; /* value being waited for */
+ XSyncValue counter_value; /* counter value when this event was sent */
+ Time time; /* milliseconds */
+ int count; /* how many more events to come */
+ Bool destroyed; /* True if counter was destroyed */
+} XSyncCounterNotifyEvent;
+
+typedef struct {
+ int type; /* event base + XSyncCounterNotify */
+ 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 */
+ XSyncAlarm alarm; /* alarm that triggered */
+ XSyncValue counter_value; /* value that triggered the alarm */
+ XSyncValue alarm_value; /* test value of trigger in alarm */
+ Time time; /* milliseconds */
+ XSyncAlarmState state; /* new state of alarm */
+} XSyncAlarmNotifyEvent;
+
+/*
+ * Errors
+ */
+
+typedef struct {
+ int type;
+ Display *display; /* Display the event was read from */
+ XSyncAlarm alarm; /* resource id */
+ unsigned long serial; /* serial number of failed request */
+ unsigned char error_code; /* error base + XSyncBadAlarm */
+ unsigned char request_code; /* Major op-code of failed request */
+ unsigned char minor_code; /* Minor op-code of failed request */
+} XSyncAlarmError;
+
+typedef struct {
+ int type;
+ Display *display; /* Display the event was read from */
+ XSyncCounter counter; /* resource id */
+ unsigned long serial; /* serial number of failed request */
+ unsigned char error_code; /* error base + XSyncBadCounter */
+ unsigned char request_code; /* Major op-code of failed request */
+ unsigned char minor_code; /* Minor op-code of failed request */
+} XSyncCounterError;
+
+/*
+ * Prototypes
+ */
+
+_XFUNCPROTOBEGIN
+
+extern Status XSyncQueryExtension(
+ Display* /*dpy*/,
+ int* /*event_base_return*/,
+ int* /*error_base_return*/
+);
+
+extern Status XSyncInitialize(
+ Display* /*dpy*/,
+ int* /*major_version_return*/,
+ int* /*minor_version_return*/
+);
+
+extern XSyncSystemCounter *XSyncListSystemCounters(
+ Display* /*dpy*/,
+ int* /*n_counters_return*/
+);
+
+extern void XSyncFreeSystemCounterList(
+ XSyncSystemCounter* /*list*/
+);
+
+extern XSyncCounter XSyncCreateCounter(
+ Display* /*dpy*/,
+ XSyncValue /*initial_value*/
+);
+
+extern Status XSyncSetCounter(
+ Display* /*dpy*/,
+ XSyncCounter /*counter*/,
+ XSyncValue /*value*/
+);
+
+extern Status XSyncChangeCounter(
+ Display* /*dpy*/,
+ XSyncCounter /*counter*/,
+ XSyncValue /*value*/
+);
+
+extern Status XSyncDestroyCounter(
+ Display* /*dpy*/,
+ XSyncCounter /*counter*/
+);
+
+extern Status XSyncQueryCounter(
+ Display* /*dpy*/,
+ XSyncCounter /*counter*/,
+ XSyncValue* /*value_return*/
+);
+
+extern Status XSyncAwait(
+ Display* /*dpy*/,
+ XSyncWaitCondition* /*wait_list*/,
+ int /*n_conditions*/
+);
+
+extern XSyncAlarm XSyncCreateAlarm(
+ Display* /*dpy*/,
+ unsigned long /*values_mask*/,
+ XSyncAlarmAttributes* /*values*/
+);
+
+extern Status XSyncDestroyAlarm(
+ Display* /*dpy*/,
+ XSyncAlarm /*alarm*/
+);
+
+extern Status XSyncQueryAlarm(
+ Display* /*dpy*/,
+ XSyncAlarm /*alarm*/,
+ XSyncAlarmAttributes* /*values_return*/
+);
+
+extern Status XSyncChangeAlarm(
+ Display* /*dpy*/,
+ XSyncAlarm /*alarm*/,
+ unsigned long /*values_mask*/,
+ XSyncAlarmAttributes* /*values*/
+);
+
+extern Status XSyncSetPriority(
+ Display* /*dpy*/,
+ XID /*client_resource_id*/,
+ int /*priority*/
+);
+
+extern Status XSyncGetPriority(
+ Display* /*dpy*/,
+ XID /*client_resource_id*/,
+ int* /*return_priority*/
+);
+
+extern XSyncFence XSyncCreateFence(
+ Display* /*dpy*/,
+ Drawable /*d*/,
+ Bool /*initially_triggered*/
+);
+
+extern Bool XSyncTriggerFence(
+ Display* /*dpy*/,
+ XSyncFence /*fence*/
+);
+
+extern Bool XSyncResetFence(
+ Display* /*dpy*/,
+ XSyncFence /*fence*/
+);
+
+extern Bool XSyncDestroyFence(
+ Display* /*dpy*/,
+ XSyncFence /*fence*/
+);
+
+extern Bool XSyncQueryFence(
+ Display* /*dpy*/,
+ XSyncFence /*fence*/,
+ Bool* /*triggered*/
+);
+
+extern Bool XSyncAwaitFence(
+ Display* /*dpy*/,
+ const XSyncFence* /*fence_list*/,
+ int /*n_fences*/
+);
+
+_XFUNCPROTOEND
+
+#endif /* _SYNC_SERVER */
+
+#endif /* _SYNC_H_ */
diff --git a/libXext/include/X11/extensions/xtestext1.h b/libXext/include/X11/extensions/xtestext1.h
index 59cdd151d..67d015bb0 100644
--- a/libXext/include/X11/extensions/xtestext1.h
+++ b/libXext/include/X11/extensions/xtestext1.h
@@ -41,8 +41,8 @@ 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
+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
diff --git a/libXext/man/DBE.man b/libXext/man/DBE.man
index 6199d4917..5ed34c236 100644
--- a/libXext/man/DBE.man
+++ b/libXext/man/DBE.man
@@ -1,313 +1,313 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DBE - Double Buffer Extension
-.SH SYNOPSIS
-The Double Buffer Extension (DBE) provides a standard way to utilize
-double-buffering within the framework of the X Window System.
-Double-buffering uses two buffers, called front and back, which hold images.
-The front buffer is visible to the user; the back buffer is not. Successive
-frames of an animation are rendered into the back buffer while the previously
-rendered frame is displayed in the front buffer. When a new frame is ready,
-the back and front buffers swap roles, making the new frame visible. Ideally,
-this exchange appears to happen instantaneously to the user, with no visual
-artifacts. Thus, only completely rendered images are presented to the user,
-and remain visible during the entire time it takes to render a new frame. The
-result is a flicker-free animation.
-.SH DESCRIPTION
-.B Concepts
-.RS
-Normal windows are created using
-.B XCreateWindow()
-or
-.B XCreateSimpleWindow(),
-which allocate a set of window attributes and, for InputOutput windows, a front
-buffer, into which an image can be drawn. The contents of this buffer will be
-displayed when the window is visible.
-
-This extension enables applications to use double-buffering with a window.
-This involves creating a second buffer, called a back buffer, and associating
-one or more back buffer names
-.I (XIDs)
-with the window, for use when referring
-to (i.e., drawing to or reading from) the window's back buffer.
-The back buffer name is a drawable of type
-.I XdbeBackBuffer.
-
-DBE provides a relative double-buffering model. One XID, the window,
-always refers to the front buffer. One or more other XIDs, the back buffer
-names, always refer to the back buffer. After a buffer swap, the window
-continues to refer to the (new) front buffer, and the back buffer name
-continues to refer to the (new) back buffer. Thus, applications and toolkits
-that want to just render to the back buffer always use the back buffer name
-for all drawing requests to the window. Portions of an application that want
-to render to the front buffer always use the window XID for all drawing
-requests to the window.
-
-Multiple clients and toolkits can all use double-buffering on the same window.
-DBE does not provide a request for querying whether a window has
-double-buffering support, and if so, what the back buffer name is. Given the
-asynchronous nature of the X Window System, this would cause race
-conditions. Instead, DBE allows multiple back buffer names to exist for the
-same window; they all refer to the same physical back buffer. The first time a
-back buffer name is allocated for a window, the window becomes
-double-buffered and the back buffer name is associated with the window.
-Subsequently, the window already is a double-buffered window, and nothing
-about the window changes when a new back buffer name is allocated, except
-that the new back buffer name is associated with the window. The window
-remains double-buffered until either the window is destroyed, or until all of
-the back buffer names for the window are deallocated.
-
-In general, both the front and back buffers ae treated the same. In
-particular, here are some important characteristics:
-
-.RS
-Only one buffer per window can be visible at a time (the front buffer).
-
-Both buffers associated with a window have the same visual type, depth,
-width, height, and shape as the window.
-
-Both buffers associated with a window are "visible" (or "obscured") in
-the same way. When an Expose event is generated for a window, this
-event is considered to apply to both buffers equally. When a
-double-buffered window is exposed, both buffers are tiled with the
-window background.
-Even though the back buffer is not visible, terms such as obscure apply to the
-back buffer as well as to the front buffer.
-
-It is acceptable at any time to pass an
-.I XdbeBackBuffer
-in any function that expects a drawable.
-This enables an application to draw directly into
-.I XdbeBackBuffer
-in the same fashion as it would draw into any other drawable.
-
-It is an error (Window) to pass an
-.I XdbeBackBuffer
-in a function that expects a Window.
-
-An
-.I XdbeBackBuffer
-will never be sent in a reply, event, or error where a Window is specified.
-
-If backing-store and save-under applies to a double-buffered
-window, it applies to both buffers equally.
-
-If the
-.B XClearArea()
-or
-.B XClearWindow()
-function is executed on a
-double-buffered window, the same area in both the front and back buffers
-is cleared.
-.RE
-
-The effect of passing a window to a function that accepts a drawable
-is unchanged by this extension. The window and front buffer are synonymous
-with each other. This includes obeying the
-.B XGetImage()
-and
-.B XGetSubImage()
-semantics and the subwindow-mode semantics if a graphics context is
-involved. Regardless of whether the window was explicitly passed in an
-.B XGetImage()
-or
-.B XGetSubImage()
-call, or implicitly referenced (i.e., one of
-the window's ancestors was passed in the function), the front (i.e. visible)
-buffer is always referenced.
-Thus, DBE-naive screen dump clients will always get the front buffer.
-.B XGetImage()
-and
-.B XGetSubImage()
-on a back
-buffer return undefined image contents for any obscured regions of the back
-buffer that fall within the image.
-
-Drawing to a back buffer always uses the clip region that would be used to
-draw to the front buffer with a GC subwindow-mode of ClipByChildren. If an
-ancestor of a double-buffered window is drawn to with a GC having a
-subwindow-mode of IncludeInferiors, the effect on the double-buffered
-window's back buffer depends on the depth of the double-buffered window
-and the ancestor. If the depths are the same, the contents of the back buffer
-of the double-buffered window are not changed. If the depths are different,
-the contents of the back buffer of the double-buffered window are undefined
-for the pixels that the IncludeInferiors drawing touched.
-
-DBE adds no new events. DBE does not extend the semantics of any existing
-events with the exception of adding a new drawable type called
-.I XdbeBackBuffer.
-
-If events, replies, or errors that contain a drawable
-(e.g., GraphicsExpose) are generated in response to a request, the
-drawable returned will be the one specified in the request.
-
-DBE advertises which visuals support double buffering.
-
-DBE does not include any timing or synchronization facilities. Applications
-that need such facilities (e.g., to maintain a constant frame rate) should
-investigate the Synchronization Extension, an X Consortium standard.
-.RE
-
-.B Window Management Operations
-
-.RS
-The basic philosophy of DBE is that both buffers are treated the same by
-X window management operations.
-
-When a double-buffered window is destroyed,
-both buffers associated with the window are destroyed, and all back buffer
-names associated with the window are freed.
-
-If the size of a double-buffered window changes, both
-buffers assume the new size. If the window's size increases, the effect on the
-buffers depends on whether the implementation honors bit gravity for buffers.
-If bit gravity is implemented, then the contents of both buffers are moved in
-accordance with the window's bit gravity,
-and the remaining areas are tiled with the window background. If
-bit gravity is not implemented, then the entire unobscured region of both
-buffers is tiled with the window background. In either case, Expose events are
-generated for the region that is tiled with the window background.
-
-If the
-.B XGetGeometry()
-function is executed on an
-.I XdbeBackBuffer,
-the returned x, y, and border-width will be zero.
-
-If the Shape extension
-.B ShapeRectangles, ShapeMask, ShapeCombine,
-or
-.B ShapeOffset
-request is executed on a double-buffered window, both
-buffers are reshaped to match the new window shape. The region difference
-D = new shape - old shape is tiled with the window background in both
-buffers, and Expose events are generated for D.
-.RE
-
-.B Complex Swap Actions
-
-.RS
-DBE has no explicit knowledge of ancillary buffers (e.g. depth buffers or
-alpha buffers), and only has a limited set of defined swap actions. Some
-applications may need a richer set of swap actions than DBE provides. Some
-DBE implementations have knowledge of ancillary buffers, and/or can provide
-a rich set of swap actions. Instead of continually extending DBE to increase
-its set of swap actions, DBE provides a flexible "idiom" mechanism. If an
-applications's needs are served by the defined swap actions, it should use
-them; otherwise, it should use the following method of expressing a complex
-swap action as an idiom. Following this policy will ensure the best possible
-performance across a wide variety of implementations.
-
-As suggested by the term "idiom," a complex swap action should be expressed
-as a group/series of requests. Taken together, this group of requests may be
-combined into an atomic operation by the implementation, in order to
-maximize performance. The set of idioms actually recognized for optimization
-is implementation dependent. To help with idiom expression and
-interpretation, an idiom must be surrounded by two function calls:
-.B XdbeBeginIdiom()
-and
-.B XdbeEndIdiom().
-Unless this begin-end pair
-surrounds the idiom, it may not be recognized by a given implementation, and
-performance will suffer.
-
-For example, if an application wants to swap buffers for two windows, and use
-X to clear only certain planes of the back buffers, the application would
-make the following calls as a group, and in the following order:
-
-.RS
-.B XdbeBeginIdiom().
-
-.B XdbeSwapBuffers()
-with XIDs for two windows, each of which uses a swap action of Untouched.
-
-.B XFillRectangle()
-to the back buffer of one window.
-
-.B XFillRectangle()
-to the back buffer of the other window.
-
-.B XdbeEndIdiom().
-.RE
-
-The
-.B XdbeBeginIdiom()
-and
-.B XdbeEndIdiom()
-functions do not perform any
-actions themselves. They are treated as markers by implementations that can
-combine certain groups/series of requests as idioms, and are ignored by other
-implementations or for non-recognized groups/series of requests. If these
-function calls are made out of order, or are mismatched, no errors are sent,
-and the functions are executed as usual, though performance may suffer.
-
-.B XdbeSwapBuffers()
-need not be included in an idiom. For
-example, if a swap action of Copied is desired, but only some of the planes
-should be copied,
-.B XCopyArea()
-may be used instead of
-.B XdbeSwapBuffers().
-If
-.B XdbeSwapBuffers()
-is included in an idiom, it should immediately follow the
-.B XdbeBeginIdiom()
-call. Also, when the
-.B XdbeSwapBuffers()
-is included in an idiom, that request's swap action will
-still be valid, and if the swap action might overlap with another request, then
-the final result of the idiom must be as if the separate requests were executed
-serially. For example, if the specified swap action is Untouched, and if a
-.B XFillRectangle()
-using a client clip rectangle is done to the window's back
-buffer after the
-.B XdbeSwapBuffers()
-call, then the contents of the new
-back buffer (after the idiom) will be the same as if the idiom was not
-recognized by the implementation.
-
-It is highly recommended that API providers define, and application
-developers use, "convenience" functions that allow client applications to call
-one procedure that encapsulates common idioms. These functions will
-generate the
-.B XdbeBeginIdiom(),
-idiom, and
-.B XdbeEndIdiom()
-calls. Usage of these functions will ensure best possible
-performance across a wide variety of implementations.
-.SH SEE ALSO
-.I XdbeAllocateBackBufferName(),
-.I XdbeBeginIdiom(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeEndIdiom(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeGetVisualInfo(),
-.I XdbeQueryExtension(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DBE - Double Buffer Extension
+.SH SYNOPSIS
+The Double Buffer Extension (DBE) provides a standard way to utilize
+double-buffering within the framework of the X Window System.
+Double-buffering uses two buffers, called front and back, which hold images.
+The front buffer is visible to the user; the back buffer is not. Successive
+frames of an animation are rendered into the back buffer while the previously
+rendered frame is displayed in the front buffer. When a new frame is ready,
+the back and front buffers swap roles, making the new frame visible. Ideally,
+this exchange appears to happen instantaneously to the user, with no visual
+artifacts. Thus, only completely rendered images are presented to the user,
+and remain visible during the entire time it takes to render a new frame. The
+result is a flicker-free animation.
+.SH DESCRIPTION
+.B Concepts
+.RS
+Normal windows are created using
+.B XCreateWindow()
+or
+.B XCreateSimpleWindow(),
+which allocate a set of window attributes and, for InputOutput windows, a front
+buffer, into which an image can be drawn. The contents of this buffer will be
+displayed when the window is visible.
+
+This extension enables applications to use double-buffering with a window.
+This involves creating a second buffer, called a back buffer, and associating
+one or more back buffer names
+.I (XIDs)
+with the window, for use when referring
+to (i.e., drawing to or reading from) the window's back buffer.
+The back buffer name is a drawable of type
+.I XdbeBackBuffer.
+
+DBE provides a relative double-buffering model. One XID, the window,
+always refers to the front buffer. One or more other XIDs, the back buffer
+names, always refer to the back buffer. After a buffer swap, the window
+continues to refer to the (new) front buffer, and the back buffer name
+continues to refer to the (new) back buffer. Thus, applications and toolkits
+that want to just render to the back buffer always use the back buffer name
+for all drawing requests to the window. Portions of an application that want
+to render to the front buffer always use the window XID for all drawing
+requests to the window.
+
+Multiple clients and toolkits can all use double-buffering on the same window.
+DBE does not provide a request for querying whether a window has
+double-buffering support, and if so, what the back buffer name is. Given the
+asynchronous nature of the X Window System, this would cause race
+conditions. Instead, DBE allows multiple back buffer names to exist for the
+same window; they all refer to the same physical back buffer. The first time a
+back buffer name is allocated for a window, the window becomes
+double-buffered and the back buffer name is associated with the window.
+Subsequently, the window already is a double-buffered window, and nothing
+about the window changes when a new back buffer name is allocated, except
+that the new back buffer name is associated with the window. The window
+remains double-buffered until either the window is destroyed, or until all of
+the back buffer names for the window are deallocated.
+
+In general, both the front and back buffers ae treated the same. In
+particular, here are some important characteristics:
+
+.RS
+Only one buffer per window can be visible at a time (the front buffer).
+
+Both buffers associated with a window have the same visual type, depth,
+width, height, and shape as the window.
+
+Both buffers associated with a window are "visible" (or "obscured") in
+the same way. When an Expose event is generated for a window, this
+event is considered to apply to both buffers equally. When a
+double-buffered window is exposed, both buffers are tiled with the
+window background.
+Even though the back buffer is not visible, terms such as obscure apply to the
+back buffer as well as to the front buffer.
+
+It is acceptable at any time to pass an
+.I XdbeBackBuffer
+in any function that expects a drawable.
+This enables an application to draw directly into
+.I XdbeBackBuffer
+in the same fashion as it would draw into any other drawable.
+
+It is an error (Window) to pass an
+.I XdbeBackBuffer
+in a function that expects a Window.
+
+An
+.I XdbeBackBuffer
+will never be sent in a reply, event, or error where a Window is specified.
+
+If backing-store and save-under applies to a double-buffered
+window, it applies to both buffers equally.
+
+If the
+.B XClearArea()
+or
+.B XClearWindow()
+function is executed on a
+double-buffered window, the same area in both the front and back buffers
+is cleared.
+.RE
+
+The effect of passing a window to a function that accepts a drawable
+is unchanged by this extension. The window and front buffer are synonymous
+with each other. This includes obeying the
+.B XGetImage()
+and
+.B XGetSubImage()
+semantics and the subwindow-mode semantics if a graphics context is
+involved. Regardless of whether the window was explicitly passed in an
+.B XGetImage()
+or
+.B XGetSubImage()
+call, or implicitly referenced (i.e., one of
+the window's ancestors was passed in the function), the front (i.e. visible)
+buffer is always referenced.
+Thus, DBE-naive screen dump clients will always get the front buffer.
+.B XGetImage()
+and
+.B XGetSubImage()
+on a back
+buffer return undefined image contents for any obscured regions of the back
+buffer that fall within the image.
+
+Drawing to a back buffer always uses the clip region that would be used to
+draw to the front buffer with a GC subwindow-mode of ClipByChildren. If an
+ancestor of a double-buffered window is drawn to with a GC having a
+subwindow-mode of IncludeInferiors, the effect on the double-buffered
+window's back buffer depends on the depth of the double-buffered window
+and the ancestor. If the depths are the same, the contents of the back buffer
+of the double-buffered window are not changed. If the depths are different,
+the contents of the back buffer of the double-buffered window are undefined
+for the pixels that the IncludeInferiors drawing touched.
+
+DBE adds no new events. DBE does not extend the semantics of any existing
+events with the exception of adding a new drawable type called
+.I XdbeBackBuffer.
+
+If events, replies, or errors that contain a drawable
+(e.g., GraphicsExpose) are generated in response to a request, the
+drawable returned will be the one specified in the request.
+
+DBE advertises which visuals support double buffering.
+
+DBE does not include any timing or synchronization facilities. Applications
+that need such facilities (e.g., to maintain a constant frame rate) should
+investigate the Synchronization Extension, an X Consortium standard.
+.RE
+
+.B Window Management Operations
+
+.RS
+The basic philosophy of DBE is that both buffers are treated the same by
+X window management operations.
+
+When a double-buffered window is destroyed,
+both buffers associated with the window are destroyed, and all back buffer
+names associated with the window are freed.
+
+If the size of a double-buffered window changes, both
+buffers assume the new size. If the window's size increases, the effect on the
+buffers depends on whether the implementation honors bit gravity for buffers.
+If bit gravity is implemented, then the contents of both buffers are moved in
+accordance with the window's bit gravity,
+and the remaining areas are tiled with the window background. If
+bit gravity is not implemented, then the entire unobscured region of both
+buffers is tiled with the window background. In either case, Expose events are
+generated for the region that is tiled with the window background.
+
+If the
+.B XGetGeometry()
+function is executed on an
+.I XdbeBackBuffer,
+the returned x, y, and border-width will be zero.
+
+If the Shape extension
+.B ShapeRectangles, ShapeMask, ShapeCombine,
+or
+.B ShapeOffset
+request is executed on a double-buffered window, both
+buffers are reshaped to match the new window shape. The region difference
+D = new shape - old shape is tiled with the window background in both
+buffers, and Expose events are generated for D.
+.RE
+
+.B Complex Swap Actions
+
+.RS
+DBE has no explicit knowledge of ancillary buffers (e.g. depth buffers or
+alpha buffers), and only has a limited set of defined swap actions. Some
+applications may need a richer set of swap actions than DBE provides. Some
+DBE implementations have knowledge of ancillary buffers, and/or can provide
+a rich set of swap actions. Instead of continually extending DBE to increase
+its set of swap actions, DBE provides a flexible "idiom" mechanism. If an
+applications's needs are served by the defined swap actions, it should use
+them; otherwise, it should use the following method of expressing a complex
+swap action as an idiom. Following this policy will ensure the best possible
+performance across a wide variety of implementations.
+
+As suggested by the term "idiom," a complex swap action should be expressed
+as a group/series of requests. Taken together, this group of requests may be
+combined into an atomic operation by the implementation, in order to
+maximize performance. The set of idioms actually recognized for optimization
+is implementation dependent. To help with idiom expression and
+interpretation, an idiom must be surrounded by two function calls:
+.B XdbeBeginIdiom()
+and
+.B XdbeEndIdiom().
+Unless this begin-end pair
+surrounds the idiom, it may not be recognized by a given implementation, and
+performance will suffer.
+
+For example, if an application wants to swap buffers for two windows, and use
+X to clear only certain planes of the back buffers, the application would
+make the following calls as a group, and in the following order:
+
+.RS
+.B XdbeBeginIdiom().
+
+.B XdbeSwapBuffers()
+with XIDs for two windows, each of which uses a swap action of Untouched.
+
+.B XFillRectangle()
+to the back buffer of one window.
+
+.B XFillRectangle()
+to the back buffer of the other window.
+
+.B XdbeEndIdiom().
+.RE
+
+The
+.B XdbeBeginIdiom()
+and
+.B XdbeEndIdiom()
+functions do not perform any
+actions themselves. They are treated as markers by implementations that can
+combine certain groups/series of requests as idioms, and are ignored by other
+implementations or for non-recognized groups/series of requests. If these
+function calls are made out of order, or are mismatched, no errors are sent,
+and the functions are executed as usual, though performance may suffer.
+
+.B XdbeSwapBuffers()
+need not be included in an idiom. For
+example, if a swap action of Copied is desired, but only some of the planes
+should be copied,
+.B XCopyArea()
+may be used instead of
+.B XdbeSwapBuffers().
+If
+.B XdbeSwapBuffers()
+is included in an idiom, it should immediately follow the
+.B XdbeBeginIdiom()
+call. Also, when the
+.B XdbeSwapBuffers()
+is included in an idiom, that request's swap action will
+still be valid, and if the swap action might overlap with another request, then
+the final result of the idiom must be as if the separate requests were executed
+serially. For example, if the specified swap action is Untouched, and if a
+.B XFillRectangle()
+using a client clip rectangle is done to the window's back
+buffer after the
+.B XdbeSwapBuffers()
+call, then the contents of the new
+back buffer (after the idiom) will be the same as if the idiom was not
+recognized by the implementation.
+
+It is highly recommended that API providers define, and application
+developers use, "convenience" functions that allow client applications to call
+one procedure that encapsulates common idioms. These functions will
+generate the
+.B XdbeBeginIdiom(),
+idiom, and
+.B XdbeEndIdiom()
+calls. Usage of these functions will ensure best possible
+performance across a wide variety of implementations.
+.SH SEE ALSO
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/DPMSCapable.man b/libXext/man/DPMSCapable.man
index 62861a6fd..d802ae0a2 100644
--- a/libXext/man/DPMSCapable.man
+++ b/libXext/man/DPMSCapable.man
@@ -1,65 +1,65 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSCapable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSCapable \- returns the DPMS capability of the X server
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.BR "Bool DPMSCapable" " ( Display *\fIdisplay\fP\^ );"
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.SH DESCRIPTION
-.LP
-The
-.I DPMSCapable
-function returns the Display Power Management Signaling (DPMS) capability of
-the X server, either TRUE \^(capable of DPMS\^) or FALSE \^(incapable of
-DPMS\^).
-.SH "RETURN VALUES"
-.TP 15
-True
-The
-.I DPMSCapable
-function returns True if the X server is capable of DPMS.
-.TP 15
-False
-The
-.I DPMSCapable
-function returns True if the X server is incapable of DPMS.
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSCapable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSCapable \- returns the DPMS capability of the X server
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.BR "Bool DPMSCapable" " ( Display *\fIdisplay\fP\^ );"
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.SH DESCRIPTION
+.LP
+The
+.I DPMSCapable
+function returns the Display Power Management Signaling (DPMS) capability of
+the X server, either TRUE \^(capable of DPMS\^) or FALSE \^(incapable of
+DPMS\^).
+.SH "RETURN VALUES"
+.TP 15
+True
+The
+.I DPMSCapable
+function returns True if the X server is capable of DPMS.
+.TP 15
+False
+The
+.I DPMSCapable
+function returns True if the X server is incapable of DPMS.
diff --git a/libXext/man/DPMSDisable.man b/libXext/man/DPMSDisable.man
index eeca6cbd2..efc1405f2 100644
--- a/libXext/man/DPMSDisable.man
+++ b/libXext/man/DPMSDisable.man
@@ -1,65 +1,65 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSDisable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSDisable \- disables DPMS on the specified display
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.BR "Status DPMSDisable" " ( Display \fI*display\fP\^ );"
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.SH DESCRIPTION
-.LP
-The
-.I DPMSDisable
-function disables Display Power Management Signaling (DPMS) on the specified
-display. When disabled, DPMS sets the display to DPMSModeOn. If
-.I DPMSDisable
-is invoked on a display with DPMS already disabled or on a display which does
-not support DPMS, no change is made and no error is returned.
-.SH "RETURN VALUES"
-.TP 15
-TRUE
-The
-.I DPMSDisable
-function always returns TRUE.
-.SH "SEE ALSO"
-.BR DPMSCapable (__libmansuffix__),
-.BR DPMSEnable (__libmansuffix__)
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSDisable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSDisable \- disables DPMS on the specified display
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.BR "Status DPMSDisable" " ( Display \fI*display\fP\^ );"
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.SH DESCRIPTION
+.LP
+The
+.I DPMSDisable
+function disables Display Power Management Signaling (DPMS) on the specified
+display. When disabled, DPMS sets the display to DPMSModeOn. If
+.I DPMSDisable
+is invoked on a display with DPMS already disabled or on a display which does
+not support DPMS, no change is made and no error is returned.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The
+.I DPMSDisable
+function always returns TRUE.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSEnable (__libmansuffix__)
diff --git a/libXext/man/DPMSEnable.man b/libXext/man/DPMSEnable.man
index 14f5f35af..a377dd201 100644
--- a/libXext/man/DPMSEnable.man
+++ b/libXext/man/DPMSEnable.man
@@ -1,77 +1,77 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSEnable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSEnable \- enables DPMS on the specified display
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.BR "Status DPMSEnable" " ( Display *\fIdisplay\fP\^ );"
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.SH DESCRIPTION
-.LP
-The
-.I DPMSEnable
-function enables Display Power Management Signaling (DPMS) on the specified
-.I display.
-When DPMS is enabled, DPMS will use the currently saved timeout values. It will
-trigger the appropriate DPMS power level based on the timeout values. Refer to
-.I DPMSSetTimeouts.
-All physical screens are affected by
-.I DPMSEnable
-at the same time.
-
-If
-.I DPMSEnable
-is invoked on a display which has DPMS already enabled, or on a display which
-does not support DPMS, no change is made and no error is returned.
-.SH "RETURN VALUES"
-.TP 15
-TRUE
-The
-.I DPMSEnable
-function always returns TRUE.
-.SH "SEE ALSO"
-.BR DPMSCapable (__libmansuffix__),
-.BR DPMSDisable (__libmansuffix__),
-.BR DPMSGetTimeouts (__libmansuffix__),
-.BR DPMSSetTimeouts (__libmansuffix__)
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSEnable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSEnable \- enables DPMS on the specified display
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.BR "Status DPMSEnable" " ( Display *\fIdisplay\fP\^ );"
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.SH DESCRIPTION
+.LP
+The
+.I DPMSEnable
+function enables Display Power Management Signaling (DPMS) on the specified
+.I display.
+When DPMS is enabled, DPMS will use the currently saved timeout values. It will
+trigger the appropriate DPMS power level based on the timeout values. Refer to
+.I DPMSSetTimeouts.
+All physical screens are affected by
+.I DPMSEnable
+at the same time.
+
+If
+.I DPMSEnable
+is invoked on a display which has DPMS already enabled, or on a display which
+does not support DPMS, no change is made and no error is returned.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The
+.I DPMSEnable
+function always returns TRUE.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSDisable (__libmansuffix__),
+.BR DPMSGetTimeouts (__libmansuffix__),
+.BR DPMSSetTimeouts (__libmansuffix__)
diff --git a/libXext/man/DPMSForceLevel.man b/libXext/man/DPMSForceLevel.man
index 62610be98..6517df8c9 100644
--- a/libXext/man/DPMSForceLevel.man
+++ b/libXext/man/DPMSForceLevel.man
@@ -1,83 +1,83 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSForceLevel __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSForceLevel \- forces a DPMS capable display into the
-specified power level
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.BR "Status DPMSForceLevel" " ( Display \fI*display\fP\^, CARD16 \fIlevel\fP\^ );"
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.TP
-.I level
-Specifies the level to force power to
-.SH DESCRIPTION
-.LP
-The
-.I DPMSForceLevel
-function forces a DPMS capable display into the specified power level. The
-\fIlevel\fP must be one of following four states: DPMSModeOn, DPMSModeStandby,
-DPMSModeSuspend, or DPMSModeOff. Values other than these will result in a
-BadValue error. If DPMS
-is disabled on the display, trying to set the power level on the display will
-result in a BadMatch
-protocol error.
-.SH "RETURN VALUES"
-.TP 15
-TRUE
-The
-.I DPMSForceLevel
-function always returns TRUE.
-.SH ERRORS
-.TP 15
-BadValue
-A level other than DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or DPMSModeOff
-was specified.
-.TP 15
-.SM BadMatch
-DPMS is disabled on the specified display.
-.SH "SEE ALSO"
-.BR DPMSCapable (__libmansuffix__),
-.BR DPMSInfo (__libmansuffix__),
-.BR DPMSGetTimeouts (__libmansuffix__),
-.BR DPMSSetTimeouts (__libmansuffix__)
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSForceLevel __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSForceLevel \- forces a DPMS capable display into the
+specified power level
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.BR "Status DPMSForceLevel" " ( Display \fI*display\fP\^, CARD16 \fIlevel\fP\^ );"
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I level
+Specifies the level to force power to
+.SH DESCRIPTION
+.LP
+The
+.I DPMSForceLevel
+function forces a DPMS capable display into the specified power level. The
+\fIlevel\fP must be one of following four states: DPMSModeOn, DPMSModeStandby,
+DPMSModeSuspend, or DPMSModeOff. Values other than these will result in a
+BadValue error. If DPMS
+is disabled on the display, trying to set the power level on the display will
+result in a BadMatch
+protocol error.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The
+.I DPMSForceLevel
+function always returns TRUE.
+.SH ERRORS
+.TP 15
+BadValue
+A level other than DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or DPMSModeOff
+was specified.
+.TP 15
+.SM BadMatch
+DPMS is disabled on the specified display.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSInfo (__libmansuffix__),
+.BR DPMSGetTimeouts (__libmansuffix__),
+.BR DPMSSetTimeouts (__libmansuffix__)
diff --git a/libXext/man/DPMSGetTimeouts.man b/libXext/man/DPMSGetTimeouts.man
index 3f64eccb4..0468cfda4 100644
--- a/libXext/man/DPMSGetTimeouts.man
+++ b/libXext/man/DPMSGetTimeouts.man
@@ -1,102 +1,102 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSGetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSGetTimeouts \- retrieves the timeout values used by the X server for DPMS
-timings
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.B Bool DPMSGetTimeouts
-(
-.br
- Display *\fIdisplay\fP\^,
-.br
- CARD16 *\fIstandby\fP\^,
-.br
- CARD16 *\fIsuspend\fP\^,
-.br
- CARD16 *\fIoff\fP\^
-);
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.TP
-.I standby
-Specifies the current standby timeout in seconds
-.TP
-.I suspend
-Specifies the current suspend timeout in seconds
-.TP
-.I off
-Specifies the current off timeout in seconds
-.SH DESCRIPTION
-.LP
-The
-.I DPMSGetTimeouts
-function retrieves the timeout values used by the X server for DPMS timings.
-.LP
-The value
-.I standby
-is the amount of time of inactivity in seconds before standby mode is invoked. A
-value of zero indicates that this mode has been disabled.
-.LP
-The value \fIsuspend\fP is the amount of time of inactivity in seconds before
-the second level of power savings is invoked. A value of zero indicates that
-this mode has been disabled.
-.LP
-The value \fIoff\fP is the amount of time of inactivity in seconds before the
-third and final level of power savings is invoked. A value of zero indicates
-that this mode has been disabled.
-.SH "RETURN VALUES"
-.TP 15
-TRUE
-The
-.I DPMSGetTimeouts
-function returns TRUE when values are returned.
-.TP 15
-FALSE
-The
-.I DPMSGetTimeouts
-function returns FALSE when no values returned.
-.SH "SEE ALSO"
-.BR DPMSCapable (__libmansuffix__),
-.BR DPMSInfo (__libmansuffix__),
-.BR DPMSSetTimeouts (__libmansuffix__)
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSGetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSGetTimeouts \- retrieves the timeout values used by the X server for DPMS
+timings
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Bool DPMSGetTimeouts
+(
+.br
+ Display *\fIdisplay\fP\^,
+.br
+ CARD16 *\fIstandby\fP\^,
+.br
+ CARD16 *\fIsuspend\fP\^,
+.br
+ CARD16 *\fIoff\fP\^
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I standby
+Specifies the current standby timeout in seconds
+.TP
+.I suspend
+Specifies the current suspend timeout in seconds
+.TP
+.I off
+Specifies the current off timeout in seconds
+.SH DESCRIPTION
+.LP
+The
+.I DPMSGetTimeouts
+function retrieves the timeout values used by the X server for DPMS timings.
+.LP
+The value
+.I standby
+is the amount of time of inactivity in seconds before standby mode is invoked. A
+value of zero indicates that this mode has been disabled.
+.LP
+The value \fIsuspend\fP is the amount of time of inactivity in seconds before
+the second level of power savings is invoked. A value of zero indicates that
+this mode has been disabled.
+.LP
+The value \fIoff\fP is the amount of time of inactivity in seconds before the
+third and final level of power savings is invoked. A value of zero indicates
+that this mode has been disabled.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The
+.I DPMSGetTimeouts
+function returns TRUE when values are returned.
+.TP 15
+FALSE
+The
+.I DPMSGetTimeouts
+function returns FALSE when no values returned.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSInfo (__libmansuffix__),
+.BR DPMSSetTimeouts (__libmansuffix__)
diff --git a/libXext/man/DPMSGetVersion.man b/libXext/man/DPMSGetVersion.man
index c9db0e079..a3fcd387c 100644
--- a/libXext/man/DPMSGetVersion.man
+++ b/libXext/man/DPMSGetVersion.man
@@ -1,87 +1,87 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSGetVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSGetVersion \- returns the version of the DPMS extension implemented by
-the X server
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.B Status DPMSGetVersion
-(
-.br
- Display *\fIdisplay\fP\^,
-.br
- int *\fImajor_version\fP\^,
-.br
- int *\fIminor_version\fP\^
-);
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.TP
-.I major_version
-Specifies the return location for the extension major version
-.TP
-.I minor_version
-Specifies the return location for the extension minor version
-.SH DESCRIPTION
-.LP
-The
-.I DPMSGetVersion
-function returns the version of the Display Power Management Signaling (DPMS)
-extension implemented by the X server. It returns a major and minor version
-number. The major version number will be incremented for protocol incompatible
-changes, and the minor version number will be incremented for small, upward
-compatible changes.
-.SH "RETURN VALUES"
-.TP 15
-TRUE
-The
-.I DPMSGetVersion
-function returns TRUE when the extension is supported and values are returned.
-.TP 15
-FALSE
-The
-.I DPMSGetVersion
-function returns FALSE when the extension is not supported.
-.SH "SEE ALSO"
-.BR DPMSCapable (__libmansuffix__),
-.BR DPMSQueryExtension (__libmansuffix__)
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSGetVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSGetVersion \- returns the version of the DPMS extension implemented by
+the X server
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Status DPMSGetVersion
+(
+.br
+ Display *\fIdisplay\fP\^,
+.br
+ int *\fImajor_version\fP\^,
+.br
+ int *\fIminor_version\fP\^
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I major_version
+Specifies the return location for the extension major version
+.TP
+.I minor_version
+Specifies the return location for the extension minor version
+.SH DESCRIPTION
+.LP
+The
+.I DPMSGetVersion
+function returns the version of the Display Power Management Signaling (DPMS)
+extension implemented by the X server. It returns a major and minor version
+number. The major version number will be incremented for protocol incompatible
+changes, and the minor version number will be incremented for small, upward
+compatible changes.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The
+.I DPMSGetVersion
+function returns TRUE when the extension is supported and values are returned.
+.TP 15
+FALSE
+The
+.I DPMSGetVersion
+function returns FALSE when the extension is not supported.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSQueryExtension (__libmansuffix__)
diff --git a/libXext/man/DPMSInfo.man b/libXext/man/DPMSInfo.man
index b1272eaca..31ab29cfb 100644
--- a/libXext/man/DPMSInfo.man
+++ b/libXext/man/DPMSInfo.man
@@ -1,86 +1,86 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSInfo \- returns information about the current DPMS state
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.B Status DPMSInfo
-(
-.br
- Display \fI*display\fP\^,
-.br
- CARD16 \fI*power_level\fP\^,
-.br
- BOOL \fI*state\fP\^
-);
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.TP
-.I power_level
-Specifies the current power level
-.TP
-.I state
-Specifies the current DPMS state
-.SH DESCRIPTION
-.LP
-The
-.I DPMSInfo
-function returns information about the current Display Power Management
-Signaling (DPMS) state. The \fIstate\fP
-return parameter indicates whether or not DPMS is enabled \^(TRUE\^) or
-disabled \^(FALSE\^). The \fIpower_level\fP return parameter indicates the
-current power level \^(one of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or
-DPMSModeOff.\^)
-.SH "RETURN VALUES"
-.TP 15
-TRUE
-The
-.I DPMSInfo
-function returns TRUE, if values are returned.
-.TP 15
-FALSE
-The
-.I DPMSInfo
-function returns FALSE, if no values are returned.
-.SH "SEE ALSO"
-.BR DPMSEnable (__libmansuffix__)
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSInfo \- returns information about the current DPMS state
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Status DPMSInfo
+(
+.br
+ Display \fI*display\fP\^,
+.br
+ CARD16 \fI*power_level\fP\^,
+.br
+ BOOL \fI*state\fP\^
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I power_level
+Specifies the current power level
+.TP
+.I state
+Specifies the current DPMS state
+.SH DESCRIPTION
+.LP
+The
+.I DPMSInfo
+function returns information about the current Display Power Management
+Signaling (DPMS) state. The \fIstate\fP
+return parameter indicates whether or not DPMS is enabled \^(TRUE\^) or
+disabled \^(FALSE\^). The \fIpower_level\fP return parameter indicates the
+current power level \^(one of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or
+DPMSModeOff.\^)
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The
+.I DPMSInfo
+function returns TRUE, if values are returned.
+.TP 15
+FALSE
+The
+.I DPMSInfo
+function returns FALSE, if no values are returned.
+.SH "SEE ALSO"
+.BR DPMSEnable (__libmansuffix__)
diff --git a/libXext/man/DPMSQueryExtension.man b/libXext/man/DPMSQueryExtension.man
index ca8457757..ab05a7517 100644
--- a/libXext/man/DPMSQueryExtension.man
+++ b/libXext/man/DPMSQueryExtension.man
@@ -1,104 +1,104 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSQueryExtension \- queries the X server to determine the availability
-of the DPMS Extension
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.B Bool DPMSQueryExtension
-(
-.br
- Display \fI*display\fP\^,
-.br
- int \fI*event_base\fP\^,
-.br
- int \fI*error_base\fP\^
-);
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.TP
-.I event_base
-Specifies the return location for the assigned base event
-.TP
-.I error_base
-Specifies the return location for the assigned base error
-.SH DESCRIPTION
-.LP
-The
-.I DPMSQueryExtension
-function queries the X server to determine the availability of the
-Display Power Management Signaling (DPMS)
-Extension. If the extension is available, it returns TRUE, and the
-.I event_base
-and
-.I error_base
-are set to the base event and error numbers, respectively. Otherwise, the
-return value is FALSE, and the
-values of
-.I event_base
-and
-.I error_base
-are undefined.
-.SH "RETURN VALUES"
-.TP 15
-TRUE
-The
-.I DPMSQueryExtension
-function returns TRUE if the extension is available,
-and
-.I event_base
-and
-.I error_base
-are set to the base event number and base error number for the extension,
-respectively.
-.TP 15
-FALSE
-The
-.I DPMSQueryExtension
-function returns FALSE if extension is not available, and the values of
-.I event_base
-and
-.I error_base
-are undefined.
-.SH "SEE ALSO"
-.BR DPMSGetVersion (__libmansuffix__)
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSQueryExtension \- queries the X server to determine the availability
+of the DPMS Extension
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Bool DPMSQueryExtension
+(
+.br
+ Display \fI*display\fP\^,
+.br
+ int \fI*event_base\fP\^,
+.br
+ int \fI*error_base\fP\^
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I event_base
+Specifies the return location for the assigned base event
+.TP
+.I error_base
+Specifies the return location for the assigned base error
+.SH DESCRIPTION
+.LP
+The
+.I DPMSQueryExtension
+function queries the X server to determine the availability of the
+Display Power Management Signaling (DPMS)
+Extension. If the extension is available, it returns TRUE, and the
+.I event_base
+and
+.I error_base
+are set to the base event and error numbers, respectively. Otherwise, the
+return value is FALSE, and the
+values of
+.I event_base
+and
+.I error_base
+are undefined.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The
+.I DPMSQueryExtension
+function returns TRUE if the extension is available,
+and
+.I event_base
+and
+.I error_base
+are set to the base event number and base error number for the extension,
+respectively.
+.TP 15
+FALSE
+The
+.I DPMSQueryExtension
+function returns FALSE if extension is not available, and the values of
+.I event_base
+and
+.I error_base
+are undefined.
+.SH "SEE ALSO"
+.BR DPMSGetVersion (__libmansuffix__)
diff --git a/libXext/man/DPMSSetTimeouts.man b/libXext/man/DPMSSetTimeouts.man
index 740b24761..bf8f17fb9 100644
--- a/libXext/man/DPMSSetTimeouts.man
+++ b/libXext/man/DPMSSetTimeouts.man
@@ -1,128 +1,128 @@
-.\" Copyright \(co Digital Equipment Corporation, 1996
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this
-.\" documentation for any purpose is hereby granted without fee,
-.\" provided that the above copyright notice and this permission
-.\" notice appear in all copies. Digital Equipment Corporation
-.\" makes no representations about the suitability for any purpose
-.\" of the information in this document. This documentation is
-.\" provided ``as is'' without express or implied warranty.
-.\"
-.\" Copyright (c) 1999, 2005, 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.
-.\"
-.TH DPMSSetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-DPMSSetTimeouts \- permits applications to set the timeout values
-used by the X server for DPMS timings
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/dpms.h>
-.HP
-.B Status DPMSSetTimeouts
-(
-.br
- Display *\fIdisplay\fP\^,
-.br
- CARD16 \fIstandby\fP\^,
-.br
- CARD16 \fIsuspend\fP\^,
-.br
- CARD16 \fIoff\fP\^
-);
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.TP
-.I display
-Specifies the connection to the X server
-.TP
-.I standby
-Specifies the new standby timeout in seconds
-.TP
-.I suspend
-Specifies the new suspend timeout in seconds
-.TP
-.I off
-Specifies the new off timeout in seconds
-.SH DESCRIPTION
-.LP
-The DPMSSetTimeouts function permits applications to set the timeout values
-used by the X server for Display Power Management Signaling (DPMS) timings.
-.LP
-The value \fIstandby\fP is the amount of inactivity time, in seconds, before
-standby mode is invoked. The actual
-effects of this mode are dependent on the characteristics of the monitor and
-frame buffer card. Standby mode is
-implemented by shutting off the horizontal sync signal, and pulsing the vertical
-sync signal. Standby mode
-provides the quickest monitor recovery time. Note also that many monitors
-implement this mode identical to
-suspend mode. A value of zero disables the standby mode.
-.LP
-The value \fIsuspend\fP is the amount of time of inactivity, in seconds, before
-the second level of power
-savings is invoked. Suspend mode's physical and electrical characteristics are
-implementation defined. For DPMS
-compliant hardware, setting the suspend mode is implemented by pulsing the
-horizontal sync signal and
-shutting off the vertical sync signal. In general, suspend mode recovery is
-considered to be slower than
-standby mode, but faster than off mode. However it may vary from monitor to
-monitor. As noted above, many
-monitors implement this mode identical to the standby mode. A value of zero
-disables this mode.
-.LP
-The value \fIoff\fP is the amount of time of inactivity,in seconds, before the
-third and final level of power
-savings is invoked. Off mode's physical and electrical characteristics are
-implementation defined. In DPMS
-compliant hardware, it is implemented by shutting off both horizontal and
-vertical sync signals, resulting in
-powering down of the monitor. Recovery time is implementation dependent.
-Usually the recovery time is very
-close to the power-up time of the monitor. A value of zero disables this mode.
-.LP
-Chronologically, \fIstandby\fP mode occurs before or simultaneously with
-\fIsuspend\fP mode, and
-\fIsuspend\fP mode must occur before or simultaneously with \fIoff\fP mode.
-Therefore, non-zero mode timeout
-values must be greater than or equal to the timeout values of earlier modes. If
-inconsistent values are
-supplied, a BadValue error will result.
-.SH "RETURN VALUES"
-.TP 15
-TRUE
-The
-.I DPMSSetTimeouts
-function returns TRUE when the function has succeeded.
-.SH ERRORS
-.TP 15
-.SM BadValue
-An argument is out of range.
-.SH "SEE ALSO"
-.BR DPMSCapable (__libmansuffix__),
-.BR DPMSInfo (__libmansuffix__),
-.BR DPMSGetTimeouts (__libmansuffix__)
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this
+.\" documentation for any purpose is hereby granted without fee,
+.\" provided that the above copyright notice and this permission
+.\" notice appear in all copies. Digital Equipment Corporation
+.\" makes no representations about the suitability for any purpose
+.\" of the information in this document. This documentation is
+.\" provided ``as is'' without express or implied warranty.
+.\"
+.\" Copyright (c) 1999, 2005, 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.
+.\"
+.TH DPMSSetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSSetTimeouts \- permits applications to set the timeout values
+used by the X server for DPMS timings
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Status DPMSSetTimeouts
+(
+.br
+ Display *\fIdisplay\fP\^,
+.br
+ CARD16 \fIstandby\fP\^,
+.br
+ CARD16 \fIsuspend\fP\^,
+.br
+ CARD16 \fIoff\fP\^
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I standby
+Specifies the new standby timeout in seconds
+.TP
+.I suspend
+Specifies the new suspend timeout in seconds
+.TP
+.I off
+Specifies the new off timeout in seconds
+.SH DESCRIPTION
+.LP
+The DPMSSetTimeouts function permits applications to set the timeout values
+used by the X server for Display Power Management Signaling (DPMS) timings.
+.LP
+The value \fIstandby\fP is the amount of inactivity time, in seconds, before
+standby mode is invoked. The actual
+effects of this mode are dependent on the characteristics of the monitor and
+frame buffer card. Standby mode is
+implemented by shutting off the horizontal sync signal, and pulsing the vertical
+sync signal. Standby mode
+provides the quickest monitor recovery time. Note also that many monitors
+implement this mode identical to
+suspend mode. A value of zero disables the standby mode.
+.LP
+The value \fIsuspend\fP is the amount of time of inactivity, in seconds, before
+the second level of power
+savings is invoked. Suspend mode's physical and electrical characteristics are
+implementation defined. For DPMS
+compliant hardware, setting the suspend mode is implemented by pulsing the
+horizontal sync signal and
+shutting off the vertical sync signal. In general, suspend mode recovery is
+considered to be slower than
+standby mode, but faster than off mode. However it may vary from monitor to
+monitor. As noted above, many
+monitors implement this mode identical to the standby mode. A value of zero
+disables this mode.
+.LP
+The value \fIoff\fP is the amount of time of inactivity,in seconds, before the
+third and final level of power
+savings is invoked. Off mode's physical and electrical characteristics are
+implementation defined. In DPMS
+compliant hardware, it is implemented by shutting off both horizontal and
+vertical sync signals, resulting in
+powering down of the monitor. Recovery time is implementation dependent.
+Usually the recovery time is very
+close to the power-up time of the monitor. A value of zero disables this mode.
+.LP
+Chronologically, \fIstandby\fP mode occurs before or simultaneously with
+\fIsuspend\fP mode, and
+\fIsuspend\fP mode must occur before or simultaneously with \fIoff\fP mode.
+Therefore, non-zero mode timeout
+values must be greater than or equal to the timeout values of earlier modes. If
+inconsistent values are
+supplied, a BadValue error will result.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The
+.I DPMSSetTimeouts
+function returns TRUE when the function has succeeded.
+.SH ERRORS
+.TP 15
+.SM BadValue
+An argument is out of range.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSInfo (__libmansuffix__),
+.BR DPMSGetTimeouts (__libmansuffix__)
diff --git a/libXext/man/XShape.man b/libXext/man/XShape.man
index e40369143..44fedfe78 100644
--- a/libXext/man/XShape.man
+++ b/libXext/man/XShape.man
@@ -1,174 +1,174 @@
-.\" Copyright (c) 1989, 1994 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.
-.\"
-.de ZN
-.ie t \fB\^\\$1\^\fR\\$2
-.el \fI\^\\$1\^\fP\\$2
-..
-.TH XSHAPE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XShapeQueryExtension, XShapeQueryVersion, XShapeCombineRegion, XShapeCombineRectangles, XShapeCombineMask, XShapeCombineShape, XShapeOffsetShape, XShapeQueryExtents, XShapeSelectInput, XShapeInputSelected, XShapeGetRectangles \- X nonrectangular shape functions
-.SH SYNTAX
-.nf
-.LP
-\&#include <X11/extensions/shape.h>
-.LP
-Bool XShapeQueryExtension (
- Display *dpy,
- int *event_basep,
- int *error_basep);
-.LP
-Status XShapeQueryVersion (
- Display *dpy,
- int *major_versionp,
- int *minor_versionp);
-.LP
-void XShapeCombineRegion (
- Display *dpy,
- Window dest,
- int destKind,
- int xOff,
- int yOff,
- struct _XRegion *r,
- int op);
-.LP
-void XShapeCombineRectangles (
- Display *dpy,
- XID dest,
- int destKind,
- int xOff,
- int yOff,
- XRectangle *rects,
- int n_rects,
- int op,
- int ordering);
-.LP
-void XShapeCombineMask (
- Display *dpy,
- XID dest,
- int destKind,
- int xOff,
- int yOff,
- Pixmap src,
- int op);
-.LP
-void XShapeCombineShape (
- Display *dpy,
- XID dest,
- int destKind,
- int xOff,
- int yOff,
- Pixmap src,
- int srcKind,
- int op);
-.LP
-void XShapeOffsetShape (
- Display *dpy,
- XID dest,
- int destKind,
- int xOff,
- int yOff);
-.LP
-Status XShapeQueryExtents (
- Display *dpy,
- Window window,
- int *bShaped,
- int *xbs,
- int *ybs,
- unsigned int *wbs,
- unsigned int *hbs,
- int *cShaped,
- int *xcs,
- int *ycs,
- unsigned int *wcs,
- unsigned int *hcs);
-.LP
-void XShapeSelectInput (
- Display *dpy,
- Window window,
- unsigned longmask);
-.LP
-unsigned long XShapeInputSelected (
- Display *dpy,
- Window window);
-.LP
-XRectangle *XShapeGetRectangles (
- Display *dpy,
- Window window,
- int kind,
- int *count,
- int *ordering);
-.fi
-.SH STRUCTURES
-.nf
-.LP
-.ta 3i
-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 */
- Window window; /\&* window of event */
- int kind; /\&* ShapeBounding or ShapeClip */
- int x, y; /\&* extents of new region */
- unsigned width, height;
- Time time; /\&* server timestamp when region changed */
- Bool shaped; /\&* true if the region exists */
-} XShapeEvent;
-.fi
-.SH DESCRIPTION
-The \fIX11 Nonrectangular Window Shape Extension\fP adds nonrectangular
-windows to the X Window System.
-.SH PREDEFINED VALUES
-Operations:
-.in +.5i
-.nf
-.ZN ShapeSet
-.ZN ShapeUnion
-.ZN ShapeIntersect
-.ZN ShapeSubtract
-.ZN ShapeInvert
-.in -.5i
-.fi
-.sp
-Shape Kinds:
-.in +.5i
-.nf
-.ZN ShapeBounding
-.ZN ShapeClip
-.in -.5i
-.fi
-.sp
-Event defines:
-.in +.5i
-.nf
-.ZN ShapeNotifyMask
-.ZN ShapeNotify
-.in -.5i
-.fi
-.SH BUGS
-This manual pages needs a lot more work.
-.SH SEE ALSO
-\fIX11 Nonrectangular Window Shape Extension\fP
+.\" Copyright (c) 1989, 1994 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.
+.\"
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XSHAPE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XShapeQueryExtension, XShapeQueryVersion, XShapeCombineRegion, XShapeCombineRectangles, XShapeCombineMask, XShapeCombineShape, XShapeOffsetShape, XShapeQueryExtents, XShapeSelectInput, XShapeInputSelected, XShapeGetRectangles \- X nonrectangular shape functions
+.SH SYNTAX
+.nf
+.LP
+\&#include <X11/extensions/shape.h>
+.LP
+Bool XShapeQueryExtension (
+ Display *dpy,
+ int *event_basep,
+ int *error_basep);
+.LP
+Status XShapeQueryVersion (
+ Display *dpy,
+ int *major_versionp,
+ int *minor_versionp);
+.LP
+void XShapeCombineRegion (
+ Display *dpy,
+ Window dest,
+ int destKind,
+ int xOff,
+ int yOff,
+ struct _XRegion *r,
+ int op);
+.LP
+void XShapeCombineRectangles (
+ Display *dpy,
+ XID dest,
+ int destKind,
+ int xOff,
+ int yOff,
+ XRectangle *rects,
+ int n_rects,
+ int op,
+ int ordering);
+.LP
+void XShapeCombineMask (
+ Display *dpy,
+ XID dest,
+ int destKind,
+ int xOff,
+ int yOff,
+ Pixmap src,
+ int op);
+.LP
+void XShapeCombineShape (
+ Display *dpy,
+ XID dest,
+ int destKind,
+ int xOff,
+ int yOff,
+ Pixmap src,
+ int srcKind,
+ int op);
+.LP
+void XShapeOffsetShape (
+ Display *dpy,
+ XID dest,
+ int destKind,
+ int xOff,
+ int yOff);
+.LP
+Status XShapeQueryExtents (
+ Display *dpy,
+ Window window,
+ int *bShaped,
+ int *xbs,
+ int *ybs,
+ unsigned int *wbs,
+ unsigned int *hbs,
+ int *cShaped,
+ int *xcs,
+ int *ycs,
+ unsigned int *wcs,
+ unsigned int *hcs);
+.LP
+void XShapeSelectInput (
+ Display *dpy,
+ Window window,
+ unsigned longmask);
+.LP
+unsigned long XShapeInputSelected (
+ Display *dpy,
+ Window window);
+.LP
+XRectangle *XShapeGetRectangles (
+ Display *dpy,
+ Window window,
+ int kind,
+ int *count,
+ int *ordering);
+.fi
+.SH STRUCTURES
+.nf
+.LP
+.ta 3i
+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 */
+ Window window; /\&* window of event */
+ int kind; /\&* ShapeBounding or ShapeClip */
+ int x, y; /\&* extents of new region */
+ unsigned width, height;
+ Time time; /\&* server timestamp when region changed */
+ Bool shaped; /\&* true if the region exists */
+} XShapeEvent;
+.fi
+.SH DESCRIPTION
+The \fIX11 Nonrectangular Window Shape Extension\fP adds nonrectangular
+windows to the X Window System.
+.SH PREDEFINED VALUES
+Operations:
+.in +.5i
+.nf
+.ZN ShapeSet
+.ZN ShapeUnion
+.ZN ShapeIntersect
+.ZN ShapeSubtract
+.ZN ShapeInvert
+.in -.5i
+.fi
+.sp
+Shape Kinds:
+.in +.5i
+.nf
+.ZN ShapeBounding
+.ZN ShapeClip
+.in -.5i
+.fi
+.sp
+Event defines:
+.in +.5i
+.nf
+.ZN ShapeNotifyMask
+.ZN ShapeNotify
+.in -.5i
+.fi
+.SH BUGS
+This manual pages needs a lot more work.
+.SH SEE ALSO
+\fIX11 Nonrectangular Window Shape Extension\fP
diff --git a/libXext/man/XShm.man b/libXext/man/XShm.man
index 06284f022..7fe312514 100644
--- a/libXext/man/XShm.man
+++ b/libXext/man/XShm.man
@@ -1,26 +1,26 @@
.\" 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
+.\" 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
+.\" 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
+.\"
+.\" 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.
diff --git a/libXext/man/XcupGetReservedColormapEntries.man b/libXext/man/XcupGetReservedColormapEntries.man
index 7ba10d23c..6fb8b9f1f 100644
--- a/libXext/man/XcupGetReservedColormapEntries.man
+++ b/libXext/man/XcupGetReservedColormapEntries.man
@@ -1,73 +1,73 @@
-.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved
-.\" Copyright (c) 1999, 2005, 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 XCUP __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XcupGetReservedColormapEntries \- list colormap entries reserved by the system
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/Xcup.h>
-.HP
-Status \fBXcupGetReservedColormapEntries\fP\^(\^Display *\fIdisplay\fP\^,
-int \fIscreen\fP\^, XColor **\fIcolors_out\fP\^, int *\fIncolors\fP\^);
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.IP \fIdisplay\fP 1i
-Specifies the connection to the X server.
-.IP \fIscreen\fP 1i
-Screen number on the host server.
-.IP \fIcolors_out\fP 1i
-Returns the values reserved by the server.
-.IP \fIncolors\fP 1i
-Returns the number of items in \fIcolors_out\fP.
-.SH DESCRIPTION
-.LP
-The
-.ZN XcupGetReservedColormapEntries
-function returns a list of colormap entries (pixels) that are reserved
-by the system. This list will, at a minimum, contain entries for the
-BlackPixel and WhitePixel of the specified screen. Use
-.ZN XFree
-to free
-.I colors_out.
-.LP
-To minimize colormap flash, an application which installs its own private
-colormap should query the special colors by calling
-.ZN XCupGetReservedColormapEntries ,
-and can then store those entries (in the
-proper location) in its private colormap using
-.ZN XCupStoreColors .
-.SH "SEE ALSO"
-.BR XcupQueryVersion (3Xext),
-.BR XcupStoreColors (3Xext),
-.BR XFree (3X11),
-.br
-\fIColormap Utilization Policy and Extension\fP
+.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved
+.\" Copyright (c) 1999, 2005, 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 XCUP __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XcupGetReservedColormapEntries \- list colormap entries reserved by the system
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/Xcup.h>
+.HP
+Status \fBXcupGetReservedColormapEntries\fP\^(\^Display *\fIdisplay\fP\^,
+int \fIscreen\fP\^, XColor **\fIcolors_out\fP\^, int *\fIncolors\fP\^);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.IP \fIdisplay\fP 1i
+Specifies the connection to the X server.
+.IP \fIscreen\fP 1i
+Screen number on the host server.
+.IP \fIcolors_out\fP 1i
+Returns the values reserved by the server.
+.IP \fIncolors\fP 1i
+Returns the number of items in \fIcolors_out\fP.
+.SH DESCRIPTION
+.LP
+The
+.ZN XcupGetReservedColormapEntries
+function returns a list of colormap entries (pixels) that are reserved
+by the system. This list will, at a minimum, contain entries for the
+BlackPixel and WhitePixel of the specified screen. Use
+.ZN XFree
+to free
+.I colors_out.
+.LP
+To minimize colormap flash, an application which installs its own private
+colormap should query the special colors by calling
+.ZN XCupGetReservedColormapEntries ,
+and can then store those entries (in the
+proper location) in its private colormap using
+.ZN XCupStoreColors .
+.SH "SEE ALSO"
+.BR XcupQueryVersion (3Xext),
+.BR XcupStoreColors (3Xext),
+.BR XFree (3X11),
+.br
+\fIColormap Utilization Policy and Extension\fP
diff --git a/libXext/man/XcupQueryVersion.man b/libXext/man/XcupQueryVersion.man
index bbbbc945c..7bfa4aa0b 100644
--- a/libXext/man/XcupQueryVersion.man
+++ b/libXext/man/XcupQueryVersion.man
@@ -1,74 +1,74 @@
-.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved
-.\" Copyright (c) 1999, 2005, 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 XcupQueryVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XcupQueryVersion \- Returns TOG-CUP protocol version supported by the X server
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/Xcup.h>
-.HP
-Status \fBXcupQueryVersion\fP\^(\^Display *\fIdisplay\fP\^,
-int *\fImajor_version_return\fP\^, int *\fIminor_version_return\fP\^);
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.IP \fIdisplay\fP 1i
-Specifies the connection to the X server
-.IP \fImajor_version_return\fP 1i
-Returns the major version supported by the server
-.IP \fIminor_version_return\fP 1i
-Returns the minor version supported by the server
-.SH DESCRIPTION
-.LP
-.ZN XcupQueryVersion
-sets
-.I major_version_return
-and
-.I minor_version_return
-to the major and minor TOG-CUP protocol version supported by the
-server. If the TOG-CUP library is compatible with the version returned
-by the server, it returns nonzero. If the server does not support the TOG-CUP
-extension, or if there was an error during communications with the
-server, or if the server and library protocol versions are
-incompatible, it returns zero. No other Xcup functions may be called
-before this function. If a client violates this rule, the effects of
-all subsequent Xcup calls that it makes are undefined.
-.LP
-To get the list of reserved colormap entries, use
-.ZN XcupGetReservedColormapEntries.
-.LP
-To allocate one or more read-only color cells with RGB values, use
-.ZN XcupStoreColors.
-.SH "SEE ALSO"
-.BR XcupGetReservedColormapEntries (3Xext),
-.BR XcupStoreColors (3Xext),
-.br
-\fIColormap Utilization Policy and Extension\fP
+.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved
+.\" Copyright (c) 1999, 2005, 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 XcupQueryVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XcupQueryVersion \- Returns TOG-CUP protocol version supported by the X server
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/Xcup.h>
+.HP
+Status \fBXcupQueryVersion\fP\^(\^Display *\fIdisplay\fP\^,
+int *\fImajor_version_return\fP\^, int *\fIminor_version_return\fP\^);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.IP \fIdisplay\fP 1i
+Specifies the connection to the X server
+.IP \fImajor_version_return\fP 1i
+Returns the major version supported by the server
+.IP \fIminor_version_return\fP 1i
+Returns the minor version supported by the server
+.SH DESCRIPTION
+.LP
+.ZN XcupQueryVersion
+sets
+.I major_version_return
+and
+.I minor_version_return
+to the major and minor TOG-CUP protocol version supported by the
+server. If the TOG-CUP library is compatible with the version returned
+by the server, it returns nonzero. If the server does not support the TOG-CUP
+extension, or if there was an error during communications with the
+server, or if the server and library protocol versions are
+incompatible, it returns zero. No other Xcup functions may be called
+before this function. If a client violates this rule, the effects of
+all subsequent Xcup calls that it makes are undefined.
+.LP
+To get the list of reserved colormap entries, use
+.ZN XcupGetReservedColormapEntries.
+.LP
+To allocate one or more read-only color cells with RGB values, use
+.ZN XcupStoreColors.
+.SH "SEE ALSO"
+.BR XcupGetReservedColormapEntries (3Xext),
+.BR XcupStoreColors (3Xext),
+.br
+\fIColormap Utilization Policy and Extension\fP
diff --git a/libXext/man/XcupStoreColors.man b/libXext/man/XcupStoreColors.man
index 335afb858..255f856f5 100644
--- a/libXext/man/XcupStoreColors.man
+++ b/libXext/man/XcupStoreColors.man
@@ -1,79 +1,79 @@
-.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved
-.\" Copyright (c) 1999, 2005, 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 XcupStoreColors __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XcupStoreColors \- initialize shareable colormap entries at specific locations
-.SH SYNOPSIS
-.PP
-.nf
-\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
-\&#include <X11/extensions/Xcup.h>
-.HP
-Status \fBXcupStoreColors\fP\^(\^Display *\fIdisplay\fP\^, Colormap \fIcolormap\fP\^,
-XColor *\fIcolors_in_out\fP\^, int \fIncolors\fP\^);
-.if n .ti +5n
-.if t .ti +.5i
-.SH ARGUMENTS
-.IP \fIdisplay\fP 1i
-Specifies the connection to the X server
-.IP \fIcolormap\fP 1i
-Specifies the colormap
-.IP \fIcolors_in_out\fP 1i
-Specifies and returns the values actually used in the colormap
-.IP \fIncolors\fP 1i
-Specifies the number of items in colors_in_out
-.SH DESCRIPTION
-.LP
-The
-.ZN XcupStoreColors
-function changes the colormap entries of the pixel values in the pixel
-members of the XColor structures. The colormap entries are allocated
-as if an AllocColor has been used instead, i.e. the colors are
-read-only (shareable).
-.ZN XcupStoreColors
-returns the number of colors that were successfully allocated in the colormap.
-.LP
-A
-.ZN Value
-error is generated if a pixel is not a valid index into the colormap. A
-.ZN BadMatch
-error is generated if the colormap does not belong to a GrayScale,
-PseudoColor, or DirectColor visual.
-.LP
-Applications which allocate many colors in a screen's default colormap, e.g.
-a color-cube or a gray-ramp, should allocate them with
-.ZN XCupStoreColors .
-By using XCupStoreColors the colors will be allocated sharable (read-only)
-and any other application which allocates the same color will share that
-color cell.
-.SH "SEE ALSO"
-.BR XcupQueryVersion (3Xext),
-.BR XcupGetReservedColormapEntries (3Xext),
-.br
-\fIColormap Utilization Policy and Extension\fP
+.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved
+.\" Copyright (c) 1999, 2005, 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 XcupStoreColors __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XcupStoreColors \- initialize shareable colormap entries at specific locations
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/Xcup.h>
+.HP
+Status \fBXcupStoreColors\fP\^(\^Display *\fIdisplay\fP\^, Colormap \fIcolormap\fP\^,
+XColor *\fIcolors_in_out\fP\^, int \fIncolors\fP\^);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.IP \fIdisplay\fP 1i
+Specifies the connection to the X server
+.IP \fIcolormap\fP 1i
+Specifies the colormap
+.IP \fIcolors_in_out\fP 1i
+Specifies and returns the values actually used in the colormap
+.IP \fIncolors\fP 1i
+Specifies the number of items in colors_in_out
+.SH DESCRIPTION
+.LP
+The
+.ZN XcupStoreColors
+function changes the colormap entries of the pixel values in the pixel
+members of the XColor structures. The colormap entries are allocated
+as if an AllocColor has been used instead, i.e. the colors are
+read-only (shareable).
+.ZN XcupStoreColors
+returns the number of colors that were successfully allocated in the colormap.
+.LP
+A
+.ZN Value
+error is generated if a pixel is not a valid index into the colormap. A
+.ZN BadMatch
+error is generated if the colormap does not belong to a GrayScale,
+PseudoColor, or DirectColor visual.
+.LP
+Applications which allocate many colors in a screen's default colormap, e.g.
+a color-cube or a gray-ramp, should allocate them with
+.ZN XCupStoreColors .
+By using XCupStoreColors the colors will be allocated sharable (read-only)
+and any other application which allocates the same color will share that
+color cell.
+.SH "SEE ALSO"
+.BR XcupQueryVersion (3Xext),
+.BR XcupGetReservedColormapEntries (3Xext),
+.br
+\fIColormap Utilization Policy and Extension\fP
diff --git a/libXext/man/XdbeAllocateBackBufferName.man b/libXext/man/XdbeAllocateBackBufferName.man
index 720491eaa..1a187a908 100644
--- a/libXext/man/XdbeAllocateBackBufferName.man
+++ b/libXext/man/XdbeAllocateBackBufferName.man
@@ -1,67 +1,67 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH XdbeAllocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeAllocateBackBufferName - allocates a DBE buffer.
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-XdbeBackBuffer XdbeAllocateBackBufferName(
- Display *dpy,
- Window window,
- XdbeSwapAction swap_action)
-.SH DESCRIPTION
-This function returns a drawable ID used to refer to the back buffer of the
-specified window. The swap_action is a hint to indicate the swap action that
-will likely be used in subsequent calls to
-.B XdbeSwapBuffers().
-The actual swap
-action used in calls to
-.B XdbeSwapBuffers()
-does not have to be the same as the
-swap_action passed to this function, though clients are encouraged to provide
-accurate information whenever possible.
-.SH ERRORS
-.IP BadAlloc
-.IP BadIDChoice
-.IP BadMatch
-The specified window is not an InputOutput window or its visual does not
-support DBE.
-.IP BadValue
-An invalid swap action was specified.
-.IP BadWindow
-An invalid window was specified.
-.SH SEE ALSO
-DBE,
-.I XdbeBeginIdiom(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeEndIdiom(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeGetVisualInfo(),
-.I XdbeQueryExtension(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeAllocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeAllocateBackBufferName - allocates a DBE buffer.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+XdbeBackBuffer XdbeAllocateBackBufferName(
+ Display *dpy,
+ Window window,
+ XdbeSwapAction swap_action)
+.SH DESCRIPTION
+This function returns a drawable ID used to refer to the back buffer of the
+specified window. The swap_action is a hint to indicate the swap action that
+will likely be used in subsequent calls to
+.B XdbeSwapBuffers().
+The actual swap
+action used in calls to
+.B XdbeSwapBuffers()
+does not have to be the same as the
+swap_action passed to this function, though clients are encouraged to provide
+accurate information whenever possible.
+.SH ERRORS
+.IP BadAlloc
+.IP BadIDChoice
+.IP BadMatch
+The specified window is not an InputOutput window or its visual does not
+support DBE.
+.IP BadValue
+An invalid swap action was specified.
+.IP BadWindow
+An invalid window was specified.
+.SH SEE ALSO
+DBE,
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/XdbeBeginIdiom.man b/libXext/man/XdbeBeginIdiom.man
index c58e7666c..18ee0704e 100644
--- a/libXext/man/XdbeBeginIdiom.man
+++ b/libXext/man/XdbeBeginIdiom.man
@@ -1,46 +1,46 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeBeginIdiom - marks the beginning of a DBE idiom sequence.
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-Status XdbeBeginIdiom(
- Display *dpy)
-.SH DESCRIPTION
-This function marks the beginning of an idiom sequence.
-.SH SEE ALSO
-DBE,
-.I XdbeAllocateBackBufferName(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeEndIdiom(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeGetVisualInfo(),
-.I XdbeQueryExtension(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeBeginIdiom - marks the beginning of a DBE idiom sequence.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeBeginIdiom(
+ Display *dpy)
+.SH DESCRIPTION
+This function marks the beginning of an idiom sequence.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/XdbeDeallocateBackBufferName.man b/libXext/man/XdbeDeallocateBackBufferName.man
index 0cd2b0291..a1286494d 100644
--- a/libXext/man/XdbeDeallocateBackBufferName.man
+++ b/libXext/man/XdbeDeallocateBackBufferName.man
@@ -1,53 +1,53 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH XdbeDeallocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeDeallocateBackBufferName - frees a DBE buffer.
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-Status XdbeDeallocateBackBufferName(
- Display *dpy,
- XdbeBackBuffer buffer)
-.SH DESCRIPTION
-This function frees a drawable ID, buffer, that was obtained via
-.B XdbeAllocateBackBufferName().
-The buffer must be a valid name for the back
-buffer of a window, or a protocol error results.
-.SH ERRORS
-.IP BadBuffer
-The specified buffer is not associated with a window.
-.SH SEE ALSO
-DBE,
-.I XdbeAllocateBackBufferName(),
-.I XdbeBeginIdiom(),
-.I XdbeEndIdiom(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeGetVisualInfo(),
-.I XdbeQueryExtension(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeDeallocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeDeallocateBackBufferName - frees a DBE buffer.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeDeallocateBackBufferName(
+ Display *dpy,
+ XdbeBackBuffer buffer)
+.SH DESCRIPTION
+This function frees a drawable ID, buffer, that was obtained via
+.B XdbeAllocateBackBufferName().
+The buffer must be a valid name for the back
+buffer of a window, or a protocol error results.
+.SH ERRORS
+.IP BadBuffer
+The specified buffer is not associated with a window.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/XdbeEndIdiom.man b/libXext/man/XdbeEndIdiom.man
index ac651f5fe..9218ef598 100644
--- a/libXext/man/XdbeEndIdiom.man
+++ b/libXext/man/XdbeEndIdiom.man
@@ -1,46 +1,46 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH XdbeEndIdiom __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeEndIdiom - marks the end of a DBE idiom sequence.
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-Status XdbeEndIdiom(
- Display *dpy)
-.SH DESCRIPTION
-This function marks the end of an idiom sequence.
-.SH SEE ALSO
-DBE,
-.I XdbeAllocateBackBufferName(),
-.I XdbeBeginIdiom(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeGetVisualInfo(),
-.I XdbeQueryExtension(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeEndIdiom __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeEndIdiom - marks the end of a DBE idiom sequence.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeEndIdiom(
+ Display *dpy)
+.SH DESCRIPTION
+This function marks the end of an idiom sequence.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/XdbeFreeVisualInfo.man b/libXext/man/XdbeFreeVisualInfo.man
index 36a6effab..04f9083a3 100644
--- a/libXext/man/XdbeFreeVisualInfo.man
+++ b/libXext/man/XdbeFreeVisualInfo.man
@@ -1,48 +1,48 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH XdbeFreeVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeFreeVisualInfo - frees information returned by
-.B XdbeGetVisualInfo().
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-void XdbeFreeVisualInfo(
- XdbeScreenVisualInfo *visual_info)
-.SH DESCRIPTION
-This function frees the list of XdbeScreenVisualInfo returned by the function
-.B XdbeGetVisualInfo().
-.SH SEE ALSO
-DBE,
-.I XdbeAllocateBackBufferName(),
-.I XdbeBeginIdiom(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeEndIdiom(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeGetVisualInfo(),
-.I XdbeQueryExtension(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeFreeVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeFreeVisualInfo - frees information returned by
+.B XdbeGetVisualInfo().
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+void XdbeFreeVisualInfo(
+ XdbeScreenVisualInfo *visual_info)
+.SH DESCRIPTION
+This function frees the list of XdbeScreenVisualInfo returned by the function
+.B XdbeGetVisualInfo().
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/XdbeGetBackBufferAttributes.man b/libXext/man/XdbeGetBackBufferAttributes.man
index c51c0de22..ac9d69209 100644
--- a/libXext/man/XdbeGetBackBufferAttributes.man
+++ b/libXext/man/XdbeGetBackBufferAttributes.man
@@ -1,65 +1,65 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH XdbeGetBackBufferAttributes __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeGetBackBufferAttributes - returns attributes of a DBE buffer.
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
- Display *dpy,
- XdbeBackBuffer buffer)
-.SH DESCRIPTION
-This function returns the attributes associated with the specified buffer.
-
-The
-.I XdbeBackBufferAttributes
-structure has the following fields:
-
-.RS
-Window window window that buffer belongs to
-.RE
-
-If buffer is not a valid
-.I XdbeBackBuffer,
-window returns None.
-
-The returned
-.I XdbeBackBufferAttributes
-structure can be freed with the
-Xlib function
-.B Xfree().
-.SH SEE ALSO
-DBE,
-.I XdbeAllocateBackBufferName(),
-.I XdbeBeginIdiom(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeEndIdiom(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetVisualInfo(),
-.I XdbeQueryExtension(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeGetBackBufferAttributes __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeGetBackBufferAttributes - returns attributes of a DBE buffer.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
+ Display *dpy,
+ XdbeBackBuffer buffer)
+.SH DESCRIPTION
+This function returns the attributes associated with the specified buffer.
+
+The
+.I XdbeBackBufferAttributes
+structure has the following fields:
+
+.RS
+Window window window that buffer belongs to
+.RE
+
+If buffer is not a valid
+.I XdbeBackBuffer,
+window returns None.
+
+The returned
+.I XdbeBackBufferAttributes
+structure can be freed with the
+Xlib function
+.B Xfree().
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/XdbeGetVisualInfo.man b/libXext/man/XdbeGetVisualInfo.man
index 338805caa..a4204e6cf 100644
--- a/libXext/man/XdbeGetVisualInfo.man
+++ b/libXext/man/XdbeGetVisualInfo.man
@@ -1,125 +1,125 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH XdbeGetVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeGetVisualInfo - Get dbe Visual Informations
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-XdbeScreenVisualInfo *XdbeGetVisualInfo(
- Display *dpy,
- Drawable *screen_specifiers,
- int *num_screens)
-.SH DESCRIPTION
-This function returns information about which visuals support double
-buffering. The argument
-.I num_screens
-specifies how many elements there are
-in the
-.I screen_specifiers
-list. Each drawable in
-.I screen_specifiers
-designates a
-screen for which the supported visuals are being requested. If
-.I num_screens
-is zero, information for all screens is requested. In this case, upon return
-from this function,
-.I num_screens
-will be set to the number of screens that were
-found. If an error occurs, this function returns NULL, else it returns a
-pointer to a list of
-.I XdbeScreenVisualInfo
-structures of length
-.I num_screens.
-The nth
-element in the returned list corresponds to the nth drawable in the
-.I screen_specifiers
-list, unless
-.I num_screens
-was passed in with the value zero,
-in which case the nth element in the returned list corresponds to the nth screen
-of the server, starting with screen zero. The
-.I XdbeScreenVisualInfo
-structure has the following fields:
-
- int count
- XdbeVisualInfo *visinfo
-
-.I count
-specifies the number of items in
-.I visinfo.
-.I visinfo
-specifies a list of visuals, depths, and performance hints for this screen.
-
-The
-.I XdbeVisualInfo
-structure has the following fields:
-
- VisualID visual
- int depth
- int perflevel
-
-.I visual
-specifies one visual ID that supports double-buffering.
-.I depth
-specifies the depth of the visual.
-.I perflevel
-is a performance hint.
-
-The only operation defined on a
-.I perflevel
-is comparison to a
-.I perflevel
-of another visual on the same screen. The visual having the higher
-.I perflevel
-is likely to have better double-buffering graphics performance than the visual
-having the lower
-.I perflevel.
-Nothing can be deduced from the following: the magnitude of the difference
-of two
-.I perflevels,
-a
-.I perflevel
-value in isolation, or comparing
-.I perflevels
-from different servers.
-
-.SH ERRORS
-.IP BadDrawable
-One or more values passed in
-.I screen_specifiers
-is not a valid drawable.
-.SH SEE ALSO
-DBE,
-.I XdbeAllocateBackBufferName(),
-.I XdbeBeginIdiom(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeEndIdiom(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeQueryExtension(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeGetVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeGetVisualInfo - Get dbe Visual Informations
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+XdbeScreenVisualInfo *XdbeGetVisualInfo(
+ Display *dpy,
+ Drawable *screen_specifiers,
+ int *num_screens)
+.SH DESCRIPTION
+This function returns information about which visuals support double
+buffering. The argument
+.I num_screens
+specifies how many elements there are
+in the
+.I screen_specifiers
+list. Each drawable in
+.I screen_specifiers
+designates a
+screen for which the supported visuals are being requested. If
+.I num_screens
+is zero, information for all screens is requested. In this case, upon return
+from this function,
+.I num_screens
+will be set to the number of screens that were
+found. If an error occurs, this function returns NULL, else it returns a
+pointer to a list of
+.I XdbeScreenVisualInfo
+structures of length
+.I num_screens.
+The nth
+element in the returned list corresponds to the nth drawable in the
+.I screen_specifiers
+list, unless
+.I num_screens
+was passed in with the value zero,
+in which case the nth element in the returned list corresponds to the nth screen
+of the server, starting with screen zero. The
+.I XdbeScreenVisualInfo
+structure has the following fields:
+
+ int count
+ XdbeVisualInfo *visinfo
+
+.I count
+specifies the number of items in
+.I visinfo.
+.I visinfo
+specifies a list of visuals, depths, and performance hints for this screen.
+
+The
+.I XdbeVisualInfo
+structure has the following fields:
+
+ VisualID visual
+ int depth
+ int perflevel
+
+.I visual
+specifies one visual ID that supports double-buffering.
+.I depth
+specifies the depth of the visual.
+.I perflevel
+is a performance hint.
+
+The only operation defined on a
+.I perflevel
+is comparison to a
+.I perflevel
+of another visual on the same screen. The visual having the higher
+.I perflevel
+is likely to have better double-buffering graphics performance than the visual
+having the lower
+.I perflevel.
+Nothing can be deduced from the following: the magnitude of the difference
+of two
+.I perflevels,
+a
+.I perflevel
+value in isolation, or comparing
+.I perflevels
+from different servers.
+
+.SH ERRORS
+.IP BadDrawable
+One or more values passed in
+.I screen_specifiers
+is not a valid drawable.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/XdbeQueryExtension.man b/libXext/man/XdbeQueryExtension.man
index 6065584e8..e46559560 100644
--- a/libXext/man/XdbeQueryExtension.man
+++ b/libXext/man/XdbeQueryExtension.man
@@ -1,61 +1,61 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH XdbeQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeQueryExtension - returns the version of DBE supported by the server.
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-Status XdbeQueryExtension(
- Display *dpy,
- int *major_version_return,
- int *minor_version_return)
-.SH DESCRIPTION
-Sets
-.I major_version_return
-and
-.I minor_version_return
-to the major and minor
-DBE protocol version supported by the server. If the DBE library is
-compatible with the version returned by the server, this function returns
-non-zero. If
-.I dpy
-does not support the DBE extension, or if there was an error
-during communication with the server, or if the server and library protocol
-versions are incompatible, this function returns zero. No other Xdbe functions
-may be called before this function. If a client violates this rule, the
-effects of all subsequent Xdbe calls that it makes are undefined.
-.SH SEE ALSO
-DBE,
-.I XdbeAllocateBackBufferName(),
-.I XdbeBeginIdiom(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeEndIdiom(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeGetVisualInfo(),
-.I XdbeSwapBuffers().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeQueryExtension - returns the version of DBE supported by the server.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeQueryExtension(
+ Display *dpy,
+ int *major_version_return,
+ int *minor_version_return)
+.SH DESCRIPTION
+Sets
+.I major_version_return
+and
+.I minor_version_return
+to the major and minor
+DBE protocol version supported by the server. If the DBE library is
+compatible with the version returned by the server, this function returns
+non-zero. If
+.I dpy
+does not support the DBE extension, or if there was an error
+during communication with the server, or if the server and library protocol
+versions are incompatible, this function returns zero. No other Xdbe functions
+may be called before this function. If a client violates this rule, the
+effects of all subsequent Xdbe calls that it makes are undefined.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeSwapBuffers().
+
diff --git a/libXext/man/XdbeSwapBuffers.man b/libXext/man/XdbeSwapBuffers.man
index b414add7f..79d8af77c 100644
--- a/libXext/man/XdbeSwapBuffers.man
+++ b/libXext/man/XdbeSwapBuffers.man
@@ -1,96 +1,96 @@
-.\" Copyright (c) 1995 Hewlett-Packard Company
-.\"
-.\" 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
-.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
-.\" Hewlett-Packard Company.
-.\"
-.TH XdbeSwapBuffers __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XdbeSwapBuffers - swaps front and back DBE buffers.
-.SH SYNOPSIS
-\&#include <X11/extensions/Xdbe.h>
-
-Status XdbeSwapBuffers(
- Display *dpy,
- XdbeSwapInfo *swap_info,
- int num_windows)
-.SH DESCRIPTION
-This function swaps the front and back buffers for a list of windows. The
-argument
-.I num_windows
-specifies how many windows are to have their buffers
-swapped; it is the number of elements in the
-.I swap_info
-array. The argument
-.I swap_info
-specifies the information needed per window to do the swap.
-
-The
-.I XdbeSwapInfo
-structure has the following fields:
-
- Window swap_window
- XdbeSwapAction swap_action
-
-.I swap_window
-specifies the window for which to swap buffers.
-.I swap_action
-specifies the swap action to use for this
-.I swap_window.
-
-.I swap_action
-determines what will happen to the new back buffer of the
-.I swap_window
-it is paired with in the list in addition to making the old back buffer
-become visible. The defined actions are as follows:
-
-.IP XdbeUndefined
-The contents of the new back buffer become undefined. This may be the most
-efficient action since it allows the implementation to discard the contents of
-the buffer if it needs to.
-.IP XdbeBackground
-The unobscured region of the new back buffer will be tiled with the
-window background. The background action allows devices to use a fast clear
-capability during a swap.
-.IP XdbeUntouched
-The unobscured region of the new back buffer will be unmodified by the swap.
-.IP XdbeCopied
-The unobscured region of the new back buffer will be the contents of the old
-back buffer
-.SH ERRORS
-.IP BadMatch
-A non-double-buffered window was specified or a window was specified twice.
-.IP BadWindow
-An invalid window was specified.
-.IP BadValue
-An invalid swap action was specified.
-.SH SEE ALSO
-DBE,
-.I XdbeAllocateBackBufferName(),
-.I XdbeBeginIdiom(),
-.I XdbeDeallocateBackBufferName(),
-.I XdbeEndIdiom(),
-.I XdbeFreeVisualInfo(),
-.I XdbeGetBackBufferAttributes(),
-.I XdbeGetVisualInfo(),
-.I XdbeQueryExtension().
-
+.\" Copyright (c) 1995 Hewlett-Packard Company
+.\"
+.\" 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
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company 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
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeSwapBuffers __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeSwapBuffers - swaps front and back DBE buffers.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeSwapBuffers(
+ Display *dpy,
+ XdbeSwapInfo *swap_info,
+ int num_windows)
+.SH DESCRIPTION
+This function swaps the front and back buffers for a list of windows. The
+argument
+.I num_windows
+specifies how many windows are to have their buffers
+swapped; it is the number of elements in the
+.I swap_info
+array. The argument
+.I swap_info
+specifies the information needed per window to do the swap.
+
+The
+.I XdbeSwapInfo
+structure has the following fields:
+
+ Window swap_window
+ XdbeSwapAction swap_action
+
+.I swap_window
+specifies the window for which to swap buffers.
+.I swap_action
+specifies the swap action to use for this
+.I swap_window.
+
+.I swap_action
+determines what will happen to the new back buffer of the
+.I swap_window
+it is paired with in the list in addition to making the old back buffer
+become visible. The defined actions are as follows:
+
+.IP XdbeUndefined
+The contents of the new back buffer become undefined. This may be the most
+efficient action since it allows the implementation to discard the contents of
+the buffer if it needs to.
+.IP XdbeBackground
+The unobscured region of the new back buffer will be tiled with the
+window background. The background action allows devices to use a fast clear
+capability during a swap.
+.IP XdbeUntouched
+The unobscured region of the new back buffer will be unmodified by the swap.
+.IP XdbeCopied
+The unobscured region of the new back buffer will be the contents of the old
+back buffer
+.SH ERRORS
+.IP BadMatch
+A non-double-buffered window was specified or a window was specified twice.
+.IP BadWindow
+An invalid window was specified.
+.IP BadValue
+An invalid swap action was specified.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension().
+
diff --git a/libXext/man/Xevi.man b/libXext/man/Xevi.man
index 86c8eca33..6f0d4b598 100644
--- a/libXext/man/Xevi.man
+++ b/libXext/man/Xevi.man
@@ -1,161 +1,161 @@
-.\" Copyright (c) 1997 Silicon Graphics, 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 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
-.\" SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc. shall not
-.\" be used in advertising or otherwise to promote the sale, use or other
-.\" dealing in this Software without prior written authorization from
-.\" Silicon Graphics, Inc.
-.\"
-.TH XEVI __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XeviQueryExtension, XeviQueryVersion, XeviGetVisualInfo - X Extended Visual Information functions
-.SH SYNOPSIS
-\&#include <X11/extensions/XEVI.h>
-
-Bool
-XeviQueryExtension (Display *dpy);
-.LP
-Bool
-XeviQueryVersion (Display *dpy,
- int *major_version_return,
- int *minor_version_return);
-.LP
-int
-XeviGetVisualInfo (Display *dpy, VisualID *visual,
- int n_visual, ExtendedVisualInfo ** evi_return,
- int * n_info_return);
-.fi
-.SH DESCRIPTION
-The
-X11 Extended Visual Information extension (EVI) allows a client to determine
-information about core X visuals beyond what the core protocol provides.
-
-The EVI application programming library contains the interfaces described below.
-With the exception of
-.BR XeviQueryExtension,
-if any of these routines are
-called with a display that does not support the extension, the
-ExtensionErrorHandler (which can be set with
-.BR XSetExtensionErrorHandler
-and functions the same way as
-.BR XSetErrorHandler )
-will be called and the function will then return.
-.PP
-.BR XeviQueryExtension
-returns
-.BR True
-if the Extended Visual Information extension is available on the given display.
-A client must call
-.BR XeviQueryExtension
-before calling any other EVI
-function in order to negotiate a compatible protocol version; otherwise
-the client will get undefined behavior (EVI may or may not work).
-.PP
-.BR XeviQueryVersion
-returns
-.BR True
-if the request succeeded; the values of the major and minor protocol
-version supported by the server are returned in
-.I major_version_return
-and
-.I minor_version_return.
-.PP
-.BR XeviGetVisualInfo
-returns a list of ExtendedVisualInfo structures that describe
-visual information beyond that supported by the core protocol. This includes
-layer information relevant for systems supporting overlays and/or underlay
-planes, and information that allows applications better to determine the level
-of hardware support for multiple colormaps. XeviGetVisualInfo returns
-.BR Success
-if successful, or an X error otherwise.
-If the argument
-.I visual
-is NULL, then information for all visuals of all
-screens is returned. Otherwise, it's a pointer to a list of visuals for which
-extended visual information is desired.
-.I n_visual
-is the number of elements in the array visual.
-.I evi_return
-returns a pointer to a list of ExtendedVisualInfo. When done, the client
-should free the list using XFree\.
-.I n_info_return
-returns the number of elements in the array evi_return.
-.LP
-The
-.BR ExtendedVisualInfo
-structure has the following fields:
-.in +.5i
-.nf
-.ta 1.6i
-VisualID \fIcore_visual_id\fR
-int \fIscreen\fR
-int \fIlevel\fR
-unsigned int \fItransparency_type\fR
-unsigned int \fItransparency_value\fR
-unsigned int \fImin_hw_colormaps\fR
-unsigned int \fImax_hw_colormaps\fR
-unsigned int \fInum_colormap_conflicts\fR
-VisualID * \fIcolormap_conflicts\fR
-.fi
-.LP
-The combination of
-.I core_visual_id
-and
-.I screen
-number uniquely specify the visual being described.
-.LP
-.I level
-returns the level number for the visual, 0 for normal planes, > 0 for
-overlays, < 0 for underlays.
-.LP
-.I
-transparency_type
-returns the type of transparency supported by the visual. XEVI_TRANSPARENCY_NONE if
-there are no transparent pixels, XEVI_TRANSPARENCY_PIXEL if the visual supports
-a transparent pixel, XEVI_TRANSPARENCY_MASK if the visual supports transparent
-plane(s).
-.LP
-.I transparency_value
-returns the pixel/plane value to set for transparency if transparency_type isn't
-XEVI_TRANSPARENCY_NONE.
-.LP
-.I min_hw_colormaps
-and
-.I max_hw_colormaps
-return the minimum and maximum number of hardware colormaps backing up the
-visual.
-.LP
-.I num_colormap_conflicts
-returns the number of elements in
-.I colormap_conflicts.
-This array returns a list of visuals that may cause conflicts in the use of the
-hardware colormap. For example, if a 12-bit hardware colormap is overloaded to
-support 8-bit colormaps, the corresponding 8-bit visuals would conflict with the
-12-bit visuals.
-
-.SH ERRORS
-.BR XeviGetVisualInfo
-will return
-.I BadValue
-if passed an illegal visual ID,
-.I BadAccess
-if the X server does not respond,
-.I BadAlloc
-if there is a memory allocation failure.
+.\" Copyright (c) 1997 Silicon Graphics, 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 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
+.\" SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc. shall not
+.\" be used in advertising or otherwise to promote the sale, use or other
+.\" dealing in this Software without prior written authorization from
+.\" Silicon Graphics, Inc.
+.\"
+.TH XEVI __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XeviQueryExtension, XeviQueryVersion, XeviGetVisualInfo - X Extended Visual Information functions
+.SH SYNOPSIS
+\&#include <X11/extensions/XEVI.h>
+
+Bool
+XeviQueryExtension (Display *dpy);
+.LP
+Bool
+XeviQueryVersion (Display *dpy,
+ int *major_version_return,
+ int *minor_version_return);
+.LP
+int
+XeviGetVisualInfo (Display *dpy, VisualID *visual,
+ int n_visual, ExtendedVisualInfo ** evi_return,
+ int * n_info_return);
+.fi
+.SH DESCRIPTION
+The
+X11 Extended Visual Information extension (EVI) allows a client to determine
+information about core X visuals beyond what the core protocol provides.
+
+The EVI application programming library contains the interfaces described below.
+With the exception of
+.BR XeviQueryExtension,
+if any of these routines are
+called with a display that does not support the extension, the
+ExtensionErrorHandler (which can be set with
+.BR XSetExtensionErrorHandler
+and functions the same way as
+.BR XSetErrorHandler )
+will be called and the function will then return.
+.PP
+.BR XeviQueryExtension
+returns
+.BR True
+if the Extended Visual Information extension is available on the given display.
+A client must call
+.BR XeviQueryExtension
+before calling any other EVI
+function in order to negotiate a compatible protocol version; otherwise
+the client will get undefined behavior (EVI may or may not work).
+.PP
+.BR XeviQueryVersion
+returns
+.BR True
+if the request succeeded; the values of the major and minor protocol
+version supported by the server are returned in
+.I major_version_return
+and
+.I minor_version_return.
+.PP
+.BR XeviGetVisualInfo
+returns a list of ExtendedVisualInfo structures that describe
+visual information beyond that supported by the core protocol. This includes
+layer information relevant for systems supporting overlays and/or underlay
+planes, and information that allows applications better to determine the level
+of hardware support for multiple colormaps. XeviGetVisualInfo returns
+.BR Success
+if successful, or an X error otherwise.
+If the argument
+.I visual
+is NULL, then information for all visuals of all
+screens is returned. Otherwise, it's a pointer to a list of visuals for which
+extended visual information is desired.
+.I n_visual
+is the number of elements in the array visual.
+.I evi_return
+returns a pointer to a list of ExtendedVisualInfo. When done, the client
+should free the list using XFree\.
+.I n_info_return
+returns the number of elements in the array evi_return.
+.LP
+The
+.BR ExtendedVisualInfo
+structure has the following fields:
+.in +.5i
+.nf
+.ta 1.6i
+VisualID \fIcore_visual_id\fR
+int \fIscreen\fR
+int \fIlevel\fR
+unsigned int \fItransparency_type\fR
+unsigned int \fItransparency_value\fR
+unsigned int \fImin_hw_colormaps\fR
+unsigned int \fImax_hw_colormaps\fR
+unsigned int \fInum_colormap_conflicts\fR
+VisualID * \fIcolormap_conflicts\fR
+.fi
+.LP
+The combination of
+.I core_visual_id
+and
+.I screen
+number uniquely specify the visual being described.
+.LP
+.I level
+returns the level number for the visual, 0 for normal planes, > 0 for
+overlays, < 0 for underlays.
+.LP
+.I
+transparency_type
+returns the type of transparency supported by the visual. XEVI_TRANSPARENCY_NONE if
+there are no transparent pixels, XEVI_TRANSPARENCY_PIXEL if the visual supports
+a transparent pixel, XEVI_TRANSPARENCY_MASK if the visual supports transparent
+plane(s).
+.LP
+.I transparency_value
+returns the pixel/plane value to set for transparency if transparency_type isn't
+XEVI_TRANSPARENCY_NONE.
+.LP
+.I min_hw_colormaps
+and
+.I max_hw_colormaps
+return the minimum and maximum number of hardware colormaps backing up the
+visual.
+.LP
+.I num_colormap_conflicts
+returns the number of elements in
+.I colormap_conflicts.
+This array returns a list of visuals that may cause conflicts in the use of the
+hardware colormap. For example, if a 12-bit hardware colormap is overloaded to
+support 8-bit colormaps, the corresponding 8-bit visuals would conflict with the
+12-bit visuals.
+
+.SH ERRORS
+.BR XeviGetVisualInfo
+will return
+.I BadValue
+if passed an illegal visual ID,
+.I BadAccess
+if the X server does not respond,
+.I BadAlloc
+if there is a memory allocation failure.
diff --git a/libXext/man/Xmbuf.man b/libXext/man/Xmbuf.man
index 2d399ef78..08e85b7e0 100644
--- a/libXext/man/Xmbuf.man
+++ b/libXext/man/Xmbuf.man
@@ -1,343 +1,343 @@
-.\" Copyright (c) 1989, 1994 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 1989, Digital Equipment Corporation.
-.\" Permission to use, copy, modify, distribute, and sell this documentation
-.\" for any purpose and without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\" Digital Equipment Corporation makes no representations
-.\" about the suitability for any purpose of the information in
-.\" this document. This documentation is provided "as is"
-.\" without express or implied warranty.
-.\"
-.de ZN
-.ie t \fB\^\\$1\^\fR\\$2
-.el \fI\^\\$1\^\fP\\$2
-..
-.TH XMBUF __libmansuffix__ __xorgversion__ "X FUNCTIONS"
-.SH NAME
-XmbufQueryExtension, XmbufGetVersion, XmbufCreateBuffers, XmbufDestroyBuffers, XmbufDisplayBuffers, XmbufGetWindowAttributes, XmbufChangeWindowAttributes, XmbufGetBufferAttributes, XmbufChangeBufferAttributes, XmbufGetScreenInfo, XmbufCreateStereoWindow - X multibuffering functions
-.SH SYNTAX
-.nf
-.LP
-\&#include <X11/extensions/multibuf.h>
-.LP
-Bool XmbufQueryExtension(
- Display *dpy,
- Display *dpy,
- int *event_base_return,
- int *error_base_return);
-.LP
-Status XmbufGetVersion(
- Display *dpy,
- int *major_version_return,
- int *minor_version_return);
-.LP
-int XmbufCreateBuffers(
- Display *dpy,
- Window window,
- int count,
- int update_action,
- int update_hint,
- Multibuffer *buffers_update);
-.LP
-void XmbufDestroyBuffers(
- Display *dpy,
- Window window);
-.LP
-void XmbufDisplayBuffers(
- Display *dpy,
- int count,
- Multibuffer *buffers,
- int min_delay,
- int max_delay);
-.LP
-Status XmbufGetWindowAttributes(
- Display *dpy,
- Window window,
- XmbufWindowAttributes *attributes);
-.LP
-void XmbufChangeWindowAttributes(
- Display *dpy,
- Window window,
- unsigned long valuemask,
- XmbufSetWindowAttributes *attributes);
-.LP
-Status XmbufGetBufferAttributes(
- Display *dpy,
- Multibuffer buffer,
- XmbufBufferAttributes *attributes);
-.LP
-void XmbufChangeBufferAttributes(
- Display *dpy,
- Multibuffer buffer,
- unsigned long valuemask,
- XmbufSetBufferAttributes *attributes);
-.LP
-Status XmbufGetScreenInfo(
- Display *dpy,
- Drawable drawable,
- int *nmono_return,
- XmbufBufferInfo **mono_info_return,
- int *nstereo_return,
- XmbufBufferInfo **stereo_info_return);
-.LP
-Window XmbufCreateStereoWindow(
- Display *dpy,
- Window parent,
- int x,
- int y,
- unsigned int width,
- unsigned int height,
- unsigned int border_width,
- int depth,
- unsigned int class, /\&* InputOutput, InputOnly*/
- Visual *visual,
- unsigned long valuemask,
- XSetWindowAttributes *attributes,
- Multibuffer *left_return,
- Multibuffer *right_return);
-.fi
-.SH STRUCTURES
-.nf
-.ta 3i
-\fIEvents:\fP
-typedef struct {
- int type; /\&* of event */
- unsigned long serial; /\&* # of last request processed by server */
- int send_event; /\&* true if this came from a SendEvent request */
- Display *display; /\&* Display the event was read from */
- Multibuffer buffer; /\&* buffer of event */
- int state; /\&* see Clobbered constants above */
-} XmbufClobberNotifyEvent;
-.LP
-typedef struct {
- int type; /\&* of event */
- unsigned long serial; /\&* # of last request processed by server */
- int send_event; /\&* true if this came from a SendEvent request */
- Display *display; /\&* Display the event was read from */
- Multibuffer buffer; /\&* buffer of event */
-} XmbufUpdateNotifyEvent;
-.LP
-\fIPer-window attributes that can be got:\fP
-typedef struct {
- int displayed_index; /\&* which buffer is being displayed */
- int update_action; /\&* Undefined, Background, Untouched, Copied */
- int update_hint; /\&* Frequent, Intermittent, Static */
- int window_mode; /\&* Mono, Stereo */
- int nbuffers; /\&* Number of buffers */
- Multibuffer *buffers; /\&* Buffers */
-} XmbufWindowAttributes;
-.LP
-\fIPer-window attributes that can be set:\fP
-typedef struct {
- int update_hint; /\&* Frequent, Intermittent, Static */
-} XmbufSetWindowAttributes;
-.LP
-\fIPer-buffer attributes that can be got:\fP
-typedef struct {
- Window window; /\&* which window this belongs to */
- unsigned long event_mask; /\&* events that have been selected */
- int buffer_index; /\&* which buffer is this */
- int side; /\&* Mono, Left, Right */
-} XmbufBufferAttributes;
-.LP
-\fIPer-buffer attributes that can be set:\fP
-typedef struct {
- unsigned long event_mask; /\&* events that have been selected */
-} XmbufSetBufferAttributes;
-.LP
-\fIPer-screen buffer info (there will be lists of them):\fP
-typedef struct {
- VisualID visualid; /\&* visual usable at this depth */
- int max_buffers; /\&* most buffers for this visual */
- int depth; /\&* depth of buffers to be created */
-} XmbufBufferInfo;
-.fi
-.SH DESCRIPTION
-The application programming library for the
-\fIX11 Double-Buffering, Multi-Buffering, and Stereo Extension\fP
-contains the interfaces described below.
-With the exception of
-.ZN XmbufQueryExtension ,
-if any of these routines are
-called with a display that does not support the extension, the
-ExtensionErrorHandler (which can be set with
-.ZN XSetExtensionErrorHandler
-and functions the same way as
-.ZN XSetErrorHandler )
-will be called and the function will then return.
-.PP
-.ZN XmbufQueryExtension
-returns
-.ZN True
-if the multibuffering/stereo
-extension is available on the
-given display. If the extension exists, the value of the first event
-code (which should be added to the event type constants
-.ZN MultibufferClobberNotify
-and
-.ZN MultibufferUpdateNotify
-to get the actual
-values) is stored into event_base_return and the value of the first
-error code (which should be added to the error type constant
-.ZN MultibufferBadBuffer
-to get the actual value) is stored into error_base_return.
-.PP
-.ZN XmbufGetVersion
-gets the major and minor version numbers of the extension.
-The return
-value is zero if an error occurs or non-zero if no error happens.
-.PP
-.ZN XmbufCreateBuffers
-requests that "count" buffers be
-created with the given update_action
-and update_hint and be associated with the indicated window. The
-number of buffers created is returned (zero if an error occurred)
-and buffers_update is filled in with that many Multibuffer identifiers.
-.PP
-.ZN XmbufDestroyBuffers
-destroys the buffers associated
-with the given window.
-.PP
-.ZN XmbufDisplayBuffers
-displays the indicated buffers their
-appropriate windows within
-max_delay milliseconds after min_delay milliseconds have passed.
-No two buffers may be associated with the same window or else a Match
-error is generated.
-.PP
-.ZN XmbufGetWindowAttributes
-gets the multibuffering attributes that apply
-to all buffers associated
-with the given window.
-The list of buffers returns may be freed with
-.ZN XFree .
-Returns non-zero on success and zero if an error occurs.
-.PP
-.ZN XmbufChangeWindowAttributes
-sets the multibuffering attributes
-that apply to all buffers associated
-with the given window. This is currently limited to the update_hint.
-.PP
-.ZN XmbufGetBufferAttributes
-gets the attributes for the indicated buffer.
-Returns non-zero on
-success and zero if an error occurs.
-.PP
-.ZN XmbufChangeBufferAttributes
-sets the attributes for the indicated buffer.
-This is currently limited to the event_mask.
-.PP
-.ZN XmbufGetScreenInfo
-gets the parameters controlling how
-mono and stereo windows may be
-created on the screen of the given drawable. The numbers of sets of
-visual and depths are returned in nmono_return and nstereo_return. If
-nmono_return is greater than zero, then mono_info_return is set to the
-address of an array of
-.ZN XmbufBufferInfo
-structures describing the
-various visuals and depths that may be used. Otherwise,
-mono_info_return is set to NULL. Similarly, stereo_info_return is set
-according to nstereo_return. The storage returned in mono_info_return
-and stereo_info_return may be released by
-.ZN XFree .
-If no errors are
-encounted, non-zero will be returned.
-.PP
-.ZN XmbufCreateStereoWindow
-creates a stereo window in the same way that
-.ZN XCreateWindow
-creates a mono window. The buffer ids for the left and right buffers are
-returned in left_return and right_return, respectively. If an
-extension error handler that returns is installed,
-.ZN None
-will be returned if the extension is not available on this display.
-.SH PREDEFINED VALUES
-.sp
-Update_action field:
-.in +.5i
-.nf
-.ZN MultibufferUpdateActionUndefined
-.ZN MultibufferUpdateActionBackground
-.ZN MultibufferUpdateActionUntouched
-.ZN MultibufferUpdateActionCopied
-.in -.5i
-.fi
-.sp
-Update_hint field:
-.in +.5i
-.nf
-.ZN MultibufferUpdateHintFrequent
-.ZN MultibufferUpdateHintIntermittent
-.ZN MultibufferUpdateHintStatic
-.in -.5i
-.sp
-.fi
-Valuemask fields:
-.in +.5i
-.nf
-.ZN MultibufferWindowUpdateHint
-.ZN MultibufferBufferEventMask
-.in -.5i
-.fi
-.sp
-Mono vs. stereo and left vs. right:
-.in +.5i
-.nf
-.ZN MultibufferModeMono
-.ZN MultibufferModeStereo
-.ZN MultibufferSideMono
-.ZN MultibufferSideLeft
-.ZN MultibufferSideRight
-.in -.5i
-.fi
-.sp
-Clobber state:
-.in +.5i
-.nf
-.ZN MultibufferUnclobbered
-.ZN MultibufferPartiallyClobbered
-.ZN MultibufferFullyClobbered
-.in -.5i
-.fi
-.sp
-Event stuff:
-.in +.5i
-.nf
-.ZN MultibufferClobberNotifyMask
-.ZN MultibufferUpdateNotifyMask
-.ZN MultibufferClobberNotify
-.ZN MultibufferUpdateNotify
-.ZN MultibufferNumberEvents
-.ZN MultibufferBadBuffer
-.ZN MultibufferNumberErrors
-.in -.5i
-.fi
-.SH BUGS
-This manual page needs more work.
-.SH SEE ALSO
-\fIExtending X for Double Buffering, Multi-Buffering, and Stereo\fP
+.\" Copyright (c) 1989, 1994 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 1989, Digital Equipment Corporation.
+.\" Permission to use, copy, modify, distribute, and sell this documentation
+.\" for any purpose and without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\" Digital Equipment Corporation makes no representations
+.\" about the suitability for any purpose of the information in
+.\" this document. This documentation is provided "as is"
+.\" without express or implied warranty.
+.\"
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XMBUF __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XmbufQueryExtension, XmbufGetVersion, XmbufCreateBuffers, XmbufDestroyBuffers, XmbufDisplayBuffers, XmbufGetWindowAttributes, XmbufChangeWindowAttributes, XmbufGetBufferAttributes, XmbufChangeBufferAttributes, XmbufGetScreenInfo, XmbufCreateStereoWindow - X multibuffering functions
+.SH SYNTAX
+.nf
+.LP
+\&#include <X11/extensions/multibuf.h>
+.LP
+Bool XmbufQueryExtension(
+ Display *dpy,
+ Display *dpy,
+ int *event_base_return,
+ int *error_base_return);
+.LP
+Status XmbufGetVersion(
+ Display *dpy,
+ int *major_version_return,
+ int *minor_version_return);
+.LP
+int XmbufCreateBuffers(
+ Display *dpy,
+ Window window,
+ int count,
+ int update_action,
+ int update_hint,
+ Multibuffer *buffers_update);
+.LP
+void XmbufDestroyBuffers(
+ Display *dpy,
+ Window window);
+.LP
+void XmbufDisplayBuffers(
+ Display *dpy,
+ int count,
+ Multibuffer *buffers,
+ int min_delay,
+ int max_delay);
+.LP
+Status XmbufGetWindowAttributes(
+ Display *dpy,
+ Window window,
+ XmbufWindowAttributes *attributes);
+.LP
+void XmbufChangeWindowAttributes(
+ Display *dpy,
+ Window window,
+ unsigned long valuemask,
+ XmbufSetWindowAttributes *attributes);
+.LP
+Status XmbufGetBufferAttributes(
+ Display *dpy,
+ Multibuffer buffer,
+ XmbufBufferAttributes *attributes);
+.LP
+void XmbufChangeBufferAttributes(
+ Display *dpy,
+ Multibuffer buffer,
+ unsigned long valuemask,
+ XmbufSetBufferAttributes *attributes);
+.LP
+Status XmbufGetScreenInfo(
+ Display *dpy,
+ Drawable drawable,
+ int *nmono_return,
+ XmbufBufferInfo **mono_info_return,
+ int *nstereo_return,
+ XmbufBufferInfo **stereo_info_return);
+.LP
+Window XmbufCreateStereoWindow(
+ Display *dpy,
+ Window parent,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height,
+ unsigned int border_width,
+ int depth,
+ unsigned int class, /\&* InputOutput, InputOnly*/
+ Visual *visual,
+ unsigned long valuemask,
+ XSetWindowAttributes *attributes,
+ Multibuffer *left_return,
+ Multibuffer *right_return);
+.fi
+.SH STRUCTURES
+.nf
+.ta 3i
+\fIEvents:\fP
+typedef struct {
+ int type; /\&* of event */
+ unsigned long serial; /\&* # of last request processed by server */
+ int send_event; /\&* true if this came from a SendEvent request */
+ Display *display; /\&* Display the event was read from */
+ Multibuffer buffer; /\&* buffer of event */
+ int state; /\&* see Clobbered constants above */
+} XmbufClobberNotifyEvent;
+.LP
+typedef struct {
+ int type; /\&* of event */
+ unsigned long serial; /\&* # of last request processed by server */
+ int send_event; /\&* true if this came from a SendEvent request */
+ Display *display; /\&* Display the event was read from */
+ Multibuffer buffer; /\&* buffer of event */
+} XmbufUpdateNotifyEvent;
+.LP
+\fIPer-window attributes that can be got:\fP
+typedef struct {
+ int displayed_index; /\&* which buffer is being displayed */
+ int update_action; /\&* Undefined, Background, Untouched, Copied */
+ int update_hint; /\&* Frequent, Intermittent, Static */
+ int window_mode; /\&* Mono, Stereo */
+ int nbuffers; /\&* Number of buffers */
+ Multibuffer *buffers; /\&* Buffers */
+} XmbufWindowAttributes;
+.LP
+\fIPer-window attributes that can be set:\fP
+typedef struct {
+ int update_hint; /\&* Frequent, Intermittent, Static */
+} XmbufSetWindowAttributes;
+.LP
+\fIPer-buffer attributes that can be got:\fP
+typedef struct {
+ Window window; /\&* which window this belongs to */
+ unsigned long event_mask; /\&* events that have been selected */
+ int buffer_index; /\&* which buffer is this */
+ int side; /\&* Mono, Left, Right */
+} XmbufBufferAttributes;
+.LP
+\fIPer-buffer attributes that can be set:\fP
+typedef struct {
+ unsigned long event_mask; /\&* events that have been selected */
+} XmbufSetBufferAttributes;
+.LP
+\fIPer-screen buffer info (there will be lists of them):\fP
+typedef struct {
+ VisualID visualid; /\&* visual usable at this depth */
+ int max_buffers; /\&* most buffers for this visual */
+ int depth; /\&* depth of buffers to be created */
+} XmbufBufferInfo;
+.fi
+.SH DESCRIPTION
+The application programming library for the
+\fIX11 Double-Buffering, Multi-Buffering, and Stereo Extension\fP
+contains the interfaces described below.
+With the exception of
+.ZN XmbufQueryExtension ,
+if any of these routines are
+called with a display that does not support the extension, the
+ExtensionErrorHandler (which can be set with
+.ZN XSetExtensionErrorHandler
+and functions the same way as
+.ZN XSetErrorHandler )
+will be called and the function will then return.
+.PP
+.ZN XmbufQueryExtension
+returns
+.ZN True
+if the multibuffering/stereo
+extension is available on the
+given display. If the extension exists, the value of the first event
+code (which should be added to the event type constants
+.ZN MultibufferClobberNotify
+and
+.ZN MultibufferUpdateNotify
+to get the actual
+values) is stored into event_base_return and the value of the first
+error code (which should be added to the error type constant
+.ZN MultibufferBadBuffer
+to get the actual value) is stored into error_base_return.
+.PP
+.ZN XmbufGetVersion
+gets the major and minor version numbers of the extension.
+The return
+value is zero if an error occurs or non-zero if no error happens.
+.PP
+.ZN XmbufCreateBuffers
+requests that "count" buffers be
+created with the given update_action
+and update_hint and be associated with the indicated window. The
+number of buffers created is returned (zero if an error occurred)
+and buffers_update is filled in with that many Multibuffer identifiers.
+.PP
+.ZN XmbufDestroyBuffers
+destroys the buffers associated
+with the given window.
+.PP
+.ZN XmbufDisplayBuffers
+displays the indicated buffers their
+appropriate windows within
+max_delay milliseconds after min_delay milliseconds have passed.
+No two buffers may be associated with the same window or else a Match
+error is generated.
+.PP
+.ZN XmbufGetWindowAttributes
+gets the multibuffering attributes that apply
+to all buffers associated
+with the given window.
+The list of buffers returns may be freed with
+.ZN XFree .
+Returns non-zero on success and zero if an error occurs.
+.PP
+.ZN XmbufChangeWindowAttributes
+sets the multibuffering attributes
+that apply to all buffers associated
+with the given window. This is currently limited to the update_hint.
+.PP
+.ZN XmbufGetBufferAttributes
+gets the attributes for the indicated buffer.
+Returns non-zero on
+success and zero if an error occurs.
+.PP
+.ZN XmbufChangeBufferAttributes
+sets the attributes for the indicated buffer.
+This is currently limited to the event_mask.
+.PP
+.ZN XmbufGetScreenInfo
+gets the parameters controlling how
+mono and stereo windows may be
+created on the screen of the given drawable. The numbers of sets of
+visual and depths are returned in nmono_return and nstereo_return. If
+nmono_return is greater than zero, then mono_info_return is set to the
+address of an array of
+.ZN XmbufBufferInfo
+structures describing the
+various visuals and depths that may be used. Otherwise,
+mono_info_return is set to NULL. Similarly, stereo_info_return is set
+according to nstereo_return. The storage returned in mono_info_return
+and stereo_info_return may be released by
+.ZN XFree .
+If no errors are
+encounted, non-zero will be returned.
+.PP
+.ZN XmbufCreateStereoWindow
+creates a stereo window in the same way that
+.ZN XCreateWindow
+creates a mono window. The buffer ids for the left and right buffers are
+returned in left_return and right_return, respectively. If an
+extension error handler that returns is installed,
+.ZN None
+will be returned if the extension is not available on this display.
+.SH PREDEFINED VALUES
+.sp
+Update_action field:
+.in +.5i
+.nf
+.ZN MultibufferUpdateActionUndefined
+.ZN MultibufferUpdateActionBackground
+.ZN MultibufferUpdateActionUntouched
+.ZN MultibufferUpdateActionCopied
+.in -.5i
+.fi
+.sp
+Update_hint field:
+.in +.5i
+.nf
+.ZN MultibufferUpdateHintFrequent
+.ZN MultibufferUpdateHintIntermittent
+.ZN MultibufferUpdateHintStatic
+.in -.5i
+.sp
+.fi
+Valuemask fields:
+.in +.5i
+.nf
+.ZN MultibufferWindowUpdateHint
+.ZN MultibufferBufferEventMask
+.in -.5i
+.fi
+.sp
+Mono vs. stereo and left vs. right:
+.in +.5i
+.nf
+.ZN MultibufferModeMono
+.ZN MultibufferModeStereo
+.ZN MultibufferSideMono
+.ZN MultibufferSideLeft
+.ZN MultibufferSideRight
+.in -.5i
+.fi
+.sp
+Clobber state:
+.in +.5i
+.nf
+.ZN MultibufferUnclobbered
+.ZN MultibufferPartiallyClobbered
+.ZN MultibufferFullyClobbered
+.in -.5i
+.fi
+.sp
+Event stuff:
+.in +.5i
+.nf
+.ZN MultibufferClobberNotifyMask
+.ZN MultibufferUpdateNotifyMask
+.ZN MultibufferClobberNotify
+.ZN MultibufferUpdateNotify
+.ZN MultibufferNumberEvents
+.ZN MultibufferBadBuffer
+.ZN MultibufferNumberErrors
+.in -.5i
+.fi
+.SH BUGS
+This manual page needs more work.
+.SH SEE ALSO
+\fIExtending X for Double Buffering, Multi-Buffering, and Stereo\fP
diff --git a/libXext/specs/dbelib.xml b/libXext/specs/dbelib.xml
index c642a511f..d3616fc36 100644
--- a/libXext/specs/dbelib.xml
+++ b/libXext/specs/dbelib.xml
@@ -24,11 +24,22 @@
<firstname>David</firstname><othername>P.</othername><surname>Wiggins</surname>
<affiliation><orgname>X Consortium, Inc</orgname></affiliation>
</othercredit>
- <copyright><year>1989</year><holder>X Consortium, Inc and Digital Equipment Corporation</holder></copyright>
- <copyright><year>1992</year><holder>X Consortium, Inc and Intergraph Corporation</holder></copyright>
- <copyright><year>1993</year><holder>X Consortium, Inc and Silicon Graphics, Inc.</holder></copyright>
- <copyright><year>1994</year><holder>X Consortium, Inc and Hewlett-Packard Company</holder></copyright>
- <copyright><year>1995</year><holder>X Consortium, Inc and Hewlett-Packard Company</holder></copyright>
+ <copyright><year>1989</year>
+ <holder>X Consortium Inc</holder>
+ <holder>Digital Equipment Corporation</holder>
+ </copyright>
+ <copyright><year>1992</year>
+ <holder>X Consortium Inc</holder>
+ <holder>Intergraph Corporation</holder>
+ </copyright>
+ <copyright><year>1993</year>
+ <holder>X Consortium Inc</holder>
+ <holder>Silicon Graphics, Inc.</holder>
+ </copyright>
+ <copyright><year>1994</year><year>1995</year>
+ <holder>X Consortium Inc</holder>
+ <holder>Hewlett-Packard Company</holder>
+ </copyright>
<legalnotice>
<para>
diff --git a/libXext/src/DPMS.c b/libXext/src/DPMS.c
index c6d0adac6..07818a07e 100644
--- a/libXext/src/DPMS.c
+++ b/libXext/src/DPMS.c
@@ -1,290 +1,290 @@
-/*****************************************************************
-
-Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
-
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-
-/*
- * HISTORY
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xlibint.h>
-#include <X11/extensions/dpms.h>
-#include <X11/extensions/dpmsproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <stdio.h>
-
-static XExtensionInfo _dpms_info_data;
-static XExtensionInfo *dpms_info = &_dpms_info_data;
-static char *dpms_extension_name = DPMSExtensionName;
-
-#define DPMSCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, dpms_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static /* const */ XExtensionHooks dpms_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, dpms_info,
- dpms_extension_name,
- &dpms_extension_hooks, DPMSNumberEvents,
- NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dpms_info)
-
-/*****************************************************************************
- * *
- * public routines *
- * *
- *****************************************************************************/
-
-Bool
-DPMSQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-Status
-DPMSGetVersion(Display *dpy, int *major_versionp, int *minor_versionp)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xDPMSGetVersionReply rep;
- register xDPMSGetVersionReq *req;
-
- DPMSCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (DPMSGetVersion, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSGetVersion;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_versionp = rep.majorVersion;
- *minor_versionp = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-Bool
-DPMSCapable(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSCapableReq *req;
- xDPMSCapableReply rep;
-
- DPMSCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(DPMSCapable, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSCapable;
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.capable;
-}
-
-Status
-DPMSSetTimeouts(Display *dpy, CARD16 standby, CARD16 suspend, CARD16 off)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSSetTimeoutsReq *req;
-
- if ((off != 0)&&(off < suspend))
- {
- return BadValue;
- }
- if ((suspend != 0)&&(suspend < standby))
- {
- return BadValue;
- }
-
- DPMSCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(DPMSSetTimeouts, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSSetTimeouts;
- req->standby = standby;
- req->suspend = suspend;
- req->off = off;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Bool
-DPMSGetTimeouts(Display *dpy, CARD16 *standby, CARD16 *suspend, CARD16 *off)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSGetTimeoutsReq *req;
- xDPMSGetTimeoutsReply rep;
-
- DPMSCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(DPMSGetTimeouts, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSGetTimeouts;
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- *standby = rep.standby;
- *suspend = rep.suspend;
- *off = rep.off;
- return 1;
-}
-
-Status
-DPMSEnable(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSEnableReq *req;
-
- DPMSCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(DPMSEnable, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSEnable;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Status
-DPMSDisable(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSDisableReq *req;
-
- DPMSCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(DPMSDisable, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSDisable;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-
-Status
-DPMSForceLevel(Display *dpy, CARD16 level)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSForceLevelReq *req;
-
- DPMSCheckExtension (dpy, info, 0);
-
- if ((level != DPMSModeOn) &&
- (level != DPMSModeStandby) &&
- (level != DPMSModeSuspend) &&
- (level != DPMSModeOff))
- return BadValue;
-
- LockDisplay(dpy);
- GetReq(DPMSForceLevel, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSForceLevel;
- req->level = level;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Status
-DPMSInfo(Display *dpy, CARD16 *power_level, BOOL *state)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDPMSInfoReq *req;
- xDPMSInfoReply rep;
-
- DPMSCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(DPMSInfo, req);
- req->reqType = info->codes->major_opcode;
- req->dpmsReqType = X_DPMSInfo;
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- *power_level = rep.power_level;
- *state = rep.state;
- return 1;
-}
-
-
-
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+/*
+ * HISTORY
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <X11/extensions/dpms.h>
+#include <X11/extensions/dpmsproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <stdio.h>
+
+static XExtensionInfo _dpms_info_data;
+static XExtensionInfo *dpms_info = &_dpms_info_data;
+static char *dpms_extension_name = DPMSExtensionName;
+
+#define DPMSCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, dpms_extension_name, val)
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks dpms_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, dpms_info,
+ dpms_extension_name,
+ &dpms_extension_hooks, DPMSNumberEvents,
+ NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dpms_info)
+
+/*****************************************************************************
+ * *
+ * public routines *
+ * *
+ *****************************************************************************/
+
+Bool
+DPMSQueryExtension (Display *dpy, int *event_basep, int *error_basep)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension(info)) {
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+ return True;
+ } else {
+ return False;
+ }
+}
+
+Status
+DPMSGetVersion(Display *dpy, int *major_versionp, int *minor_versionp)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xDPMSGetVersionReply rep;
+ register xDPMSGetVersionReq *req;
+
+ DPMSCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ GetReq (DPMSGetVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->dpmsReqType = X_DPMSGetVersion;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ *major_versionp = rep.majorVersion;
+ *minor_versionp = rep.minorVersion;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 1;
+}
+
+Bool
+DPMSCapable(Display *dpy)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDPMSCapableReq *req;
+ xDPMSCapableReply rep;
+
+ DPMSCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq(DPMSCapable, req);
+ req->reqType = info->codes->major_opcode;
+ req->dpmsReqType = X_DPMSCapable;
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.capable;
+}
+
+Status
+DPMSSetTimeouts(Display *dpy, CARD16 standby, CARD16 suspend, CARD16 off)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDPMSSetTimeoutsReq *req;
+
+ if ((off != 0)&&(off < suspend))
+ {
+ return BadValue;
+ }
+ if ((suspend != 0)&&(suspend < standby))
+ {
+ return BadValue;
+ }
+
+ DPMSCheckExtension (dpy, info, 0);
+ LockDisplay(dpy);
+ GetReq(DPMSSetTimeouts, req);
+ req->reqType = info->codes->major_opcode;
+ req->dpmsReqType = X_DPMSSetTimeouts;
+ req->standby = standby;
+ req->suspend = suspend;
+ req->off = off;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+Bool
+DPMSGetTimeouts(Display *dpy, CARD16 *standby, CARD16 *suspend, CARD16 *off)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDPMSGetTimeoutsReq *req;
+ xDPMSGetTimeoutsReply rep;
+
+ DPMSCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq(DPMSGetTimeouts, req);
+ req->reqType = info->codes->major_opcode;
+ req->dpmsReqType = X_DPMSGetTimeouts;
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ *standby = rep.standby;
+ *suspend = rep.suspend;
+ *off = rep.off;
+ return 1;
+}
+
+Status
+DPMSEnable(Display *dpy)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDPMSEnableReq *req;
+
+ DPMSCheckExtension (dpy, info, 0);
+ LockDisplay(dpy);
+ GetReq(DPMSEnable, req);
+ req->reqType = info->codes->major_opcode;
+ req->dpmsReqType = X_DPMSEnable;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+Status
+DPMSDisable(Display *dpy)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDPMSDisableReq *req;
+
+ DPMSCheckExtension (dpy, info, 0);
+ LockDisplay(dpy);
+ GetReq(DPMSDisable, req);
+ req->reqType = info->codes->major_opcode;
+ req->dpmsReqType = X_DPMSDisable;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+
+Status
+DPMSForceLevel(Display *dpy, CARD16 level)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDPMSForceLevelReq *req;
+
+ DPMSCheckExtension (dpy, info, 0);
+
+ if ((level != DPMSModeOn) &&
+ (level != DPMSModeStandby) &&
+ (level != DPMSModeSuspend) &&
+ (level != DPMSModeOff))
+ return BadValue;
+
+ LockDisplay(dpy);
+ GetReq(DPMSForceLevel, req);
+ req->reqType = info->codes->major_opcode;
+ req->dpmsReqType = X_DPMSForceLevel;
+ req->level = level;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+Status
+DPMSInfo(Display *dpy, CARD16 *power_level, BOOL *state)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDPMSInfoReq *req;
+ xDPMSInfoReply rep;
+
+ DPMSCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq(DPMSInfo, req);
+ req->reqType = info->codes->major_opcode;
+ req->dpmsReqType = X_DPMSInfo;
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ *power_level = rep.power_level;
+ *state = rep.state;
+ return 1;
+}
+
+
+
diff --git a/libXext/src/MITMisc.c b/libXext/src/MITMisc.c
index 20d1157cb..bc452dba7 100644
--- a/libXext/src/MITMisc.c
+++ b/libXext/src/MITMisc.c
@@ -1,130 +1,130 @@
-/*
- *
-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.
- *
- */
-
-/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xlibint.h>
-#include <X11/extensions/MITMisc.h>
-#include <X11/extensions/mitmiscproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-static XExtensionInfo _mit_info_data;
-static XExtensionInfo *mit_info = &_mit_info_data;
-static /* const */ char *mit_extension_name = MITMISCNAME;
-
-#define MITCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, mit_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static /* const */ XExtensionHooks mit_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, mit_info, mit_extension_name,
- &mit_extension_hooks, MITMiscNumberEvents,
- NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, mit_info)
-
-
-/*****************************************************************************
- * *
- * public routines *
- * *
- *****************************************************************************/
-
-Bool XMITMiscQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status XMITMiscSetBugMode(Display *dpy, Bool onOff)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMITSetBugModeReq *req;
-
- MITCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(MITSetBugMode, req);
- req->reqType = info->codes->major_opcode;
- req->mitReqType = X_MITSetBugMode;
- req->onOff = onOff;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Bool XMITMiscGetBugMode(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMITGetBugModeReq *req;
- xMITGetBugModeReply rep;
-
- MITCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(MITGetBugMode, req);
- req->reqType = info->codes->major_opcode;
- req->mitReqType = X_MITGetBugMode;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.onOff;
-}
+/*
+ *
+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.
+ *
+ */
+
+/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <X11/extensions/MITMisc.h>
+#include <X11/extensions/mitmiscproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+static XExtensionInfo _mit_info_data;
+static XExtensionInfo *mit_info = &_mit_info_data;
+static /* const */ char *mit_extension_name = MITMISCNAME;
+
+#define MITCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, mit_extension_name, val)
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks mit_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, mit_info, mit_extension_name,
+ &mit_extension_hooks, MITMiscNumberEvents,
+ NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, mit_info)
+
+
+/*****************************************************************************
+ * *
+ * public routines *
+ * *
+ *****************************************************************************/
+
+Bool XMITMiscQueryExtension (Display *dpy, int *event_basep, int *error_basep)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension(info)) {
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+ return True;
+ } else {
+ return False;
+ }
+}
+
+
+Status XMITMiscSetBugMode(Display *dpy, Bool onOff)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMITSetBugModeReq *req;
+
+ MITCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq(MITSetBugMode, req);
+ req->reqType = info->codes->major_opcode;
+ req->mitReqType = X_MITSetBugMode;
+ req->onOff = onOff;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+}
+
+Bool XMITMiscGetBugMode(Display *dpy)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMITGetBugModeReq *req;
+ xMITGetBugModeReply rep;
+
+ MITCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq(MITGetBugMode, req);
+ req->reqType = info->codes->major_opcode;
+ req->mitReqType = X_MITGetBugMode;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.onOff;
+}
diff --git a/libXext/src/Makefile.am b/libXext/src/Makefile.am
index 62a766263..e236c3345 100644
--- a/libXext/src/Makefile.am
+++ b/libXext/src/Makefile.am
@@ -1,65 +1,65 @@
-lib_LTLIBRARIES=libXext.la
-
-AM_CPPFLAGS=\
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/include/X11/extensions\
- $(XEXT_CFLAGS) $(MALLOC_ZERO_CFLAGS)
-
-AM_CFLAGS=$(CWARNFLAGS)
-
-libXext_la_LDFLAGS = -version-number $(XEXT_SOREV) -no-undefined
-
-libXext_la_LIBADD = $(XEXT_LIBS)
-
-libXext_la_SOURCES = \
- DPMS.c \
- MITMisc.c \
- XAppgroup.c \
- XEVI.c \
- XLbx.c \
- XMultibuf.c \
- XSecurity.c \
- XShape.c \
- XShm.c \
- XSync.c \
- XTestExt1.c \
- Xcup.c \
- Xdbe.c \
- Xge.c \
- extutil.c \
- globals.c
-
-libXextincludedir = $(includedir)/X11/extensions
-libXextinclude_HEADERS = $(top_srcdir)/include/X11/extensions/dpms.h \
- $(top_srcdir)/include/X11/extensions/extutil.h \
- $(top_srcdir)/include/X11/extensions/MITMisc.h \
- $(top_srcdir)/include/X11/extensions/multibuf.h \
- $(top_srcdir)/include/X11/extensions/security.h \
- $(top_srcdir)/include/X11/extensions/shape.h \
- $(top_srcdir)/include/X11/extensions/sync.h \
- $(top_srcdir)/include/X11/extensions/Xag.h \
- $(top_srcdir)/include/X11/extensions/Xcup.h \
- $(top_srcdir)/include/X11/extensions/Xdbe.h \
- $(top_srcdir)/include/X11/extensions/XEVI.h \
- $(top_srcdir)/include/X11/extensions/Xext.h \
- $(top_srcdir)/include/X11/extensions/Xge.h \
- $(top_srcdir)/include/X11/extensions/XLbx.h \
- $(top_srcdir)/include/X11/extensions/XShm.h \
- $(top_srcdir)/include/X11/extensions/xtestext1.h
-
-if LINT
-ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS)
-
-lint:
- $(LINT) $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) $(XEXT_LIBS)
-endif LINT
-
-if MAKE_LINT_LIB
-lintlibdir = $(libdir)
-
-lintlib_DATA = $(LINTLIB)
-
-$(LINTLIB): $(libXext_la_SOURCES)
- $(LINT) -y -oXext -x $(ALL_LINT_FLAGS) $(libXext_la_SOURCES)
-endif MAKE_LINT_LIB
+lib_LTLIBRARIES=libXext.la
+
+AM_CPPFLAGS=\
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/X11/extensions\
+ $(XEXT_CFLAGS) $(MALLOC_ZERO_CFLAGS)
+
+AM_CFLAGS=$(CWARNFLAGS)
+
+libXext_la_LDFLAGS = -version-number $(XEXT_SOREV) -no-undefined
+
+libXext_la_LIBADD = $(XEXT_LIBS)
+
+libXext_la_SOURCES = \
+ DPMS.c \
+ MITMisc.c \
+ XAppgroup.c \
+ XEVI.c \
+ XLbx.c \
+ XMultibuf.c \
+ XSecurity.c \
+ XShape.c \
+ XShm.c \
+ XSync.c \
+ XTestExt1.c \
+ Xcup.c \
+ Xdbe.c \
+ Xge.c \
+ extutil.c \
+ globals.c
+
+libXextincludedir = $(includedir)/X11/extensions
+libXextinclude_HEADERS = $(top_srcdir)/include/X11/extensions/dpms.h \
+ $(top_srcdir)/include/X11/extensions/extutil.h \
+ $(top_srcdir)/include/X11/extensions/MITMisc.h \
+ $(top_srcdir)/include/X11/extensions/multibuf.h \
+ $(top_srcdir)/include/X11/extensions/security.h \
+ $(top_srcdir)/include/X11/extensions/shape.h \
+ $(top_srcdir)/include/X11/extensions/sync.h \
+ $(top_srcdir)/include/X11/extensions/Xag.h \
+ $(top_srcdir)/include/X11/extensions/Xcup.h \
+ $(top_srcdir)/include/X11/extensions/Xdbe.h \
+ $(top_srcdir)/include/X11/extensions/XEVI.h \
+ $(top_srcdir)/include/X11/extensions/Xext.h \
+ $(top_srcdir)/include/X11/extensions/Xge.h \
+ $(top_srcdir)/include/X11/extensions/XLbx.h \
+ $(top_srcdir)/include/X11/extensions/XShm.h \
+ $(top_srcdir)/include/X11/extensions/xtestext1.h
+
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS)
+
+lint:
+ $(LINT) $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) $(XEXT_LIBS)
+endif LINT
+
+if MAKE_LINT_LIB
+lintlibdir = $(libdir)
+
+lintlib_DATA = $(LINTLIB)
+
+$(LINTLIB): $(libXext_la_SOURCES)
+ $(LINT) -y -oXext -x $(ALL_LINT_FLAGS) $(libXext_la_SOURCES)
+endif MAKE_LINT_LIB
diff --git a/libXext/src/XAppgroup.c b/libXext/src/XAppgroup.c
index 2d3edf35f..16650b6a9 100644
--- a/libXext/src/XAppgroup.c
+++ b/libXext/src/XAppgroup.c
@@ -1,388 +1,388 @@
-/*
-
-Copyright 1996, 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.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef WIN32
-#include <X11/Xwindows.h>
-#endif
-
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xag.h>
-#include <X11/extensions/agproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-#include <stdarg.h>
-
-struct xagstuff {
- int attrib_mask;
- Bool app_group_leader;
- Bool single_screen;
- Window default_root;
- VisualID root_visual;
- Colormap default_colormap;
- unsigned long black_pixel;
- unsigned long white_pixel;
-};
-
-static XExtensionInfo _xag_info_data;
-static XExtensionInfo *xag_info = &_xag_info_data;
-static char *xag_extension_name = XAGNAME;
-
-#define XagCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xag_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static /* const */ XExtensionHooks xag_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xag_info,
- xag_extension_name,
- &xag_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xag_info)
-
-
-/*****************************************************************************
- * *
- * public Xag Extension routines *
- * *
- *****************************************************************************/
-
-Bool
-XagQueryVersion(
- Display *dpy,
- int *major_version_return,
- int *minor_version_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXagQueryVersionReply rep;
- xXagQueryVersionReq *req;
-
- XagCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XagQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xagReqType = X_XagQueryVersion;
- req->client_major_version = XAG_MAJOR_VERSION;
- req->client_minor_version = XAG_MINOR_VERSION;
- if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *major_version_return = rep.server_major_version;
- *minor_version_return = rep.server_minor_version;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-static void
-StuffToWire (Display *dpy, struct xagstuff *stuff, xXagCreateReq *req)
-{
- unsigned long values[8];
- unsigned long* value = values;
- unsigned int nvalues;
-
- /* the order these are in is important */
- if (stuff->attrib_mask & XagSingleScreenMask)
- *value++ = stuff->single_screen;
-
- if (stuff->attrib_mask & XagDefaultRootMask)
- *value++ = stuff->default_root;
-
- if (stuff->attrib_mask & XagRootVisualMask)
- *value++ = stuff->root_visual;
-
- if (stuff->attrib_mask & XagDefaultColormapMask)
- *value++ = stuff->default_colormap;
-
- if (stuff->attrib_mask & XagBlackPixelMask)
- *value++ = stuff->black_pixel;
-
- if (stuff->attrib_mask & XagWhitePixelMask)
- *value++ = stuff->white_pixel;
-
- if (stuff->attrib_mask & XagAppGroupLeaderMask)
- *value++ = stuff->app_group_leader;
-
- req->length += (nvalues = value - values);
-
- nvalues <<= 2;
- Data32 (dpy, (long*) values, (long) nvalues);
-}
-
-Bool
-XagCreateEmbeddedApplicationGroup(
- Display* dpy,
- VisualID root_visual,
- Colormap default_colormap,
- unsigned long black_pixel,
- unsigned long white_pixel,
- XAppGroup* app_group_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXagCreateReq *req;
- struct xagstuff stuff;
-
- XagCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- stuff.app_group_leader = True;
- stuff.single_screen = True;
- stuff.default_root = RootWindow (dpy, DefaultScreen(dpy));
- stuff.root_visual = root_visual;
- stuff.default_colormap = default_colormap;
- stuff.attrib_mask =
- XagAppGroupLeaderMask | XagSingleScreenMask | XagDefaultRootMask |
- XagRootVisualMask | XagDefaultColormapMask;
- if (default_colormap != None) {
- stuff.black_pixel = black_pixel;
- stuff.white_pixel = white_pixel;
- stuff.attrib_mask |= XagBlackPixelMask | XagWhitePixelMask;
- }
- /* might do some validation here */
- GetReq(XagCreate, req);
- req->reqType = info->codes->major_opcode;
- req->xagReqType = X_XagCreate;
- *app_group_return = req->app_group = XAllocID(dpy);
- req->attrib_mask = stuff.attrib_mask;
- StuffToWire (dpy, &stuff, req);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XagCreateNonembeddedApplicationGroup(
- Display* dpy,
- XAppGroup* app_group_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXagCreateReq *req;
- struct xagstuff stuff;
-
- XagCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- stuff.app_group_leader = False;
- stuff.single_screen = False;
- stuff.attrib_mask = XagAppGroupLeaderMask | XagSingleScreenMask;
- /* might do some validation here */
- GetReq(XagCreate, req);
- req->reqType = info->codes->major_opcode;
- req->xagReqType = X_XagCreate;
- *app_group_return = req->app_group = XAllocID(dpy);
- req->attrib_mask = stuff.attrib_mask;
- StuffToWire (dpy, &stuff, req);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XagDestroyApplicationGroup(Display* dpy, XAppGroup app_group)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXagDestroyReq *req;
-
- XagCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XagDestroy, req);
- req->reqType = info->codes->major_opcode;
- req->xagReqType = X_XagDestroy;
- req->app_group = app_group;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XagGetApplicationGroupAttributes(Display* dpy, XAppGroup app_group, ...)
-{
- va_list var;
- XExtDisplayInfo *info = find_display (dpy);
- xXagGetAttrReq *req;
- xXagGetAttrReply rep;
- int attr;
-
- XagCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XagGetAttr, req);
- req->reqType = info->codes->major_opcode;
- req->xagReqType = X_XagGetAttr;
- req->app_group = app_group;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- va_start (var, app_group);
- for (attr = va_arg(var, int); attr != 0; attr = va_arg(var, int)) {
- void* ptr;
-
- switch (attr) {
- case XagNappGroupLeader:
- ptr = va_arg(var, void*);
- *(Bool*)ptr = rep.app_group_leader;
- break;
- case XagNsingleScreen:
- ptr = va_arg(var, void*);
- *(Bool*)ptr = rep.single_screen;
- break;
- case XagNdefaultRoot:
- ptr = va_arg(var, void*);
- *(Window*)ptr = rep.default_root;
- break;
- case XagNrootVisual:
- ptr = va_arg(var, void*);
- *(VisualID*)ptr = rep.root_visual;
- break;
- case XagNdefaultColormap:
- ptr = va_arg(var, void*);
- *(Colormap*)ptr = rep.default_colormap;
- break;
- case XagNblackPixel:
- ptr = va_arg(var, void*);
- *(unsigned long*)ptr = rep.black_pixel;
- break;
- case XagNwhitePixel:
- ptr = va_arg(var, void*);
- *(unsigned long*)ptr = rep.white_pixel;
- break;
- }
- }
- va_end (var);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XagQueryApplicationGroup(
- Display* dpy,
- XID resource,
- XAppGroup* app_group_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXagQueryReq *req;
- xXagQueryReply rep;
-
- XagCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XagQuery, req);
- req->reqType = info->codes->major_opcode;
- req->xagReqType = X_XagQuery;
- req->resource = resource;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *app_group_return = rep.app_group;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-
-}
-
-Bool
-XagCreateAssociation(Display* dpy, Window* window_return, void* system_window)
-{
-#ifdef WIN32
- long tmp = *(HWND*) system_window;
- XExtDisplayInfo *info = find_display (dpy);
- xXagCreateAssocReq *req;
-
- XagCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XagCreateAssoc, req);
- req->reqType = info->codes->major_opcode;
- req->xagReqType = X_XagCreateAssoc;
- *window_return = req->window = XAllocID(dpy);
- req->window_type = XagWindowTypeWin32;
- req->system_window_len = sizeof(HWND);
- Data32 (dpy, (long*) tmp, 1L);
- req->length++;
- UnlockDisplay(dpy);
- SyncHandle();
-#else
- /* other platforms go here */
-
- /* this whole thing could be arranged better, but since X need
- * only short-circuit the protocol and WIN32 is the only other
- * platform the XC supports, it will suffice for now.
- */
- *window_return = *(Window*)system_window;
-#endif
- return True;
-}
-
-Bool
-XagDestroyAssociation(Display* dpy, Window window)
-{
-#ifdef WIN32
- XExtDisplayInfo *info = find_display (dpy);
- xXagDestroyAssocReq *req;
-
- XagCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XagDestroyAssoc, req);
- req->reqType = info->codes->major_opcode;
- req->xagReqType = X_XagDestroyAssoc;
- req->window = window;
- UnlockDisplay(dpy);
- SyncHandle();
-#endif
- return True;
-}
-
+/*
+
+Copyright 1996, 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.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xag.h>
+#include <X11/extensions/agproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+#include <stdarg.h>
+
+struct xagstuff {
+ int attrib_mask;
+ Bool app_group_leader;
+ Bool single_screen;
+ Window default_root;
+ VisualID root_visual;
+ Colormap default_colormap;
+ unsigned long black_pixel;
+ unsigned long white_pixel;
+};
+
+static XExtensionInfo _xag_info_data;
+static XExtensionInfo *xag_info = &_xag_info_data;
+static char *xag_extension_name = XAGNAME;
+
+#define XagCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, xag_extension_name, val)
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks xag_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, xag_info,
+ xag_extension_name,
+ &xag_extension_hooks,
+ 0, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xag_info)
+
+
+/*****************************************************************************
+ * *
+ * public Xag Extension routines *
+ * *
+ *****************************************************************************/
+
+Bool
+XagQueryVersion(
+ Display *dpy,
+ int *major_version_return,
+ int *minor_version_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXagQueryVersionReply rep;
+ xXagQueryVersionReq *req;
+
+ XagCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XagQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xagReqType = X_XagQueryVersion;
+ req->client_major_version = XAG_MAJOR_VERSION;
+ req->client_minor_version = XAG_MINOR_VERSION;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *major_version_return = rep.server_major_version;
+ *minor_version_return = rep.server_minor_version;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+static void
+StuffToWire (Display *dpy, struct xagstuff *stuff, xXagCreateReq *req)
+{
+ unsigned long values[8];
+ unsigned long* value = values;
+ unsigned int nvalues;
+
+ /* the order these are in is important */
+ if (stuff->attrib_mask & XagSingleScreenMask)
+ *value++ = stuff->single_screen;
+
+ if (stuff->attrib_mask & XagDefaultRootMask)
+ *value++ = stuff->default_root;
+
+ if (stuff->attrib_mask & XagRootVisualMask)
+ *value++ = stuff->root_visual;
+
+ if (stuff->attrib_mask & XagDefaultColormapMask)
+ *value++ = stuff->default_colormap;
+
+ if (stuff->attrib_mask & XagBlackPixelMask)
+ *value++ = stuff->black_pixel;
+
+ if (stuff->attrib_mask & XagWhitePixelMask)
+ *value++ = stuff->white_pixel;
+
+ if (stuff->attrib_mask & XagAppGroupLeaderMask)
+ *value++ = stuff->app_group_leader;
+
+ req->length += (nvalues = value - values);
+
+ nvalues <<= 2;
+ Data32 (dpy, (long*) values, (long) nvalues);
+}
+
+Bool
+XagCreateEmbeddedApplicationGroup(
+ Display* dpy,
+ VisualID root_visual,
+ Colormap default_colormap,
+ unsigned long black_pixel,
+ unsigned long white_pixel,
+ XAppGroup* app_group_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXagCreateReq *req;
+ struct xagstuff stuff;
+
+ XagCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ stuff.app_group_leader = True;
+ stuff.single_screen = True;
+ stuff.default_root = RootWindow (dpy, DefaultScreen(dpy));
+ stuff.root_visual = root_visual;
+ stuff.default_colormap = default_colormap;
+ stuff.attrib_mask =
+ XagAppGroupLeaderMask | XagSingleScreenMask | XagDefaultRootMask |
+ XagRootVisualMask | XagDefaultColormapMask;
+ if (default_colormap != None) {
+ stuff.black_pixel = black_pixel;
+ stuff.white_pixel = white_pixel;
+ stuff.attrib_mask |= XagBlackPixelMask | XagWhitePixelMask;
+ }
+ /* might do some validation here */
+ GetReq(XagCreate, req);
+ req->reqType = info->codes->major_opcode;
+ req->xagReqType = X_XagCreate;
+ *app_group_return = req->app_group = XAllocID(dpy);
+ req->attrib_mask = stuff.attrib_mask;
+ StuffToWire (dpy, &stuff, req);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XagCreateNonembeddedApplicationGroup(
+ Display* dpy,
+ XAppGroup* app_group_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXagCreateReq *req;
+ struct xagstuff stuff;
+
+ XagCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ stuff.app_group_leader = False;
+ stuff.single_screen = False;
+ stuff.attrib_mask = XagAppGroupLeaderMask | XagSingleScreenMask;
+ /* might do some validation here */
+ GetReq(XagCreate, req);
+ req->reqType = info->codes->major_opcode;
+ req->xagReqType = X_XagCreate;
+ *app_group_return = req->app_group = XAllocID(dpy);
+ req->attrib_mask = stuff.attrib_mask;
+ StuffToWire (dpy, &stuff, req);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool XagDestroyApplicationGroup(Display* dpy, XAppGroup app_group)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXagDestroyReq *req;
+
+ XagCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XagDestroy, req);
+ req->reqType = info->codes->major_opcode;
+ req->xagReqType = X_XagDestroy;
+ req->app_group = app_group;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XagGetApplicationGroupAttributes(Display* dpy, XAppGroup app_group, ...)
+{
+ va_list var;
+ XExtDisplayInfo *info = find_display (dpy);
+ xXagGetAttrReq *req;
+ xXagGetAttrReply rep;
+ int attr;
+
+ XagCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XagGetAttr, req);
+ req->reqType = info->codes->major_opcode;
+ req->xagReqType = X_XagGetAttr;
+ req->app_group = app_group;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ va_start (var, app_group);
+ for (attr = va_arg(var, int); attr != 0; attr = va_arg(var, int)) {
+ void* ptr;
+
+ switch (attr) {
+ case XagNappGroupLeader:
+ ptr = va_arg(var, void*);
+ *(Bool*)ptr = rep.app_group_leader;
+ break;
+ case XagNsingleScreen:
+ ptr = va_arg(var, void*);
+ *(Bool*)ptr = rep.single_screen;
+ break;
+ case XagNdefaultRoot:
+ ptr = va_arg(var, void*);
+ *(Window*)ptr = rep.default_root;
+ break;
+ case XagNrootVisual:
+ ptr = va_arg(var, void*);
+ *(VisualID*)ptr = rep.root_visual;
+ break;
+ case XagNdefaultColormap:
+ ptr = va_arg(var, void*);
+ *(Colormap*)ptr = rep.default_colormap;
+ break;
+ case XagNblackPixel:
+ ptr = va_arg(var, void*);
+ *(unsigned long*)ptr = rep.black_pixel;
+ break;
+ case XagNwhitePixel:
+ ptr = va_arg(var, void*);
+ *(unsigned long*)ptr = rep.white_pixel;
+ break;
+ }
+ }
+ va_end (var);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XagQueryApplicationGroup(
+ Display* dpy,
+ XID resource,
+ XAppGroup* app_group_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXagQueryReq *req;
+ xXagQueryReply rep;
+
+ XagCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XagQuery, req);
+ req->reqType = info->codes->major_opcode;
+ req->xagReqType = X_XagQuery;
+ req->resource = resource;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *app_group_return = rep.app_group;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+
+}
+
+Bool
+XagCreateAssociation(Display* dpy, Window* window_return, void* system_window)
+{
+#ifdef WIN32
+ long tmp = *(HWND*) system_window;
+ XExtDisplayInfo *info = find_display (dpy);
+ xXagCreateAssocReq *req;
+
+ XagCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XagCreateAssoc, req);
+ req->reqType = info->codes->major_opcode;
+ req->xagReqType = X_XagCreateAssoc;
+ *window_return = req->window = XAllocID(dpy);
+ req->window_type = XagWindowTypeWin32;
+ req->system_window_len = sizeof(HWND);
+ Data32 (dpy, (long*) tmp, 1L);
+ req->length++;
+ UnlockDisplay(dpy);
+ SyncHandle();
+#else
+ /* other platforms go here */
+
+ /* this whole thing could be arranged better, but since X need
+ * only short-circuit the protocol and WIN32 is the only other
+ * platform the XC supports, it will suffice for now.
+ */
+ *window_return = *(Window*)system_window;
+#endif
+ return True;
+}
+
+Bool
+XagDestroyAssociation(Display* dpy, Window window)
+{
+#ifdef WIN32
+ XExtDisplayInfo *info = find_display (dpy);
+ xXagDestroyAssocReq *req;
+
+ XagCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XagDestroyAssoc, req);
+ req->reqType = info->codes->major_opcode;
+ req->xagReqType = X_XagDestroyAssoc;
+ req->window = window;
+ UnlockDisplay(dpy);
+ SyncHandle();
+#endif
+ return True;
+}
+
diff --git a/libXext/src/XLbx.c b/libXext/src/XLbx.c
index 0b7eb5827..b3ba1b2ea 100644
--- a/libXext/src/XLbx.c
+++ b/libXext/src/XLbx.c
@@ -1,124 +1,124 @@
-/*
- * Copyright 1992 Network Computing Devices
- *
- * 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 NCD. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. NCD. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
- * 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.
- *
- * Author: Keith Packard, Network Computing Devices
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/XLbx.h>
-#include <X11/extensions/lbxproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-static XExtensionInfo _lbx_info_data;
-static XExtensionInfo *lbx_info = &_lbx_info_data;
-static /* const */ char *lbx_extension_name = LBXNAME;
-
-#define LbxCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, lbx_extension_name, val)
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static char *error_string(Display *dpy, int code, XExtCodes *codes,
- char *buf, int n);
-static /* const */ XExtensionHooks lbx_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- error_string, /* error_string */
-};
-
-static /* const */ char *lbx_error_list[] = {
- "BadLbxClient", /* BadLbxClient */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, lbx_info, lbx_extension_name,
- &lbx_extension_hooks, LbxNumberEvents, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, lbx_info)
-
-static XEXT_GENERATE_ERROR_STRING (error_string, lbx_extension_name,
- LbxNumberErrors, lbx_error_list)
-
-
-Bool XLbxQueryExtension (
- Display *dpy,
- int *requestp, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *requestp = info->codes->major_opcode;
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-int XLbxGetEventBase(Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- return info->codes->first_event;
- } else {
- return -1;
- }
-}
-
-
-Bool XLbxQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xLbxQueryVersionReply rep;
- register xLbxQueryVersionReq *req;
-
- LbxCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(LbxQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->lbxReqType = X_LbxQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-/* all other requests will run after Xlib has lost the wire ... */
+/*
+ * Copyright 1992 Network Computing Devices
+ *
+ * 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 NCD. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. NCD. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+ * 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.
+ *
+ * Author: Keith Packard, Network Computing Devices
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XLbx.h>
+#include <X11/extensions/lbxproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+static XExtensionInfo _lbx_info_data;
+static XExtensionInfo *lbx_info = &_lbx_info_data;
+static /* const */ char *lbx_extension_name = LBXNAME;
+
+#define LbxCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, lbx_extension_name, val)
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static char *error_string(Display *dpy, int code, XExtCodes *codes,
+ char *buf, int n);
+static /* const */ XExtensionHooks lbx_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ error_string, /* error_string */
+};
+
+static /* const */ char *lbx_error_list[] = {
+ "BadLbxClient", /* BadLbxClient */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, lbx_info, lbx_extension_name,
+ &lbx_extension_hooks, LbxNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, lbx_info)
+
+static XEXT_GENERATE_ERROR_STRING (error_string, lbx_extension_name,
+ LbxNumberErrors, lbx_error_list)
+
+
+Bool XLbxQueryExtension (
+ Display *dpy,
+ int *requestp, int *event_basep, int *error_basep)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension(info)) {
+ *requestp = info->codes->major_opcode;
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+ return True;
+ } else {
+ return False;
+ }
+}
+
+
+int XLbxGetEventBase(Display *dpy)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension(info)) {
+ return info->codes->first_event;
+ } else {
+ return -1;
+ }
+}
+
+
+Bool XLbxQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xLbxQueryVersionReply rep;
+ register xLbxQueryVersionReq *req;
+
+ LbxCheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(LbxQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->lbxReqType = X_LbxQueryVersion;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *majorVersion = rep.majorVersion;
+ *minorVersion = rep.minorVersion;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+/* all other requests will run after Xlib has lost the wire ... */
diff --git a/libXext/src/XMultibuf.c b/libXext/src/XMultibuf.c
index 67551443d..fb995f840 100644
--- a/libXext/src/XMultibuf.c
+++ b/libXext/src/XMultibuf.c
@@ -1,711 +1,711 @@
-/*
- *
-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.
- *
- * Authors: Jim Fulton, MIT X Consortium
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xlibint.h>
-#include <stdio.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/multibufproto.h>
-#include <X11/extensions/multibuf.h>
-
-static XExtensionInfo _multibuf_info_data;
-static XExtensionInfo *multibuf_info = &_multibuf_info_data;
-static /* const */ char *multibuf_extension_name = MULTIBUFFER_PROTOCOL_NAME;
-
-#define MbufCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, multibuf_extension_name, val)
-#define MbufSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, multibuf_extension_name)
-
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-/*
- * find_display - locate the display info block
- */
-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 *libevent, xEvent *netevent);
-static Status event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent);
-static /* const */ XExtensionHooks multibuf_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 *multibuf_error_list[] = {
- "BadBuffer", /* MultibufferBadBuffer */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, multibuf_info,
- multibuf_extension_name,
- &multibuf_extension_hooks,
- MultibufferNumberEvents, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, multibuf_info)
-
-static XEXT_GENERATE_ERROR_STRING (error_string, multibuf_extension_name,
- MultibufferNumberErrors,
- multibuf_error_list)
-
-/*
- * wire_to_event - convert a wire event in network format to a C
- * event structure
- */
-static Bool wire_to_event (Display *dpy, XEvent *libevent, xEvent *netevent)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- MbufCheckExtension (dpy, info, False);
-
- switch ((netevent->u.u.type & 0x7f) - info->codes->first_event) {
- case MultibufferClobberNotify:
- {
- XmbufClobberNotifyEvent *ev;
- xMbufClobberNotifyEvent *event;
-
- ev = (XmbufClobberNotifyEvent *) libevent;
- event = (xMbufClobberNotifyEvent *) netevent;
- ev->type = event->type & 0x7f;
- ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent);
- ev->send_event = ((event->type & 0x80) != 0);
- ev->display = dpy;
- ev->buffer = event->buffer;
- ev->state = event->state;
- return True;
- }
- case MultibufferUpdateNotify:
- {
- XmbufUpdateNotifyEvent *ev;
- xMbufUpdateNotifyEvent *event;
-
- ev = (XmbufUpdateNotifyEvent *) libevent;
- event = (xMbufUpdateNotifyEvent *) netevent;
- ev->type = event->type & 0x7f;
- ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent);
- ev->send_event = ((event->type & 0x80) != 0);
- ev->display = dpy;
- ev->buffer = event->buffer;
- return True;
- }
- }
- return False;
-}
-
-
-/*
- * event_to_wire - convert a C event structure to a wire event in
- * network format
- */
-static Status event_to_wire (Display *dpy, XEvent *libevent, xEvent *netevent)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- MbufCheckExtension (dpy, info, 0);
-
- switch ((libevent->type & 0x7f) - info->codes->first_event) {
- case MultibufferClobberNotify:
- {
- XmbufClobberNotifyEvent *ev;
- xMbufClobberNotifyEvent *event;
-
- ev = (XmbufClobberNotifyEvent *) libevent;
- event = (xMbufClobberNotifyEvent *) netevent;
- event->type = ev->type;
- event->sequenceNumber = (ev->serial & 0xffff);
- event->buffer = ev->buffer;
- event->state = ev->state;
- return 1;
- }
- case MultibufferUpdateNotify:
- {
- XmbufUpdateNotifyEvent *ev;
- xMbufUpdateNotifyEvent *event;
-
- ev = (XmbufUpdateNotifyEvent *) libevent;
- event = (xMbufUpdateNotifyEvent *) netevent;
- event->type = ev->type;
- event->sequenceNumber = (ev->serial & 0xffff);
- event->buffer = ev->buffer;
- return 1;
- }
- }
- return 0;
-}
-
-
-/*
- * read_buffer_info - read Buffer Info descriptors from the net; if unable
- * to allocate memory, read junk to make sure that stream is clear.
- */
-#define TALLOC(type,count) ((type *) Xmalloc ((unsigned) count * sizeof(type)))
-
-static XmbufBufferInfo *read_buffer_info (Display *dpy, int nbufs)
-{
- xMbufBufferInfo *netbuf = TALLOC (xMbufBufferInfo, nbufs);
- XmbufBufferInfo *bufinfo = NULL;
- long netbytes = nbufs * SIZEOF(xMbufBufferInfo);
-
- if (netbuf) {
- _XRead (dpy, (char *) netbuf, netbytes);
-
- bufinfo = TALLOC (XmbufBufferInfo, nbufs);
- if (bufinfo) {
- register XmbufBufferInfo *c;
- register xMbufBufferInfo *net;
- register int i;
-
- for (i = 0, c = bufinfo, net = netbuf; i < nbufs;
- i++, c++, net++) {
- c->visualid = net->visualID;
- c->max_buffers = net->maxBuffers;
- c->depth = net->depth;
- }
- }
- Xfree ((char *) netbuf);
- } else { /* eat the data */
- while (netbytes > 0) {
- char dummy[256]; /* stack size vs loops tradeoff */
- long nbytes = sizeof dummy;
-
- if (nbytes > netbytes) nbytes = netbytes;
- _XRead (dpy, dummy, nbytes);
- netbytes -= nbytes;
- }
- }
-
- return bufinfo;
-}
-
-#undef TALLOC
-
-
-/*****************************************************************************
- * *
- * Multibuffering/stereo public interfaces *
- * *
- *****************************************************************************/
-
-
-/*
- * XmbufQueryExtension -
- * Returns True if the multibuffering/stereo extension is available
- * on the given display. If the extension exists, the value of the
- * first event code (which should be added to the event type constants
- * MultibufferClobberNotify and MultibufferUpdateNotify to get the
- * actual values) is stored into event_base and the value of the first
- * error code (which should be added to the error type constant
- * MultibufferBadBuffer to get the actual value) is stored into
- * error_base.
- */
-Bool XmbufQueryExtension (
- Display *dpy,
- int *event_base_return, int *error_base_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension (info)) {
- *event_base_return = info->codes->first_event;
- *error_base_return = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-/*
- * XmbufGetVersion -
- * Gets the major and minor version numbers of the extension. The return
- * value is zero if an error occurs or non-zero if no error happens.
- */
-Status XmbufGetVersion (
- Display *dpy,
- int *major_version_return, int *minor_version_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xMbufGetBufferVersionReply rep;
- register xMbufGetBufferVersionReq *req;
-
- MbufCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- MbufGetReq (MbufGetBufferVersion, req, info);
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_version_return = rep.majorVersion;
- *minor_version_return = rep.minorVersion;
- UnlockDisplay (dpy);
-
- SyncHandle ();
- return 1;
-}
-
-
-/*
- * XmbufCreateBuffers -
- * Requests that "count" buffers be created with the given update_action
- * and update_hint and be associated with the indicated window. The
- * number of buffers created is returned (zero if an error occurred)
- * and buffers_return is filled in with that many Multibuffer identifiers.
- */
-int XmbufCreateBuffers (
- Display *dpy,
- Window w,
- int count,
- int update_action, int update_hint,
- Multibuffer *buffers)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xMbufCreateImageBuffersReply rep;
- register xMbufCreateImageBuffersReq *req;
- int result;
-
- MbufCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
-
- XAllocIDs(dpy, buffers, count);
- MbufGetReq (MbufCreateImageBuffers, req, info);
- req->window = w;
- req->updateAction = update_action;
- req->updateHint = update_hint;
- req->length += count;
- count <<= 2;
- PackData32 (dpy, buffers, count);
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- result = rep.numberBuffer;
- UnlockDisplay (dpy);
-
- SyncHandle ();
- return result;
-}
-
-
-/*
- * XmbufDestroyBuffers -
- * Destroys the buffers associated with the given window.
- */
-void XmbufDestroyBuffers (Display *dpy, Window window)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMbufDestroyImageBuffersReq *req;
-
- MbufSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- MbufGetReq (MbufDestroyImageBuffers, req, info);
- req->window = window;
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-/*
- * XmbufDisplayBuffers -
- * Displays the indicated buffers their appropriate windows within
- * max_delay milliseconds after min_delay milliseconds have passed.
- * No two buffers may be associated with the same window or else a Match
- * error is generated.
- */
-void XmbufDisplayBuffers (
- Display *dpy,
- int count,
- Multibuffer *buffers,
- int min_delay, int max_delay)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMbufDisplayImageBuffersReq *req;
-
- MbufSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- MbufGetReq (MbufDisplayImageBuffers, req, info);
- req->minDelay = min_delay;
- req->maxDelay = max_delay;
- req->length += count;
- count <<= 2;
- PackData32 (dpy, buffers, count);
- UnlockDisplay (dpy);
- SyncHandle();
-}
-
-
-/*
- * XmbufGetWindowAttributes -
- * Gets the multibuffering attributes that apply to all buffers associated
- * with the given window. Returns non-zero on success and zero if an
- * error occurs.
- */
-Status XmbufGetWindowAttributes (
- Display *dpy,
- Window w,
- XmbufWindowAttributes *attr)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMbufGetMBufferAttributesReq *req;
- xMbufGetMBufferAttributesReply rep;
-
- MbufCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- MbufGetReq (MbufGetMBufferAttributes, req, info);
- req->window = w;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- attr->buffers = (Multibuffer *) NULL;
- if ((attr->nbuffers = rep.length)) {
- int nbytes = rep.length * sizeof(Multibuffer);
- attr->buffers = (Multibuffer *) Xmalloc((unsigned) nbytes);
- nbytes = rep.length << 2;
- if (! attr->buffers) {
- _XEatData(dpy, (unsigned long) nbytes);
- UnlockDisplay(dpy);
- SyncHandle();
- return (0);
- }
- _XRead32 (dpy, (long *) attr->buffers, nbytes);
- }
- attr->displayed_index = rep.displayedBuffer;
- attr->update_action = rep.updateAction;
- attr->update_hint = rep.updateHint;
- attr->window_mode = rep.windowMode;
-
- UnlockDisplay (dpy);
- SyncHandle();
- return 1;
-}
-
-
-/*
- * XmbufChangeWindowAttributes -
- * Sets the multibuffering attributes that apply to all buffers associated
- * with the given window. This is currently limited to the update_hint.
- */
-void XmbufChangeWindowAttributes (
- Display *dpy,
- Window w,
- unsigned long valuemask,
- XmbufSetWindowAttributes *attr)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMbufSetMBufferAttributesReq *req;
-
- MbufSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- MbufGetReq (MbufSetMBufferAttributes, req, info);
- req->window = w;
- if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */
- unsigned long values[1]; /* one per element in if stmts below */
- unsigned long *v = values;
- unsigned int nvalues;
-
- if (valuemask & MultibufferWindowUpdateHint)
- *v++ = attr->update_hint;
- req->length += (nvalues = v - values);
- nvalues <<= 2; /* watch out for macros... */
- Data32 (dpy, (long *) values, (long)nvalues);
- }
- UnlockDisplay (dpy);
- SyncHandle();
-}
-
-
-/*
- * XmbufGetBufferAttributes -
- * Gets the attributes for the indicated buffer. Returns non-zero on
- * success and zero if an error occurs.
- */
-Status XmbufGetBufferAttributes (
- Display *dpy,
- Multibuffer b,
- XmbufBufferAttributes *attr)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMbufGetBufferAttributesReq *req;
- xMbufGetBufferAttributesReply rep;
-
- MbufCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- MbufGetReq (MbufGetBufferAttributes, req, info);
- req->buffer = b;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- attr->window = rep.window;
- attr->event_mask = rep.eventMask;
- attr->buffer_index = rep.bufferIndex;
- attr->side = rep.side;
-
- UnlockDisplay (dpy);
- SyncHandle();
- return 1;
-}
-
-
-/*
- * XmbufChangeBufferAttributes -
- * Sets the attributes for the indicated buffer. This is currently
- * limited to the event_mask.
- */
-void XmbufChangeBufferAttributes (
- Display *dpy,
- Multibuffer b,
- unsigned long valuemask,
- XmbufSetBufferAttributes *attr)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMbufSetBufferAttributesReq *req;
-
- MbufSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- MbufGetReq (MbufSetBufferAttributes, req, info);
- req->buffer = b;
- if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */
- unsigned long values[1]; /* one per element in if stmts below */
- unsigned long *v = values;
- unsigned int nvalues;
-
- if (valuemask & MultibufferBufferEventMask)
- *v++ = attr->event_mask;
- req->length += (nvalues = v - values);
- nvalues <<= 2; /* watch out for macros... */
- Data32 (dpy, (long *) values, (long)nvalues);
- }
- UnlockDisplay (dpy);
- SyncHandle();
-}
-
-
-
-/*
- * XmbufGetScreenInfo -
- * Gets the parameters controlling how mono and stereo windows may be
- * created on the indicated screen. The numbers of sets of visual and
- * depths are returned in nmono_return and nstereo_return. If
- * nmono_return is greater than zero, then mono_info_return is set to
- * the address of an array of XmbufBufferInfo structures describing the
- * various visuals and depths that may be used. Otherwise,
- * mono_info_return is set to NULL. Similarly, stereo_info_return is
- * set according to nstereo_return. The storage returned in
- * mono_info_return and stereo_info_return may be released by XFree.
- * If no errors are encounted, non-zero will be returned.
- */
-Status XmbufGetScreenInfo (
- Display *dpy,
- Drawable d,
- int *nmono_return,
- XmbufBufferInfo **mono_info_return,
- int *nstereo_return,
- XmbufBufferInfo **stereo_info_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMbufGetBufferInfoReq *req;
- xMbufGetBufferInfoReply rep;
- int nmono, nstereo;
- XmbufBufferInfo *minfo, *sinfo;
-
- MbufCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- MbufGetReq (MbufGetBufferInfo, req, info);
- req->drawable = d;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- nmono = rep.normalInfo;
- nstereo = rep.stereoInfo;
- minfo = ((nmono > 0) ? read_buffer_info (dpy, nmono) : NULL);
- sinfo = ((nstereo > 0) ? read_buffer_info (dpy, nstereo) : NULL);
-
- /* check for bad reads indicating we need to return an error */
- if ((nmono > 0 && !minfo) || (nstereo > 0 && !sinfo)) {
- if (minfo) Xfree ((char *) minfo);
- if (sinfo) Xfree ((char *) sinfo);
- UnlockDisplay (dpy);
- SyncHandle();
- return 0;
- }
-
- *nmono_return = nmono;
- *mono_info_return = minfo;
- *nstereo_return = nstereo;
- *stereo_info_return = sinfo;
-
- UnlockDisplay (dpy);
- SyncHandle();
- return 1;
-}
-
-
-/*
- * XmbufCreateStereoWindow -
- * Creates a stereo window in the same way that XCreateWindow creates
- * a mono window (in fact, use the same code, except for the request)
- * and returns the left and right buffers that may be
- */
-Window XmbufCreateStereoWindow (
- Display *dpy,
- Window parent,
- int x, int y,
- unsigned int width, unsigned int height, unsigned int border_width,
- int depth,
- unsigned int class,
- Visual *visual,
- unsigned long valuemask,
- XSetWindowAttributes *attr,
- Multibuffer *leftp, Multibuffer *rightp)
-{
- XExtDisplayInfo *info = find_display (dpy);
- Window wid;
- register xMbufCreateStereoWindowReq *req;
-
- MbufCheckExtension (dpy, info, None);
-
- LockDisplay(dpy);
- MbufGetReq(MbufCreateStereoWindow, req, info);
- wid = req->wid = XAllocID(dpy);
- req->parent = parent;
- req->left = *leftp = XAllocID (dpy);
- req->right = *rightp = XAllocID (dpy);
- req->x = x;
- req->y = y;
- req->width = width;
- req->height = height;
- req->borderWidth = border_width;
- req->depth = depth;
- req->class = class;
- if (visual == (Visual *)CopyFromParent)
- req->visual = CopyFromParent;
- else
- req->visual = visual->visualid;
- valuemask &= (CWBackPixmap|CWBackPixel|CWBorderPixmap|
- CWBorderPixel|CWBitGravity|CWWinGravity|
- CWBackingStore|CWBackingPlanes|CWBackingPixel|
- CWOverrideRedirect|CWSaveUnder|CWEventMask|
- CWDontPropagate|CWColormap|CWCursor);
- if ((req->mask = valuemask)) {
- unsigned long values[32];
- register unsigned long *value = values;
- unsigned int nvalues;
-
- if (valuemask & CWBackPixmap)
- *value++ = attr->background_pixmap;
- if (valuemask & CWBackPixel)
- *value++ = attr->background_pixel;
- if (valuemask & CWBorderPixmap)
- *value++ = attr->border_pixmap;
- if (valuemask & CWBorderPixel)
- *value++ = attr->border_pixel;
- if (valuemask & CWBitGravity)
- *value++ = attr->bit_gravity;
- if (valuemask & CWWinGravity)
- *value++ = attr->win_gravity;
- if (valuemask & CWBackingStore)
- *value++ = attr->backing_store;
- if (valuemask & CWBackingPlanes)
- *value++ = attr->backing_planes;
- if (valuemask & CWBackingPixel)
- *value++ = attr->backing_pixel;
- if (valuemask & CWOverrideRedirect)
- *value++ = attr->override_redirect;
- if (valuemask & CWSaveUnder)
- *value++ = attr->save_under;
- if (valuemask & CWEventMask)
- *value++ = attr->event_mask;
- if (valuemask & CWDontPropagate)
- *value++ = attr->do_not_propagate_mask;
- if (valuemask & CWColormap)
- *value++ = attr->colormap;
- if (valuemask & CWCursor)
- *value++ = attr->cursor;
- req->length += (nvalues = value - values);
-
- nvalues <<= 2; /* watch out for macros... */
- Data32 (dpy, (long *) values, (long)nvalues);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return wid;
-}
-
-void XmbufClearBufferArea (
- Display *dpy,
- Multibuffer buffer,
- int x, int y,
- unsigned int width, unsigned int height,
- Bool exposures)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xMbufClearImageBufferAreaReq *req;
-
- MbufSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- MbufGetReq (MbufClearImageBufferArea, req, info);
- req->buffer = buffer;
- req->x = x;
- req->y = y;
- req->width = width;
- req->height = height;
- req->exposures = exposures;
- UnlockDisplay (dpy);
- SyncHandle();
-}
-
+/*
+ *
+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.
+ *
+ * Authors: Jim Fulton, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <stdio.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/multibufproto.h>
+#include <X11/extensions/multibuf.h>
+
+static XExtensionInfo _multibuf_info_data;
+static XExtensionInfo *multibuf_info = &_multibuf_info_data;
+static /* const */ char *multibuf_extension_name = MULTIBUFFER_PROTOCOL_NAME;
+
+#define MbufCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, multibuf_extension_name, val)
+#define MbufSimpleCheckExtension(dpy,i) \
+ XextSimpleCheckExtension (dpy, i, multibuf_extension_name)
+
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+/*
+ * find_display - locate the display info block
+ */
+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 *libevent, xEvent *netevent);
+static Status event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent);
+static /* const */ XExtensionHooks multibuf_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 *multibuf_error_list[] = {
+ "BadBuffer", /* MultibufferBadBuffer */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, multibuf_info,
+ multibuf_extension_name,
+ &multibuf_extension_hooks,
+ MultibufferNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, multibuf_info)
+
+static XEXT_GENERATE_ERROR_STRING (error_string, multibuf_extension_name,
+ MultibufferNumberErrors,
+ multibuf_error_list)
+
+/*
+ * wire_to_event - convert a wire event in network format to a C
+ * event structure
+ */
+static Bool wire_to_event (Display *dpy, XEvent *libevent, xEvent *netevent)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ MbufCheckExtension (dpy, info, False);
+
+ switch ((netevent->u.u.type & 0x7f) - info->codes->first_event) {
+ case MultibufferClobberNotify:
+ {
+ XmbufClobberNotifyEvent *ev;
+ xMbufClobberNotifyEvent *event;
+
+ ev = (XmbufClobberNotifyEvent *) libevent;
+ event = (xMbufClobberNotifyEvent *) netevent;
+ ev->type = event->type & 0x7f;
+ ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent);
+ ev->send_event = ((event->type & 0x80) != 0);
+ ev->display = dpy;
+ ev->buffer = event->buffer;
+ ev->state = event->state;
+ return True;
+ }
+ case MultibufferUpdateNotify:
+ {
+ XmbufUpdateNotifyEvent *ev;
+ xMbufUpdateNotifyEvent *event;
+
+ ev = (XmbufUpdateNotifyEvent *) libevent;
+ event = (xMbufUpdateNotifyEvent *) netevent;
+ ev->type = event->type & 0x7f;
+ ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent);
+ ev->send_event = ((event->type & 0x80) != 0);
+ ev->display = dpy;
+ ev->buffer = event->buffer;
+ return True;
+ }
+ }
+ return False;
+}
+
+
+/*
+ * event_to_wire - convert a C event structure to a wire event in
+ * network format
+ */
+static Status event_to_wire (Display *dpy, XEvent *libevent, xEvent *netevent)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ MbufCheckExtension (dpy, info, 0);
+
+ switch ((libevent->type & 0x7f) - info->codes->first_event) {
+ case MultibufferClobberNotify:
+ {
+ XmbufClobberNotifyEvent *ev;
+ xMbufClobberNotifyEvent *event;
+
+ ev = (XmbufClobberNotifyEvent *) libevent;
+ event = (xMbufClobberNotifyEvent *) netevent;
+ event->type = ev->type;
+ event->sequenceNumber = (ev->serial & 0xffff);
+ event->buffer = ev->buffer;
+ event->state = ev->state;
+ return 1;
+ }
+ case MultibufferUpdateNotify:
+ {
+ XmbufUpdateNotifyEvent *ev;
+ xMbufUpdateNotifyEvent *event;
+
+ ev = (XmbufUpdateNotifyEvent *) libevent;
+ event = (xMbufUpdateNotifyEvent *) netevent;
+ event->type = ev->type;
+ event->sequenceNumber = (ev->serial & 0xffff);
+ event->buffer = ev->buffer;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+
+/*
+ * read_buffer_info - read Buffer Info descriptors from the net; if unable
+ * to allocate memory, read junk to make sure that stream is clear.
+ */
+#define TALLOC(type,count) ((type *) Xmalloc ((unsigned) count * sizeof(type)))
+
+static XmbufBufferInfo *read_buffer_info (Display *dpy, int nbufs)
+{
+ xMbufBufferInfo *netbuf = TALLOC (xMbufBufferInfo, nbufs);
+ XmbufBufferInfo *bufinfo = NULL;
+ long netbytes = nbufs * SIZEOF(xMbufBufferInfo);
+
+ if (netbuf) {
+ _XRead (dpy, (char *) netbuf, netbytes);
+
+ bufinfo = TALLOC (XmbufBufferInfo, nbufs);
+ if (bufinfo) {
+ register XmbufBufferInfo *c;
+ register xMbufBufferInfo *net;
+ register int i;
+
+ for (i = 0, c = bufinfo, net = netbuf; i < nbufs;
+ i++, c++, net++) {
+ c->visualid = net->visualID;
+ c->max_buffers = net->maxBuffers;
+ c->depth = net->depth;
+ }
+ }
+ Xfree ((char *) netbuf);
+ } else { /* eat the data */
+ while (netbytes > 0) {
+ char dummy[256]; /* stack size vs loops tradeoff */
+ long nbytes = sizeof dummy;
+
+ if (nbytes > netbytes) nbytes = netbytes;
+ _XRead (dpy, dummy, nbytes);
+ netbytes -= nbytes;
+ }
+ }
+
+ return bufinfo;
+}
+
+#undef TALLOC
+
+
+/*****************************************************************************
+ * *
+ * Multibuffering/stereo public interfaces *
+ * *
+ *****************************************************************************/
+
+
+/*
+ * XmbufQueryExtension -
+ * Returns True if the multibuffering/stereo extension is available
+ * on the given display. If the extension exists, the value of the
+ * first event code (which should be added to the event type constants
+ * MultibufferClobberNotify and MultibufferUpdateNotify to get the
+ * actual values) is stored into event_base and the value of the first
+ * error code (which should be added to the error type constant
+ * MultibufferBadBuffer to get the actual value) is stored into
+ * error_base.
+ */
+Bool XmbufQueryExtension (
+ Display *dpy,
+ int *event_base_return, int *error_base_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension (info)) {
+ *event_base_return = info->codes->first_event;
+ *error_base_return = info->codes->first_error;
+ return True;
+ } else {
+ return False;
+ }
+}
+
+
+/*
+ * XmbufGetVersion -
+ * Gets the major and minor version numbers of the extension. The return
+ * value is zero if an error occurs or non-zero if no error happens.
+ */
+Status XmbufGetVersion (
+ Display *dpy,
+ int *major_version_return, int *minor_version_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xMbufGetBufferVersionReply rep;
+ register xMbufGetBufferVersionReq *req;
+
+ MbufCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufGetBufferVersion, req, info);
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ *major_version_return = rep.majorVersion;
+ *minor_version_return = rep.minorVersion;
+ UnlockDisplay (dpy);
+
+ SyncHandle ();
+ return 1;
+}
+
+
+/*
+ * XmbufCreateBuffers -
+ * Requests that "count" buffers be created with the given update_action
+ * and update_hint and be associated with the indicated window. The
+ * number of buffers created is returned (zero if an error occurred)
+ * and buffers_return is filled in with that many Multibuffer identifiers.
+ */
+int XmbufCreateBuffers (
+ Display *dpy,
+ Window w,
+ int count,
+ int update_action, int update_hint,
+ Multibuffer *buffers)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xMbufCreateImageBuffersReply rep;
+ register xMbufCreateImageBuffersReq *req;
+ int result;
+
+ MbufCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+
+ XAllocIDs(dpy, buffers, count);
+ MbufGetReq (MbufCreateImageBuffers, req, info);
+ req->window = w;
+ req->updateAction = update_action;
+ req->updateHint = update_hint;
+ req->length += count;
+ count <<= 2;
+ PackData32 (dpy, buffers, count);
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ result = rep.numberBuffer;
+ UnlockDisplay (dpy);
+
+ SyncHandle ();
+ return result;
+}
+
+
+/*
+ * XmbufDestroyBuffers -
+ * Destroys the buffers associated with the given window.
+ */
+void XmbufDestroyBuffers (Display *dpy, Window window)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMbufDestroyImageBuffersReq *req;
+
+ MbufSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufDestroyImageBuffers, req, info);
+ req->window = window;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+}
+
+
+/*
+ * XmbufDisplayBuffers -
+ * Displays the indicated buffers their appropriate windows within
+ * max_delay milliseconds after min_delay milliseconds have passed.
+ * No two buffers may be associated with the same window or else a Match
+ * error is generated.
+ */
+void XmbufDisplayBuffers (
+ Display *dpy,
+ int count,
+ Multibuffer *buffers,
+ int min_delay, int max_delay)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMbufDisplayImageBuffersReq *req;
+
+ MbufSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufDisplayImageBuffers, req, info);
+ req->minDelay = min_delay;
+ req->maxDelay = max_delay;
+ req->length += count;
+ count <<= 2;
+ PackData32 (dpy, buffers, count);
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+
+/*
+ * XmbufGetWindowAttributes -
+ * Gets the multibuffering attributes that apply to all buffers associated
+ * with the given window. Returns non-zero on success and zero if an
+ * error occurs.
+ */
+Status XmbufGetWindowAttributes (
+ Display *dpy,
+ Window w,
+ XmbufWindowAttributes *attr)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMbufGetMBufferAttributesReq *req;
+ xMbufGetMBufferAttributesReply rep;
+
+ MbufCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufGetMBufferAttributes, req, info);
+ req->window = w;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ attr->buffers = (Multibuffer *) NULL;
+ if ((attr->nbuffers = rep.length)) {
+ int nbytes = rep.length * sizeof(Multibuffer);
+ attr->buffers = (Multibuffer *) Xmalloc((unsigned) nbytes);
+ nbytes = rep.length << 2;
+ if (! attr->buffers) {
+ _XEatData(dpy, (unsigned long) nbytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (0);
+ }
+ _XRead32 (dpy, (long *) attr->buffers, nbytes);
+ }
+ attr->displayed_index = rep.displayedBuffer;
+ attr->update_action = rep.updateAction;
+ attr->update_hint = rep.updateHint;
+ attr->window_mode = rep.windowMode;
+
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return 1;
+}
+
+
+/*
+ * XmbufChangeWindowAttributes -
+ * Sets the multibuffering attributes that apply to all buffers associated
+ * with the given window. This is currently limited to the update_hint.
+ */
+void XmbufChangeWindowAttributes (
+ Display *dpy,
+ Window w,
+ unsigned long valuemask,
+ XmbufSetWindowAttributes *attr)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMbufSetMBufferAttributesReq *req;
+
+ MbufSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufSetMBufferAttributes, req, info);
+ req->window = w;
+ if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */
+ unsigned long values[1]; /* one per element in if stmts below */
+ unsigned long *v = values;
+ unsigned int nvalues;
+
+ if (valuemask & MultibufferWindowUpdateHint)
+ *v++ = attr->update_hint;
+ req->length += (nvalues = v - values);
+ nvalues <<= 2; /* watch out for macros... */
+ Data32 (dpy, (long *) values, (long)nvalues);
+ }
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+
+/*
+ * XmbufGetBufferAttributes -
+ * Gets the attributes for the indicated buffer. Returns non-zero on
+ * success and zero if an error occurs.
+ */
+Status XmbufGetBufferAttributes (
+ Display *dpy,
+ Multibuffer b,
+ XmbufBufferAttributes *attr)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMbufGetBufferAttributesReq *req;
+ xMbufGetBufferAttributesReply rep;
+
+ MbufCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufGetBufferAttributes, req, info);
+ req->buffer = b;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ attr->window = rep.window;
+ attr->event_mask = rep.eventMask;
+ attr->buffer_index = rep.bufferIndex;
+ attr->side = rep.side;
+
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return 1;
+}
+
+
+/*
+ * XmbufChangeBufferAttributes -
+ * Sets the attributes for the indicated buffer. This is currently
+ * limited to the event_mask.
+ */
+void XmbufChangeBufferAttributes (
+ Display *dpy,
+ Multibuffer b,
+ unsigned long valuemask,
+ XmbufSetBufferAttributes *attr)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMbufSetBufferAttributesReq *req;
+
+ MbufSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufSetBufferAttributes, req, info);
+ req->buffer = b;
+ if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */
+ unsigned long values[1]; /* one per element in if stmts below */
+ unsigned long *v = values;
+ unsigned int nvalues;
+
+ if (valuemask & MultibufferBufferEventMask)
+ *v++ = attr->event_mask;
+ req->length += (nvalues = v - values);
+ nvalues <<= 2; /* watch out for macros... */
+ Data32 (dpy, (long *) values, (long)nvalues);
+ }
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
+
+
+/*
+ * XmbufGetScreenInfo -
+ * Gets the parameters controlling how mono and stereo windows may be
+ * created on the indicated screen. The numbers of sets of visual and
+ * depths are returned in nmono_return and nstereo_return. If
+ * nmono_return is greater than zero, then mono_info_return is set to
+ * the address of an array of XmbufBufferInfo structures describing the
+ * various visuals and depths that may be used. Otherwise,
+ * mono_info_return is set to NULL. Similarly, stereo_info_return is
+ * set according to nstereo_return. The storage returned in
+ * mono_info_return and stereo_info_return may be released by XFree.
+ * If no errors are encounted, non-zero will be returned.
+ */
+Status XmbufGetScreenInfo (
+ Display *dpy,
+ Drawable d,
+ int *nmono_return,
+ XmbufBufferInfo **mono_info_return,
+ int *nstereo_return,
+ XmbufBufferInfo **stereo_info_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMbufGetBufferInfoReq *req;
+ xMbufGetBufferInfoReply rep;
+ int nmono, nstereo;
+ XmbufBufferInfo *minfo, *sinfo;
+
+ MbufCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufGetBufferInfo, req, info);
+ req->drawable = d;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ nmono = rep.normalInfo;
+ nstereo = rep.stereoInfo;
+ minfo = ((nmono > 0) ? read_buffer_info (dpy, nmono) : NULL);
+ sinfo = ((nstereo > 0) ? read_buffer_info (dpy, nstereo) : NULL);
+
+ /* check for bad reads indicating we need to return an error */
+ if ((nmono > 0 && !minfo) || (nstereo > 0 && !sinfo)) {
+ if (minfo) Xfree ((char *) minfo);
+ if (sinfo) Xfree ((char *) sinfo);
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return 0;
+ }
+
+ *nmono_return = nmono;
+ *mono_info_return = minfo;
+ *nstereo_return = nstereo;
+ *stereo_info_return = sinfo;
+
+ UnlockDisplay (dpy);
+ SyncHandle();
+ return 1;
+}
+
+
+/*
+ * XmbufCreateStereoWindow -
+ * Creates a stereo window in the same way that XCreateWindow creates
+ * a mono window (in fact, use the same code, except for the request)
+ * and returns the left and right buffers that may be
+ */
+Window XmbufCreateStereoWindow (
+ Display *dpy,
+ Window parent,
+ int x, int y,
+ unsigned int width, unsigned int height, unsigned int border_width,
+ int depth,
+ unsigned int class,
+ Visual *visual,
+ unsigned long valuemask,
+ XSetWindowAttributes *attr,
+ Multibuffer *leftp, Multibuffer *rightp)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ Window wid;
+ register xMbufCreateStereoWindowReq *req;
+
+ MbufCheckExtension (dpy, info, None);
+
+ LockDisplay(dpy);
+ MbufGetReq(MbufCreateStereoWindow, req, info);
+ wid = req->wid = XAllocID(dpy);
+ req->parent = parent;
+ req->left = *leftp = XAllocID (dpy);
+ req->right = *rightp = XAllocID (dpy);
+ req->x = x;
+ req->y = y;
+ req->width = width;
+ req->height = height;
+ req->borderWidth = border_width;
+ req->depth = depth;
+ req->class = class;
+ if (visual == (Visual *)CopyFromParent)
+ req->visual = CopyFromParent;
+ else
+ req->visual = visual->visualid;
+ valuemask &= (CWBackPixmap|CWBackPixel|CWBorderPixmap|
+ CWBorderPixel|CWBitGravity|CWWinGravity|
+ CWBackingStore|CWBackingPlanes|CWBackingPixel|
+ CWOverrideRedirect|CWSaveUnder|CWEventMask|
+ CWDontPropagate|CWColormap|CWCursor);
+ if ((req->mask = valuemask)) {
+ unsigned long values[32];
+ register unsigned long *value = values;
+ unsigned int nvalues;
+
+ if (valuemask & CWBackPixmap)
+ *value++ = attr->background_pixmap;
+ if (valuemask & CWBackPixel)
+ *value++ = attr->background_pixel;
+ if (valuemask & CWBorderPixmap)
+ *value++ = attr->border_pixmap;
+ if (valuemask & CWBorderPixel)
+ *value++ = attr->border_pixel;
+ if (valuemask & CWBitGravity)
+ *value++ = attr->bit_gravity;
+ if (valuemask & CWWinGravity)
+ *value++ = attr->win_gravity;
+ if (valuemask & CWBackingStore)
+ *value++ = attr->backing_store;
+ if (valuemask & CWBackingPlanes)
+ *value++ = attr->backing_planes;
+ if (valuemask & CWBackingPixel)
+ *value++ = attr->backing_pixel;
+ if (valuemask & CWOverrideRedirect)
+ *value++ = attr->override_redirect;
+ if (valuemask & CWSaveUnder)
+ *value++ = attr->save_under;
+ if (valuemask & CWEventMask)
+ *value++ = attr->event_mask;
+ if (valuemask & CWDontPropagate)
+ *value++ = attr->do_not_propagate_mask;
+ if (valuemask & CWColormap)
+ *value++ = attr->colormap;
+ if (valuemask & CWCursor)
+ *value++ = attr->cursor;
+ req->length += (nvalues = value - values);
+
+ nvalues <<= 2; /* watch out for macros... */
+ Data32 (dpy, (long *) values, (long)nvalues);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return wid;
+}
+
+void XmbufClearBufferArea (
+ Display *dpy,
+ Multibuffer buffer,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ Bool exposures)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xMbufClearImageBufferAreaReq *req;
+
+ MbufSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ MbufGetReq (MbufClearImageBufferArea, req, info);
+ req->buffer = buffer;
+ req->x = x;
+ req->y = y;
+ req->width = width;
+ req->height = height;
+ req->exposures = exposures;
+ UnlockDisplay (dpy);
+ SyncHandle();
+}
+
diff --git a/libXext/src/XShape.c b/libXext/src/XShape.c
index f189a41b9..1e3a77f23 100644
--- a/libXext/src/XShape.c
+++ b/libXext/src/XShape.c
@@ -1,488 +1,488 @@
-/*
- *
-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: Keith Packard, MIT X Consortium
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include <X11/Xregion.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/shape.h>
-#include <X11/extensions/shapeproto.h>
-
-static XExtensionInfo _shape_info_data;
-static XExtensionInfo *shape_info = &_shape_info_data;
-static /* const */ char *shape_extension_name = SHAPENAME;
-
-#define ShapeCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, shape_extension_name, val)
-#define ShapeSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, shape_extension_name)
-
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *codes);
-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 shape_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 */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, shape_info,
- shape_extension_name,
- &shape_extension_hooks,
- ShapeNumberEvents, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shape_info)
-
-
-static Bool
-wire_to_event (Display *dpy, XEvent *re, xEvent *event)
-{
- XExtDisplayInfo *info = find_display (dpy);
- XShapeEvent *se;
- xShapeNotifyEvent *sevent;
-
- ShapeCheckExtension (dpy, info, False);
-
- switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
- case ShapeNotify:
- se = (XShapeEvent *) re;
- sevent = (xShapeNotifyEvent *) event;
- se->type = sevent->type & 0x7f;
- se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
- se->send_event = (sevent->type & 0x80) != 0;
- se->display = dpy;
- se->window = sevent->window;
- se->kind = sevent->kind;
- se->x = cvtINT16toInt (sevent->x);
- se->y = cvtINT16toInt (sevent->y);
- se->width = sevent->width;
- se->height = sevent->height;
- se->time = sevent->time;
- se->shaped = True;
- if (sevent->shaped == xFalse)
- se->shaped = False;
- return True;
- }
- return False;
-}
-
-static Status
-event_to_wire (Display *dpy, XEvent *re, xEvent *event)
-{
- XExtDisplayInfo *info = find_display (dpy);
- XShapeEvent *se;
- xShapeNotifyEvent *sevent;
-
- ShapeCheckExtension (dpy, info, 0);
-
- switch ((re->type & 0x7f) - info->codes->first_event) {
- case ShapeNotify:
- se = (XShapeEvent *) re;
- sevent = (xShapeNotifyEvent *) event;
- sevent->type = se->type | (se->send_event ? 0x80 : 0);
- sevent->sequenceNumber = se->serial & 0xffff;
- sevent->window = se->window;
- sevent->kind = se->kind;
- sevent->x = se->x;
- sevent->y = se->y;
- sevent->width = se->width;
- sevent->height = se->height;
- sevent->time = se->time;
- return 1;
- }
- return 0;
-}
-
-
-/****************************************************************************
- * *
- * Shape public interfaces *
- * *
- ****************************************************************************/
-
-Bool XShapeQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status XShapeQueryVersion(
- Display *dpy,
- int *major_versionp,
- int *minor_versionp)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xShapeQueryVersionReply rep;
- register xShapeQueryVersionReq *req;
-
- ShapeCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (ShapeQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeQueryVersion;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_versionp = rep.majorVersion;
- *minor_versionp = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-void XShapeCombineRegion(
- register Display *dpy,
- Window dest,
- int destKind, int xOff, int yOff,
- register REGION *r,
- int op)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShapeRectanglesReq *req;
- register long nbytes;
- register int i;
- register XRectangle *xr, *pr;
- register BOX *pb;
-
- ShapeSimpleCheckExtension (dpy, info);
-
- LockDisplay(dpy);
- GetReq(ShapeRectangles, req);
- xr = (XRectangle *)
- _XAllocScratch(dpy, (unsigned long)(r->numRects * sizeof (XRectangle)));
- for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) {
- pr->x = pb->x1;
- pr->y = pb->y1;
- pr->width = pb->x2 - pb->x1;
- pr->height = pb->y2 - pb->y1;
- }
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeRectangles;
- req->op = op;
- req->ordering = YXBanded;
- req->destKind = destKind;
- req->dest = dest;
- req->xOff = xOff;
- req->yOff = yOff;
-
- /* SIZEOF(xRectangle) will be a multiple of 4 */
- req->length += r->numRects * (SIZEOF(xRectangle) / 4);
-
- nbytes = r->numRects * sizeof(xRectangle);
-
- Data16 (dpy, (short *) xr, nbytes);
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-void XShapeCombineRectangles (
- register Display *dpy,
- XID dest,
- int destKind, int xOff, int yOff,
- XRectangle *rects,
- int n_rects,
- int op, int ordering)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShapeRectanglesReq *req;
- register long nbytes;
-
- ShapeSimpleCheckExtension (dpy, info);
-
- LockDisplay(dpy);
- GetReq(ShapeRectangles, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeRectangles;
- req->op = op;
- req->ordering = ordering;
- req->destKind = destKind;
- req->dest = dest;
- req->xOff = xOff;
- req->yOff = yOff;
-
- /* SIZEOF(xRectangle) will be a multiple of 4 */
- req->length += n_rects * (SIZEOF(xRectangle) / 4);
-
- nbytes = n_rects * sizeof(xRectangle);
-
- Data16 (dpy, (short *) rects, nbytes);
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-void XShapeCombineMask (
- register Display *dpy,
- XID dest,
- int destKind,
- int xOff, int yOff,
- Pixmap src,
- int op)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShapeMaskReq *req;
-
- ShapeSimpleCheckExtension (dpy, info);
-
- LockDisplay(dpy);
- GetReq(ShapeMask, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeMask;
- req->op = op;
- req->destKind = destKind;
- req->dest = dest;
- req->xOff = xOff;
- req->yOff = yOff;
- req->src = src;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XShapeCombineShape (
- register Display *dpy,
- XID dest,
- int destKind,
- int xOff, int yOff,
- XID src,
- int srcKind,
- int op)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShapeCombineReq *req;
-
- ShapeSimpleCheckExtension (dpy, info);
-
- LockDisplay(dpy);
- GetReq(ShapeCombine, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeCombine;
- req->op = op;
- req->destKind = destKind;
- req->srcKind = srcKind;
- req->dest = dest;
- req->xOff = xOff;
- req->yOff = yOff;
- req->src = src;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XShapeOffsetShape (
- register Display *dpy,
- XID dest,
- int destKind,
- int xOff, int yOff)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShapeOffsetReq *req;
-
- ShapeSimpleCheckExtension (dpy, info);
-
- LockDisplay(dpy);
- GetReq(ShapeOffset, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeOffset;
- req->destKind = destKind;
- req->dest = dest;
- req->xOff = xOff;
- req->yOff = yOff;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-Status XShapeQueryExtents (
- register Display *dpy,
- Window window,
- int *bShaped, int *xbs, int *ybs, unsigned int *wbs, unsigned int *hbs, /* RETURN */
- int *cShaped, int *xcs, int *ycs, unsigned int *wcs, unsigned int *hcs /* RETURN */)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xShapeQueryExtentsReply rep;
- register xShapeQueryExtentsReq *req;
-
- ShapeCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (ShapeQueryExtents, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeQueryExtents;
- req->window = window;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *bShaped = rep.boundingShaped;
- *cShaped = rep.clipShaped;
- *xbs = cvtINT16toInt (rep.xBoundingShape);
- *ybs = cvtINT16toInt (rep.yBoundingShape);
- *wbs = rep.widthBoundingShape;
- *hbs = rep.heightBoundingShape;
- *xcs = cvtINT16toInt (rep.xClipShape);
- *ycs = cvtINT16toInt (rep.yClipShape);
- *wcs = rep.widthClipShape;
- *hcs = rep.heightClipShape;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-
-void XShapeSelectInput (
- register Display *dpy,
- Window window,
- unsigned long mask)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShapeSelectInputReq *req;
-
- ShapeSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- GetReq (ShapeSelectInput, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeSelectInput;
- req->window = window;
- if (mask & ShapeNotifyMask)
- req->enable = xTrue;
- else
- req->enable = xFalse;
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-unsigned long XShapeInputSelected (register Display *dpy, Window window)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShapeInputSelectedReq *req;
- xShapeInputSelectedReply rep;
-
- ShapeCheckExtension (dpy, info, False);
-
- LockDisplay (dpy);
- GetReq (ShapeInputSelected, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeInputSelected;
- req->window = window;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- return rep.enabled ? ShapeNotifyMask : 0L;
-}
-
-
-XRectangle *XShapeGetRectangles (
- register Display *dpy,
- Window window,
- int kind,
- int *count, /* RETURN */
- int *ordering /* RETURN */)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xShapeGetRectanglesReq *req;
- xShapeGetRectanglesReply rep;
- XRectangle *rects;
- xRectangle *xrects;
- int i;
-
- ShapeCheckExtension (dpy, info, (XRectangle *)NULL);
-
- LockDisplay (dpy);
- GetReq (ShapeGetRectangles, req);
- req->reqType = info->codes->major_opcode;
- req->shapeReqType = X_ShapeGetRectangles;
- req->window = window;
- req->kind = kind;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return (XRectangle *)NULL;
- }
- *count = rep.nrects;
- *ordering = rep.ordering;
- rects = NULL;
- if (*count) {
- xrects = (xRectangle *) Xmalloc (*count * sizeof (xRectangle));
- rects = (XRectangle *) Xmalloc (*count * sizeof (XRectangle));
- if (!xrects || !rects) {
- if (xrects)
- Xfree (xrects);
- if (rects)
- Xfree (rects);
- _XEatData (dpy, *count * sizeof (xRectangle));
- rects = NULL;
- *count = 0;
- } else {
- _XRead (dpy, (char *) xrects, *count * sizeof (xRectangle));
- for (i = 0; i < *count; i++) {
- rects[i].x = (short) cvtINT16toInt (xrects[i].x);
- rects[i].y = (short) cvtINT16toInt (xrects[i].y);
- rects[i].width = xrects[i].width;
- rects[i].height = xrects[i].height;
- }
- Xfree (xrects);
- }
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- return rects;
-}
+/*
+ *
+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: Keith Packard, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <X11/Xregion.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/shape.h>
+#include <X11/extensions/shapeproto.h>
+
+static XExtensionInfo _shape_info_data;
+static XExtensionInfo *shape_info = &_shape_info_data;
+static /* const */ char *shape_extension_name = SHAPENAME;
+
+#define ShapeCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, shape_extension_name, val)
+#define ShapeSimpleCheckExtension(dpy,i) \
+ XextSimpleCheckExtension (dpy, i, shape_extension_name)
+
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+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 shape_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 */
+ NULL, /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, shape_info,
+ shape_extension_name,
+ &shape_extension_hooks,
+ ShapeNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shape_info)
+
+
+static Bool
+wire_to_event (Display *dpy, XEvent *re, xEvent *event)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ XShapeEvent *se;
+ xShapeNotifyEvent *sevent;
+
+ ShapeCheckExtension (dpy, info, False);
+
+ switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
+ case ShapeNotify:
+ se = (XShapeEvent *) re;
+ sevent = (xShapeNotifyEvent *) event;
+ se->type = sevent->type & 0x7f;
+ se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
+ se->send_event = (sevent->type & 0x80) != 0;
+ se->display = dpy;
+ se->window = sevent->window;
+ se->kind = sevent->kind;
+ se->x = cvtINT16toInt (sevent->x);
+ se->y = cvtINT16toInt (sevent->y);
+ se->width = sevent->width;
+ se->height = sevent->height;
+ se->time = sevent->time;
+ se->shaped = True;
+ if (sevent->shaped == xFalse)
+ se->shaped = False;
+ return True;
+ }
+ return False;
+}
+
+static Status
+event_to_wire (Display *dpy, XEvent *re, xEvent *event)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ XShapeEvent *se;
+ xShapeNotifyEvent *sevent;
+
+ ShapeCheckExtension (dpy, info, 0);
+
+ switch ((re->type & 0x7f) - info->codes->first_event) {
+ case ShapeNotify:
+ se = (XShapeEvent *) re;
+ sevent = (xShapeNotifyEvent *) event;
+ sevent->type = se->type | (se->send_event ? 0x80 : 0);
+ sevent->sequenceNumber = se->serial & 0xffff;
+ sevent->window = se->window;
+ sevent->kind = se->kind;
+ sevent->x = se->x;
+ sevent->y = se->y;
+ sevent->width = se->width;
+ sevent->height = se->height;
+ sevent->time = se->time;
+ return 1;
+ }
+ return 0;
+}
+
+
+/****************************************************************************
+ * *
+ * Shape public interfaces *
+ * *
+ ****************************************************************************/
+
+Bool XShapeQueryExtension (Display *dpy, int *event_basep, int *error_basep)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension(info)) {
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+ return True;
+ } else {
+ return False;
+ }
+}
+
+
+Status XShapeQueryVersion(
+ Display *dpy,
+ int *major_versionp,
+ int *minor_versionp)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xShapeQueryVersionReply rep;
+ register xShapeQueryVersionReq *req;
+
+ ShapeCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ GetReq (ShapeQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeQueryVersion;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ *major_versionp = rep.majorVersion;
+ *minor_versionp = rep.minorVersion;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 1;
+}
+
+void XShapeCombineRegion(
+ register Display *dpy,
+ Window dest,
+ int destKind, int xOff, int yOff,
+ register REGION *r,
+ int op)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShapeRectanglesReq *req;
+ register long nbytes;
+ register int i;
+ register XRectangle *xr, *pr;
+ register BOX *pb;
+
+ ShapeSimpleCheckExtension (dpy, info);
+
+ LockDisplay(dpy);
+ GetReq(ShapeRectangles, req);
+ xr = (XRectangle *)
+ _XAllocScratch(dpy, (unsigned long)(r->numRects * sizeof (XRectangle)));
+ for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) {
+ pr->x = pb->x1;
+ pr->y = pb->y1;
+ pr->width = pb->x2 - pb->x1;
+ pr->height = pb->y2 - pb->y1;
+ }
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeRectangles;
+ req->op = op;
+ req->ordering = YXBanded;
+ req->destKind = destKind;
+ req->dest = dest;
+ req->xOff = xOff;
+ req->yOff = yOff;
+
+ /* SIZEOF(xRectangle) will be a multiple of 4 */
+ req->length += r->numRects * (SIZEOF(xRectangle) / 4);
+
+ nbytes = r->numRects * sizeof(xRectangle);
+
+ Data16 (dpy, (short *) xr, nbytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
+
+void XShapeCombineRectangles (
+ register Display *dpy,
+ XID dest,
+ int destKind, int xOff, int yOff,
+ XRectangle *rects,
+ int n_rects,
+ int op, int ordering)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShapeRectanglesReq *req;
+ register long nbytes;
+
+ ShapeSimpleCheckExtension (dpy, info);
+
+ LockDisplay(dpy);
+ GetReq(ShapeRectangles, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeRectangles;
+ req->op = op;
+ req->ordering = ordering;
+ req->destKind = destKind;
+ req->dest = dest;
+ req->xOff = xOff;
+ req->yOff = yOff;
+
+ /* SIZEOF(xRectangle) will be a multiple of 4 */
+ req->length += n_rects * (SIZEOF(xRectangle) / 4);
+
+ nbytes = n_rects * sizeof(xRectangle);
+
+ Data16 (dpy, (short *) rects, nbytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
+
+void XShapeCombineMask (
+ register Display *dpy,
+ XID dest,
+ int destKind,
+ int xOff, int yOff,
+ Pixmap src,
+ int op)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShapeMaskReq *req;
+
+ ShapeSimpleCheckExtension (dpy, info);
+
+ LockDisplay(dpy);
+ GetReq(ShapeMask, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeMask;
+ req->op = op;
+ req->destKind = destKind;
+ req->dest = dest;
+ req->xOff = xOff;
+ req->yOff = yOff;
+ req->src = src;
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
+void XShapeCombineShape (
+ register Display *dpy,
+ XID dest,
+ int destKind,
+ int xOff, int yOff,
+ XID src,
+ int srcKind,
+ int op)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShapeCombineReq *req;
+
+ ShapeSimpleCheckExtension (dpy, info);
+
+ LockDisplay(dpy);
+ GetReq(ShapeCombine, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeCombine;
+ req->op = op;
+ req->destKind = destKind;
+ req->srcKind = srcKind;
+ req->dest = dest;
+ req->xOff = xOff;
+ req->yOff = yOff;
+ req->src = src;
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
+void XShapeOffsetShape (
+ register Display *dpy,
+ XID dest,
+ int destKind,
+ int xOff, int yOff)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShapeOffsetReq *req;
+
+ ShapeSimpleCheckExtension (dpy, info);
+
+ LockDisplay(dpy);
+ GetReq(ShapeOffset, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeOffset;
+ req->destKind = destKind;
+ req->dest = dest;
+ req->xOff = xOff;
+ req->yOff = yOff;
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
+Status XShapeQueryExtents (
+ register Display *dpy,
+ Window window,
+ int *bShaped, int *xbs, int *ybs, unsigned int *wbs, unsigned int *hbs, /* RETURN */
+ int *cShaped, int *xcs, int *ycs, unsigned int *wcs, unsigned int *hcs /* RETURN */)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xShapeQueryExtentsReply rep;
+ register xShapeQueryExtentsReq *req;
+
+ ShapeCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ GetReq (ShapeQueryExtents, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeQueryExtents;
+ req->window = window;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ *bShaped = rep.boundingShaped;
+ *cShaped = rep.clipShaped;
+ *xbs = cvtINT16toInt (rep.xBoundingShape);
+ *ybs = cvtINT16toInt (rep.yBoundingShape);
+ *wbs = rep.widthBoundingShape;
+ *hbs = rep.heightBoundingShape;
+ *xcs = cvtINT16toInt (rep.xClipShape);
+ *ycs = cvtINT16toInt (rep.yClipShape);
+ *wcs = rep.widthClipShape;
+ *hcs = rep.heightClipShape;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 1;
+}
+
+
+void XShapeSelectInput (
+ register Display *dpy,
+ Window window,
+ unsigned long mask)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShapeSelectInputReq *req;
+
+ ShapeSimpleCheckExtension (dpy, info);
+
+ LockDisplay (dpy);
+ GetReq (ShapeSelectInput, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeSelectInput;
+ req->window = window;
+ if (mask & ShapeNotifyMask)
+ req->enable = xTrue;
+ else
+ req->enable = xFalse;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+}
+
+unsigned long XShapeInputSelected (register Display *dpy, Window window)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShapeInputSelectedReq *req;
+ xShapeInputSelectedReply rep;
+
+ ShapeCheckExtension (dpy, info, False);
+
+ LockDisplay (dpy);
+ GetReq (ShapeInputSelected, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeInputSelected;
+ req->window = window;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return False;
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return rep.enabled ? ShapeNotifyMask : 0L;
+}
+
+
+XRectangle *XShapeGetRectangles (
+ register Display *dpy,
+ Window window,
+ int kind,
+ int *count, /* RETURN */
+ int *ordering /* RETURN */)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xShapeGetRectanglesReq *req;
+ xShapeGetRectanglesReply rep;
+ XRectangle *rects;
+ xRectangle *xrects;
+ int i;
+
+ ShapeCheckExtension (dpy, info, (XRectangle *)NULL);
+
+ LockDisplay (dpy);
+ GetReq (ShapeGetRectangles, req);
+ req->reqType = info->codes->major_opcode;
+ req->shapeReqType = X_ShapeGetRectangles;
+ req->window = window;
+ req->kind = kind;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return (XRectangle *)NULL;
+ }
+ *count = rep.nrects;
+ *ordering = rep.ordering;
+ rects = NULL;
+ if (*count) {
+ xrects = (xRectangle *) Xmalloc (*count * sizeof (xRectangle));
+ rects = (XRectangle *) Xmalloc (*count * sizeof (XRectangle));
+ if (!xrects || !rects) {
+ if (xrects)
+ Xfree (xrects);
+ if (rects)
+ Xfree (rects);
+ _XEatData (dpy, *count * sizeof (xRectangle));
+ rects = NULL;
+ *count = 0;
+ } else {
+ _XRead (dpy, (char *) xrects, *count * sizeof (xRectangle));
+ for (i = 0; i < *count; i++) {
+ rects[i].x = (short) cvtINT16toInt (xrects[i].x);
+ rects[i].y = (short) cvtINT16toInt (xrects[i].y);
+ rects[i].width = xrects[i].width;
+ rects[i].height = xrects[i].height;
+ }
+ Xfree (xrects);
+ }
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return rects;
+}
diff --git a/libXext/src/XShm.c b/libXext/src/XShm.c
index d1f1a4d7f..e3f8fa09b 100644
--- a/libXext/src/XShm.c
+++ b/libXext/src/XShm.c
@@ -74,7 +74,7 @@ static /* const */ char *shm_error_list[] = {
"BadShmSeg", /* BadShmSeg */
};
-static XEXT_GENERATE_FIND_DISPLAY (find_display, shm_info, shm_extension_name,
+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)
diff --git a/libXext/src/XSync.c b/libXext/src/XSync.c
index 9fdb47e2f..0e19922dd 100644
--- a/libXext/src/XSync.c
+++ b/libXext/src/XSync.c
@@ -1,999 +1,999 @@
-/*
-
-Copyright 1991, 1993, 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 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
-and Olivetti Research Limited, Cambridge, England.
-
- All Rights Reserved
-
-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 names of Digital or Olivetti
-not be used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL THEY 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 <stdio.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/sync.h>
-#include <X11/extensions/syncproto.h>
-
-static XExtensionInfo _sync_info_data;
-static XExtensionInfo *sync_info = &_sync_info_data;
-static char *sync_extension_name = SYNC_NAME;
-
-#define SyncCheckExtension(dpy,i,val) \
- XextCheckExtension(dpy, i, sync_extension_name, val)
-#define SyncSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension(dpy, i, sync_extension_name)
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire);
-static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire);
-static char *error_string(Display *dpy, int code, XExtCodes *codes,
- char *buf, int n);
-
-static XExtensionHooks sync_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 char *sync_error_list[] = {
- "BadCounter",
- "BadAlarm",
- "BadFence",
-};
-
-typedef struct _SyncVersionInfoRec {
- short major;
- short minor;
- int num_errors;
-} SyncVersionInfo;
-
-static /* const */ SyncVersionInfo supported_versions[] = {
- { 3 /* major */, 0 /* minor */, 2 /* num_errors */ },
- { 3 /* major */, 1 /* minor */, 3 /* num_errors */ },
-};
-
-#define NUM_VERSIONS (sizeof(supported_versions)/sizeof(supported_versions[0]))
-#define GET_VERSION(info) ((info) ? (const SyncVersionInfo*)(info)->data : NULL)
-#define IS_VERSION_SUPPORTED(info) (!!GET_VERSION(info))
-
-static
-const SyncVersionInfo* GetVersionInfo(Display *dpy)
-{
- xSyncInitializeReply rep;
- xSyncInitializeReq *req;
- XExtCodes codes;
- int i;
-
- if (!XQueryExtension(dpy, sync_extension_name,
- &codes.major_opcode,
- &codes.first_event,
- &codes.first_error))
- return NULL;
-
- LockDisplay(dpy);
- GetReq(SyncInitialize, req);
- req->reqType = codes.major_opcode;
- req->syncReqType = X_SyncInitialize;
- req->majorVersion = SYNC_MAJOR_VERSION;
- req->minorVersion = SYNC_MINOR_VERSION;
- if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
-
- for (i = 0; i < NUM_VERSIONS; i++) {
- if (supported_versions[i].major == rep.majorVersion &&
- supported_versions[i].minor == rep.minorVersion) {
- return &supported_versions[i];
- }
- }
-
- return NULL;
-}
-
-static
-XExtDisplayInfo *find_display_create_optional(Display *dpy, Bool create)
-{
- XExtDisplayInfo *dpyinfo;
-
- if (!sync_info) {
- if (!(sync_info = XextCreateExtension())) return NULL;
- }
-
- if (!(dpyinfo = XextFindDisplay (sync_info, dpy)) && create) {
- dpyinfo = XextAddDisplay(sync_info, dpy,
- sync_extension_name,
- &sync_extension_hooks,
- XSyncNumberEvents,
- (XPointer)GetVersionInfo(dpy));
- }
-
- return dpyinfo;
-}
-
-static
-XExtDisplayInfo *find_display (Display *dpy)
-{
- return find_display_create_optional(dpy, True);
-}
-
-static
-XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info)
-
-static
-char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
-{
- XExtDisplayInfo *info = find_display_create_optional(dpy, False);
- int nerr = IS_VERSION_SUPPORTED(info) ? GET_VERSION(info)->num_errors : 0;
-
- code -= codes->first_error;
- if (code >= 0 && code < nerr) {
- char tmp[256];
- sprintf (tmp, "%s.%d", sync_extension_name, code);
- XGetErrorDatabaseText (dpy, "XProtoError", tmp, sync_error_list[code], buf, n);
- return buf;
- }
- return (char *)0;
-}
-
-static Bool
-wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display(dpy);
- XSyncCounterNotifyEvent *aevent;
- xSyncCounterNotifyEvent *awire;
- XSyncAlarmNotifyEvent *anl;
- xSyncAlarmNotifyEvent *ane;
-
- SyncCheckExtension(dpy, info, False);
-
- switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
- {
- case XSyncCounterNotify:
- awire = (xSyncCounterNotifyEvent *) wire;
- aevent = (XSyncCounterNotifyEvent *) event;
- aevent->type = awire->type & 0x7F;
- aevent->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *) wire);
- aevent->send_event = (awire->type & 0x80) != 0;
- aevent->display = dpy;
- aevent->counter = awire->counter;
- XSyncIntsToValue(&aevent->wait_value, awire->wait_value_lo,
- awire->wait_value_hi);
- XSyncIntsToValue(&aevent->counter_value,
- awire->counter_value_lo,
- awire->counter_value_hi);
- aevent->time = awire->time;
- aevent->count = awire->count;
- aevent->destroyed = awire->destroyed;
- return True;
-
- case XSyncAlarmNotify:
- ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */
- anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */
- anl->type = ane->type & 0x7F;
- anl->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *) wire);
- anl->send_event = (ane->type & 0x80) != 0;
- anl->display = dpy;
- anl->alarm = ane->alarm;
- XSyncIntsToValue(&anl->counter_value,
- ane->counter_value_lo,
- ane->counter_value_hi);
- XSyncIntsToValue(&anl->alarm_value,
- ane->alarm_value_lo,
- ane->alarm_value_hi);
- anl->state = (XSyncAlarmState)ane->state;
- anl->time = ane->time;
- return True;
- }
-
- return False;
-}
-
-static Status
-event_to_wire(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display(dpy);
- XSyncCounterNotifyEvent *aevent;
- xSyncCounterNotifyEvent *awire;
- XSyncAlarmNotifyEvent *anl;
- xSyncAlarmNotifyEvent *ane;
-
- SyncCheckExtension(dpy, info, False);
-
- switch ((event->type & 0x7F) - info->codes->first_event)
- {
- case XSyncCounterNotify:
- awire = (xSyncCounterNotifyEvent *) wire;
- aevent = (XSyncCounterNotifyEvent *) event;
- awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
- awire->sequenceNumber = aevent->serial & 0xFFFF;
- awire->counter = aevent->counter;
- awire->wait_value_lo = XSyncValueLow32(aevent->wait_value);
- awire->wait_value_hi = XSyncValueHigh32(aevent->wait_value);
- awire->counter_value_lo = XSyncValueLow32(aevent->counter_value);
- awire->counter_value_hi = XSyncValueHigh32(aevent->counter_value);
- awire->time = aevent->time;
- awire->count = aevent->count;
- awire->destroyed = aevent->destroyed;
- return True;
-
- case XSyncAlarmNotify:
- ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */
- anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */
- ane->type = anl->type | (anl->send_event ? 0x80 : 0);
- ane->sequenceNumber = anl->serial & 0xFFFF;
- ane->alarm = anl->alarm;
- ane->counter_value_lo = XSyncValueLow32(anl->counter_value);
- ane->counter_value_hi = XSyncValueHigh32(anl->counter_value);
- ane->alarm_value_lo = XSyncValueLow32(anl->alarm_value);
- ane->alarm_value_hi = XSyncValueHigh32(anl->alarm_value);
- ane->state = anl->state;
- ane->time = anl->time;
- return True;
- }
- return False;
-}
-
-Status
-XSyncQueryExtension(
- Display *dpy,
- int *event_base_return, int *error_base_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- if (XextHasExtension(info))
- {
- *event_base_return = info->codes->first_event;
- *error_base_return = info->codes->first_error;
- return True;
- }
- else
- return False;
-}
-
-Status
-XSyncInitialize(
- Display *dpy,
- int *major_version_return, int *minor_version_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- SyncCheckExtension(dpy, info, False);
-
- if (IS_VERSION_SUPPORTED(info)) {
- *major_version_return = GET_VERSION(info)->major;
- *minor_version_return = GET_VERSION(info)->minor;
-
- return True;
- } else {
- return False;
- }
-}
-
-XSyncSystemCounter *
-XSyncListSystemCounters(Display *dpy, int *n_counters_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncListSystemCountersReply rep;
- xSyncListSystemCountersReq *req;
- XSyncSystemCounter *list = NULL;
-
- SyncCheckExtension(dpy, info, NULL);
-
- LockDisplay(dpy);
- GetReq(SyncListSystemCounters, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncListSystemCounters;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
- goto bail;
-
- *n_counters_return = rep.nCounters;
- if (rep.nCounters > 0)
- {
- xSyncSystemCounter *pWireSysCounter, *pNextWireSysCounter;
- XSyncCounter counter;
- int replylen;
- int i;
-
- list = Xmalloc(rep.nCounters * sizeof(XSyncSystemCounter));
- replylen = rep.length << 2;
- pWireSysCounter = Xmalloc ((unsigned) replylen + sizeof(XSyncCounter));
- /* +1 to leave room for last counter read-ahead */
-
- if ((!list) || (!pWireSysCounter))
- {
- if (list) Xfree((char *) list);
- if (pWireSysCounter) Xfree((char *) pWireSysCounter);
- _XEatData(dpy, (unsigned long) replylen);
- list = NULL;
- goto bail;
- }
-
- _XReadPad(dpy, (char *)pWireSysCounter, replylen);
-
- counter = pWireSysCounter->counter;
- for (i = 0; i < rep.nCounters; i++)
- {
- list[i].counter = counter;
- XSyncIntsToValue(&list[i].resolution,
- pWireSysCounter->resolution_lo,
- pWireSysCounter->resolution_hi);
-
- /* we may be about to clobber the counter field of the
- * next syscounter because we have to add a null terminator
- * to the counter name string. So we save the next counter
- * here.
- */
- pNextWireSysCounter = (xSyncSystemCounter *)
- (((char *)pWireSysCounter) + ((SIZEOF(xSyncSystemCounter) +
- pWireSysCounter->name_length + 3) & ~3));
- counter = pNextWireSysCounter->counter;
-
- list[i].name = ((char *)pWireSysCounter) +
- SIZEOF(xSyncSystemCounter);
- /* null-terminate the string */
- *(list[i].name + pWireSysCounter->name_length) = '\0';
- pWireSysCounter = pNextWireSysCounter;
- }
- }
-
-bail:
- UnlockDisplay(dpy);
- SyncHandle();
- return list;
-}
-
-void
-XSyncFreeSystemCounterList(XSyncSystemCounter *list)
-{
- if (list)
- {
- Xfree( ((char *)list[0].name) - SIZEOF(xSyncSystemCounter));
- Xfree(list);
- }
-}
-
-
-XSyncCounter
-XSyncCreateCounter(Display *dpy, XSyncValue initial_value)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncCreateCounterReq *req;
-
- SyncCheckExtension(dpy, info, None);
-
- LockDisplay(dpy);
- GetReq(SyncCreateCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncCreateCounter;
-
- req->cid = XAllocID(dpy);
- req->initial_value_lo = XSyncValueLow32(initial_value);
- req->initial_value_hi = XSyncValueHigh32(initial_value);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return req->cid;
-}
-
-Status
-XSyncSetCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncSetCounterReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncSetCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncSetCounter;
- req->cid = counter;
- req->value_lo = XSyncValueLow32(value);
- req->value_hi = XSyncValueHigh32(value);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncChangeCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncChangeCounterReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncChangeCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncChangeCounter;
- req->cid = counter;
- req->value_lo = XSyncValueLow32(value);
- req->value_hi = XSyncValueHigh32(value);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncDestroyCounter(Display *dpy, XSyncCounter counter)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncDestroyCounterReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncDestroyCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncDestroyCounter;
- req->counter = counter;
- UnlockDisplay(dpy);
- SyncHandle();
-
- return True;
-}
-
-Status
-XSyncQueryCounter(Display *dpy, XSyncCounter counter, XSyncValue *value_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncQueryCounterReply rep;
- xSyncQueryCounterReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncQueryCounter, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncQueryCounter;
- req->counter = counter;
- if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- XSyncIntsToValue(value_return, rep.value_lo, rep.value_hi);
- UnlockDisplay(dpy);
- SyncHandle();
-
- return True;
-}
-
-
-Status
-XSyncAwait(Display *dpy, XSyncWaitCondition *wait_list, int n_conditions)
-{
- XExtDisplayInfo *info = find_display(dpy);
- XSyncWaitCondition *wait_item = wait_list;
- xSyncAwaitReq *req;
- unsigned int len;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncAwait, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncAwait;
- len = (n_conditions * SIZEOF(xSyncWaitCondition)) >> 2;
- SetReqLen(req, len, len /* XXX */ );
-
- while (n_conditions--)
- {
- xSyncWaitCondition wc;
- wc.counter = wait_item->trigger.counter;
- wc.value_type = wait_item->trigger.value_type;
- wc.wait_value_lo = XSyncValueLow32(wait_item->trigger.wait_value);
- wc.wait_value_hi = XSyncValueHigh32(wait_item->trigger.wait_value);
- wc.test_type = wait_item->trigger.test_type;
- wc.event_threshold_lo = XSyncValueLow32(wait_item->event_threshold);
- wc.event_threshold_hi = XSyncValueHigh32(wait_item->event_threshold);
- Data(dpy, (char *)&wc, SIZEOF(xSyncWaitCondition));
- wait_item++; /* get next trigger */
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-static void
-_XProcessAlarmAttributes(Display *dpy, xSyncChangeAlarmReq *req,
- unsigned long valuemask,
- XSyncAlarmAttributes *attributes)
-{
-
- unsigned long values[32];
- unsigned long *value = values;
- unsigned int nvalues;
-
- if (valuemask & XSyncCACounter)
- *value++ = attributes->trigger.counter;
-
- if (valuemask & XSyncCAValueType)
- *value++ = attributes->trigger.value_type;
-
- if (valuemask & XSyncCAValue)
- {
- *value++ = XSyncValueHigh32(attributes->trigger.wait_value);
- *value++ = XSyncValueLow32(attributes->trigger.wait_value);
- }
-
- if (valuemask & XSyncCATestType)
- *value++ = attributes->trigger.test_type;
-
- if (valuemask & XSyncCADelta)
- {
- *value++ = XSyncValueHigh32(attributes->delta);
- *value++ = XSyncValueLow32(attributes->delta);
- }
-
- if (valuemask & XSyncCAEvents)
- *value++ = attributes->events;
-
- /* N.B. the 'state' field cannot be set or changed */
- req->length += (nvalues = value - values);
- nvalues <<= 2; /* watch out for macros... */
-
- Data32(dpy, (long *) values, (long) nvalues);
-}
-
-XSyncAlarm
-XSyncCreateAlarm(
- Display *dpy,
- unsigned long values_mask,
- XSyncAlarmAttributes *values)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncCreateAlarmReq *req;
- XSyncAlarm aid;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncCreateAlarm, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncCreateAlarm;
- req->id = aid = XAllocID(dpy);
- values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
- | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
- if ((req->valueMask = values_mask))
- _XProcessAlarmAttributes(dpy, (xSyncChangeAlarmReq *) req,
- values_mask, values);
- UnlockDisplay(dpy);
- SyncHandle();
- return aid;
-}
-
-Status
-XSyncDestroyAlarm(Display *dpy, XSyncAlarm alarm)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncDestroyAlarmReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncDestroyAlarm, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncDestroyAlarm;
- req->alarm = alarm;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncQueryAlarm(
- Display *dpy,
- XSyncAlarm alarm,
- XSyncAlarmAttributes *values_return)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncQueryAlarmReq *req;
- xSyncQueryAlarmReply rep;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncQueryAlarm, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncQueryAlarm;
- req->alarm = alarm;
-
- if (!(_XReply(dpy, (xReply *) & rep,
- ((SIZEOF(xSyncQueryAlarmReply) - SIZEOF(xGenericReply)) >> 2), xFalse)))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- values_return->trigger.counter = rep.counter;
- values_return->trigger.value_type = (XSyncValueType)rep.value_type;
- XSyncIntsToValue(&values_return->trigger.wait_value,
- rep.wait_value_lo, rep.wait_value_hi);
- values_return->trigger.test_type = (XSyncTestType)rep.test_type;
- XSyncIntsToValue(&values_return->delta, rep.delta_lo,
- rep.delta_hi);
- values_return->events = rep.events;
- values_return->state = (XSyncAlarmState)rep.state;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncChangeAlarm(
- Display *dpy,
- XSyncAlarm alarm,
- unsigned long values_mask,
- XSyncAlarmAttributes *values)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncChangeAlarmReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncChangeAlarm, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncChangeAlarm;
- req->alarm = alarm;
- values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
- | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
- if ((req->valueMask = values_mask))
- _XProcessAlarmAttributes(dpy, req, values_mask, values);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncSetPriority(
- Display *dpy,
- XID client_resource_id,
- int priority)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncSetPriorityReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncSetPriority, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncSetPriority;
- req->id = client_resource_id;
- req->priority = priority;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncGetPriorityReply rep;
- xSyncGetPriorityReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncGetPriority, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncGetPriority;
- req->id = client_resource_id;
-
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- if (return_priority)
- *return_priority = rep.priority;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-XSyncFence
-XSyncCreateFence(Display *dpy, Drawable d, Bool initially_triggered)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncCreateFenceReq *req;
- XSyncFence id;
-
- SyncCheckExtension(dpy, info, None);
-
- LockDisplay(dpy);
- GetReq(SyncCreateFence, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncCreateFence;
-
- req->d = d;
- id = req->fid = XAllocID(dpy);
- req->initially_triggered = initially_triggered;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return id;
-}
-
-Bool
-XSyncTriggerFence(Display *dpy, XSyncFence fence)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncTriggerFenceReq *req;
-
- SyncCheckExtension(dpy, info, None);
-
- LockDisplay(dpy);
- GetReq(SyncTriggerFence, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncTriggerFence;
-
- req->fid = fence;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XSyncResetFence(Display *dpy, XSyncFence fence)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncResetFenceReq *req;
-
- SyncCheckExtension(dpy, info, None);
-
- LockDisplay(dpy);
- GetReq(SyncResetFence, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncResetFence;
-
- req->fid = fence;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XSyncDestroyFence(Display *dpy, XSyncFence fence)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncDestroyFenceReq *req;
-
- SyncCheckExtension(dpy, info, None);
-
- LockDisplay(dpy);
- GetReq(SyncDestroyFence, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncDestroyFence;
-
- req->fid = fence;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncQueryFenceReply rep;
- xSyncQueryFenceReq *req;
-
- SyncCheckExtension(dpy, info, None);
-
- LockDisplay(dpy);
- GetReq(SyncQueryFence, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncQueryFence;
- req->fid = fence;
-
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- if (triggered)
- *triggered = rep.triggered;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xSyncAwaitFenceReq *req;
-
- SyncCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(SyncAwaitFence, req);
- req->reqType = info->codes->major_opcode;
- req->syncReqType = X_SyncAwaitFence;
- SetReqLen(req, n_fences, n_fences);
-
- Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-/*
- * Functions corresponding to the macros for manipulating 64-bit values
- */
-
-void
-XSyncIntToValue(XSyncValue *pv, int i)
-{
- _XSyncIntToValue(pv,i);
-}
-
-void
-XSyncIntsToValue(XSyncValue *pv, unsigned int l, int h)
-{
- _XSyncIntsToValue(pv, l, h);
-}
-
-Bool
-XSyncValueGreaterThan(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueGreaterThan(a, b);
-}
-
-Bool
-XSyncValueLessThan(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueLessThan(a, b);
-}
-
-Bool
-XSyncValueGreaterOrEqual(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueGreaterOrEqual(a, b);
-}
-
-Bool
-XSyncValueLessOrEqual(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueLessOrEqual(a, b);
-}
-
-Bool
-XSyncValueEqual(XSyncValue a, XSyncValue b)
-{
- return _XSyncValueEqual(a, b);
-}
-
-Bool
-XSyncValueIsNegative(XSyncValue v)
-{
- return _XSyncValueIsNegative(v);
-}
-
-Bool
-XSyncValueIsZero(XSyncValue a)
-{
- return _XSyncValueIsZero(a);
-}
-
-Bool
-XSyncValueIsPositive(XSyncValue v)
-{
- return _XSyncValueIsPositive(v);
-}
-
-unsigned int
-XSyncValueLow32(XSyncValue v)
-{
- return _XSyncValueLow32(v);
-}
-
-int
-XSyncValueHigh32(XSyncValue v)
-{
- return _XSyncValueHigh32(v);
-}
-
-void
-XSyncValueAdd(XSyncValue *presult, XSyncValue a, XSyncValue b, Bool *poverflow)
-{
- _XSyncValueAdd(presult, a, b, poverflow);
-}
-
-void
-XSyncValueSubtract(
- XSyncValue *presult,
- XSyncValue a, XSyncValue b,
- Bool *poverflow)
-{
- _XSyncValueSubtract(presult, a, b, poverflow);
-}
-
-void
-XSyncMaxValue(XSyncValue *pv)
-{
- _XSyncMaxValue(pv);
-}
-
-void
-XSyncMinValue(XSyncValue *pv)
-{
- _XSyncMinValue(pv);
-}
+/*
+
+Copyright 1991, 1993, 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 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+ All Rights Reserved
+
+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 names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY 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 <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/sync.h>
+#include <X11/extensions/syncproto.h>
+
+static XExtensionInfo _sync_info_data;
+static XExtensionInfo *sync_info = &_sync_info_data;
+static char *sync_extension_name = SYNC_NAME;
+
+#define SyncCheckExtension(dpy,i,val) \
+ XextCheckExtension(dpy, i, sync_extension_name, val)
+#define SyncSimpleCheckExtension(dpy,i) \
+ XextSimpleCheckExtension(dpy, i, sync_extension_name)
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire);
+static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire);
+static char *error_string(Display *dpy, int code, XExtCodes *codes,
+ char *buf, int n);
+
+static XExtensionHooks sync_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 char *sync_error_list[] = {
+ "BadCounter",
+ "BadAlarm",
+ "BadFence",
+};
+
+typedef struct _SyncVersionInfoRec {
+ short major;
+ short minor;
+ int num_errors;
+} SyncVersionInfo;
+
+static /* const */ SyncVersionInfo supported_versions[] = {
+ { 3 /* major */, 0 /* minor */, 2 /* num_errors */ },
+ { 3 /* major */, 1 /* minor */, 3 /* num_errors */ },
+};
+
+#define NUM_VERSIONS (sizeof(supported_versions)/sizeof(supported_versions[0]))
+#define GET_VERSION(info) ((info) ? (const SyncVersionInfo*)(info)->data : NULL)
+#define IS_VERSION_SUPPORTED(info) (!!GET_VERSION(info))
+
+static
+const SyncVersionInfo* GetVersionInfo(Display *dpy)
+{
+ xSyncInitializeReply rep;
+ xSyncInitializeReq *req;
+ XExtCodes codes;
+ int i;
+
+ if (!XQueryExtension(dpy, sync_extension_name,
+ &codes.major_opcode,
+ &codes.first_event,
+ &codes.first_error))
+ return NULL;
+
+ LockDisplay(dpy);
+ GetReq(SyncInitialize, req);
+ req->reqType = codes.major_opcode;
+ req->syncReqType = X_SyncInitialize;
+ req->majorVersion = SYNC_MAJOR_VERSION;
+ req->minorVersion = SYNC_MINOR_VERSION;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ for (i = 0; i < NUM_VERSIONS; i++) {
+ if (supported_versions[i].major == rep.majorVersion &&
+ supported_versions[i].minor == rep.minorVersion) {
+ return &supported_versions[i];
+ }
+ }
+
+ return NULL;
+}
+
+static
+XExtDisplayInfo *find_display_create_optional(Display *dpy, Bool create)
+{
+ XExtDisplayInfo *dpyinfo;
+
+ if (!sync_info) {
+ if (!(sync_info = XextCreateExtension())) return NULL;
+ }
+
+ if (!(dpyinfo = XextFindDisplay (sync_info, dpy)) && create) {
+ dpyinfo = XextAddDisplay(sync_info, dpy,
+ sync_extension_name,
+ &sync_extension_hooks,
+ XSyncNumberEvents,
+ (XPointer)GetVersionInfo(dpy));
+ }
+
+ return dpyinfo;
+}
+
+static
+XExtDisplayInfo *find_display (Display *dpy)
+{
+ return find_display_create_optional(dpy, True);
+}
+
+static
+XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info)
+
+static
+char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
+{
+ XExtDisplayInfo *info = find_display_create_optional(dpy, False);
+ int nerr = IS_VERSION_SUPPORTED(info) ? GET_VERSION(info)->num_errors : 0;
+
+ code -= codes->first_error;
+ if (code >= 0 && code < nerr) {
+ char tmp[256];
+ sprintf (tmp, "%s.%d", sync_extension_name, code);
+ XGetErrorDatabaseText (dpy, "XProtoError", tmp, sync_error_list[code], buf, n);
+ return buf;
+ }
+ return (char *)0;
+}
+
+static Bool
+wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ XSyncCounterNotifyEvent *aevent;
+ xSyncCounterNotifyEvent *awire;
+ XSyncAlarmNotifyEvent *anl;
+ xSyncAlarmNotifyEvent *ane;
+
+ SyncCheckExtension(dpy, info, False);
+
+ switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
+ {
+ case XSyncCounterNotify:
+ awire = (xSyncCounterNotifyEvent *) wire;
+ aevent = (XSyncCounterNotifyEvent *) event;
+ aevent->type = awire->type & 0x7F;
+ aevent->serial = _XSetLastRequestRead(dpy,
+ (xGenericReply *) wire);
+ aevent->send_event = (awire->type & 0x80) != 0;
+ aevent->display = dpy;
+ aevent->counter = awire->counter;
+ XSyncIntsToValue(&aevent->wait_value, awire->wait_value_lo,
+ awire->wait_value_hi);
+ XSyncIntsToValue(&aevent->counter_value,
+ awire->counter_value_lo,
+ awire->counter_value_hi);
+ aevent->time = awire->time;
+ aevent->count = awire->count;
+ aevent->destroyed = awire->destroyed;
+ return True;
+
+ case XSyncAlarmNotify:
+ ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */
+ anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */
+ anl->type = ane->type & 0x7F;
+ anl->serial = _XSetLastRequestRead(dpy,
+ (xGenericReply *) wire);
+ anl->send_event = (ane->type & 0x80) != 0;
+ anl->display = dpy;
+ anl->alarm = ane->alarm;
+ XSyncIntsToValue(&anl->counter_value,
+ ane->counter_value_lo,
+ ane->counter_value_hi);
+ XSyncIntsToValue(&anl->alarm_value,
+ ane->alarm_value_lo,
+ ane->alarm_value_hi);
+ anl->state = (XSyncAlarmState)ane->state;
+ anl->time = ane->time;
+ return True;
+ }
+
+ return False;
+}
+
+static Status
+event_to_wire(Display *dpy, XEvent *event, xEvent *wire)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ XSyncCounterNotifyEvent *aevent;
+ xSyncCounterNotifyEvent *awire;
+ XSyncAlarmNotifyEvent *anl;
+ xSyncAlarmNotifyEvent *ane;
+
+ SyncCheckExtension(dpy, info, False);
+
+ switch ((event->type & 0x7F) - info->codes->first_event)
+ {
+ case XSyncCounterNotify:
+ awire = (xSyncCounterNotifyEvent *) wire;
+ aevent = (XSyncCounterNotifyEvent *) event;
+ awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
+ awire->sequenceNumber = aevent->serial & 0xFFFF;
+ awire->counter = aevent->counter;
+ awire->wait_value_lo = XSyncValueLow32(aevent->wait_value);
+ awire->wait_value_hi = XSyncValueHigh32(aevent->wait_value);
+ awire->counter_value_lo = XSyncValueLow32(aevent->counter_value);
+ awire->counter_value_hi = XSyncValueHigh32(aevent->counter_value);
+ awire->time = aevent->time;
+ awire->count = aevent->count;
+ awire->destroyed = aevent->destroyed;
+ return True;
+
+ case XSyncAlarmNotify:
+ ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */
+ anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */
+ ane->type = anl->type | (anl->send_event ? 0x80 : 0);
+ ane->sequenceNumber = anl->serial & 0xFFFF;
+ ane->alarm = anl->alarm;
+ ane->counter_value_lo = XSyncValueLow32(anl->counter_value);
+ ane->counter_value_hi = XSyncValueHigh32(anl->counter_value);
+ ane->alarm_value_lo = XSyncValueLow32(anl->alarm_value);
+ ane->alarm_value_hi = XSyncValueHigh32(anl->alarm_value);
+ ane->state = anl->state;
+ ane->time = anl->time;
+ return True;
+ }
+ return False;
+}
+
+Status
+XSyncQueryExtension(
+ Display *dpy,
+ int *event_base_return, int *error_base_return)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+
+ if (XextHasExtension(info))
+ {
+ *event_base_return = info->codes->first_event;
+ *error_base_return = info->codes->first_error;
+ return True;
+ }
+ else
+ return False;
+}
+
+Status
+XSyncInitialize(
+ Display *dpy,
+ int *major_version_return, int *minor_version_return)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+
+ SyncCheckExtension(dpy, info, False);
+
+ if (IS_VERSION_SUPPORTED(info)) {
+ *major_version_return = GET_VERSION(info)->major;
+ *minor_version_return = GET_VERSION(info)->minor;
+
+ return True;
+ } else {
+ return False;
+ }
+}
+
+XSyncSystemCounter *
+XSyncListSystemCounters(Display *dpy, int *n_counters_return)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncListSystemCountersReply rep;
+ xSyncListSystemCountersReq *req;
+ XSyncSystemCounter *list = NULL;
+
+ SyncCheckExtension(dpy, info, NULL);
+
+ LockDisplay(dpy);
+ GetReq(SyncListSystemCounters, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncListSystemCounters;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+ goto bail;
+
+ *n_counters_return = rep.nCounters;
+ if (rep.nCounters > 0)
+ {
+ xSyncSystemCounter *pWireSysCounter, *pNextWireSysCounter;
+ XSyncCounter counter;
+ int replylen;
+ int i;
+
+ list = Xmalloc(rep.nCounters * sizeof(XSyncSystemCounter));
+ replylen = rep.length << 2;
+ pWireSysCounter = Xmalloc ((unsigned) replylen + sizeof(XSyncCounter));
+ /* +1 to leave room for last counter read-ahead */
+
+ if ((!list) || (!pWireSysCounter))
+ {
+ if (list) Xfree((char *) list);
+ if (pWireSysCounter) Xfree((char *) pWireSysCounter);
+ _XEatData(dpy, (unsigned long) replylen);
+ list = NULL;
+ goto bail;
+ }
+
+ _XReadPad(dpy, (char *)pWireSysCounter, replylen);
+
+ counter = pWireSysCounter->counter;
+ for (i = 0; i < rep.nCounters; i++)
+ {
+ list[i].counter = counter;
+ XSyncIntsToValue(&list[i].resolution,
+ pWireSysCounter->resolution_lo,
+ pWireSysCounter->resolution_hi);
+
+ /* we may be about to clobber the counter field of the
+ * next syscounter because we have to add a null terminator
+ * to the counter name string. So we save the next counter
+ * here.
+ */
+ pNextWireSysCounter = (xSyncSystemCounter *)
+ (((char *)pWireSysCounter) + ((SIZEOF(xSyncSystemCounter) +
+ pWireSysCounter->name_length + 3) & ~3));
+ counter = pNextWireSysCounter->counter;
+
+ list[i].name = ((char *)pWireSysCounter) +
+ SIZEOF(xSyncSystemCounter);
+ /* null-terminate the string */
+ *(list[i].name + pWireSysCounter->name_length) = '\0';
+ pWireSysCounter = pNextWireSysCounter;
+ }
+ }
+
+bail:
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return list;
+}
+
+void
+XSyncFreeSystemCounterList(XSyncSystemCounter *list)
+{
+ if (list)
+ {
+ Xfree( ((char *)list[0].name) - SIZEOF(xSyncSystemCounter));
+ Xfree(list);
+ }
+}
+
+
+XSyncCounter
+XSyncCreateCounter(Display *dpy, XSyncValue initial_value)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncCreateCounterReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncCreateCounter, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncCreateCounter;
+
+ req->cid = XAllocID(dpy);
+ req->initial_value_lo = XSyncValueLow32(initial_value);
+ req->initial_value_hi = XSyncValueHigh32(initial_value);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return req->cid;
+}
+
+Status
+XSyncSetCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncSetCounterReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncSetCounter, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncSetCounter;
+ req->cid = counter;
+ req->value_lo = XSyncValueLow32(value);
+ req->value_hi = XSyncValueHigh32(value);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Status
+XSyncChangeCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncChangeCounterReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncChangeCounter, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncChangeCounter;
+ req->cid = counter;
+ req->value_lo = XSyncValueLow32(value);
+ req->value_hi = XSyncValueHigh32(value);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Status
+XSyncDestroyCounter(Display *dpy, XSyncCounter counter)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncDestroyCounterReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncDestroyCounter, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncDestroyCounter;
+ req->counter = counter;
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return True;
+}
+
+Status
+XSyncQueryCounter(Display *dpy, XSyncCounter counter, XSyncValue *value_return)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncQueryCounterReply rep;
+ xSyncQueryCounterReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncQueryCounter, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncQueryCounter;
+ req->counter = counter;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ XSyncIntsToValue(value_return, rep.value_lo, rep.value_hi);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return True;
+}
+
+
+Status
+XSyncAwait(Display *dpy, XSyncWaitCondition *wait_list, int n_conditions)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ XSyncWaitCondition *wait_item = wait_list;
+ xSyncAwaitReq *req;
+ unsigned int len;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncAwait, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncAwait;
+ len = (n_conditions * SIZEOF(xSyncWaitCondition)) >> 2;
+ SetReqLen(req, len, len /* XXX */ );
+
+ while (n_conditions--)
+ {
+ xSyncWaitCondition wc;
+ wc.counter = wait_item->trigger.counter;
+ wc.value_type = wait_item->trigger.value_type;
+ wc.wait_value_lo = XSyncValueLow32(wait_item->trigger.wait_value);
+ wc.wait_value_hi = XSyncValueHigh32(wait_item->trigger.wait_value);
+ wc.test_type = wait_item->trigger.test_type;
+ wc.event_threshold_lo = XSyncValueLow32(wait_item->event_threshold);
+ wc.event_threshold_hi = XSyncValueHigh32(wait_item->event_threshold);
+ Data(dpy, (char *)&wc, SIZEOF(xSyncWaitCondition));
+ wait_item++; /* get next trigger */
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+static void
+_XProcessAlarmAttributes(Display *dpy, xSyncChangeAlarmReq *req,
+ unsigned long valuemask,
+ XSyncAlarmAttributes *attributes)
+{
+
+ unsigned long values[32];
+ unsigned long *value = values;
+ unsigned int nvalues;
+
+ if (valuemask & XSyncCACounter)
+ *value++ = attributes->trigger.counter;
+
+ if (valuemask & XSyncCAValueType)
+ *value++ = attributes->trigger.value_type;
+
+ if (valuemask & XSyncCAValue)
+ {
+ *value++ = XSyncValueHigh32(attributes->trigger.wait_value);
+ *value++ = XSyncValueLow32(attributes->trigger.wait_value);
+ }
+
+ if (valuemask & XSyncCATestType)
+ *value++ = attributes->trigger.test_type;
+
+ if (valuemask & XSyncCADelta)
+ {
+ *value++ = XSyncValueHigh32(attributes->delta);
+ *value++ = XSyncValueLow32(attributes->delta);
+ }
+
+ if (valuemask & XSyncCAEvents)
+ *value++ = attributes->events;
+
+ /* N.B. the 'state' field cannot be set or changed */
+ req->length += (nvalues = value - values);
+ nvalues <<= 2; /* watch out for macros... */
+
+ Data32(dpy, (long *) values, (long) nvalues);
+}
+
+XSyncAlarm
+XSyncCreateAlarm(
+ Display *dpy,
+ unsigned long values_mask,
+ XSyncAlarmAttributes *values)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncCreateAlarmReq *req;
+ XSyncAlarm aid;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncCreateAlarm, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncCreateAlarm;
+ req->id = aid = XAllocID(dpy);
+ values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
+ | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
+ if ((req->valueMask = values_mask))
+ _XProcessAlarmAttributes(dpy, (xSyncChangeAlarmReq *) req,
+ values_mask, values);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return aid;
+}
+
+Status
+XSyncDestroyAlarm(Display *dpy, XSyncAlarm alarm)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncDestroyAlarmReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncDestroyAlarm, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncDestroyAlarm;
+ req->alarm = alarm;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Status
+XSyncQueryAlarm(
+ Display *dpy,
+ XSyncAlarm alarm,
+ XSyncAlarmAttributes *values_return)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncQueryAlarmReq *req;
+ xSyncQueryAlarmReply rep;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncQueryAlarm, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncQueryAlarm;
+ req->alarm = alarm;
+
+ if (!(_XReply(dpy, (xReply *) & rep,
+ ((SIZEOF(xSyncQueryAlarmReply) - SIZEOF(xGenericReply)) >> 2), xFalse)))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ values_return->trigger.counter = rep.counter;
+ values_return->trigger.value_type = (XSyncValueType)rep.value_type;
+ XSyncIntsToValue(&values_return->trigger.wait_value,
+ rep.wait_value_lo, rep.wait_value_hi);
+ values_return->trigger.test_type = (XSyncTestType)rep.test_type;
+ XSyncIntsToValue(&values_return->delta, rep.delta_lo,
+ rep.delta_hi);
+ values_return->events = rep.events;
+ values_return->state = (XSyncAlarmState)rep.state;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Status
+XSyncChangeAlarm(
+ Display *dpy,
+ XSyncAlarm alarm,
+ unsigned long values_mask,
+ XSyncAlarmAttributes *values)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncChangeAlarmReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncChangeAlarm, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncChangeAlarm;
+ req->alarm = alarm;
+ values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
+ | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
+ if ((req->valueMask = values_mask))
+ _XProcessAlarmAttributes(dpy, req, values_mask, values);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Status
+XSyncSetPriority(
+ Display *dpy,
+ XID client_resource_id,
+ int priority)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncSetPriorityReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncSetPriority, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncSetPriority;
+ req->id = client_resource_id;
+ req->priority = priority;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Status
+XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncGetPriorityReply rep;
+ xSyncGetPriorityReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncGetPriority, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncGetPriority;
+ req->id = client_resource_id;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ if (return_priority)
+ *return_priority = rep.priority;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+XSyncFence
+XSyncCreateFence(Display *dpy, Drawable d, Bool initially_triggered)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncCreateFenceReq *req;
+ XSyncFence id;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncCreateFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncCreateFence;
+
+ req->d = d;
+ id = req->fid = XAllocID(dpy);
+ req->initially_triggered = initially_triggered;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return id;
+}
+
+Bool
+XSyncTriggerFence(Display *dpy, XSyncFence fence)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncTriggerFenceReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncTriggerFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncTriggerFence;
+
+ req->fid = fence;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XSyncResetFence(Display *dpy, XSyncFence fence)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncResetFenceReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncResetFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncResetFence;
+
+ req->fid = fence;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XSyncDestroyFence(Display *dpy, XSyncFence fence)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncDestroyFenceReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncDestroyFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncDestroyFence;
+
+ req->fid = fence;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncQueryFenceReply rep;
+ xSyncQueryFenceReq *req;
+
+ SyncCheckExtension(dpy, info, None);
+
+ LockDisplay(dpy);
+ GetReq(SyncQueryFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncQueryFence;
+ req->fid = fence;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ if (triggered)
+ *triggered = rep.triggered;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+Bool
+XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xSyncAwaitFenceReq *req;
+
+ SyncCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(SyncAwaitFence, req);
+ req->reqType = info->codes->major_opcode;
+ req->syncReqType = X_SyncAwaitFence;
+ SetReqLen(req, n_fences, n_fences);
+
+ Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+/*
+ * Functions corresponding to the macros for manipulating 64-bit values
+ */
+
+void
+XSyncIntToValue(XSyncValue *pv, int i)
+{
+ _XSyncIntToValue(pv,i);
+}
+
+void
+XSyncIntsToValue(XSyncValue *pv, unsigned int l, int h)
+{
+ _XSyncIntsToValue(pv, l, h);
+}
+
+Bool
+XSyncValueGreaterThan(XSyncValue a, XSyncValue b)
+{
+ return _XSyncValueGreaterThan(a, b);
+}
+
+Bool
+XSyncValueLessThan(XSyncValue a, XSyncValue b)
+{
+ return _XSyncValueLessThan(a, b);
+}
+
+Bool
+XSyncValueGreaterOrEqual(XSyncValue a, XSyncValue b)
+{
+ return _XSyncValueGreaterOrEqual(a, b);
+}
+
+Bool
+XSyncValueLessOrEqual(XSyncValue a, XSyncValue b)
+{
+ return _XSyncValueLessOrEqual(a, b);
+}
+
+Bool
+XSyncValueEqual(XSyncValue a, XSyncValue b)
+{
+ return _XSyncValueEqual(a, b);
+}
+
+Bool
+XSyncValueIsNegative(XSyncValue v)
+{
+ return _XSyncValueIsNegative(v);
+}
+
+Bool
+XSyncValueIsZero(XSyncValue a)
+{
+ return _XSyncValueIsZero(a);
+}
+
+Bool
+XSyncValueIsPositive(XSyncValue v)
+{
+ return _XSyncValueIsPositive(v);
+}
+
+unsigned int
+XSyncValueLow32(XSyncValue v)
+{
+ return _XSyncValueLow32(v);
+}
+
+int
+XSyncValueHigh32(XSyncValue v)
+{
+ return _XSyncValueHigh32(v);
+}
+
+void
+XSyncValueAdd(XSyncValue *presult, XSyncValue a, XSyncValue b, Bool *poverflow)
+{
+ _XSyncValueAdd(presult, a, b, poverflow);
+}
+
+void
+XSyncValueSubtract(
+ XSyncValue *presult,
+ XSyncValue a, XSyncValue b,
+ Bool *poverflow)
+{
+ _XSyncValueSubtract(presult, a, b, poverflow);
+}
+
+void
+XSyncMaxValue(XSyncValue *pv)
+{
+ _XSyncMaxValue(pv);
+}
+
+void
+XSyncMinValue(XSyncValue *pv)
+{
+ _XSyncMinValue(pv);
+}
diff --git a/libXext/src/XTestExt1.c b/libXext/src/XTestExt1.c
index 83a59a3d8..15aa4c0f2 100644
--- a/libXext/src/XTestExt1.c
+++ b/libXext/src/XTestExt1.c
@@ -1,1317 +1,1317 @@
-/*
- * File: xtestext1lib.c
- *
- * This file contains the Xlib parts of the input synthesis extension
- */
-
-/*
-
-
-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.
-
-*/
-
-/******************************************************************************
- * include files
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <X11/Xproto.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/xtestext1.h>
-#include <X11/extensions/xtestext1proto.h>
-
-/******************************************************************************
- * variables
- *****************************************************************************/
-
-/*
- * Holds the request type code for this extension. The request type code
- * for this extension may vary depending on how many extensions are installed
- * already, so the initial value given below will be added to the base request
- * code that is acquired when this extension is installed.
- */
-static int XTestReqCode = 0;
-/*
- * Holds the two event type codes for this extension. The event type codes
- * for this extension may vary depending on how many extensions are installed
- * already, so the initial values given below will be added to the base event
- * code that is acquired when this extension is installed.
- *
- * These two variables must be available to programs that use this extension.
- */
-int XTestInputActionType = 0;
-int XTestFakeAckType = 1;
-/*
- * holds the current x and y coordinates for XTestMovePointer
- */
-static int current_x = 0;
-static int current_y = 0;
-/*
- * Holds input actions being accumulated until the input action buffer is
- * full or until XTestFlush is called.
- */
-static CARD8 action_buf[XTestMAX_ACTION_LIST_SIZE];
-/*
- * the index into the input action buffer
- */
-static int action_index = 0;
-/*
- * the number of input actions that the server can handle at one time
- */
-static unsigned long action_array_size = 0;
-/*
- * the current number of input actions
- */
-static unsigned long action_count = 0;
-
-/******************************************************************************
- * function declarations
- *****************************************************************************/
-
-static int XTestWireToEvent(Display *dpy, XEvent *reTemp, xEvent *eventTemp);
-static int XTestCheckExtInit(register Display *dpy);
-static Bool XTestIdentifyMyEvent(Display *display, XEvent *event_ptr, char *args);
-static int XTestInitExtension(register Display *dpy);
-static int XTestKeyOrButton(Display *display, int device_id, long unsigned int delay, unsigned int code, unsigned int action);
-static int XTestCheckDelay(Display *display, long unsigned int *delay_addr);
-static int XTestPackInputAction(Display *display, CARD8 *action_addr, int action_size);
-static int XTestWriteInputActions(Display *display, char *action_list_addr, int action_list_size, int ack_flag);
-
-/******************************************************************************
- *
- * XTestFakeInput
- *
- * Send a a request containing one or more input actions to be sent
- * to the server by this extension.
- */
-int
-XTestFakeInput(
-/*
- * the connection to the X server
- */
-register Display *dpy,
-/*
- * the address of a list of input actions to be sent to the server
- */
-char *action_list_addr,
-/*
- * the size (in bytes) of the list of input actions
- */
-int action_list_size,
-/*
- * specifies whether the server needs to send an event to indicate that its
- * input action buffer is empty
- */
-int ack_flag)
-{
- /*
- * pointer to xTestFakeInputReq structure
- */
- xTestFakeInputReq *req;
- /*
- * loop index
- */
- int i;
-
- LockDisplay(dpy);
- if ((XTestCheckExtInit(dpy) == -1) ||
- (action_list_size > XTestMAX_ACTION_LIST_SIZE))
- {
- /*
- * if the extension is not installed in the server or the
- * action list will not fit in the request, then unlock
- * the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestFakeInput, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestFakeInput, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestFakeInput
- */
- req->XTestReqType = X_TestFakeInput;
- /*
- * set the ack code
- */
- req->ack = ack_flag;
- /*
- * Set the action_list area to all 0's. An input action header
- * value of 0 is interpreted as a flag to the input action
- * list handling code in the server part of this extension
- * that there are no more input actions in this request.
- */
- for (i = 0; i < XTestMAX_ACTION_LIST_SIZE; i++)
- {
- req->action_list[i] = 0;
- }
- /*
- * copy the input actions into the request
- */
- for (i = 0; i < action_list_size; i++)
- {
- req->action_list[i] = *(action_list_addr++);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestGetInput
- *
- * Request the server to begin putting user input actions into events
- * to be sent to the client that called this function.
- */
-int
-XTestGetInput(
-/*
- * the connection to the X server
- */
-register Display *dpy,
-/*
- * tells the server what to do with the user input actions
- */
-int action_handling)
-{
- /*
- * pointer to xTestGetInputReq structure
- */
- xTestGetInputReq *req;
-
- LockDisplay(dpy);
- if (XTestCheckExtInit(dpy) == -1)
- {
- /*
- * if the extension is not installed in the server
- * then unlock the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestGetInput, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestGetInput, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestGetInput
- */
- req->XTestReqType = X_TestGetInput;
- /*
- * set the action handling mode
- */
- req->mode = action_handling;
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestStopInput
- *
- * Tell the server to stop putting information about user input actions
- * into events.
- */
-int
-XTestStopInput(
-/*
- * the connection to the X server
- */
-register Display *dpy)
-{
- /*
- * pointer to xTestStopInputReq structure
- */
- xTestStopInputReq *req;
-
- LockDisplay(dpy);
- if (XTestCheckExtInit(dpy) == -1)
- {
- /*
- * if the extension is not installed in the server
- * then unlock the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestStopInput, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestStopInput, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestStopInput
- */
- req->XTestReqType = X_TestStopInput;
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestReset
- *
- * Tell the server to set everything having to do with this extension
- * back to its initial state.
- */
-int
-XTestReset(
-/*
- * the connection to the X server
- */
-register Display *dpy)
-{
- /*
- * pointer to xTestReset structure
- */
- xTestResetReq *req;
-
- LockDisplay(dpy);
- if (XTestCheckExtInit(dpy) == -1)
- {
- /*
- * if the extension is not installed in the server
- * then unlock the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestReset, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestReset, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestReset
- */
- req->XTestReqType = X_TestReset;
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestQueryInputSize
- *
- * Returns the number of input actions in the server's input action buffer.
- */
-int
-XTestQueryInputSize(
-/*
- * the connection to the X server
- */
-register Display *dpy,
-/*
- * the address of the place to put the number of input actions in the
- * server's input action buffer
- */
-unsigned long *size_return)
-{
- /*
- * pointer to xTestQueryInputSize structure
- */
- xTestQueryInputSizeReq *req;
- /*
- * pointer to xTestQueryInputSize structure
- */
- xTestQueryInputSizeReply rep;
-
- LockDisplay(dpy);
- if (XTestCheckExtInit(dpy) == -1)
- {
- /*
- * if the extension is not installed in the server
- * then unlock the display and return -1.
- */
- UnlockDisplay(dpy);
- return(-1);
- }
- else
- {
- /*
- * Get the next available X request packet in the buffer.
- * It sets the `length' field to the size (in 32-bit words)
- * of the request. It also sets the `reqType' field in the
- * request to X_TestQueryInputSize, which is not what is needed.
- *
- * GetReq is a macro defined in Xlibint.h.
- */
- GetReq(TestQueryInputSize, req);
- /*
- * fix up the request type code to what is needed
- */
- req->reqType = XTestReqCode;
- /*
- * set the minor request type code to X_TestQueryInputSize
- */
- req->XTestReqType = X_TestQueryInputSize;
- /*
- * get a reply from the server
- */
- (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
- /*
- * put the size in the caller's variable
- */
- *size_return = (unsigned long) rep.size_return;
- UnlockDisplay(dpy);
- SyncHandle();
- return(0);
- }
-}
-
-/******************************************************************************
- *
- * XTestCheckExtInit
- *
- * Check to see if the XTest extension is installed in the server.
- */
-static int
-XTestCheckExtInit(
-/*
- * the connection to the X server
- */
-register Display *dpy)
-{
- /*
- * if the extension has not been initialized, then do so
- */
- if (!XTestReqCode)
- {
- return(XTestInitExtension(dpy));
- }
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestInitExtension
- *
- * Attempt to initialize this extension in the server. Return 0 if it
- * succeeds, -1 if it does not succeed.
- */
-static int
-XTestInitExtension(
-/*
- * the connection to the X server
- */
-register Display *dpy)
-{
- /*
- * loop index
- */
- int i;
- /*
- * return value from XInitExtension
- */
- XExtCodes *ret;
-
- /*
- * attempt to initialize the extension
- */
- ret = XInitExtension(dpy, XTestEXTENSION_NAME);
- /*
- * if the initialize failed, return -1
- */
- if (ret == NULL)
- {
- return (-1);
- }
- /*
- * the initialize succeeded, remember the major opcode
- * for this extension
- */
- XTestReqCode = ret->major_opcode;
- /*
- * set up the event handler for any events from
- * this extension
- */
- for (i = 0; i < XTestEVENT_COUNT; i++)
- {
- XESetWireToEvent(dpy,
- ret->first_event+i,
- XTestWireToEvent);
- }
- /*
- * compute the event type codes for the events
- * in this extension
- */
- XTestInputActionType += ret->first_event;
- XTestFakeAckType += ret->first_event;
- /*
- * everything worked ok
- */
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestWireToEvent
- *
- * Handle XTest extension events.
- * Reformat a wire event into an XEvent structure of the right type.
- */
-static Bool
-XTestWireToEvent(
-/*
- * the connection to the X server
- */
-Display *dpy,
-/*
- * a pointer to where a host formatted event should be stored
- * with the information copied to it
- */
-XEvent *reTemp,
-/*
- * a pointer to the wire event
- */
-xEvent *eventTemp)
-{
- XTestInputActionEvent *re = (XTestInputActionEvent *) reTemp;
- xTestInputActionEvent *event = (xTestInputActionEvent *) eventTemp;
-
- /*
- * loop index
- */
- int i;
- /*
- * pointer to where the input actions go in the host format event
- */
- CARD8 *to;
- /*
- * pointer to the input actions in the wire event
- */
- CARD8 *from;
-
- /*
- * Copy the type of the wire event to the new event.
- * This will work for either event type because the type,
- * display, and window fields in the events have to be the same.
- */
- re->type = event->type;
- /*
- * set the display parameter in case it is needed (by who?)
- */
- re->display = dpy;
- if (re->type == XTestInputActionType)
- {
- /*
- * point at the first byte of input actions in the wire event
- */
- from = &(event->actions[0]);
- /*
- * point at where the input action bytes go in the new event
- */
- to = &(re->actions[0]);
- /*
- * copy the input action bytes from the wire event to
- * the new event
- */
- for (i = 0; i < XTestACTIONS_SIZE; i++)
- {
- *(to++) = *(from++);
- }
- }
- else if (re->type == XTestFakeAckType)
- {
- /*
- * nothing else needs to be done
- */
- }
- else
- {
- printf("XTestWireToEvent: UNKNOWN WIRE EVENT! type=%d\n",
- (int) event->type);
- printf("%s is giving up.\n", XTestEXTENSION_NAME);
- exit (1);
- }
- return 1;
-}
-
-/******************************************************************************
- *
- * XTestPressKey
- *
- * Send input actions to the server to cause the server to think
- * that the specified key on the keyboard was moved as specified.
- */
-int
-XTestPressKey(
-Display *display,
-int device_id,
-unsigned long delay,
-unsigned int keycode,
-unsigned int key_action)
-{
- /*
- * bounds check the key code
- */
- if (keycode < 8 || keycode > 255)
- {
- return(-1);
- }
- /*
- * use the commmon key/button handling routine
- */
- return(XTestKeyOrButton(display,
- device_id,
- delay,
- keycode,
- key_action));
-}
-
-/******************************************************************************
- *
- * XTestPressButton
- *
- * Send input actions to the server to cause the server to think
- * that the specified button on the mouse was moved as specified.
- */
-int
-XTestPressButton(
-Display *display,
-int device_id,
-unsigned long delay,
-unsigned int button_number,
-unsigned int button_action)
-{
- /*
- * bounds check the button number
- */
- if (button_number > 7)
- {
- return(-1);
- }
- /*
- * use the commmon key/button handling routine
- */
- return(XTestKeyOrButton(display,
- device_id,
- delay,
- button_number,
- button_action));
-}
-
-/******************************************************************************
- *
- * XTestKeyOrButton
- *
- * Send input actions to the server to cause the server to think
- * that the specified key/button was moved as specified.
- */
-static int
-XTestKeyOrButton(
-Display *display,
-int device_id,
-unsigned long delay,
-unsigned int code,
-unsigned int action)
-{
- /*
- * holds a key input action to be filled out and sent to the server
- */
- XTestKeyInfo keyinfo;
-
- /*
- * bounds check the device id
- */
- if (device_id < 0 || device_id > XTestMAX_DEVICE_ID)
- {
- return(-1);
- }
- /*
- * fill out the key input action(s) as appropriate
- */
- switch(action)
- {
- case XTestPRESS:
- /*
- * Check the delay. If it is larger than will fit in the
- * key input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &delay) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * create the header
- */
- keyinfo.header = XTestPackDeviceID(device_id) |
- XTestKEY_ACTION |
- XTestKEY_DOWN;
- /*
- * set the key/button code
- */
- keyinfo.keycode = code;
- /*
- * set the delay time
- */
- keyinfo.delay_time = delay;
- /*
- * pack the input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- return(XTestPackInputAction(display,
- (CARD8 *) &keyinfo,
- sizeof(XTestKeyInfo)));
- case XTestRELEASE:
- /*
- * Check the delay. If it is larger than will fit in the
- * key input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &delay) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * create the header
- */
- keyinfo.header = XTestPackDeviceID(device_id) |
- XTestKEY_ACTION |
- XTestKEY_UP;
- /*
- * set the key/button code
- */
- keyinfo.keycode = code;
- /*
- * set the delay time
- */
- keyinfo.delay_time = delay;
- /*
- * pack the input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- return(XTestPackInputAction(display,
- (CARD8 *) &keyinfo,
- sizeof(XTestKeyInfo)));
- case XTestSTROKE:
- /*
- * Check the delay. If it is larger than will fit in the
- * key input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &delay) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * create a key/button-down input action header
- */
- keyinfo.header = XTestPackDeviceID(device_id) |
- XTestKEY_ACTION |
- XTestKEY_DOWN;
- /*
- * set the key/button code
- */
- keyinfo.keycode = code;
- /*
- * set the delay time
- */
- keyinfo.delay_time = delay;
- /*
- * pack the input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- if (XTestPackInputAction(display,
- (CARD8 *) &keyinfo,
- sizeof(XTestKeyInfo)) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * set the delay to XTestSTROKE_DELAY_TIME
- */
- delay = XTestSTROKE_DELAY_TIME;
- /*
- * Check the delay. If it is larger than will fit in the
- * key input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &delay) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * create a key/button-up input action header
- */
- keyinfo.header = XTestPackDeviceID(device_id) |
- XTestKEY_ACTION |
- XTestKEY_UP;
- /*
- * set the key/button code
- */
- keyinfo.keycode = code;
- /*
- * set the delay time
- */
- keyinfo.delay_time = delay;
- /*
- * pack the input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- return(XTestPackInputAction(display,
- (CARD8 *) &keyinfo,
- sizeof(XTestKeyInfo)));
- default:
- /*
- * invalid action value, return -1
- */
- return(-1);
- }
-}
-
-/******************************************************************************
- *
- * XTestMovePointer
- *
- * Send input actions to the server to cause the server to think
- * that the mouse was moved as specified.
- */
-int
-XTestMovePointer(
-Display *display,
-int device_id,
-unsigned long delay[],
-int x[],
-int y[],
-unsigned int count)
-{
- /*
- * holds a motion input action to be filled out and sent to the server
- */
- XTestMotionInfo motioninfo;
- /*
- * holds a jump input action to be filled out and sent to the server
- */
- XTestJumpInfo jumpinfo;
- /*
- * loop index
- */
- unsigned int i;
- /*
- * holds the change in x and y directions from the current x and y
- * coordinates
- */
- int dx;
- int dy;
-
- /*
- * bounds check the device id
- */
- if (device_id < 0 || device_id > XTestMAX_DEVICE_ID)
- {
- return(-1);
- }
- /*
- * if the count is 0, there is nothing to do. return 0
- */
- if (count == 0)
- {
- return(0);
- }
- /*
- * loop through the pointer motions, creating the appropriate
- * input actions for each motion
- */
- for (i = 0; i < count; i++)
- {
- /*
- * Check the delay. If it is larger than will fit in the
- * input action, send a delay input action.
- */
- if(XTestCheckDelay(display, &(delay[i])) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- /*
- * compute the change from the current x and y coordinates
- * to the new x and y coordinates
- */
- dx = x[i] - current_x;
- dy = y[i] - current_y;
- /*
- * update the current x and y coordinates
- */
- current_x = x[i];
- current_y = y[i];
- /*
- * If the pointer motion range is too large to fit into
- * a motion input action, then use a jump input action.
- * Otherwise, use a motion input action.
- */
- if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) ||
- (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN))
- {
- /*
- * create a jump input action header
- */
- jumpinfo.header = XTestPackDeviceID(device_id) |
- XTestJUMP_ACTION;
- /*
- * set the x and y coordinates to jump to
- */
- jumpinfo.jumpx = x[i];
- jumpinfo.jumpy = y[i];
- /*
- * set the delay time
- */
- jumpinfo.delay_time = delay[i];
- /*
- * pack the jump input action into a request to be
- * sent to the server when the request is full
- * or XTestFlush is called
- */
- if (XTestPackInputAction(display,
- (CARD8 *) &jumpinfo,
- sizeof(XTestJumpInfo)) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- }
- else
- {
- /*
- * create a motion input action header
- */
- motioninfo.header = XTestPackDeviceID(device_id) |
- XTestMOTION_ACTION;
- /*
- * compute the motion data byte
- */
- if (dx < 0)
- {
- motioninfo.header |= XTestX_NEGATIVE;
- dx = abs(dx);
- }
- if (dy < 0)
- {
- motioninfo.header |= XTestY_NEGATIVE;
- dy = abs(dy);
- }
- motioninfo.motion_data = XTestPackXMotionValue(dx);
- motioninfo.motion_data |= XTestPackYMotionValue(dy);
- /*
- * set the delay time
- */
- motioninfo.delay_time = delay[i];
- /*
- * pack the motion input action into a request to be
- * sent to the server when the request is full
- * or XTestFlush is called
- */
- if (XTestPackInputAction(display,
- (CARD8 *) &motioninfo,
- sizeof(XTestMotionInfo)) == -1)
- {
- /*
- * an error occurred, return -1
- */
- return(-1);
- }
- }
- }
- /*
- * if you get here, everything went ok
- */
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestCheckDelay
- *
- * Check the delay value at the passed-in address. If it is larger than
- * will fit in a normal input action, then send a delay input action.
- */
-static int
-XTestCheckDelay(
-Display *display,
-unsigned long *delay_addr)
-{
- /*
- * holds a delay input action to be filled out and sent to the server
- */
- XTestDelayInfo delayinfo;
-
- /*
- * if the delay value will fit in the input action,
- * then there is no need for a delay input action
- */
- if (*delay_addr <= XTestSHORT_DELAY_TIME)
- {
- return(0);
- }
- /*
- * fill out a delay input action
- */
- delayinfo.header = XTestPackDeviceID(XTestDELAY_DEVICE_ID);
- delayinfo.delay_time = *delay_addr;
- /*
- * all of the delay time will be accounted for in the
- * delay input action, so set the original delay value to 0
- */
- *delay_addr = 0;
- /*
- * pack the delay input action into a request to be sent to the
- * server when the request is full or XTestFlush is called
- */
- return(XTestPackInputAction(display,
- (CARD8 *) &delayinfo,
- sizeof(XTestDelayInfo)));
-}
-
-/******************************************************************************
- *
- * XTestPackInputAction
- *
- * If the input action buffer is full or the number of input actions
- * has reached the maximum that the server can handle at one time,
- * then send the input actions to the server using XTestFakeInput.
- */
-static int
-XTestPackInputAction(
-Display *display,
-CARD8 *action_addr,
-int action_size)
-{
- /*
- * loop index
- */
- int i;
- /*
- * acknowledge flag
- */
- int ack_flag;
-
- /*
- * if we don't already know it, find out how many input actions
- * the server can handle at one time
- */
- if (action_array_size == 0)
- {
- if(XTestQueryInputSize(display, &action_array_size) == -1)
- {
- /*
- * if an error, return -1
- */
- return(-1);
- }
- }
- /*
- * if the specified input action will fit in the the input
- * action buffer and won't exceed the server's capacity, then
- * put the input action into the input buffer
- */
- if(((action_index + action_size) <= XTestMAX_ACTION_LIST_SIZE) &&
- ((action_count + 1) < action_array_size))
- {
- /*
- * copy the input action into the buffer
- */
- for (i = 0; i < action_size; i++)
- {
- action_buf[action_index++] = *(action_addr++);
- }
- /*
- * increment the action count
- */
- action_count++;
- /*
- * everything went ok, return 0
- */
- return(0);
- }
- /*
- * We have to write input actions to the server. If the server's
- * input action capacity will be reached, then ask for an
- * acknowledge event when the server has processed all of the
- * input actions. Otherwise, an acknowledge event is not needed.
- */
- if (action_count >= action_array_size)
- {
- ack_flag = XTestFAKE_ACK_REQUEST;
- }
- else
- {
- ack_flag = XTestFAKE_ACK_NOT_NEEDED;
- }
- /*
- * write the input actions to the server
- */
- if (XTestWriteInputActions(display,
- (char *) &(action_buf[0]),
- action_index,
- ack_flag) == -1)
- {
- /*
- * error, return -1
- */
- return(-1);
- }
- /*
- * copy the input action into the buffer
- */
- for (i = 0; i < action_size; i++)
- {
- action_buf[action_index++] = *(action_addr++);
- }
- /*
- * increment the action count
- */
- action_count++;
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestWriteInputActions
- *
- * Send input actions to the server.
- */
-static int
-XTestWriteInputActions(
-Display *display,
-char *action_list_addr,
-int action_list_size,
-int ack_flag)
-{
- /*
- * Holds an event. Used while waiting for an acknowledge event
- */
- XEvent event;
- /*
- * points to XTestIdentifyMyEvent
- */
- Bool (*func_ptr)(Display *, XEvent *, XPointer);
-
- /*
- * write the input actions to the server
- */
- if (XTestFakeInput(display,
- action_list_addr,
- action_list_size,
- ack_flag) == -1)
- {
- /*
- * if an error, return -1
- */
- return(-1);
- }
- /*
- * flush X's buffers to make sure that the server really gets
- * the input actions
- */
- XFlush(display);
- /*
- * mark the input action buffer as empty
- */
- action_index = 0;
- /*
- * if we asked for an acknowledge event, then wait for it
- */
- if (ack_flag == XTestFAKE_ACK_REQUEST)
- {
- /*
- * point func_ptr at XTestIdentifyMyEvent
- */
- func_ptr = XTestIdentifyMyEvent;
- /*
- * Wait until the acknowledge event comes. When the
- * acknowledge event comes, it is removed from the event
- * queue without disturbing any other events that might
- * be in the queue.
- */
- XIfEvent(display, &event, func_ptr, NULL);
- /*
- * set the input action count back to 0
- */
- action_count = 0;
- }
- /*
- * if we got here, then everything is ok, return 0
- */
- return(0);
-}
-
-/******************************************************************************
- *
- * XTestIdentifyMyEvent
- *
- * This function is called by XIfEvent to look at an event and see if
- * it is of XTestFakeAckType.
- */
-static Bool
-XTestIdentifyMyEvent(
-Display *display,
-/*
- * Holds the event that this routine is supposed to look at.
- */
-XEvent *event_ptr,
-/*
- * this points to any user-specified arguments (ignored)
- */
-char *args)
-{
- /*
- * if the event if of the correct type, return the Bool True,
- * otherwise return the Bool False.
- */
- if (event_ptr->type == XTestFakeAckType)
- {
- return(True);
- }
- else
- {
- return(False);
- }
-}
-
-/******************************************************************************
- *
- * XTestFlush
- *
- * Send any input actions in the input action buffer to the server.
- */
-int
-XTestFlush(Display *display)
-{
- /*
- * acknowledge flag
- */
- int ack_flag;
-
- /*
- * if there are no input actions in the input action buffer,
- * then return 0
- */
- if (action_index == 0)
- {
- return(0);
- }
- /*
- * We have input actions to write to the server. We will
- * wait until the server has finished processing the input actions.
- */
- ack_flag = XTestFAKE_ACK_REQUEST;
- /*
- * write the input actions to the server
- */
- return(XTestWriteInputActions(display,
- (char *) &(action_buf[0]),
- action_index,
- ack_flag));
-}
+/*
+ * File: xtestext1lib.c
+ *
+ * This file contains the Xlib parts of the input synthesis extension
+ */
+
+/*
+
+
+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.
+
+*/
+
+/******************************************************************************
+ * include files
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/xtestext1.h>
+#include <X11/extensions/xtestext1proto.h>
+
+/******************************************************************************
+ * variables
+ *****************************************************************************/
+
+/*
+ * Holds the request type code for this extension. The request type code
+ * for this extension may vary depending on how many extensions are installed
+ * already, so the initial value given below will be added to the base request
+ * code that is acquired when this extension is installed.
+ */
+static int XTestReqCode = 0;
+/*
+ * Holds the two event type codes for this extension. The event type codes
+ * for this extension may vary depending on how many extensions are installed
+ * already, so the initial values given below will be added to the base event
+ * code that is acquired when this extension is installed.
+ *
+ * These two variables must be available to programs that use this extension.
+ */
+int XTestInputActionType = 0;
+int XTestFakeAckType = 1;
+/*
+ * holds the current x and y coordinates for XTestMovePointer
+ */
+static int current_x = 0;
+static int current_y = 0;
+/*
+ * Holds input actions being accumulated until the input action buffer is
+ * full or until XTestFlush is called.
+ */
+static CARD8 action_buf[XTestMAX_ACTION_LIST_SIZE];
+/*
+ * the index into the input action buffer
+ */
+static int action_index = 0;
+/*
+ * the number of input actions that the server can handle at one time
+ */
+static unsigned long action_array_size = 0;
+/*
+ * the current number of input actions
+ */
+static unsigned long action_count = 0;
+
+/******************************************************************************
+ * function declarations
+ *****************************************************************************/
+
+static int XTestWireToEvent(Display *dpy, XEvent *reTemp, xEvent *eventTemp);
+static int XTestCheckExtInit(register Display *dpy);
+static Bool XTestIdentifyMyEvent(Display *display, XEvent *event_ptr, char *args);
+static int XTestInitExtension(register Display *dpy);
+static int XTestKeyOrButton(Display *display, int device_id, long unsigned int delay, unsigned int code, unsigned int action);
+static int XTestCheckDelay(Display *display, long unsigned int *delay_addr);
+static int XTestPackInputAction(Display *display, CARD8 *action_addr, int action_size);
+static int XTestWriteInputActions(Display *display, char *action_list_addr, int action_list_size, int ack_flag);
+
+/******************************************************************************
+ *
+ * XTestFakeInput
+ *
+ * Send a a request containing one or more input actions to be sent
+ * to the server by this extension.
+ */
+int
+XTestFakeInput(
+/*
+ * the connection to the X server
+ */
+register Display *dpy,
+/*
+ * the address of a list of input actions to be sent to the server
+ */
+char *action_list_addr,
+/*
+ * the size (in bytes) of the list of input actions
+ */
+int action_list_size,
+/*
+ * specifies whether the server needs to send an event to indicate that its
+ * input action buffer is empty
+ */
+int ack_flag)
+{
+ /*
+ * pointer to xTestFakeInputReq structure
+ */
+ xTestFakeInputReq *req;
+ /*
+ * loop index
+ */
+ int i;
+
+ LockDisplay(dpy);
+ if ((XTestCheckExtInit(dpy) == -1) ||
+ (action_list_size > XTestMAX_ACTION_LIST_SIZE))
+ {
+ /*
+ * if the extension is not installed in the server or the
+ * action list will not fit in the request, then unlock
+ * the display and return -1.
+ */
+ UnlockDisplay(dpy);
+ return(-1);
+ }
+ else
+ {
+ /*
+ * Get the next available X request packet in the buffer.
+ * It sets the `length' field to the size (in 32-bit words)
+ * of the request. It also sets the `reqType' field in the
+ * request to X_TestFakeInput, which is not what is needed.
+ *
+ * GetReq is a macro defined in Xlibint.h.
+ */
+ GetReq(TestFakeInput, req);
+ /*
+ * fix up the request type code to what is needed
+ */
+ req->reqType = XTestReqCode;
+ /*
+ * set the minor request type code to X_TestFakeInput
+ */
+ req->XTestReqType = X_TestFakeInput;
+ /*
+ * set the ack code
+ */
+ req->ack = ack_flag;
+ /*
+ * Set the action_list area to all 0's. An input action header
+ * value of 0 is interpreted as a flag to the input action
+ * list handling code in the server part of this extension
+ * that there are no more input actions in this request.
+ */
+ for (i = 0; i < XTestMAX_ACTION_LIST_SIZE; i++)
+ {
+ req->action_list[i] = 0;
+ }
+ /*
+ * copy the input actions into the request
+ */
+ for (i = 0; i < action_list_size; i++)
+ {
+ req->action_list[i] = *(action_list_addr++);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return(0);
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestGetInput
+ *
+ * Request the server to begin putting user input actions into events
+ * to be sent to the client that called this function.
+ */
+int
+XTestGetInput(
+/*
+ * the connection to the X server
+ */
+register Display *dpy,
+/*
+ * tells the server what to do with the user input actions
+ */
+int action_handling)
+{
+ /*
+ * pointer to xTestGetInputReq structure
+ */
+ xTestGetInputReq *req;
+
+ LockDisplay(dpy);
+ if (XTestCheckExtInit(dpy) == -1)
+ {
+ /*
+ * if the extension is not installed in the server
+ * then unlock the display and return -1.
+ */
+ UnlockDisplay(dpy);
+ return(-1);
+ }
+ else
+ {
+ /*
+ * Get the next available X request packet in the buffer.
+ * It sets the `length' field to the size (in 32-bit words)
+ * of the request. It also sets the `reqType' field in the
+ * request to X_TestGetInput, which is not what is needed.
+ *
+ * GetReq is a macro defined in Xlibint.h.
+ */
+ GetReq(TestGetInput, req);
+ /*
+ * fix up the request type code to what is needed
+ */
+ req->reqType = XTestReqCode;
+ /*
+ * set the minor request type code to X_TestGetInput
+ */
+ req->XTestReqType = X_TestGetInput;
+ /*
+ * set the action handling mode
+ */
+ req->mode = action_handling;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return(0);
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestStopInput
+ *
+ * Tell the server to stop putting information about user input actions
+ * into events.
+ */
+int
+XTestStopInput(
+/*
+ * the connection to the X server
+ */
+register Display *dpy)
+{
+ /*
+ * pointer to xTestStopInputReq structure
+ */
+ xTestStopInputReq *req;
+
+ LockDisplay(dpy);
+ if (XTestCheckExtInit(dpy) == -1)
+ {
+ /*
+ * if the extension is not installed in the server
+ * then unlock the display and return -1.
+ */
+ UnlockDisplay(dpy);
+ return(-1);
+ }
+ else
+ {
+ /*
+ * Get the next available X request packet in the buffer.
+ * It sets the `length' field to the size (in 32-bit words)
+ * of the request. It also sets the `reqType' field in the
+ * request to X_TestStopInput, which is not what is needed.
+ *
+ * GetReq is a macro defined in Xlibint.h.
+ */
+ GetReq(TestStopInput, req);
+ /*
+ * fix up the request type code to what is needed
+ */
+ req->reqType = XTestReqCode;
+ /*
+ * set the minor request type code to X_TestStopInput
+ */
+ req->XTestReqType = X_TestStopInput;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return(0);
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestReset
+ *
+ * Tell the server to set everything having to do with this extension
+ * back to its initial state.
+ */
+int
+XTestReset(
+/*
+ * the connection to the X server
+ */
+register Display *dpy)
+{
+ /*
+ * pointer to xTestReset structure
+ */
+ xTestResetReq *req;
+
+ LockDisplay(dpy);
+ if (XTestCheckExtInit(dpy) == -1)
+ {
+ /*
+ * if the extension is not installed in the server
+ * then unlock the display and return -1.
+ */
+ UnlockDisplay(dpy);
+ return(-1);
+ }
+ else
+ {
+ /*
+ * Get the next available X request packet in the buffer.
+ * It sets the `length' field to the size (in 32-bit words)
+ * of the request. It also sets the `reqType' field in the
+ * request to X_TestReset, which is not what is needed.
+ *
+ * GetReq is a macro defined in Xlibint.h.
+ */
+ GetReq(TestReset, req);
+ /*
+ * fix up the request type code to what is needed
+ */
+ req->reqType = XTestReqCode;
+ /*
+ * set the minor request type code to X_TestReset
+ */
+ req->XTestReqType = X_TestReset;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return(0);
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestQueryInputSize
+ *
+ * Returns the number of input actions in the server's input action buffer.
+ */
+int
+XTestQueryInputSize(
+/*
+ * the connection to the X server
+ */
+register Display *dpy,
+/*
+ * the address of the place to put the number of input actions in the
+ * server's input action buffer
+ */
+unsigned long *size_return)
+{
+ /*
+ * pointer to xTestQueryInputSize structure
+ */
+ xTestQueryInputSizeReq *req;
+ /*
+ * pointer to xTestQueryInputSize structure
+ */
+ xTestQueryInputSizeReply rep;
+
+ LockDisplay(dpy);
+ if (XTestCheckExtInit(dpy) == -1)
+ {
+ /*
+ * if the extension is not installed in the server
+ * then unlock the display and return -1.
+ */
+ UnlockDisplay(dpy);
+ return(-1);
+ }
+ else
+ {
+ /*
+ * Get the next available X request packet in the buffer.
+ * It sets the `length' field to the size (in 32-bit words)
+ * of the request. It also sets the `reqType' field in the
+ * request to X_TestQueryInputSize, which is not what is needed.
+ *
+ * GetReq is a macro defined in Xlibint.h.
+ */
+ GetReq(TestQueryInputSize, req);
+ /*
+ * fix up the request type code to what is needed
+ */
+ req->reqType = XTestReqCode;
+ /*
+ * set the minor request type code to X_TestQueryInputSize
+ */
+ req->XTestReqType = X_TestQueryInputSize;
+ /*
+ * get a reply from the server
+ */
+ (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
+ /*
+ * put the size in the caller's variable
+ */
+ *size_return = (unsigned long) rep.size_return;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return(0);
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestCheckExtInit
+ *
+ * Check to see if the XTest extension is installed in the server.
+ */
+static int
+XTestCheckExtInit(
+/*
+ * the connection to the X server
+ */
+register Display *dpy)
+{
+ /*
+ * if the extension has not been initialized, then do so
+ */
+ if (!XTestReqCode)
+ {
+ return(XTestInitExtension(dpy));
+ }
+ return(0);
+}
+
+/******************************************************************************
+ *
+ * XTestInitExtension
+ *
+ * Attempt to initialize this extension in the server. Return 0 if it
+ * succeeds, -1 if it does not succeed.
+ */
+static int
+XTestInitExtension(
+/*
+ * the connection to the X server
+ */
+register Display *dpy)
+{
+ /*
+ * loop index
+ */
+ int i;
+ /*
+ * return value from XInitExtension
+ */
+ XExtCodes *ret;
+
+ /*
+ * attempt to initialize the extension
+ */
+ ret = XInitExtension(dpy, XTestEXTENSION_NAME);
+ /*
+ * if the initialize failed, return -1
+ */
+ if (ret == NULL)
+ {
+ return (-1);
+ }
+ /*
+ * the initialize succeeded, remember the major opcode
+ * for this extension
+ */
+ XTestReqCode = ret->major_opcode;
+ /*
+ * set up the event handler for any events from
+ * this extension
+ */
+ for (i = 0; i < XTestEVENT_COUNT; i++)
+ {
+ XESetWireToEvent(dpy,
+ ret->first_event+i,
+ XTestWireToEvent);
+ }
+ /*
+ * compute the event type codes for the events
+ * in this extension
+ */
+ XTestInputActionType += ret->first_event;
+ XTestFakeAckType += ret->first_event;
+ /*
+ * everything worked ok
+ */
+ return(0);
+}
+
+/******************************************************************************
+ *
+ * XTestWireToEvent
+ *
+ * Handle XTest extension events.
+ * Reformat a wire event into an XEvent structure of the right type.
+ */
+static Bool
+XTestWireToEvent(
+/*
+ * the connection to the X server
+ */
+Display *dpy,
+/*
+ * a pointer to where a host formatted event should be stored
+ * with the information copied to it
+ */
+XEvent *reTemp,
+/*
+ * a pointer to the wire event
+ */
+xEvent *eventTemp)
+{
+ XTestInputActionEvent *re = (XTestInputActionEvent *) reTemp;
+ xTestInputActionEvent *event = (xTestInputActionEvent *) eventTemp;
+
+ /*
+ * loop index
+ */
+ int i;
+ /*
+ * pointer to where the input actions go in the host format event
+ */
+ CARD8 *to;
+ /*
+ * pointer to the input actions in the wire event
+ */
+ CARD8 *from;
+
+ /*
+ * Copy the type of the wire event to the new event.
+ * This will work for either event type because the type,
+ * display, and window fields in the events have to be the same.
+ */
+ re->type = event->type;
+ /*
+ * set the display parameter in case it is needed (by who?)
+ */
+ re->display = dpy;
+ if (re->type == XTestInputActionType)
+ {
+ /*
+ * point at the first byte of input actions in the wire event
+ */
+ from = &(event->actions[0]);
+ /*
+ * point at where the input action bytes go in the new event
+ */
+ to = &(re->actions[0]);
+ /*
+ * copy the input action bytes from the wire event to
+ * the new event
+ */
+ for (i = 0; i < XTestACTIONS_SIZE; i++)
+ {
+ *(to++) = *(from++);
+ }
+ }
+ else if (re->type == XTestFakeAckType)
+ {
+ /*
+ * nothing else needs to be done
+ */
+ }
+ else
+ {
+ printf("XTestWireToEvent: UNKNOWN WIRE EVENT! type=%d\n",
+ (int) event->type);
+ printf("%s is giving up.\n", XTestEXTENSION_NAME);
+ exit (1);
+ }
+ return 1;
+}
+
+/******************************************************************************
+ *
+ * XTestPressKey
+ *
+ * Send input actions to the server to cause the server to think
+ * that the specified key on the keyboard was moved as specified.
+ */
+int
+XTestPressKey(
+Display *display,
+int device_id,
+unsigned long delay,
+unsigned int keycode,
+unsigned int key_action)
+{
+ /*
+ * bounds check the key code
+ */
+ if (keycode < 8 || keycode > 255)
+ {
+ return(-1);
+ }
+ /*
+ * use the commmon key/button handling routine
+ */
+ return(XTestKeyOrButton(display,
+ device_id,
+ delay,
+ keycode,
+ key_action));
+}
+
+/******************************************************************************
+ *
+ * XTestPressButton
+ *
+ * Send input actions to the server to cause the server to think
+ * that the specified button on the mouse was moved as specified.
+ */
+int
+XTestPressButton(
+Display *display,
+int device_id,
+unsigned long delay,
+unsigned int button_number,
+unsigned int button_action)
+{
+ /*
+ * bounds check the button number
+ */
+ if (button_number > 7)
+ {
+ return(-1);
+ }
+ /*
+ * use the commmon key/button handling routine
+ */
+ return(XTestKeyOrButton(display,
+ device_id,
+ delay,
+ button_number,
+ button_action));
+}
+
+/******************************************************************************
+ *
+ * XTestKeyOrButton
+ *
+ * Send input actions to the server to cause the server to think
+ * that the specified key/button was moved as specified.
+ */
+static int
+XTestKeyOrButton(
+Display *display,
+int device_id,
+unsigned long delay,
+unsigned int code,
+unsigned int action)
+{
+ /*
+ * holds a key input action to be filled out and sent to the server
+ */
+ XTestKeyInfo keyinfo;
+
+ /*
+ * bounds check the device id
+ */
+ if (device_id < 0 || device_id > XTestMAX_DEVICE_ID)
+ {
+ return(-1);
+ }
+ /*
+ * fill out the key input action(s) as appropriate
+ */
+ switch(action)
+ {
+ case XTestPRESS:
+ /*
+ * Check the delay. If it is larger than will fit in the
+ * key input action, send a delay input action.
+ */
+ if(XTestCheckDelay(display, &delay) == -1)
+ {
+ /*
+ * an error occurred, return -1
+ */
+ return(-1);
+ }
+ /*
+ * create the header
+ */
+ keyinfo.header = XTestPackDeviceID(device_id) |
+ XTestKEY_ACTION |
+ XTestKEY_DOWN;
+ /*
+ * set the key/button code
+ */
+ keyinfo.keycode = code;
+ /*
+ * set the delay time
+ */
+ keyinfo.delay_time = delay;
+ /*
+ * pack the input action into a request to be sent to the
+ * server when the request is full or XTestFlush is called
+ */
+ return(XTestPackInputAction(display,
+ (CARD8 *) &keyinfo,
+ sizeof(XTestKeyInfo)));
+ case XTestRELEASE:
+ /*
+ * Check the delay. If it is larger than will fit in the
+ * key input action, send a delay input action.
+ */
+ if(XTestCheckDelay(display, &delay) == -1)
+ {
+ /*
+ * an error occurred, return -1
+ */
+ return(-1);
+ }
+ /*
+ * create the header
+ */
+ keyinfo.header = XTestPackDeviceID(device_id) |
+ XTestKEY_ACTION |
+ XTestKEY_UP;
+ /*
+ * set the key/button code
+ */
+ keyinfo.keycode = code;
+ /*
+ * set the delay time
+ */
+ keyinfo.delay_time = delay;
+ /*
+ * pack the input action into a request to be sent to the
+ * server when the request is full or XTestFlush is called
+ */
+ return(XTestPackInputAction(display,
+ (CARD8 *) &keyinfo,
+ sizeof(XTestKeyInfo)));
+ case XTestSTROKE:
+ /*
+ * Check the delay. If it is larger than will fit in the
+ * key input action, send a delay input action.
+ */
+ if(XTestCheckDelay(display, &delay) == -1)
+ {
+ /*
+ * an error occurred, return -1
+ */
+ return(-1);
+ }
+ /*
+ * create a key/button-down input action header
+ */
+ keyinfo.header = XTestPackDeviceID(device_id) |
+ XTestKEY_ACTION |
+ XTestKEY_DOWN;
+ /*
+ * set the key/button code
+ */
+ keyinfo.keycode = code;
+ /*
+ * set the delay time
+ */
+ keyinfo.delay_time = delay;
+ /*
+ * pack the input action into a request to be sent to the
+ * server when the request is full or XTestFlush is called
+ */
+ if (XTestPackInputAction(display,
+ (CARD8 *) &keyinfo,
+ sizeof(XTestKeyInfo)) == -1)
+ {
+ /*
+ * an error occurred, return -1
+ */
+ return(-1);
+ }
+ /*
+ * set the delay to XTestSTROKE_DELAY_TIME
+ */
+ delay = XTestSTROKE_DELAY_TIME;
+ /*
+ * Check the delay. If it is larger than will fit in the
+ * key input action, send a delay input action.
+ */
+ if(XTestCheckDelay(display, &delay) == -1)
+ {
+ /*
+ * an error occurred, return -1
+ */
+ return(-1);
+ }
+ /*
+ * create a key/button-up input action header
+ */
+ keyinfo.header = XTestPackDeviceID(device_id) |
+ XTestKEY_ACTION |
+ XTestKEY_UP;
+ /*
+ * set the key/button code
+ */
+ keyinfo.keycode = code;
+ /*
+ * set the delay time
+ */
+ keyinfo.delay_time = delay;
+ /*
+ * pack the input action into a request to be sent to the
+ * server when the request is full or XTestFlush is called
+ */
+ return(XTestPackInputAction(display,
+ (CARD8 *) &keyinfo,
+ sizeof(XTestKeyInfo)));
+ default:
+ /*
+ * invalid action value, return -1
+ */
+ return(-1);
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestMovePointer
+ *
+ * Send input actions to the server to cause the server to think
+ * that the mouse was moved as specified.
+ */
+int
+XTestMovePointer(
+Display *display,
+int device_id,
+unsigned long delay[],
+int x[],
+int y[],
+unsigned int count)
+{
+ /*
+ * holds a motion input action to be filled out and sent to the server
+ */
+ XTestMotionInfo motioninfo;
+ /*
+ * holds a jump input action to be filled out and sent to the server
+ */
+ XTestJumpInfo jumpinfo;
+ /*
+ * loop index
+ */
+ unsigned int i;
+ /*
+ * holds the change in x and y directions from the current x and y
+ * coordinates
+ */
+ int dx;
+ int dy;
+
+ /*
+ * bounds check the device id
+ */
+ if (device_id < 0 || device_id > XTestMAX_DEVICE_ID)
+ {
+ return(-1);
+ }
+ /*
+ * if the count is 0, there is nothing to do. return 0
+ */
+ if (count == 0)
+ {
+ return(0);
+ }
+ /*
+ * loop through the pointer motions, creating the appropriate
+ * input actions for each motion
+ */
+ for (i = 0; i < count; i++)
+ {
+ /*
+ * Check the delay. If it is larger than will fit in the
+ * input action, send a delay input action.
+ */
+ if(XTestCheckDelay(display, &(delay[i])) == -1)
+ {
+ /*
+ * an error occurred, return -1
+ */
+ return(-1);
+ }
+ /*
+ * compute the change from the current x and y coordinates
+ * to the new x and y coordinates
+ */
+ dx = x[i] - current_x;
+ dy = y[i] - current_y;
+ /*
+ * update the current x and y coordinates
+ */
+ current_x = x[i];
+ current_y = y[i];
+ /*
+ * If the pointer motion range is too large to fit into
+ * a motion input action, then use a jump input action.
+ * Otherwise, use a motion input action.
+ */
+ if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) ||
+ (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN))
+ {
+ /*
+ * create a jump input action header
+ */
+ jumpinfo.header = XTestPackDeviceID(device_id) |
+ XTestJUMP_ACTION;
+ /*
+ * set the x and y coordinates to jump to
+ */
+ jumpinfo.jumpx = x[i];
+ jumpinfo.jumpy = y[i];
+ /*
+ * set the delay time
+ */
+ jumpinfo.delay_time = delay[i];
+ /*
+ * pack the jump input action into a request to be
+ * sent to the server when the request is full
+ * or XTestFlush is called
+ */
+ if (XTestPackInputAction(display,
+ (CARD8 *) &jumpinfo,
+ sizeof(XTestJumpInfo)) == -1)
+ {
+ /*
+ * an error occurred, return -1
+ */
+ return(-1);
+ }
+ }
+ else
+ {
+ /*
+ * create a motion input action header
+ */
+ motioninfo.header = XTestPackDeviceID(device_id) |
+ XTestMOTION_ACTION;
+ /*
+ * compute the motion data byte
+ */
+ if (dx < 0)
+ {
+ motioninfo.header |= XTestX_NEGATIVE;
+ dx = abs(dx);
+ }
+ if (dy < 0)
+ {
+ motioninfo.header |= XTestY_NEGATIVE;
+ dy = abs(dy);
+ }
+ motioninfo.motion_data = XTestPackXMotionValue(dx);
+ motioninfo.motion_data |= XTestPackYMotionValue(dy);
+ /*
+ * set the delay time
+ */
+ motioninfo.delay_time = delay[i];
+ /*
+ * pack the motion input action into a request to be
+ * sent to the server when the request is full
+ * or XTestFlush is called
+ */
+ if (XTestPackInputAction(display,
+ (CARD8 *) &motioninfo,
+ sizeof(XTestMotionInfo)) == -1)
+ {
+ /*
+ * an error occurred, return -1
+ */
+ return(-1);
+ }
+ }
+ }
+ /*
+ * if you get here, everything went ok
+ */
+ return(0);
+}
+
+/******************************************************************************
+ *
+ * XTestCheckDelay
+ *
+ * Check the delay value at the passed-in address. If it is larger than
+ * will fit in a normal input action, then send a delay input action.
+ */
+static int
+XTestCheckDelay(
+Display *display,
+unsigned long *delay_addr)
+{
+ /*
+ * holds a delay input action to be filled out and sent to the server
+ */
+ XTestDelayInfo delayinfo;
+
+ /*
+ * if the delay value will fit in the input action,
+ * then there is no need for a delay input action
+ */
+ if (*delay_addr <= XTestSHORT_DELAY_TIME)
+ {
+ return(0);
+ }
+ /*
+ * fill out a delay input action
+ */
+ delayinfo.header = XTestPackDeviceID(XTestDELAY_DEVICE_ID);
+ delayinfo.delay_time = *delay_addr;
+ /*
+ * all of the delay time will be accounted for in the
+ * delay input action, so set the original delay value to 0
+ */
+ *delay_addr = 0;
+ /*
+ * pack the delay input action into a request to be sent to the
+ * server when the request is full or XTestFlush is called
+ */
+ return(XTestPackInputAction(display,
+ (CARD8 *) &delayinfo,
+ sizeof(XTestDelayInfo)));
+}
+
+/******************************************************************************
+ *
+ * XTestPackInputAction
+ *
+ * If the input action buffer is full or the number of input actions
+ * has reached the maximum that the server can handle at one time,
+ * then send the input actions to the server using XTestFakeInput.
+ */
+static int
+XTestPackInputAction(
+Display *display,
+CARD8 *action_addr,
+int action_size)
+{
+ /*
+ * loop index
+ */
+ int i;
+ /*
+ * acknowledge flag
+ */
+ int ack_flag;
+
+ /*
+ * if we don't already know it, find out how many input actions
+ * the server can handle at one time
+ */
+ if (action_array_size == 0)
+ {
+ if(XTestQueryInputSize(display, &action_array_size) == -1)
+ {
+ /*
+ * if an error, return -1
+ */
+ return(-1);
+ }
+ }
+ /*
+ * if the specified input action will fit in the the input
+ * action buffer and won't exceed the server's capacity, then
+ * put the input action into the input buffer
+ */
+ if(((action_index + action_size) <= XTestMAX_ACTION_LIST_SIZE) &&
+ ((action_count + 1) < action_array_size))
+ {
+ /*
+ * copy the input action into the buffer
+ */
+ for (i = 0; i < action_size; i++)
+ {
+ action_buf[action_index++] = *(action_addr++);
+ }
+ /*
+ * increment the action count
+ */
+ action_count++;
+ /*
+ * everything went ok, return 0
+ */
+ return(0);
+ }
+ /*
+ * We have to write input actions to the server. If the server's
+ * input action capacity will be reached, then ask for an
+ * acknowledge event when the server has processed all of the
+ * input actions. Otherwise, an acknowledge event is not needed.
+ */
+ if (action_count >= action_array_size)
+ {
+ ack_flag = XTestFAKE_ACK_REQUEST;
+ }
+ else
+ {
+ ack_flag = XTestFAKE_ACK_NOT_NEEDED;
+ }
+ /*
+ * write the input actions to the server
+ */
+ if (XTestWriteInputActions(display,
+ (char *) &(action_buf[0]),
+ action_index,
+ ack_flag) == -1)
+ {
+ /*
+ * error, return -1
+ */
+ return(-1);
+ }
+ /*
+ * copy the input action into the buffer
+ */
+ for (i = 0; i < action_size; i++)
+ {
+ action_buf[action_index++] = *(action_addr++);
+ }
+ /*
+ * increment the action count
+ */
+ action_count++;
+ return(0);
+}
+
+/******************************************************************************
+ *
+ * XTestWriteInputActions
+ *
+ * Send input actions to the server.
+ */
+static int
+XTestWriteInputActions(
+Display *display,
+char *action_list_addr,
+int action_list_size,
+int ack_flag)
+{
+ /*
+ * Holds an event. Used while waiting for an acknowledge event
+ */
+ XEvent event;
+ /*
+ * points to XTestIdentifyMyEvent
+ */
+ Bool (*func_ptr)(Display *, XEvent *, XPointer);
+
+ /*
+ * write the input actions to the server
+ */
+ if (XTestFakeInput(display,
+ action_list_addr,
+ action_list_size,
+ ack_flag) == -1)
+ {
+ /*
+ * if an error, return -1
+ */
+ return(-1);
+ }
+ /*
+ * flush X's buffers to make sure that the server really gets
+ * the input actions
+ */
+ XFlush(display);
+ /*
+ * mark the input action buffer as empty
+ */
+ action_index = 0;
+ /*
+ * if we asked for an acknowledge event, then wait for it
+ */
+ if (ack_flag == XTestFAKE_ACK_REQUEST)
+ {
+ /*
+ * point func_ptr at XTestIdentifyMyEvent
+ */
+ func_ptr = XTestIdentifyMyEvent;
+ /*
+ * Wait until the acknowledge event comes. When the
+ * acknowledge event comes, it is removed from the event
+ * queue without disturbing any other events that might
+ * be in the queue.
+ */
+ XIfEvent(display, &event, func_ptr, NULL);
+ /*
+ * set the input action count back to 0
+ */
+ action_count = 0;
+ }
+ /*
+ * if we got here, then everything is ok, return 0
+ */
+ return(0);
+}
+
+/******************************************************************************
+ *
+ * XTestIdentifyMyEvent
+ *
+ * This function is called by XIfEvent to look at an event and see if
+ * it is of XTestFakeAckType.
+ */
+static Bool
+XTestIdentifyMyEvent(
+Display *display,
+/*
+ * Holds the event that this routine is supposed to look at.
+ */
+XEvent *event_ptr,
+/*
+ * this points to any user-specified arguments (ignored)
+ */
+char *args)
+{
+ /*
+ * if the event if of the correct type, return the Bool True,
+ * otherwise return the Bool False.
+ */
+ if (event_ptr->type == XTestFakeAckType)
+ {
+ return(True);
+ }
+ else
+ {
+ return(False);
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestFlush
+ *
+ * Send any input actions in the input action buffer to the server.
+ */
+int
+XTestFlush(Display *display)
+{
+ /*
+ * acknowledge flag
+ */
+ int ack_flag;
+
+ /*
+ * if there are no input actions in the input action buffer,
+ * then return 0
+ */
+ if (action_index == 0)
+ {
+ return(0);
+ }
+ /*
+ * We have input actions to write to the server. We will
+ * wait until the server has finished processing the input actions.
+ */
+ ack_flag = XTestFAKE_ACK_REQUEST;
+ /*
+ * write the input actions to the server
+ */
+ return(XTestWriteInputActions(display,
+ (char *) &(action_buf[0]),
+ action_index,
+ ack_flag));
+}
diff --git a/libXext/src/Xcup.c b/libXext/src/Xcup.c
index d050ba0b6..ad78699be 100644
--- a/libXext/src/Xcup.c
+++ b/libXext/src/Xcup.c
@@ -1,262 +1,262 @@
-/*
-
-Copyright 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.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef WIN32
-#include <X11/Xwindows.h>
-#endif
-
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xcup.h>
-#include <X11/extensions/cupproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-static XExtensionInfo _xcup_info_data;
-static XExtensionInfo *xcup_info = &_xcup_info_data;
-static char *xcup_extension_name = XCUPNAME;
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *codes);
-static /* const */ XExtensionHooks xcup_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xcup_info,
- xcup_extension_name,
- &xcup_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xcup_info)
-
-
-/*****************************************************************************
- * *
- * public Xcup Extension routines *
- * *
- *****************************************************************************/
-
-Status
-XcupQueryVersion(
- Display* dpy,
- int* major_version_return,
- int* minor_version_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXcupQueryVersionReply rep;
- xXcupQueryVersionReq *req;
-
- XextCheckExtension (dpy, info, xcup_extension_name, False);
-
- LockDisplay(dpy);
- GetReq(XcupQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xcupReqType = X_XcupQueryVersion;
- req->client_major_version = XCUP_MAJOR_VERSION;
- req->client_minor_version = XCUP_MINOR_VERSION;
- if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *major_version_return = rep.server_major_version;
- *minor_version_return = rep.server_minor_version;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-/* Win32 reserves 20 colormap entries for its desktop */
-#ifndef TYP_RESERVED_ENTRIES
-#define TYP_RESERVED_ENTRIES 20
-#endif
-
-Status
-XcupGetReservedColormapEntries(
- Display* dpy,
- int screen,
- XColor** colors_out,
- int* ncolors)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXcupGetReservedColormapEntriesReply rep;
- xXcupGetReservedColormapEntriesReq *req;
- xColorItem rbuf[TYP_RESERVED_ENTRIES];
-
- *ncolors = 0;
-
- XextCheckExtension (dpy, info, xcup_extension_name, False);
-
- LockDisplay(dpy);
- GetReq(XcupGetReservedColormapEntries, req);
- req->reqType = info->codes->major_opcode;
- req->xcupReqType = X_XcupGetReservedColormapEntries;
- req->screen = screen;
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- long nbytes;
- xColorItem* rbufp;
- int nentries = rep.length / 3;
-
- nbytes = nentries * SIZEOF (xColorItem);
- if (nentries > TYP_RESERVED_ENTRIES)
- rbufp = (xColorItem*) Xmalloc (nbytes);
- else
- rbufp = rbuf;
-
- if (rbufp == NULL) {
- _XEatData (dpy, (unsigned long) nbytes);
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- _XRead (dpy, (char*) rbufp, nbytes);
-
- *colors_out = (XColor*) Xmalloc (nentries * sizeof (XColor));
- if (*colors_out) {
- xColorItem* cs = (xColorItem *) rbufp;
- XColor* cd = *colors_out;
- int i;
-
- *ncolors = nentries;
- for (i = 0; i < *ncolors; i++, cd++) {
- cd->pixel = cs->pixel;
- cd->red = cs->red;
- cd->green = cs->green;
- cd->blue = cs->blue;
- cs = (xColorItem*) (((char*) cs) + SIZEOF(xColorItem));
- }
- if (rbufp != rbuf) XFree ((char*) rbufp);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
- }
- if (rbufp != rbuf) XFree ((char*) rbufp);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
-}
-
-Status
-XcupStoreColors(
- Display* dpy,
- Colormap colormap,
- XColor* colors_in_out,
- int ncolors)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXcupStoreColorsReply rep;
- xXcupStoreColorsReq *req;
- xColorItem rbuf[256];
- xColorItem citem;
- int i;
- XColor* xcp;
-
- XextCheckExtension (dpy, info, xcup_extension_name, False);
-
- LockDisplay(dpy);
- GetReq(XcupStoreColors, req);
- req->reqType = info->codes->major_opcode;
- req->xcupReqType = X_XcupStoreColors;
- req->cmap = colormap;
- req->length += (ncolors * SIZEOF(xColorItem)) >> 2;
-
- for (i = 0, xcp = colors_in_out; i < ncolors; i++, xcp++) {
- citem.pixel = xcp->pixel;
- citem.red = xcp->red;
- citem.green = xcp->green;
- citem.blue = xcp->blue;
-
- /* note that xColorItem doesn't contain all 16-bit quantities, so
- we can't use Data16 */
- Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem));
- }
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- long nbytes;
- xColorItem* rbufp;
- xColorItem* cs;
- int nentries = rep.length / 3;
-
- nbytes = nentries * SIZEOF (xColorItem);
-
- if (nentries != ncolors) {
- _XEatData (dpy, (unsigned long) nbytes);
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
-
- if (ncolors > 256)
- rbufp = (xColorItem*) Xmalloc (nbytes);
- else
- rbufp = rbuf;
-
- if (rbufp == NULL) {
- _XEatData (dpy, (unsigned long) nbytes);
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
-
- }
-
- _XRead (dpy, (char*) rbufp, nbytes);
-
- for (i = 0, xcp = colors_in_out, cs = rbufp; i < ncolors; i++, xcp++, cs++) {
- xcp->pixel = cs->pixel;
- xcp->red = cs->red;
- xcp->green = cs->green;
- xcp->blue = cs->blue;
- xcp->flags = cs->flags;
- }
- if (rbufp != rbuf) XFree ((char*)rbufp);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
-}
-
+/*
+
+Copyright 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.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xcup.h>
+#include <X11/extensions/cupproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+static XExtensionInfo _xcup_info_data;
+static XExtensionInfo *xcup_info = &_xcup_info_data;
+static char *xcup_extension_name = XCUPNAME;
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks xcup_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, xcup_info,
+ xcup_extension_name,
+ &xcup_extension_hooks,
+ 0, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xcup_info)
+
+
+/*****************************************************************************
+ * *
+ * public Xcup Extension routines *
+ * *
+ *****************************************************************************/
+
+Status
+XcupQueryVersion(
+ Display* dpy,
+ int* major_version_return,
+ int* minor_version_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXcupQueryVersionReply rep;
+ xXcupQueryVersionReq *req;
+
+ XextCheckExtension (dpy, info, xcup_extension_name, False);
+
+ LockDisplay(dpy);
+ GetReq(XcupQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->xcupReqType = X_XcupQueryVersion;
+ req->client_major_version = XCUP_MAJOR_VERSION;
+ req->client_minor_version = XCUP_MINOR_VERSION;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *major_version_return = rep.server_major_version;
+ *minor_version_return = rep.server_minor_version;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+/* Win32 reserves 20 colormap entries for its desktop */
+#ifndef TYP_RESERVED_ENTRIES
+#define TYP_RESERVED_ENTRIES 20
+#endif
+
+Status
+XcupGetReservedColormapEntries(
+ Display* dpy,
+ int screen,
+ XColor** colors_out,
+ int* ncolors)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXcupGetReservedColormapEntriesReply rep;
+ xXcupGetReservedColormapEntriesReq *req;
+ xColorItem rbuf[TYP_RESERVED_ENTRIES];
+
+ *ncolors = 0;
+
+ XextCheckExtension (dpy, info, xcup_extension_name, False);
+
+ LockDisplay(dpy);
+ GetReq(XcupGetReservedColormapEntries, req);
+ req->reqType = info->codes->major_opcode;
+ req->xcupReqType = X_XcupGetReservedColormapEntries;
+ req->screen = screen;
+ if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ long nbytes;
+ xColorItem* rbufp;
+ int nentries = rep.length / 3;
+
+ nbytes = nentries * SIZEOF (xColorItem);
+ if (nentries > TYP_RESERVED_ENTRIES)
+ rbufp = (xColorItem*) Xmalloc (nbytes);
+ else
+ rbufp = rbuf;
+
+ if (rbufp == NULL) {
+ _XEatData (dpy, (unsigned long) nbytes);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return False;
+ }
+ _XRead (dpy, (char*) rbufp, nbytes);
+
+ *colors_out = (XColor*) Xmalloc (nentries * sizeof (XColor));
+ if (*colors_out) {
+ xColorItem* cs = (xColorItem *) rbufp;
+ XColor* cd = *colors_out;
+ int i;
+
+ *ncolors = nentries;
+ for (i = 0; i < *ncolors; i++, cd++) {
+ cd->pixel = cs->pixel;
+ cd->red = cs->red;
+ cd->green = cs->green;
+ cd->blue = cs->blue;
+ cs = (xColorItem*) (((char*) cs) + SIZEOF(xColorItem));
+ }
+ if (rbufp != rbuf) XFree ((char*) rbufp);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+ }
+ if (rbufp != rbuf) XFree ((char*) rbufp);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+}
+
+Status
+XcupStoreColors(
+ Display* dpy,
+ Colormap colormap,
+ XColor* colors_in_out,
+ int ncolors)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXcupStoreColorsReply rep;
+ xXcupStoreColorsReq *req;
+ xColorItem rbuf[256];
+ xColorItem citem;
+ int i;
+ XColor* xcp;
+
+ XextCheckExtension (dpy, info, xcup_extension_name, False);
+
+ LockDisplay(dpy);
+ GetReq(XcupStoreColors, req);
+ req->reqType = info->codes->major_opcode;
+ req->xcupReqType = X_XcupStoreColors;
+ req->cmap = colormap;
+ req->length += (ncolors * SIZEOF(xColorItem)) >> 2;
+
+ for (i = 0, xcp = colors_in_out; i < ncolors; i++, xcp++) {
+ citem.pixel = xcp->pixel;
+ citem.red = xcp->red;
+ citem.green = xcp->green;
+ citem.blue = xcp->blue;
+
+ /* note that xColorItem doesn't contain all 16-bit quantities, so
+ we can't use Data16 */
+ Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem));
+ }
+
+ if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ long nbytes;
+ xColorItem* rbufp;
+ xColorItem* cs;
+ int nentries = rep.length / 3;
+
+ nbytes = nentries * SIZEOF (xColorItem);
+
+ if (nentries != ncolors) {
+ _XEatData (dpy, (unsigned long) nbytes);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return False;
+ }
+
+ if (ncolors > 256)
+ rbufp = (xColorItem*) Xmalloc (nbytes);
+ else
+ rbufp = rbuf;
+
+ if (rbufp == NULL) {
+ _XEatData (dpy, (unsigned long) nbytes);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return False;
+
+ }
+
+ _XRead (dpy, (char*) rbufp, nbytes);
+
+ for (i = 0, xcp = colors_in_out, cs = rbufp; i < ncolors; i++, xcp++, cs++) {
+ xcp->pixel = cs->pixel;
+ xcp->red = cs->red;
+ xcp->green = cs->green;
+ xcp->blue = cs->blue;
+ xcp->flags = cs->flags;
+ }
+ if (rbufp != rbuf) XFree ((char*)rbufp);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+}
+
diff --git a/libXext/src/Xdbe.c b/libXext/src/Xdbe.c
index 930b51f60..1b9e2da52 100644
--- a/libXext/src/Xdbe.c
+++ b/libXext/src/Xdbe.c
@@ -1,468 +1,468 @@
-/******************************************************************************
- *
- * Copyright (c) 1994, 1995 Hewlett-Packard Company
- *
- * 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 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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
- * Company 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 Hewlett-Packard Company.
- *
- * Xlib DBE code
- *
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/Xdbe.h>
-#include <X11/extensions/dbeproto.h>
-
-static XExtensionInfo _dbe_info_data;
-static XExtensionInfo *dbe_info = &_dbe_info_data;
-static char *dbe_extension_name = DBE_PROTOCOL_NAME;
-
-#define DbeCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, dbe_extension_name, val)
-#define DbeSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, dbe_extension_name)
-
-#if !defined(UNIXCPP)
-#define DbeGetReq(name,req,info) GetReq (name, req); \
- req->reqType = info->codes->major_opcode; \
- req->dbeReqType = X_##name;
-#else
-#define DbeGetReq(name,req,info) GetReq (name, req); \
- req->reqType = info->codes->major_opcode; \
- req->dbeReqType = X_/**/name;
-#endif
-
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-/*
- * find_display - locate the display info block
- */
-static int close_display(Display *dpy, XExtCodes *codes);
-static char *error_string(Display *dpy, int code, XExtCodes *codes,
- char *buf, int n);
-static XExtensionHooks dbe_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- error_string, /* error_string */
-};
-
-static char *dbe_error_list[] = {
- "BadBuffer", /* DbeBadBuffer */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, dbe_info,
- dbe_extension_name,
- &dbe_extension_hooks,
- DbeNumberEvents, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dbe_info)
-
-static XEXT_GENERATE_ERROR_STRING (error_string, dbe_extension_name,
- DbeNumberErrors,
- dbe_error_list)
-
-
-/*****************************************************************************
- * *
- * Double-Buffering public interfaces *
- * *
- *****************************************************************************/
-
-/*
- * XdbeQueryExtension -
- * Sets major_version_return and minor_verion_return to the major and
- * minor DBE protocol version supported by the server. If the DBE
- * library is compatible with the version returned by the server, this
- * function returns non-zero. If dpy does not support the DBE
- * extension, or if there was an error during communication with the
- * server, or if the server and library protocol versions are
- * incompatible, this functions returns zero. No other Xdbe functions
- * may be called before this function. If a client violates this rule,
- * the effects of all subsequent Xdbe calls are undefined.
- */
-Status XdbeQueryExtension (
- Display *dpy,
- int *major_version_return,
- int *minor_version_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xDbeGetVersionReply rep;
- register xDbeGetVersionReq *req;
-
- if (!XextHasExtension (info))
- return (Status)0; /* failure */
-
- LockDisplay (dpy);
- DbeGetReq (DbeGetVersion, req, info);
- req->majorVersion = DBE_MAJOR_VERSION;
- req->minorVersion = DBE_MINOR_VERSION;
-
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return (Status)0; /* failure */
- }
- *major_version_return = rep.majorVersion;
- *minor_version_return = rep.minorVersion;
- UnlockDisplay (dpy);
-
- SyncHandle ();
-
- if (*major_version_return != DBE_MAJOR_VERSION)
- return (Status)0; /* failure */
- else
- return (Status)1; /* success */
-}
-
-
-/*
- * XdbeAllocateBackBuffer -
- * This function returns a drawable ID used to refer to the back buffer
- * of the specified window. The swap_action is a hint to indicate the
- * swap action that will likely be used in subsequent calls to
- * XdbeSwapBuffers. The actual swap action used in calls to
- * XdbeSwapBuffers does not have to be the same as the swap_action
- * passed to this function, though clients are encouraged to provide
- * accurate information whenever possible.
- */
-
-XdbeBackBuffer XdbeAllocateBackBufferName(
- Display *dpy,
- Window window,
- XdbeSwapAction swap_action)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDbeAllocateBackBufferNameReq *req;
- XdbeBackBuffer buffer;
-
- /* make sure extension is available; if not, return the
- * third parameter (0).
- */
- DbeCheckExtension (dpy, info, (XdbeBackBuffer)0);
-
- LockDisplay(dpy);
- DbeGetReq(DbeAllocateBackBufferName, req, info);
- req->window = window;
- req->swapAction = (unsigned char)swap_action;
- req->buffer = buffer = XAllocID (dpy);
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return buffer;
-
-} /* XdbeAllocateBackBufferName() */
-
-/*
- * XdbeDeallocateBackBufferName -
- * This function frees a drawable ID, buffer, that was obtained via
- * XdbeAllocateBackBufferName. The buffer must refer to the back buffer
- * of the specified window, or a protocol error results.
- */
-Status XdbeDeallocateBackBufferName (
- Display *dpy,
- XdbeBackBuffer buffer)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDbeDeallocateBackBufferNameReq *req;
-
- DbeCheckExtension (dpy, info, (Status)0 /* failure */);
-
- LockDisplay (dpy);
- DbeGetReq (DbeDeallocateBackBufferName, req, info);
- req->buffer = buffer;
- UnlockDisplay (dpy);
- SyncHandle ();
-
- return (Status)1; /* success */
-}
-
-
-/*
- * XdbeSwapBuffers -
- * This function swaps the front and back buffers for a list of windows.
- * The argument num_windows specifies how many windows are to have their
- * buffers swapped; it is the number of elements in the swap_info array.
- * The argument swap_info specifies the information needed per window
- * to do the swap.
- */
-Status XdbeSwapBuffers (
- Display *dpy,
- XdbeSwapInfo *swap_info,
- int num_windows)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xDbeSwapBuffersReq *req;
- int i;
-
- DbeCheckExtension (dpy, info, (Status)0 /* failure */);
-
- LockDisplay (dpy);
- DbeGetReq (DbeSwapBuffers, req, info);
- req->length += 2*num_windows;
- req->n = num_windows;
-
- /* We need to handle 64-bit machines, where we can not use PackData32
- * directly because info would be lost in translating from 32- to 64-bit.
- * Instead we send data via a loop that accounts for the translation.
- */
- for (i = 0; i < num_windows; i++)
- {
- char tmp[4];
- Data32 (dpy, (long *)&swap_info[i].swap_window, 4);
- tmp[0] = swap_info[i].swap_action;
- Data (dpy, (char *)tmp, 4);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
-
-
- return (Status)1; /* success */
-
-} /* XdbeSwapBuffers() */
-
-
-/*
- * XdbeBeginIdiom -
- * This function marks the beginning of an idiom sequence.
- */
-Status XdbeBeginIdiom (Display *dpy)
-{
- XExtDisplayInfo *info = find_display(dpy);
- register xDbeBeginIdiomReq *req;
-
- DbeCheckExtension (dpy, info, (Status)0 /* failure */);
-
- LockDisplay (dpy);
- DbeGetReq (DbeBeginIdiom, req, info);
- UnlockDisplay (dpy);
- SyncHandle ();
-
- return (Status)1; /* success */
-}
-
-
-/*
- * XdbeEndIdiom -
- * This function marks the end of an idiom sequence.
- */
-Status XdbeEndIdiom (Display *dpy)
-{
- XExtDisplayInfo *info = find_display(dpy);
- register xDbeEndIdiomReq *req;
-
- DbeCheckExtension (dpy, info, (Status)0 /* failure */);
-
- LockDisplay (dpy);
- DbeGetReq (DbeEndIdiom, req, info);
- UnlockDisplay (dpy);
- SyncHandle ();
-
- return (Status)1; /* success */
-}
-
-
-/*
- * XdbeGetVisualInfo -
- * This function returns information about which visuals support
- * double buffering. The argument num_screens specifies how many
- * elements there are in the screen_specifiers list. Each drawable
- * in screen_specifiers designates a screen for which the supported
- * visuals are being requested. If num_screens is zero, information
- * for all screens is requested. In this case, upon return from this
- * function, num_screens will be set to the number of screens that were
- * found. If an error occurs, this function returns NULL, else it returns
- * a pointer to a list of XdbeScreenVisualInfo structures of length
- * num_screens. The nth element in the returned list corresponds to the
- * nth drawable in the screen_specifiers list, unless num_screens was
- * passed in with the value zero, in which case the nth element in the
- * returned list corresponds to the nth screen of the server, starting
- * with screen zero.
- */
-XdbeScreenVisualInfo *XdbeGetVisualInfo (
- Display *dpy,
- Drawable *screen_specifiers,
- int *num_screens) /* SEND and RETURN */
-{
- XExtDisplayInfo *info = find_display(dpy);
- register xDbeGetVisualInfoReq *req;
- xDbeGetVisualInfoReply rep;
- XdbeScreenVisualInfo *scrVisInfo;
- int i;
-
- DbeCheckExtension (dpy, info, (XdbeScreenVisualInfo *)NULL);
-
- LockDisplay (dpy);
-
- DbeGetReq(DbeGetVisualInfo, req, info);
- req->length = 2 + *num_screens;
- req->n = *num_screens;
- Data32 (dpy, screen_specifiers, (*num_screens * sizeof (CARD32)));
-
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
-
- /* return the number of screens actually found if we
- * requested information about all screens (*num_screens == 0)
- */
- if (*num_screens == 0)
- *num_screens = rep.m;
-
- /* allocate list of visual information to be returned */
- if (!(scrVisInfo =
- (XdbeScreenVisualInfo *)Xmalloc(
- (unsigned)(*num_screens * sizeof(XdbeScreenVisualInfo))))) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
-
- for (i = 0; i < *num_screens; i++)
- {
- int nbytes;
- int j;
- long c;
-
- _XRead32 (dpy, &c, sizeof(CARD32));
- scrVisInfo[i].count = c;
-
- nbytes = scrVisInfo[i].count * sizeof(XdbeVisualInfo);
-
- /* if we can not allocate the list of visual/depth info
- * then free the lists that we already allocate as well
- * as the visual info list itself
- */
- if (!(scrVisInfo[i].visinfo = (XdbeVisualInfo *)Xmalloc(
- (unsigned)nbytes))) {
- for (j = 0; j < i; j++) {
- Xfree ((char *)scrVisInfo[j].visinfo);
- }
- Xfree ((char *)scrVisInfo);
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
-
- /* Read the visual info item into the wire structure. Then copy each
- * element into the library structure. The element sizes and/or
- * padding may be different in the two structures.
- */
- for (j = 0; j < scrVisInfo[i].count; j++) {
- xDbeVisInfo xvi;
-
- _XRead (dpy, (char *)&xvi, sizeof(xDbeVisInfo));
- scrVisInfo[i].visinfo[j].visual = xvi.visualID;
- scrVisInfo[i].visinfo[j].depth = xvi.depth;
- scrVisInfo[i].visinfo[j].perflevel = xvi.perfLevel;
- }
-
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return scrVisInfo;
-
-} /* XdbeGetVisualInfo() */
-
-
-/*
- * XdbeFreeVisualInfo -
- * This function frees the list of XdbeScreenVisualInfo returned by the
- * function XdbeGetVisualInfo.
- */
-void XdbeFreeVisualInfo(XdbeScreenVisualInfo *visual_info)
-{
- if (visual_info == NULL) {
- return;
- }
-
- if (visual_info->visinfo) {
- XFree(visual_info->visinfo);
- }
-
- XFree(visual_info);
-}
-
-
-/*
- * XdbeGetBackBufferAttributes -
- * This function returns the attributes associated with the specified
- * buffer.
- */
-XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
- Display *dpy,
- XdbeBackBuffer buffer)
-{
- XExtDisplayInfo *info = find_display(dpy);
- register xDbeGetBackBufferAttributesReq *req;
- xDbeGetBackBufferAttributesReply rep;
- XdbeBackBufferAttributes *attr;
-
- DbeCheckExtension(dpy, info, (XdbeBackBufferAttributes *)NULL);
-
- if (!(attr =
- (XdbeBackBufferAttributes *)Xmalloc(sizeof(XdbeBackBufferAttributes)))) {
- return NULL;
- }
-
- LockDisplay(dpy);
- DbeGetReq(DbeGetBackBufferAttributes, req, info);
- req->buffer = buffer;
-
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- Xfree(attr);
- return NULL;
- }
- attr->window = rep.attributes;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-
- return attr;
-}
-
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * 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 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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
+ * Company 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 Hewlett-Packard Company.
+ *
+ * Xlib DBE code
+ *
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xdbe.h>
+#include <X11/extensions/dbeproto.h>
+
+static XExtensionInfo _dbe_info_data;
+static XExtensionInfo *dbe_info = &_dbe_info_data;
+static char *dbe_extension_name = DBE_PROTOCOL_NAME;
+
+#define DbeCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, dbe_extension_name, val)
+#define DbeSimpleCheckExtension(dpy,i) \
+ XextSimpleCheckExtension (dpy, i, dbe_extension_name)
+
+#if !defined(UNIXCPP)
+#define DbeGetReq(name,req,info) GetReq (name, req); \
+ req->reqType = info->codes->major_opcode; \
+ req->dbeReqType = X_##name;
+#else
+#define DbeGetReq(name,req,info) GetReq (name, req); \
+ req->reqType = info->codes->major_opcode; \
+ req->dbeReqType = X_/**/name;
+#endif
+
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+/*
+ * find_display - locate the display info block
+ */
+static int close_display(Display *dpy, XExtCodes *codes);
+static char *error_string(Display *dpy, int code, XExtCodes *codes,
+ char *buf, int n);
+static XExtensionHooks dbe_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ error_string, /* error_string */
+};
+
+static char *dbe_error_list[] = {
+ "BadBuffer", /* DbeBadBuffer */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, dbe_info,
+ dbe_extension_name,
+ &dbe_extension_hooks,
+ DbeNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dbe_info)
+
+static XEXT_GENERATE_ERROR_STRING (error_string, dbe_extension_name,
+ DbeNumberErrors,
+ dbe_error_list)
+
+
+/*****************************************************************************
+ * *
+ * Double-Buffering public interfaces *
+ * *
+ *****************************************************************************/
+
+/*
+ * XdbeQueryExtension -
+ * Sets major_version_return and minor_verion_return to the major and
+ * minor DBE protocol version supported by the server. If the DBE
+ * library is compatible with the version returned by the server, this
+ * function returns non-zero. If dpy does not support the DBE
+ * extension, or if there was an error during communication with the
+ * server, or if the server and library protocol versions are
+ * incompatible, this functions returns zero. No other Xdbe functions
+ * may be called before this function. If a client violates this rule,
+ * the effects of all subsequent Xdbe calls are undefined.
+ */
+Status XdbeQueryExtension (
+ Display *dpy,
+ int *major_version_return,
+ int *minor_version_return)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xDbeGetVersionReply rep;
+ register xDbeGetVersionReq *req;
+
+ if (!XextHasExtension (info))
+ return (Status)0; /* failure */
+
+ LockDisplay (dpy);
+ DbeGetReq (DbeGetVersion, req, info);
+ req->majorVersion = DBE_MAJOR_VERSION;
+ req->minorVersion = DBE_MINOR_VERSION;
+
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return (Status)0; /* failure */
+ }
+ *major_version_return = rep.majorVersion;
+ *minor_version_return = rep.minorVersion;
+ UnlockDisplay (dpy);
+
+ SyncHandle ();
+
+ if (*major_version_return != DBE_MAJOR_VERSION)
+ return (Status)0; /* failure */
+ else
+ return (Status)1; /* success */
+}
+
+
+/*
+ * XdbeAllocateBackBuffer -
+ * This function returns a drawable ID used to refer to the back buffer
+ * of the specified window. The swap_action is a hint to indicate the
+ * swap action that will likely be used in subsequent calls to
+ * XdbeSwapBuffers. The actual swap action used in calls to
+ * XdbeSwapBuffers does not have to be the same as the swap_action
+ * passed to this function, though clients are encouraged to provide
+ * accurate information whenever possible.
+ */
+
+XdbeBackBuffer XdbeAllocateBackBufferName(
+ Display *dpy,
+ Window window,
+ XdbeSwapAction swap_action)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDbeAllocateBackBufferNameReq *req;
+ XdbeBackBuffer buffer;
+
+ /* make sure extension is available; if not, return the
+ * third parameter (0).
+ */
+ DbeCheckExtension (dpy, info, (XdbeBackBuffer)0);
+
+ LockDisplay(dpy);
+ DbeGetReq(DbeAllocateBackBufferName, req, info);
+ req->window = window;
+ req->swapAction = (unsigned char)swap_action;
+ req->buffer = buffer = XAllocID (dpy);
+
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return buffer;
+
+} /* XdbeAllocateBackBufferName() */
+
+/*
+ * XdbeDeallocateBackBufferName -
+ * This function frees a drawable ID, buffer, that was obtained via
+ * XdbeAllocateBackBufferName. The buffer must refer to the back buffer
+ * of the specified window, or a protocol error results.
+ */
+Status XdbeDeallocateBackBufferName (
+ Display *dpy,
+ XdbeBackBuffer buffer)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDbeDeallocateBackBufferNameReq *req;
+
+ DbeCheckExtension (dpy, info, (Status)0 /* failure */);
+
+ LockDisplay (dpy);
+ DbeGetReq (DbeDeallocateBackBufferName, req, info);
+ req->buffer = buffer;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+
+ return (Status)1; /* success */
+}
+
+
+/*
+ * XdbeSwapBuffers -
+ * This function swaps the front and back buffers for a list of windows.
+ * The argument num_windows specifies how many windows are to have their
+ * buffers swapped; it is the number of elements in the swap_info array.
+ * The argument swap_info specifies the information needed per window
+ * to do the swap.
+ */
+Status XdbeSwapBuffers (
+ Display *dpy,
+ XdbeSwapInfo *swap_info,
+ int num_windows)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ register xDbeSwapBuffersReq *req;
+ int i;
+
+ DbeCheckExtension (dpy, info, (Status)0 /* failure */);
+
+ LockDisplay (dpy);
+ DbeGetReq (DbeSwapBuffers, req, info);
+ req->length += 2*num_windows;
+ req->n = num_windows;
+
+ /* We need to handle 64-bit machines, where we can not use PackData32
+ * directly because info would be lost in translating from 32- to 64-bit.
+ * Instead we send data via a loop that accounts for the translation.
+ */
+ for (i = 0; i < num_windows; i++)
+ {
+ char tmp[4];
+ Data32 (dpy, (long *)&swap_info[i].swap_window, 4);
+ tmp[0] = swap_info[i].swap_action;
+ Data (dpy, (char *)tmp, 4);
+ }
+
+ UnlockDisplay (dpy);
+ SyncHandle ();
+
+
+ return (Status)1; /* success */
+
+} /* XdbeSwapBuffers() */
+
+
+/*
+ * XdbeBeginIdiom -
+ * This function marks the beginning of an idiom sequence.
+ */
+Status XdbeBeginIdiom (Display *dpy)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ register xDbeBeginIdiomReq *req;
+
+ DbeCheckExtension (dpy, info, (Status)0 /* failure */);
+
+ LockDisplay (dpy);
+ DbeGetReq (DbeBeginIdiom, req, info);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+
+ return (Status)1; /* success */
+}
+
+
+/*
+ * XdbeEndIdiom -
+ * This function marks the end of an idiom sequence.
+ */
+Status XdbeEndIdiom (Display *dpy)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ register xDbeEndIdiomReq *req;
+
+ DbeCheckExtension (dpy, info, (Status)0 /* failure */);
+
+ LockDisplay (dpy);
+ DbeGetReq (DbeEndIdiom, req, info);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+
+ return (Status)1; /* success */
+}
+
+
+/*
+ * XdbeGetVisualInfo -
+ * This function returns information about which visuals support
+ * double buffering. The argument num_screens specifies how many
+ * elements there are in the screen_specifiers list. Each drawable
+ * in screen_specifiers designates a screen for which the supported
+ * visuals are being requested. If num_screens is zero, information
+ * for all screens is requested. In this case, upon return from this
+ * function, num_screens will be set to the number of screens that were
+ * found. If an error occurs, this function returns NULL, else it returns
+ * a pointer to a list of XdbeScreenVisualInfo structures of length
+ * num_screens. The nth element in the returned list corresponds to the
+ * nth drawable in the screen_specifiers list, unless num_screens was
+ * passed in with the value zero, in which case the nth element in the
+ * returned list corresponds to the nth screen of the server, starting
+ * with screen zero.
+ */
+XdbeScreenVisualInfo *XdbeGetVisualInfo (
+ Display *dpy,
+ Drawable *screen_specifiers,
+ int *num_screens) /* SEND and RETURN */
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ register xDbeGetVisualInfoReq *req;
+ xDbeGetVisualInfoReply rep;
+ XdbeScreenVisualInfo *scrVisInfo;
+ int i;
+
+ DbeCheckExtension (dpy, info, (XdbeScreenVisualInfo *)NULL);
+
+ LockDisplay (dpy);
+
+ DbeGetReq(DbeGetVisualInfo, req, info);
+ req->length = 2 + *num_screens;
+ req->n = *num_screens;
+ Data32 (dpy, screen_specifiers, (*num_screens * sizeof (CARD32)));
+
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+
+ /* return the number of screens actually found if we
+ * requested information about all screens (*num_screens == 0)
+ */
+ if (*num_screens == 0)
+ *num_screens = rep.m;
+
+ /* allocate list of visual information to be returned */
+ if (!(scrVisInfo =
+ (XdbeScreenVisualInfo *)Xmalloc(
+ (unsigned)(*num_screens * sizeof(XdbeScreenVisualInfo))))) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+
+ for (i = 0; i < *num_screens; i++)
+ {
+ int nbytes;
+ int j;
+ long c;
+
+ _XRead32 (dpy, &c, sizeof(CARD32));
+ scrVisInfo[i].count = c;
+
+ nbytes = scrVisInfo[i].count * sizeof(XdbeVisualInfo);
+
+ /* if we can not allocate the list of visual/depth info
+ * then free the lists that we already allocate as well
+ * as the visual info list itself
+ */
+ if (!(scrVisInfo[i].visinfo = (XdbeVisualInfo *)Xmalloc(
+ (unsigned)nbytes))) {
+ for (j = 0; j < i; j++) {
+ Xfree ((char *)scrVisInfo[j].visinfo);
+ }
+ Xfree ((char *)scrVisInfo);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+
+ /* Read the visual info item into the wire structure. Then copy each
+ * element into the library structure. The element sizes and/or
+ * padding may be different in the two structures.
+ */
+ for (j = 0; j < scrVisInfo[i].count; j++) {
+ xDbeVisInfo xvi;
+
+ _XRead (dpy, (char *)&xvi, sizeof(xDbeVisInfo));
+ scrVisInfo[i].visinfo[j].visual = xvi.visualID;
+ scrVisInfo[i].visinfo[j].depth = xvi.depth;
+ scrVisInfo[i].visinfo[j].perflevel = xvi.perfLevel;
+ }
+
+ }
+
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return scrVisInfo;
+
+} /* XdbeGetVisualInfo() */
+
+
+/*
+ * XdbeFreeVisualInfo -
+ * This function frees the list of XdbeScreenVisualInfo returned by the
+ * function XdbeGetVisualInfo.
+ */
+void XdbeFreeVisualInfo(XdbeScreenVisualInfo *visual_info)
+{
+ if (visual_info == NULL) {
+ return;
+ }
+
+ if (visual_info->visinfo) {
+ XFree(visual_info->visinfo);
+ }
+
+ XFree(visual_info);
+}
+
+
+/*
+ * XdbeGetBackBufferAttributes -
+ * This function returns the attributes associated with the specified
+ * buffer.
+ */
+XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
+ Display *dpy,
+ XdbeBackBuffer buffer)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ register xDbeGetBackBufferAttributesReq *req;
+ xDbeGetBackBufferAttributesReply rep;
+ XdbeBackBufferAttributes *attr;
+
+ DbeCheckExtension(dpy, info, (XdbeBackBufferAttributes *)NULL);
+
+ if (!(attr =
+ (XdbeBackBufferAttributes *)Xmalloc(sizeof(XdbeBackBufferAttributes)))) {
+ return NULL;
+ }
+
+ LockDisplay(dpy);
+ DbeGetReq(DbeGetBackBufferAttributes, req, info);
+ req->buffer = buffer;
+
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ Xfree(attr);
+ return NULL;
+ }
+ attr->window = rep.attributes;
+
+ UnlockDisplay (dpy);
+ SyncHandle ();
+
+ return attr;
+}
+
diff --git a/libXext/src/extutil.c b/libXext/src/extutil.c
index 8813c1154..361a3274d 100644
--- a/libXext/src/extutil.c
+++ b/libXext/src/extutil.c
@@ -1,280 +1,280 @@
-/*
- *
-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: Jim Fulton, MIT X Consortium
- *
- *
- * Xlib Extension-Writing Utilities
- *
- * This package contains utilities for writing the client API for various
- * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
- * ARE SUBJECT TO CHANGE!
- *
- * Routines include:
- *
- * XextCreateExtension called once per extension
- * XextDestroyExtension if no longer using extension
- * XextAddDisplay add another display
- * XextRemoveDisplay remove a display
- * XextFindDisplay is a display open
- *
- * In addition, the following Xlib-style interfaces are provided:
- *
- * XSetExtensionErrorHandler establish an extension error handler
- * XMissingExtension raise an error about missing ext
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/ge.h>
-
-/* defined in Xge.c */
-extern _X_HIDDEN Bool
-xgeExtRegister(Display* dpy, int extension, XExtensionHooks* callbacks);
-
-/*
- * XextCreateExtension - return an extension descriptor containing context
- * information for this extension. This object is passed to all Xext
- * routines.
- */
-XExtensionInfo *XextCreateExtension (void)
-{
- register XExtensionInfo *info =
- (XExtensionInfo *) Xmalloc (sizeof (XExtensionInfo));
-
- if (info) {
- info->head = NULL;
- info->cur = NULL;
- info->ndisplays = 0;
- }
- return info;
-}
-
-
-/*
- * XextDestroyExtension - free memory the given extension descriptor
- */
-void XextDestroyExtension (XExtensionInfo *info)
-{
- info->head = NULL; /* to catch refs after this */
- info->cur = NULL;
- info->ndisplays = 0;
- XFree ((char *) info);
-}
-
-
-
-/*
- * XextAddDisplay - add a display to this extension
- */
-XExtDisplayInfo *XextAddDisplay (
- XExtensionInfo *extinfo,
- Display *dpy,
- char *ext_name,
- XExtensionHooks *hooks,
- int nevents,
- XPointer data)
-{
- XExtDisplayInfo *dpyinfo;
-
- dpyinfo = (XExtDisplayInfo *) Xmalloc (sizeof (XExtDisplayInfo));
- if (!dpyinfo) return NULL;
- dpyinfo->display = dpy;
- dpyinfo->data = data;
- dpyinfo->codes = XInitExtension (dpy, ext_name);
-
- /*
- * if the server has the extension, then we can initialize the
- * appropriate function vectors
- */
- if (dpyinfo->codes) {
- int i, j;
-
- for (i = 0, j = dpyinfo->codes->first_event; i < nevents; i++, j++) {
- XESetWireToEvent (dpy, j, hooks->wire_to_event);
- XESetEventToWire (dpy, j, hooks->event_to_wire);
- }
-
- /* register extension for XGE */
- if (strcmp(ext_name, GE_NAME))
- xgeExtRegister(dpy, dpyinfo->codes->major_opcode, hooks);
-
- if (hooks->create_gc)
- XESetCreateGC (dpy, dpyinfo->codes->extension, hooks->create_gc);
- if (hooks->copy_gc)
- XESetCopyGC (dpy, dpyinfo->codes->extension, hooks->copy_gc);
- if (hooks->flush_gc)
- XESetFlushGC (dpy, dpyinfo->codes->extension, hooks->flush_gc);
- if (hooks->free_gc)
- XESetFreeGC (dpy, dpyinfo->codes->extension, hooks->free_gc);
- if (hooks->create_font)
- XESetCreateFont (dpy, dpyinfo->codes->extension, hooks->create_font);
- if (hooks->free_font)
- XESetFreeFont (dpy, dpyinfo->codes->extension, hooks->free_font);
- if (hooks->close_display)
- XESetCloseDisplay (dpy, dpyinfo->codes->extension,
- hooks->close_display);
- if (hooks->error)
- XESetError (dpy, dpyinfo->codes->extension, hooks->error);
- if (hooks->error_string)
- XESetErrorString (dpy, dpyinfo->codes->extension,
- hooks->error_string);
- } else if (hooks->close_display) {
- /* 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(dpyinfo);
- return NULL;
- }
- XESetCloseDisplay (dpy, codes->extension, hooks->close_display);
- }
-
- /*
- * now, chain it onto the list
- */
- _XLockMutex(_Xglobal_lock);
- dpyinfo->next = extinfo->head;
- extinfo->head = dpyinfo;
- extinfo->cur = dpyinfo;
- extinfo->ndisplays++;
- _XUnlockMutex(_Xglobal_lock);
- return dpyinfo;
-}
-
-
-/*
- * XextRemoveDisplay - remove the indicated display from the extension object
- */
-int XextRemoveDisplay (XExtensionInfo *extinfo, Display *dpy)
-{
- XExtDisplayInfo *dpyinfo, *prev;
-
- /*
- * locate this display and its back link so that it can be removed
- */
- _XLockMutex(_Xglobal_lock);
- prev = NULL;
- for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) {
- if (dpyinfo->display == dpy) break;
- prev = dpyinfo;
- }
- if (!dpyinfo) {
- _XUnlockMutex(_Xglobal_lock);
- return 0; /* hmm, actually an error */
- }
-
- /*
- * remove the display from the list; handles going to zero
- */
- if (prev)
- prev->next = dpyinfo->next;
- else
- extinfo->head = dpyinfo->next;
-
- extinfo->ndisplays--;
- if (dpyinfo == extinfo->cur) extinfo->cur = NULL; /* flush cache */
- _XUnlockMutex(_Xglobal_lock);
-
- Xfree ((char *) dpyinfo);
- return 1;
-}
-
-
-/*
- * XextFindDisplay - look for a display in this extension; keeps a cache
- * of the most-recently used for efficiency.
- */
-XExtDisplayInfo *XextFindDisplay (XExtensionInfo *extinfo, Display *dpy)
-{
- register XExtDisplayInfo *dpyinfo;
-
- /*
- * see if this was the most recently accessed display
- */
- if ((dpyinfo = extinfo->cur)&& dpyinfo->display == dpy) return dpyinfo;
-
-
- /*
- * look for display in list
- */
- _XLockMutex(_Xglobal_lock);
- for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) {
- if (dpyinfo->display == dpy) {
- extinfo->cur = dpyinfo; /* cache most recently used */
- _XUnlockMutex(_Xglobal_lock);
- return dpyinfo;
- }
- }
- _XUnlockMutex(_Xglobal_lock);
-
- return NULL;
-}
-
-
-
-static int _default_exterror (Display *dpy, _Xconst char *ext_name, _Xconst char *reason)
-{
- fprintf (stderr, "Xlib: extension \"%s\" %s on display \"%s\".\n",
- ext_name, reason, DisplayString(dpy));
- return 0;
-}
-
-
-/*
- * XSetExtensionErrorHandler - sets the handler that gets called when a
- * requested extension is referenced. This should eventually move into Xlib.
- */
-
-extern XextErrorHandler _XExtensionErrorFunction;
-
-XextErrorHandler XSetExtensionErrorHandler (XextErrorHandler handler)
-{
- XextErrorHandler oldhandler = _XExtensionErrorFunction;
-
- _XExtensionErrorFunction = (handler ? handler :
- _default_exterror);
- return oldhandler;
-}
-
-
-/*
- * XMissingExtension - call the extension error handler
- */
-int XMissingExtension (Display *dpy, _Xconst char *ext_name)
-{
- XextErrorHandler func = (_XExtensionErrorFunction ?
- _XExtensionErrorFunction : _default_exterror);
-
- if (!ext_name) ext_name = X_EXTENSION_UNKNOWN;
- return (*func) (dpy, ext_name, X_EXTENSION_MISSING);
-}
+/*
+ *
+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: Jim Fulton, MIT X Consortium
+ *
+ *
+ * Xlib Extension-Writing Utilities
+ *
+ * This package contains utilities for writing the client API for various
+ * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
+ * ARE SUBJECT TO CHANGE!
+ *
+ * Routines include:
+ *
+ * XextCreateExtension called once per extension
+ * XextDestroyExtension if no longer using extension
+ * XextAddDisplay add another display
+ * XextRemoveDisplay remove a display
+ * XextFindDisplay is a display open
+ *
+ * In addition, the following Xlib-style interfaces are provided:
+ *
+ * XSetExtensionErrorHandler establish an extension error handler
+ * XMissingExtension raise an error about missing ext
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/ge.h>
+
+/* defined in Xge.c */
+extern _X_HIDDEN Bool
+xgeExtRegister(Display* dpy, int extension, XExtensionHooks* callbacks);
+
+/*
+ * XextCreateExtension - return an extension descriptor containing context
+ * information for this extension. This object is passed to all Xext
+ * routines.
+ */
+XExtensionInfo *XextCreateExtension (void)
+{
+ register XExtensionInfo *info =
+ (XExtensionInfo *) Xmalloc (sizeof (XExtensionInfo));
+
+ if (info) {
+ info->head = NULL;
+ info->cur = NULL;
+ info->ndisplays = 0;
+ }
+ return info;
+}
+
+
+/*
+ * XextDestroyExtension - free memory the given extension descriptor
+ */
+void XextDestroyExtension (XExtensionInfo *info)
+{
+ info->head = NULL; /* to catch refs after this */
+ info->cur = NULL;
+ info->ndisplays = 0;
+ XFree ((char *) info);
+}
+
+
+
+/*
+ * XextAddDisplay - add a display to this extension
+ */
+XExtDisplayInfo *XextAddDisplay (
+ XExtensionInfo *extinfo,
+ Display *dpy,
+ char *ext_name,
+ XExtensionHooks *hooks,
+ int nevents,
+ XPointer data)
+{
+ XExtDisplayInfo *dpyinfo;
+
+ dpyinfo = (XExtDisplayInfo *) Xmalloc (sizeof (XExtDisplayInfo));
+ if (!dpyinfo) return NULL;
+ dpyinfo->display = dpy;
+ dpyinfo->data = data;
+ dpyinfo->codes = XInitExtension (dpy, ext_name);
+
+ /*
+ * if the server has the extension, then we can initialize the
+ * appropriate function vectors
+ */
+ if (dpyinfo->codes) {
+ int i, j;
+
+ for (i = 0, j = dpyinfo->codes->first_event; i < nevents; i++, j++) {
+ XESetWireToEvent (dpy, j, hooks->wire_to_event);
+ XESetEventToWire (dpy, j, hooks->event_to_wire);
+ }
+
+ /* register extension for XGE */
+ if (strcmp(ext_name, GE_NAME))
+ xgeExtRegister(dpy, dpyinfo->codes->major_opcode, hooks);
+
+ if (hooks->create_gc)
+ XESetCreateGC (dpy, dpyinfo->codes->extension, hooks->create_gc);
+ if (hooks->copy_gc)
+ XESetCopyGC (dpy, dpyinfo->codes->extension, hooks->copy_gc);
+ if (hooks->flush_gc)
+ XESetFlushGC (dpy, dpyinfo->codes->extension, hooks->flush_gc);
+ if (hooks->free_gc)
+ XESetFreeGC (dpy, dpyinfo->codes->extension, hooks->free_gc);
+ if (hooks->create_font)
+ XESetCreateFont (dpy, dpyinfo->codes->extension, hooks->create_font);
+ if (hooks->free_font)
+ XESetFreeFont (dpy, dpyinfo->codes->extension, hooks->free_font);
+ if (hooks->close_display)
+ XESetCloseDisplay (dpy, dpyinfo->codes->extension,
+ hooks->close_display);
+ if (hooks->error)
+ XESetError (dpy, dpyinfo->codes->extension, hooks->error);
+ if (hooks->error_string)
+ XESetErrorString (dpy, dpyinfo->codes->extension,
+ hooks->error_string);
+ } else if (hooks->close_display) {
+ /* 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(dpyinfo);
+ return NULL;
+ }
+ XESetCloseDisplay (dpy, codes->extension, hooks->close_display);
+ }
+
+ /*
+ * now, chain it onto the list
+ */
+ _XLockMutex(_Xglobal_lock);
+ dpyinfo->next = extinfo->head;
+ extinfo->head = dpyinfo;
+ extinfo->cur = dpyinfo;
+ extinfo->ndisplays++;
+ _XUnlockMutex(_Xglobal_lock);
+ return dpyinfo;
+}
+
+
+/*
+ * XextRemoveDisplay - remove the indicated display from the extension object
+ */
+int XextRemoveDisplay (XExtensionInfo *extinfo, Display *dpy)
+{
+ XExtDisplayInfo *dpyinfo, *prev;
+
+ /*
+ * locate this display and its back link so that it can be removed
+ */
+ _XLockMutex(_Xglobal_lock);
+ prev = NULL;
+ for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) {
+ if (dpyinfo->display == dpy) break;
+ prev = dpyinfo;
+ }
+ if (!dpyinfo) {
+ _XUnlockMutex(_Xglobal_lock);
+ return 0; /* hmm, actually an error */
+ }
+
+ /*
+ * remove the display from the list; handles going to zero
+ */
+ if (prev)
+ prev->next = dpyinfo->next;
+ else
+ extinfo->head = dpyinfo->next;
+
+ extinfo->ndisplays--;
+ if (dpyinfo == extinfo->cur) extinfo->cur = NULL; /* flush cache */
+ _XUnlockMutex(_Xglobal_lock);
+
+ Xfree ((char *) dpyinfo);
+ return 1;
+}
+
+
+/*
+ * XextFindDisplay - look for a display in this extension; keeps a cache
+ * of the most-recently used for efficiency.
+ */
+XExtDisplayInfo *XextFindDisplay (XExtensionInfo *extinfo, Display *dpy)
+{
+ register XExtDisplayInfo *dpyinfo;
+
+ /*
+ * see if this was the most recently accessed display
+ */
+ if ((dpyinfo = extinfo->cur)&& dpyinfo->display == dpy) return dpyinfo;
+
+
+ /*
+ * look for display in list
+ */
+ _XLockMutex(_Xglobal_lock);
+ for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) {
+ if (dpyinfo->display == dpy) {
+ extinfo->cur = dpyinfo; /* cache most recently used */
+ _XUnlockMutex(_Xglobal_lock);
+ return dpyinfo;
+ }
+ }
+ _XUnlockMutex(_Xglobal_lock);
+
+ return NULL;
+}
+
+
+
+static int _default_exterror (Display *dpy, _Xconst char *ext_name, _Xconst char *reason)
+{
+ fprintf (stderr, "Xlib: extension \"%s\" %s on display \"%s\".\n",
+ ext_name, reason, DisplayString(dpy));
+ return 0;
+}
+
+
+/*
+ * XSetExtensionErrorHandler - sets the handler that gets called when a
+ * requested extension is referenced. This should eventually move into Xlib.
+ */
+
+extern XextErrorHandler _XExtensionErrorFunction;
+
+XextErrorHandler XSetExtensionErrorHandler (XextErrorHandler handler)
+{
+ XextErrorHandler oldhandler = _XExtensionErrorFunction;
+
+ _XExtensionErrorFunction = (handler ? handler :
+ _default_exterror);
+ return oldhandler;
+}
+
+
+/*
+ * XMissingExtension - call the extension error handler
+ */
+int XMissingExtension (Display *dpy, _Xconst char *ext_name)
+{
+ XextErrorHandler func = (_XExtensionErrorFunction ?
+ _XExtensionErrorFunction : _default_exterror);
+
+ if (!ext_name) ext_name = X_EXTENSION_UNKNOWN;
+ return (*func) (dpy, ext_name, X_EXTENSION_MISSING);
+}
diff --git a/libXext/src/globals.c b/libXext/src/globals.c
index a40492abe..8b5923de6 100644
--- a/libXext/src/globals.c
+++ b/libXext/src/globals.c
@@ -1,87 +1,87 @@
-/*
-
-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 file should contain only those objects which must be predefined.
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xlib.h>
-#include <X11/extensions/Xext.h>
-#include <stddef.h> /* for definition of NULL */
-
-/*
- * If possible, it is useful to have the global data default to a null value.
- * Some shared library implementations are *much* happier if there isn't any
- * global initialized data.
- */
-#ifdef NULL_NOT_ZERO /* then need to initialize */
-#define SetZero(t,var,z) t var = z
-#else
-#define SetZero(t,var,z) t var
-#endif
-
-#ifdef ATTSHAREDLIB /* then need extra variables */
-/*
- * If we need to define extra variables for each global
- */
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define ZEROINIT(t,var,val) SetZero(t,var,val); \
- SetZero (long, _libX_##var##Flag, 0); \
- SetZero (void *, _libX_##var##Ptr, NULL)
-#else /* else pcc concatenation */
-#define ZEROINIT(t,var,val) SetZero(t,var,val); \
- SetZero (long, _libX_/**/var/**/Flag, 0); \
- SetZero (void *, _libX_/**/var/**/Ptr, NULL)
-#endif /* concat ANSI C vs. pcc */
-
-#else /* else not ATTSHAREDLIB */
-/*
- * no extra crud
- */
-#define ZEROINIT(t,var,val) SetZero (t, var, val)
-
-#endif /* ATTSHAREDLIB */
-
-
-/*
- * Error handlers; used to be in XlibInt.c
- */
-ZEROINIT (XextErrorHandler, _XExtensionErrorFunction, NULL);
-
-/*
- * NOTE: any additional external definition NEED
- * to be inserted BELOW this point!!!
- */
-
-/*
- * NOTE: any additional external definition NEED
- * to be inserted ABOVE this point!!!
- */
-
+/*
+
+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 file should contain only those objects which must be predefined.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <X11/extensions/Xext.h>
+#include <stddef.h> /* for definition of NULL */
+
+/*
+ * If possible, it is useful to have the global data default to a null value.
+ * Some shared library implementations are *much* happier if there isn't any
+ * global initialized data.
+ */
+#ifdef NULL_NOT_ZERO /* then need to initialize */
+#define SetZero(t,var,z) t var = z
+#else
+#define SetZero(t,var,z) t var
+#endif
+
+#ifdef ATTSHAREDLIB /* then need extra variables */
+/*
+ * If we need to define extra variables for each global
+ */
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define ZEROINIT(t,var,val) SetZero(t,var,val); \
+ SetZero (long, _libX_##var##Flag, 0); \
+ SetZero (void *, _libX_##var##Ptr, NULL)
+#else /* else pcc concatenation */
+#define ZEROINIT(t,var,val) SetZero(t,var,val); \
+ SetZero (long, _libX_/**/var/**/Flag, 0); \
+ SetZero (void *, _libX_/**/var/**/Ptr, NULL)
+#endif /* concat ANSI C vs. pcc */
+
+#else /* else not ATTSHAREDLIB */
+/*
+ * no extra crud
+ */
+#define ZEROINIT(t,var,val) SetZero (t, var, val)
+
+#endif /* ATTSHAREDLIB */
+
+
+/*
+ * Error handlers; used to be in XlibInt.c
+ */
+ZEROINIT (XextErrorHandler, _XExtensionErrorFunction, NULL);
+
+/*
+ * NOTE: any additional external definition NEED
+ * to be inserted BELOW this point!!!
+ */
+
+/*
+ * NOTE: any additional external definition NEED
+ * to be inserted ABOVE this point!!!
+ */
+
diff --git a/libXft/configure.ac b/libXft/configure.ac
index 9b9f6a74d..54d960fa0 100644
--- a/libXft/configure.ac
+++ b/libXft/configure.ac
@@ -64,11 +64,11 @@ AC_SUBST([XFT_LT_VERSION])
#
# Check for Xrender
#
-PKG_CHECK_MODULES(XRENDER, xrender >= 0.8.2, [xrender_found_with_pkgconfig=yes],
+PKG_CHECK_MODULES(XRENDER, xrender >= 0.8.2, [xrender_found_with_pkgconfig=yes],
[xrender_found_with_pkgconfig=no])
case "$xrender_found_with_pkgconfig" in
no)
- PKG_CHECK_MODULES(XRENDER, xrender >= 0, [old_xrender_found_with_pkgconfig=yes],
+ PKG_CHECK_MODULES(XRENDER, xrender >= 0, [old_xrender_found_with_pkgconfig=yes],
[old_xrender_found_with_pkgconfig=no])
case "$old_xrender_found_with_pkgconfig" in
yes)
@@ -97,13 +97,13 @@ esac
# Check freetype configuration
AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto)
-
+
if test "$freetype_config" = "auto"; then
- PKG_CHECK_MODULES(FREETYPE, freetype2,
+ PKG_CHECK_MODULES(FREETYPE, freetype2,
freetype_config=no, freetype_config=yes)
fi
-if test "$freetype_config" = "yes"; then
+if test "$freetype_config" = "yes"; then
AC_PATH_PROG(ft_config,freetype-config,no)
if test "$ft_config" = "no"; then
AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
@@ -112,7 +112,7 @@ else
ft_config="$freetype_config"
fi
-if test "$freetype_config" != "no"; then
+if test "$freetype_config" != "no"; then
FREETYPE_CFLAGS="`$ft_config --cflags`"
FREETYPE_LIBS="`$ft_config --libs`"
fi
diff --git a/libXft/include/X11/Xft/Xft.h.in b/libXft/include/X11/Xft/Xft.h.in
index 490945fc5..9b3b475c6 100644
--- a/libXft/include/X11/Xft/Xft.h.in
+++ b/libXft/include/X11/Xft/Xft.h.in
@@ -104,7 +104,7 @@ typedef struct _XftGlyphFontSpec {
_XFUNCPROTOBEGIN
-
+
/* xftcolor.c */
Bool
XftColorAllocName (Display *dpy,
@@ -129,13 +129,13 @@ XftColorFree (Display *dpy,
/* xftdpy.c */
Bool
XftDefaultHasRender (Display *dpy);
-
+
Bool
XftDefaultSet (Display *dpy, FcPattern *defaults);
void
XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern);
-
+
/* xftdraw.c */
XftDraw *
@@ -149,7 +149,7 @@ XftDrawCreateBitmap (Display *dpy,
Pixmap bitmap);
XftDraw *
-XftDrawCreateAlpha (Display *dpy,
+XftDrawCreateAlpha (Display *dpy,
Pixmap pixmap,
int depth);
@@ -191,7 +191,7 @@ void
XftDrawString8 (XftDraw *draw,
_Xconst XftColor *color,
XftFont *pub,
- int x,
+ int x,
int y,
_Xconst FcChar8 *string,
int len);
@@ -218,7 +218,7 @@ void
XftDrawStringUtf8 (XftDraw *draw,
_Xconst XftColor *color,
XftFont *pub,
- int x,
+ int x,
int y,
_Xconst FcChar8 *string,
int len);
@@ -262,7 +262,7 @@ XftDrawGlyphFontSpec (XftDraw *draw,
void
XftDrawRect (XftDraw *draw,
_Xconst XftColor *color,
- int x,
+ int x,
int y,
unsigned int width,
unsigned int height);
@@ -296,35 +296,35 @@ XftGlyphExtents (Display *dpy,
void
XftTextExtents8 (Display *dpy,
XftFont *pub,
- _Xconst FcChar8 *string,
+ _Xconst FcChar8 *string,
int len,
XGlyphInfo *extents);
void
XftTextExtents16 (Display *dpy,
XftFont *pub,
- _Xconst FcChar16 *string,
+ _Xconst FcChar16 *string,
int len,
XGlyphInfo *extents);
void
XftTextExtents32 (Display *dpy,
XftFont *pub,
- _Xconst FcChar32 *string,
+ _Xconst FcChar32 *string,
int len,
XGlyphInfo *extents);
-
+
void
XftTextExtentsUtf8 (Display *dpy,
XftFont *pub,
- _Xconst FcChar8 *string,
+ _Xconst FcChar8 *string,
int len,
XGlyphInfo *extents);
void
XftTextExtentsUtf16 (Display *dpy,
XftFont *pub,
- _Xconst FcChar8 *string,
+ _Xconst FcChar8 *string,
FcEndian endian,
int len,
XGlyphInfo *extents);
@@ -366,8 +366,8 @@ FcBool
XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b);
XftFont *
-XftFontOpenInfo (Display *dpy,
- FcPattern *pattern,
+XftFontOpenInfo (Display *dpy,
+ FcPattern *pattern,
XftFontInfo *fi);
XftFont *
@@ -410,12 +410,12 @@ FcBool
XftCharExists (Display *dpy,
XftFont *pub,
FcChar32 ucs4);
-
+
FT_UInt
-XftCharIndex (Display *dpy,
+XftCharIndex (Display *dpy,
XftFont *pub,
FcChar32 ucs4);
-
+
/* xftinit.c */
FcBool
XftInit (_Xconst char *config);
@@ -431,7 +431,7 @@ XftListFonts (Display *dpy,
...) _X_SENTINEL(0);
/* xftname.c */
-FcPattern
+FcPattern
*XftNameParse (_Xconst char *name);
/* xftrender.c */
@@ -465,7 +465,7 @@ XftCharSpecRender (Display *dpy,
Picture src,
XftFont *pub,
Picture dst,
- int srcx,
+ int srcx,
int srcy,
_Xconst XftCharSpec *chars,
int len);
@@ -611,7 +611,7 @@ XftTextRenderUtf16 (Display *dpy,
/* xftxlfd.c */
FcPattern *
XftXlfdParse (_Xconst char *xlfd_orig, Bool ignore_scalable, Bool complete);
-
+
_XFUNCPROTOEND
#endif /* _XFT_H_ */
diff --git a/libXft/src/xftcolor.c b/libXft/src/xftcolor.c
index 77872efa4..a323822bd 100644
--- a/libXft/src/xftcolor.c
+++ b/libXft/src/xftcolor.c
@@ -30,7 +30,7 @@ XftColorAllocName (Display *dpy,
XftColor *result)
{
XColor screen, exact;
-
+
if (!XAllocNamedColor (dpy, cmap, name, &screen, &exact))
{
/* XXX stick standard colormap stuff here */
@@ -97,7 +97,7 @@ XftColorAllocValue (Display *dpy,
else
{
XColor xcolor;
-
+
xcolor.red = color->red;
xcolor.green = color->green;
xcolor.blue = color->blue;
@@ -112,7 +112,7 @@ XftColorAllocValue (Display *dpy,
return True;
}
-_X_EXPORT void
+_X_EXPORT void
XftColorFree (Display *dpy,
Visual *visual,
Colormap cmap,
diff --git a/libXft/src/xftcore.c b/libXft/src/xftcore.c
index a0103cf26..85b58c3f3 100644
--- a/libXft/src/xftcore.c
+++ b/libXft/src/xftcore.c
@@ -25,7 +25,7 @@
_X_HIDDEN void
XftRectCore (XftDraw *draw,
_Xconst XftColor *color,
- int x,
+ int x,
int y,
unsigned int width,
unsigned int height)
@@ -63,10 +63,10 @@ _XftSharpGlyphMono (XftDraw *draw,
src = srcLine;
srcLine += stride;
w = width;
-
+
bitsMask = 0x80; /* FreeType is always MSB first */
bits = *src++;
-
+
xspan = x;
while (w)
{
@@ -85,7 +85,7 @@ _XftSharpGlyphMono (XftDraw *draw,
bitsMask = 0x80;
}
} while (bits & bitsMask);
- XFillRectangle (draw->dpy, draw->drawable,
+ XFillRectangle (draw->dpy, draw->drawable,
draw->core.gc, xspan, y, lenspan, 1);
xspan += lenspan;
w -= lenspan;
@@ -135,7 +135,7 @@ _XftSharpGlyphGray (XftDraw *draw,
src = srcLine;
srcLine += stride;
w = width;
-
+
bits = *src++;
xspan = x;
while (w)
@@ -150,7 +150,7 @@ _XftSharpGlyphGray (XftDraw *draw,
break;
bits = *src++;
} while (bits >= 0x80);
- XFillRectangle (draw->dpy, draw->drawable,
+ XFillRectangle (draw->dpy, draw->drawable,
draw->core.gc, xspan, y, lenspan, 1);
xspan += lenspan;
w -= lenspan;
@@ -191,7 +191,7 @@ _XftSharpGlyphRgba (XftDraw *draw,
src = srcLine;
srcLine += stride;
w = width;
-
+
bits = *src++;
xspan = x;
while (w)
@@ -206,7 +206,7 @@ _XftSharpGlyphRgba (XftDraw *draw,
break;
bits = *src++;
} while (bits >= 0x80000000);
- XFillRectangle (draw->dpy, draw->drawable,
+ XFillRectangle (draw->dpy, draw->drawable,
draw->core.gc, xspan, y, lenspan, 1);
xspan += lenspan;
w -= lenspan;
@@ -257,7 +257,7 @@ _XftSharpGlyphFind (XftDraw *draw, XftFont *public)
/*
* Primitives for converting between RGB values and TrueColor pixels
*/
-
+
static void
_XftExamineBitfield (unsigned long mask, int *shift, int *len)
{
@@ -283,7 +283,7 @@ static CARD32
_XftGetField (unsigned long l_pixel, int shift, int len)
{
CARD32 pixel = (CARD32) l_pixel;
-
+
pixel = pixel & (((1 << (len)) - 1) << shift);
pixel = pixel << (32 - (shift + len)) >> 24;
while (len < 8)
@@ -346,10 +346,10 @@ _XftSmoothGlyphMono (XImage *image,
src = srcLine;
srcLine += stride;
w = width;
-
+
bitsMask = 0x80; /* FreeType is always MSB first */
bits = *src++;
-
+
xspan = x;
while (w--)
{
@@ -465,7 +465,7 @@ _XftSmoothGlyphGray8888 (XImage *image,
int w;
srca = color->color.alpha >> 8;
-
+
/* This handles only RGB and BGR */
g = (color->color.green & 0xff00);
if (image->red_mask == 0xff0000)
@@ -479,10 +479,10 @@ _XftSmoothGlyphGray8888 (XImage *image,
b = (color->color.blue & 0xff00) << 8;
}
src = (srca << 24) | r | g | b;
-
+
width = xftg->metrics.width;
height = xftg->metrics.height;
-
+
x -= xftg->metrics.x;
y -= xftg->metrics.y;
@@ -490,7 +490,7 @@ _XftSmoothGlyphGray8888 (XImage *image,
dstStride = image->bytes_per_line >> 2;
maskLine = (unsigned char *) xftg->bitmap;
maskStride = (width + 3) & ~3;
-
+
while (height--)
{
dst = dstLine;
@@ -536,7 +536,7 @@ _XftSmoothGlyphGray565 (XImage *image,
int w;
srca = color->color.alpha >> 8;
-
+
/* This handles only RGB and BGR */
g = (color->color.green & 0xff00);
if (image->red_mask == 0xf800)
@@ -550,10 +550,10 @@ _XftSmoothGlyphGray565 (XImage *image,
b = (color->color.blue & 0xff00) << 8;
}
src = (srca << 24) | r | g | b;
-
+
width = xftg->metrics.width;
height = xftg->metrics.height;
-
+
x -= xftg->metrics.x;
y -= xftg->metrics.y;
@@ -561,7 +561,7 @@ _XftSmoothGlyphGray565 (XImage *image,
dstStride = image->bytes_per_line >> 1;
maskLine = (unsigned char *) xftg->bitmap;
maskStride = (width + 3) & ~3;
-
+
while (height--)
{
dst = dstLine;
@@ -612,7 +612,7 @@ _XftSmoothGlyphGray555 (XImage *image,
int w;
srca = color->color.alpha >> 8;
-
+
/* This handles only RGB and BGR */
g = (color->color.green & 0xff00);
if (image->red_mask == 0xf800)
@@ -626,10 +626,10 @@ _XftSmoothGlyphGray555 (XImage *image,
b = (color->color.blue & 0xff00) << 8;
}
src = (srca << 24) | r | g | b;
-
+
width = xftg->metrics.width;
height = xftg->metrics.height;
-
+
x -= xftg->metrics.x;
y -= xftg->metrics.y;
@@ -637,7 +637,7 @@ _XftSmoothGlyphGray555 (XImage *image,
dstStride = image->bytes_per_line >> 1;
maskLine = (unsigned char *) xftg->bitmap;
maskStride = (width + 3) & ~3;
-
+
while (height--)
{
dst = dstLine;
@@ -688,7 +688,7 @@ _XftSmoothGlyphGray (XImage *image,
unsigned long pixel;
int width, height;
int w, tx;
-
+
srca = color->color.alpha >> 8;
src = (srca << 24 |
(color->color.red & 0xff00) << 8 |
@@ -698,7 +698,7 @@ _XftSmoothGlyphGray (XImage *image,
y -= xftg->metrics.y;
width = xftg->metrics.width;
height = xftg->metrics.height;
-
+
maskLine = (unsigned char *) xftg->bitmap;
maskStride = (width + 3) & ~3;
@@ -711,7 +711,7 @@ _XftSmoothGlyphGray (XImage *image,
maskLine += maskStride;
w = width;
tx = x;
-
+
while (w--)
{
m = *mask++;
@@ -766,7 +766,7 @@ _XftSmoothGlyphRgba (XImage *image,
unsigned long pixel;
int width, height;
int w, tx;
-
+
srca = color->color.alpha >> 8;
src = (srca << 24 |
(color->color.red & 0xff00) << 8 |
@@ -776,7 +776,7 @@ _XftSmoothGlyphRgba (XImage *image,
y -= xftg->metrics.y;
width = xftg->metrics.width;
height = xftg->metrics.height;
-
+
mask = (CARD32 *) xftg->bitmap;
_XftExamineBitfield (image->red_mask, &r_shift, &r_len);
@@ -786,7 +786,7 @@ _XftSmoothGlyphRgba (XImage *image,
{
w = width;
tx = x;
-
+
while (w--)
{
ma = *mask++;
@@ -849,7 +849,7 @@ _XftSmoothGlyphPossible (XftDraw *draw)
return FcTrue;
}
-typedef void (*XftSmoothGlyph) (XImage *image,
+typedef void (*XftSmoothGlyph) (XImage *image,
_Xconst XftGlyph *xftg,
int x,
int y,
@@ -960,7 +960,7 @@ XftGlyphCore (XftDraw *draw,
glyphs_loaded = FcTrue;
if (nmissing)
XftFontLoadGlyphs (dpy, public, FcTrue, missing, nmissing);
-
+
g = glyphs;
n = nglyphs;
if ((font->info.antialias || color->color.alpha != 0xffff) &&
@@ -971,7 +971,7 @@ XftGlyphCore (XftDraw *draw,
unsigned int depth;
int ox, oy;
XftSmoothGlyph smooth = _XftSmoothGlyphFind (draw, public);
-
+
XftGlyphExtents (dpy, public, glyphs, nglyphs, &gi);
if (!gi.width || !gi.height)
goto bail1;
@@ -1090,7 +1090,7 @@ XftGlyphSpecCore (XftDraw *draw,
{
XGlyphInfo gi;
int g_x1, g_x2, g_y1, g_y2;
-
+
nmissing = 0;
if (XftFontCheckGlyph (dpy, public, FcTrue, glyphs[i].glyph, missing, &nmissing))
glyphs_loaded = FcTrue;
@@ -1121,7 +1121,7 @@ XftGlyphSpecCore (XftDraw *draw,
y2 = g_y2;
}
}
-
+
if (x1 == x2 || y1 == y2)
goto bail1;
@@ -1186,7 +1186,7 @@ XftGlyphSpecCore (XftDraw *draw,
xftg = _XftGlyphDefault (dpy, public);
if (xftg)
{
- (*smooth) (image, xftg, glyphs[i].x - x1,
+ (*smooth) (image, xftg, glyphs[i].x - x1,
glyphs[i].y - y1, color);
}
}
@@ -1238,13 +1238,13 @@ XftGlyphFontSpecCore (XftDraw *draw,
XftFont *public = glyphs[i].font;
XGlyphInfo gi;
int g_x1, g_x2, g_y1, g_y2;
-
+
nmissing = 0;
if (XftFontCheckGlyph (dpy, public, FcTrue, glyphs[i].glyph, missing, &nmissing))
glyphs_loaded = FcTrue;
if (nmissing)
XftFontLoadGlyphs (dpy, public, FcTrue, missing, nmissing);
-
+
XftGlyphExtents (dpy, public, &glyphs[i].glyph, 1, &gi);
g_x1 = glyphs[i].x - gi.x;
g_y1 = glyphs[i].y - gi.y;
@@ -1279,14 +1279,14 @@ XftGlyphFontSpecCore (XftDraw *draw,
y2 = g_y2;
}
}
-
+
if (x1 == x2 || y1 == y2)
goto bail1;
for (i = 0; i < nglyphs; i++)
if (((XftFontInt *) glyphs[i].font)->info.antialias)
break;
-
+
if ((i != nglyphs || color->color.alpha != 0xffff) &&
_XftSmoothGlyphPossible (draw))
{
@@ -1346,12 +1346,12 @@ XftGlyphFontSpecCore (XftDraw *draw,
XftFontInt *font = (XftFontInt *) public;
XftSmoothGlyph smooth = _XftSmoothGlyphFind (draw, public);
FT_UInt glyph = glyphs[i].glyph;
-
+
if (glyph >= font->num_glyphs || !(xftg = font->glyphs[glyph]))
xftg = _XftGlyphDefault (dpy, public);
if (xftg)
{
- (*smooth) (image, xftg, glyphs[i].x - x1,
+ (*smooth) (image, xftg, glyphs[i].x - x1,
glyphs[i].y - y1, color);
}
}
@@ -1369,7 +1369,7 @@ XftGlyphFontSpecCore (XftDraw *draw,
XftFontInt *font = (XftFontInt *) public;
XftSharpGlyph sharp = _XftSharpGlyphFind (draw, public);
FT_UInt glyph = glyphs[i].glyph;
-
+
if (glyph >= font->num_glyphs || !(xftg = font->glyphs[glyph]))
xftg = _XftGlyphDefault (dpy, public);
if (xftg)
diff --git a/libXft/src/xftdpy.c b/libXft/src/xftdpy.c
index cd50358d2..747b8db81 100644
--- a/libXft/src/xftdpy.c
+++ b/libXft/src/xftdpy.c
@@ -32,19 +32,19 @@ _XftCloseDisplay (Display *dpy, XExtCodes *codes)
info = _XftDisplayInfoGet (dpy, FcFalse);
if (!info)
return 0;
-
+
/*
* Get rid of any dangling unreferenced fonts
*/
info->max_unref_fonts = 0;
XftFontManageMemory (dpy);
-
+
/*
* Clean up the default values
*/
if (info->defaults)
FcPatternDestroy (info->defaults);
-
+
/*
* Unhook from the global list
*/
@@ -52,7 +52,7 @@ _XftCloseDisplay (Display *dpy, XExtCodes *codes)
if (info->display == dpy)
break;
*prev = info->next;
-
+
free (info);
return 0;
}
@@ -126,8 +126,8 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary)
{
Visual *visual = DefaultVisual (dpy, DefaultScreen (dpy));
XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
-
- printf ("XftDisplayInfoGet Default visual 0x%x ",
+
+ printf ("XftDisplayInfoGet Default visual 0x%x ",
(int) visual->visualid);
if (format)
{
@@ -146,7 +146,7 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary)
}
else
printf ("No Render format for default visual\n");
-
+
printf ("XftDisplayInfoGet initialized, hasRender set to \"%s\"\n",
info->hasRender ? "True" : "False");
}
@@ -156,7 +156,7 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary)
info->colors[i].pict = 0;
}
info->fonts = NULL;
-
+
info->next = _XftDisplayInfo;
_XftDisplayInfo = info;
@@ -167,7 +167,7 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary)
if (XftDebug () & XFT_DBG_CACHE)
printf ("global max cache memory %ld\n", info->max_glyph_memory);
-
+
info->num_unref_fonts = 0;
info->max_unref_fonts = XftDefaultGetInteger (dpy,
XFT_MAX_UNREF_FONTS, 0,
@@ -177,7 +177,7 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary)
memset (info->fontHash, '\0', sizeof (XftFont *) * XFT_NUM_FONT_HASH);
return info;
-
+
bail1:
free (info);
bail0:
@@ -387,9 +387,9 @@ _XftDefaultInit (Display *dpy)
goto bail1;
if (!_XftDefaultInitInteger (dpy, pat, XFT_MAX_GLYPH_MEMORY))
goto bail1;
-
+
return pat;
-
+
bail1:
FcPatternDestroy (pat);
bail0:
@@ -404,7 +404,7 @@ _XftDefaultGet (Display *dpy, const char *object, int screen, FcValue *v)
if (!info)
return FcResultNoMatch;
-
+
if (!info->defaults)
{
info->defaults = _XftDefaultInit (dpy);
@@ -462,7 +462,7 @@ XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern)
if (FcPatternGet (pattern, XFT_RENDER, 0, &v) == FcResultNoMatch)
{
FcPatternAddBool (pattern, XFT_RENDER,
- XftDefaultGetBool (dpy, XFT_RENDER, screen,
+ XftDefaultGetBool (dpy, XFT_RENDER, screen,
XftDefaultHasRender (dpy)));
}
if (FcPatternGet (pattern, FC_ANTIALIAS, 0, &v) == FcResultNoMatch)
@@ -518,7 +518,7 @@ XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern)
}
#endif
FcPatternAddInteger (pattern, FC_RGBA,
- XftDefaultGetInteger (dpy, FC_RGBA, screen,
+ XftDefaultGetInteger (dpy, FC_RGBA, screen,
subpixel));
}
if (FcPatternGet (pattern, FC_MINSPACE, 0, &v) == FcResultNoMatch)
@@ -529,10 +529,10 @@ XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern)
}
if (FcPatternGet (pattern, FC_DPI, 0, &v) == FcResultNoMatch)
{
- dpi = (((double) DisplayHeight (dpy, screen) * 25.4) /
+ dpi = (((double) DisplayHeight (dpy, screen) * 25.4) /
(double) DisplayHeightMM (dpy, screen));
- FcPatternAddDouble (pattern, FC_DPI,
- XftDefaultGetDouble (dpy, FC_DPI, screen,
+ FcPatternAddDouble (pattern, FC_DPI,
+ XftDefaultGetDouble (dpy, FC_DPI, screen,
dpi));
}
if (FcPatternGet (pattern, FC_SCALE, 0, &v) == FcResultNoMatch)
diff --git a/libXft/src/xftdraw.c b/libXft/src/xftdraw.c
index 21f8538a3..186bcb876 100644
--- a/libXft/src/xftdraw.c
+++ b/libXft/src/xftdraw.c
@@ -88,7 +88,7 @@ XftDrawDepth (XftDraw *draw)
Window root;
int x, y;
unsigned int width, height, borderWidth, depth;
- if (XGetGeometry (draw->dpy, draw->drawable,
+ if (XGetGeometry (draw->dpy, draw->drawable,
&root, &x, &y, &width, &height,
&borderWidth, &depth))
draw->depth = depth;
@@ -104,7 +104,7 @@ XftDrawBitsPerPixel (XftDraw *draw)
XPixmapFormatValues *formats;
int nformats;
unsigned int depth;
-
+
if ((depth = XftDrawDepth (draw)) &&
(formats = XListPixmapFormats (draw->dpy, &nformats)))
{
@@ -135,7 +135,7 @@ XftDrawCreate (Display *dpy,
draw = (XftDraw *) malloc (sizeof (XftDraw));
if (!draw)
return NULL;
-
+
draw->dpy = dpy;
draw->drawable = drawable;
draw->screen = _XftDrawScreen (dpy, drawable, visual);
@@ -303,7 +303,7 @@ XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color)
if (!info || !info->solidFormat)
return 0;
-
+
/*
* Monochrome targets require special handling; the PictOp controls
* the color, and the color must be opaque
@@ -322,9 +322,9 @@ XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color)
*/
for (i = 0; i < XFT_NUM_SOLID_COLOR; i++)
{
- if (info->colors[i].pict &&
+ if (info->colors[i].pict &&
info->colors[i].screen == draw->screen &&
- !memcmp ((void *) &color->color,
+ !memcmp ((void *) &color->color,
(void *) &info->colors[i].color,
sizeof (XRenderColor)))
return info->colors[i].pict;
@@ -348,7 +348,7 @@ XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color)
{
Pixmap pix;
XRenderPictureAttributes pa;
-
+
pix = XCreatePixmap (dpy, RootWindow (dpy, draw->screen), 1, 1,
info->solidFormat->depth);
pa.repeat = True;
@@ -391,7 +391,7 @@ _XftDrawRenderPrepare (XftDraw *draw)
format = _XftDrawFormat (draw);
if (!format)
return FcFalse;
-
+
if (draw->subwindow_mode == IncludeInferiors)
{
pa.subwindow_mode = IncludeInferiors;
@@ -454,7 +454,7 @@ _XftDrawCorePrepare (XftDraw *draw, _Xconst XftColor *color)
XSetForeground (draw->dpy, draw->core.gc, color->pixel);
return FcTrue;
}
-
+
_X_EXPORT Picture
XftDrawPicture (XftDraw *draw)
{
@@ -479,7 +479,7 @@ XftDrawGlyphs (XftDraw *draw,
if (font->format)
{
Picture src;
-
+
if (_XftDrawRenderPrepare (draw) &&
(src = XftDrawSrcPicture (draw, color)))
XftGlyphRender (draw->dpy, _XftDrawOp (draw, color),
@@ -497,7 +497,7 @@ _X_EXPORT void
XftDrawString8 (XftDraw *draw,
_Xconst XftColor *color,
XftFont *pub,
- int x,
+ int x,
int y,
_Xconst FcChar8 *string,
int len)
@@ -507,7 +507,7 @@ XftDrawString8 (XftDraw *draw,
if (XftDebug () & XFT_DBG_DRAW)
printf ("DrawString \"%*.*s\"\n", len, len, string);
-
+
if (len <= NUM_LOCAL)
glyphs = glyphs_local;
else
@@ -545,7 +545,7 @@ XftDrawString16 (XftDraw *draw,
}
for (i = 0; i < len; i++)
glyphs[i] = XftCharIndex (draw->dpy, pub, string[i]);
-
+
XftDrawGlyphs (draw, color, pub, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
@@ -573,7 +573,7 @@ XftDrawString32 (XftDraw *draw,
}
for (i = 0; i < len; i++)
glyphs[i] = XftCharIndex (draw->dpy, pub, string[i]);
-
+
XftDrawGlyphs (draw, color, pub, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
@@ -583,7 +583,7 @@ _X_EXPORT void
XftDrawStringUtf8 (XftDraw *draw,
_Xconst XftColor *color,
XftFont *pub,
- int x,
+ int x,
int y,
_Xconst FcChar8 *string,
int len)
@@ -795,7 +795,7 @@ XftDrawCharFontSpec (XftDraw *draw,
_X_EXPORT void
XftDrawRect (XftDraw *draw,
_Xconst XftColor *color,
- int x,
+ int x,
int y,
unsigned int width,
unsigned int height)
@@ -825,9 +825,9 @@ XftDrawSetClip (XftDraw *draw,
*/
if (!r && draw->clip_type == XftClipTypeNone)
return True;
-
- if (r &&
- draw->clip_type == XftClipTypeRegion &&
+
+ if (r &&
+ draw->clip_type == XftClipTypeRegion &&
XEqualRegion (r, draw->clip.region))
{
return True;
@@ -862,7 +862,7 @@ XftDrawSetClip (XftDraw *draw,
case XftClipTypeNone:
break;
}
-
+
/*
* Set the clip
*/
@@ -946,7 +946,7 @@ XftDrawSetClipRectangles (XftDraw *draw,
case XftClipTypeNone:
break;
}
-
+
/*
* Set the clip
*/
@@ -986,7 +986,7 @@ XftDrawSetSubwindowMode (XftDraw *draw, int mode)
XRenderPictureAttributes pa;
pa.subwindow_mode = mode;
- XRenderChangePicture (draw->dpy, draw->render.pict,
+ XRenderChangePicture (draw->dpy, draw->render.pict,
CPSubwindowMode, &pa);
}
if (draw->core.gc)
diff --git a/libXft/src/xftextent.c b/libXft/src/xftextent.c
index 71f5c1c13..1e418f28a 100644
--- a/libXft/src/xftextent.c
+++ b/libXft/src/xftextent.c
@@ -21,7 +21,7 @@
*/
#include "xftint.h"
-
+
_X_EXPORT void
XftGlyphExtents (Display *dpy,
XftFont *pub,
@@ -41,7 +41,7 @@ XftGlyphExtents (Display *dpy,
int left, right, top, bottom;
int overall_left, overall_right;
int overall_top, overall_bottom;
-
+
g = glyphs;
n = nglyphs;
nmissing = 0;
@@ -116,7 +116,7 @@ XftGlyphExtents (Display *dpy,
_X_EXPORT void
XftTextExtents8 (Display *dpy,
XftFont *pub,
- _Xconst FcChar8 *string,
+ _Xconst FcChar8 *string,
int len,
XGlyphInfo *extents)
{
@@ -144,7 +144,7 @@ XftTextExtents8 (Display *dpy,
_X_EXPORT void
XftTextExtents16 (Display *dpy,
XftFont *pub,
- _Xconst FcChar16 *string,
+ _Xconst FcChar16 *string,
int len,
XGlyphInfo *extents)
{
@@ -172,7 +172,7 @@ XftTextExtents16 (Display *dpy,
_X_EXPORT void
XftTextExtents32 (Display *dpy,
XftFont *pub,
- _Xconst FcChar32 *string,
+ _Xconst FcChar32 *string,
int len,
XGlyphInfo *extents)
{
@@ -200,7 +200,7 @@ XftTextExtents32 (Display *dpy,
_X_EXPORT void
XftTextExtentsUtf8 (Display *dpy,
XftFont *pub,
- _Xconst FcChar8 *string,
+ _Xconst FcChar8 *string,
int len,
XGlyphInfo *extents)
{
@@ -243,7 +243,7 @@ XftTextExtentsUtf8 (Display *dpy,
_X_EXPORT void
XftTextExtentsUtf16 (Display *dpy,
XftFont *pub,
- _Xconst FcChar8 *string,
+ _Xconst FcChar8 *string,
FcEndian endian,
int len,
XGlyphInfo *extents)
diff --git a/libXft/src/xftfont.c b/libXft/src/xftfont.c
index 70ab5d8bb..d361498db 100644
--- a/libXft/src/xftfont.c
+++ b/libXft/src/xftfont.c
@@ -33,7 +33,7 @@ XftFontMatch (Display *dpy,
if (!XftInit (NULL))
return NULL;
-
+
new = FcPatternDuplicate (pattern);
if (!new)
return NULL;
@@ -100,7 +100,7 @@ XftFontOpen (Display *dpy, int screen, ...)
FcPatternDestroy (pat);
if (!match)
return NULL;
-
+
font = XftFontOpenPattern (dpy, match);
if (!font)
{
@@ -129,7 +129,7 @@ XftFontOpenName (Display *dpy, int screen, const char *name)
else
printf ("Invalid name\n");
}
-
+
if (!pat)
return NULL;
match = XftFontMatch (dpy, screen, pat, &result);
@@ -146,7 +146,7 @@ XftFontOpenName (Display *dpy, int screen, const char *name)
FcPatternDestroy (pat);
if (!match)
return NULL;
-
+
font = XftFontOpenPattern (dpy, match);
if (!font)
{
@@ -154,7 +154,7 @@ XftFontOpenName (Display *dpy, int screen, const char *name)
printf ("No Font\n");
FcPatternDestroy (match);
}
-
+
return font;
}
@@ -175,7 +175,7 @@ XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd)
else
FcPatternPrint (pat);
}
-
+
if (!pat)
return NULL;
match = XftFontMatch (dpy, screen, pat, &result);
@@ -192,7 +192,7 @@ XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd)
FcPatternDestroy (pat);
if (!match)
return NULL;
-
+
font = XftFontOpenPattern (dpy, match);
if (!font)
{
@@ -200,7 +200,7 @@ XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd)
printf ("No Font\n");
FcPatternDestroy (match);
}
-
+
return font;
}
diff --git a/libXft/src/xftfreetype.c b/libXft/src/xftfreetype.c
index 7238b8259..3d930be78 100644
--- a/libXft/src/xftfreetype.c
+++ b/libXft/src/xftfreetype.c
@@ -57,20 +57,20 @@ _XftGetFile (const FcChar8 *file, int id)
f = malloc (sizeof (XftFtFile) + strlen ((char *) file) + 1);
if (!f)
return NULL;
-
+
XftMemAlloc (XFT_MEM_FILE, sizeof (XftFtFile) + strlen ((char *) file) + 1);
if (XftDebug () & XFT_DBG_REF)
printf ("FontFile %s/%d matches new\n",
file, id);
f->next = _XftFtFiles;
_XftFtFiles = f;
-
+
f->ref = 1;
-
+
f->file = (char *) (f+1);
strcpy (f->file, (char *) file);
f->id = id;
-
+
f->lock = 0;
f->face = NULL;
f->xsize = 0;
@@ -89,7 +89,7 @@ _XftGetFaceFile (FT_Face face)
return NULL;
XftMemAlloc (XFT_MEM_FILE, sizeof(XftFtFile));
f->next = NULL;
-
+
f->ref = 1;
f->file = NULL;
@@ -154,7 +154,7 @@ _XftLockFile (XftFtFile *f)
printf ("Loading file %s/%d\n", f->file, f->id);
if (FT_New_Face (_XftFTlibrary, f->file, f->id, &f->face))
--f->lock;
-
+
f->xsize = 0;
f->ysize = 0;
f->matrix.xx = f->matrix.xy = f->matrix.yx = f->matrix.yy = 0;
@@ -188,11 +188,11 @@ _X_HIDDEN FcBool
_XftSetFace (XftFtFile *f, FT_F26Dot6 xsize, FT_F26Dot6 ysize, FT_Matrix *matrix)
{
FT_Face face = f->face;
-
+
if (f->xsize != xsize || f->ysize != ysize)
{
if (XftDebug() & XFT_DBG_GLYPH)
- printf ("Set face size to %dx%d (%dx%d)\n",
+ printf ("Set face size to %dx%d (%dx%d)\n",
(int) (xsize >> 6), (int) (ysize >> 6), (int) xsize, (int) ysize);
/*
* Bitmap only faces must match exactly, so find the closest
@@ -217,7 +217,7 @@ _XftSetFace (XftFtFile *f, FT_F26Dot6 xsize, FT_F26Dot6 ysize, FT_Matrix *matrix
best = i;
}
}
- /*
+ /*
* Freetype 2.1.7 and earlier used width/height
* for matching sizes in the BDF and PCF loaders.
* This has been fixed for 2.1.8. Because BDF and PCF
@@ -265,7 +265,7 @@ static void
_XftReleaseFile (XftFtFile *f)
{
XftFtFile **prev;
-
+
if (--f->ref != 0)
return;
if (f->lock)
@@ -283,7 +283,7 @@ _XftReleaseFile (XftFtFile *f)
if (f->face)
FT_Done_Face (f->face);
}
- XftMemFree (XFT_MEM_FILE,
+ XftMemFree (XFT_MEM_FILE,
sizeof (XftFtFile) + (f->file ? strlen (f->file) + 1 : 0));
free (f);
}
@@ -349,7 +349,7 @@ XftLockFace (XftFont *public)
XftFontInt *font = (XftFontInt *) public;
XftFontInfo *fi = &font->info;
FT_Face face;
-
+
face = _XftLockFile (fi->file);
/*
* Make sure the face is usable at the requested size
@@ -394,7 +394,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
* Initialize the whole XftFontInfo so that padding doesn't interfere with
* hash or XftFontInfoEqual().
*/
-
+
memset (fi, '\0', sizeof(*fi));
/*
@@ -409,7 +409,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
default:
goto bail0;
}
-
+
switch (FcPatternGetInteger (pattern, FC_INDEX, 0, &id)) {
case FcResultNoMatch:
id = 0;
@@ -419,7 +419,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
default:
goto bail0;
}
-
+
if (filename)
fi->file = _XftGetFile (filename, id);
else if (FcPatternGetFTFace (pattern, FC_FT_FACE, 0, &face) == FcResultMatch
@@ -436,7 +436,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
if (FcPatternGetDouble (pattern, FC_ASPECT, 0, &aspect) != FcResultMatch)
aspect = 1.0;
-
+
fi->ysize = (FT_F26Dot6) (dsize * 64.0);
fi->xsize = (FT_F26Dot6) (dsize * aspect * 64.0);
@@ -455,7 +455,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
default:
goto bail1;
}
-
+
/*
* Get rgba value
*/
@@ -468,7 +468,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
default:
goto bail1;
}
-
+
/*
* Get matrix and transform values
*/
@@ -489,8 +489,8 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
fi->transform = (fi->matrix.xx != 0x10000 || fi->matrix.xy != 0 ||
fi->matrix.yx != 0 || fi->matrix.yy != 0x10000);
-
- /*
+
+ /*
* Get render value, set to false if no Render extension present
*/
if (info->hasRender)
@@ -507,7 +507,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
}
else
fi->render = FcFalse;
-
+
/*
* Compute glyph load flags
*/
@@ -530,7 +530,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
/* disable bitmaps when anti-aliasing or transforming glyphs */
if ((!bitmap && fi->antialias) || fi->transform)
fi->load_flags |= FT_LOAD_NO_BITMAP;
-
+
/* disable hinting if requested */
switch (FcPatternGetBool (pattern, FC_HINTING, 0, &hinting)) {
case FcResultNoMatch:
@@ -555,7 +555,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
#else
fi->embolden = FcFalse;
#endif
-
+
#ifdef FC_HINT_STYLE
switch (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style)) {
case FcResultNoMatch:
@@ -615,7 +615,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
else
fi->load_flags |= FT_LOAD_TARGET_MONO;
#endif
-
+
/* set vertical layout if requested */
switch (FcPatternGetBool (pattern, FC_VERTICAL_LAYOUT, 0, &vertical_layout)) {
case FcResultNoMatch:
@@ -657,7 +657,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
if (!global_advance)
fi->load_flags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
-
+
/*
* Get requested spacing value
*/
@@ -670,7 +670,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
default:
goto bail1;
}
-
+
/*
* Check for minspace
*/
@@ -685,7 +685,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
goto bail1;
}
/*
- * Check for fixed pixel spacing
+ * Check for fixed pixel spacing
*/
switch (FcPatternGetInteger (pattern, FC_CHAR_WIDTH, 0, &fi->char_width)) {
case FcResultNoMatch:
@@ -709,12 +709,12 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
while (nhash--)
hash += *hashp++;
fi->hash = hash;
-
+
/*
* All done
*/
return FcTrue;
-
+
bail1:
_XftReleaseFile (fi->file);
fi->file = NULL;
@@ -736,7 +736,7 @@ XftFontInfoCreate (Display *dpy, _Xconst FcPattern *pattern)
if (!fi)
return NULL;
-
+
if (!XftFontInfoFill (dpy, pattern, fi))
{
free (fi);
@@ -759,7 +759,7 @@ XftFontInfoHash (_Xconst XftFontInfo *fi)
{
return fi->hash;
}
-
+
_X_EXPORT FcBool
XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b)
{
@@ -767,8 +767,8 @@ XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b)
}
_X_EXPORT XftFont *
-XftFontOpenInfo (Display *dpy,
- FcPattern *pattern,
+XftFontOpenInfo (Display *dpy,
+ FcPattern *pattern,
XftFontInfo *fi)
{
XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True);
@@ -803,14 +803,14 @@ XftFontOpenInfo (Display *dpy,
}
/*
- * No existing font, create another.
+ * No existing font, create another.
*/
-
+
if (XftDebug () & XFT_DBG_CACHE)
printf ("New font %s/%d size %dx%d\n",
fi->file->file, fi->file->id,
(int) fi->xsize >> 6, (int) fi->ysize >> 6);
-
+
if (FcPatternGetInteger (pattern, XFT_MAX_GLYPH_MEMORY, 0,
&max_glyph_memory) != FcResultMatch)
max_glyph_memory = XFT_FONT_MAX_GLYPH_MEMORY;
@@ -832,7 +832,7 @@ XftFontOpenInfo (Display *dpy,
charset = FcCharSetCopy (charset);
else
charset = FcFreeTypeCharSet (face, FcConfigGetBlanks (NULL));
-
+
antialias = fi->antialias;
if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
antialias = FcFalse;
@@ -860,13 +860,13 @@ XftFontOpenInfo (Display *dpy,
{
format = XRenderFindStandardFormat (dpy, PictStandardA1);
}
-
+
if (!format)
goto bail2;
}
else
format = NULL;
-
+
if (charset)
{
num_unicode = FcCharSetCount (charset);
@@ -879,17 +879,17 @@ XftFontOpenInfo (Display *dpy,
hash_value = 0;
rehash_value = 0;
}
-
+
/*
* Sometimes the glyphs are numbered 1..n, other times 0..n-1,
* accept either numbering scheme by making room in the table
*/
num_glyphs = face->num_glyphs + 1;
- alloc_size = (sizeof (XftFontInt) +
+ alloc_size = (sizeof (XftFontInt) +
num_glyphs * sizeof (XftGlyph *) +
hash_value * sizeof (XftUcsHash));
font = malloc (alloc_size);
-
+
if (!font)
goto bail2;
@@ -901,12 +901,12 @@ XftFontOpenInfo (Display *dpy,
if (fi->transform)
{
FT_Vector vector;
-
+
vector.x = 0;
vector.y = face->size->metrics.descender;
FT_Vector_Transform (&vector, &fi->matrix);
descent = -(vector.y >> 6);
-
+
vector.x = 0;
vector.y = face->size->metrics.ascender;
FT_Vector_Transform (&vector, &fi->matrix);
@@ -934,7 +934,7 @@ XftFontOpenInfo (Display *dpy,
font->public.ascent = ascent;
font->public.descent = descent;
font->public.height = height;
-
+
if (fi->char_width)
font->public.max_advance_width = fi->char_width;
else
@@ -952,7 +952,7 @@ XftFontOpenInfo (Display *dpy,
}
font->public.charset = charset;
font->public.pattern = pattern;
-
+
/*
* Management fields
*/
@@ -960,10 +960,10 @@ XftFontOpenInfo (Display *dpy,
font->next = info->fonts;
info->fonts = &font->public;
-
+
font->hash_next = *bucket;
*bucket = &font->public;
-
+
/*
* Copy the info over
*/
@@ -978,7 +978,7 @@ XftFontOpenInfo (Display *dpy,
* bump XftFile reference count
*/
font->info.file->ref++;
-
+
/*
* Per glyph information
*/
@@ -1001,18 +1001,18 @@ XftFontOpenInfo (Display *dpy,
*/
font->glyphset = 0;
font->format = format;
-
+
/*
* Glyph memory management fields
*/
font->glyph_memory = 0;
font->max_glyph_memory = max_glyph_memory;
font->use_free_glyphs = info->use_free_glyphs;
-
+
_XftUnlockFile (fi->file);
return &font->public;
-
+
bail2:
FcCharSetDestroy (charset);
bail1:
@@ -1050,7 +1050,7 @@ XftFontDestroy (Display *dpy, XftFont *public)
XftDisplayInfo *info = _XftDisplayInfoGet (dpy, False);
XftFontInt *font = (XftFontInt *) public;
int i;
-
+
/* note reduction in memory use */
if (info)
info->glyph_memory -= font->glyph_memory;
@@ -1070,11 +1070,11 @@ XftFontDestroy (Display *dpy, XftFont *public)
free (xftg);
}
}
-
+
/* Free the pattern and the charset */
FcPatternDestroy (font->public.pattern);
FcCharSetDestroy (font->public.charset);
-
+
/* Finally, free the font structure */
XftMemFree (XFT_MEM_FONT, sizeof (XftFontInt) +
font->num_glyphs * sizeof (XftGlyph *) +
@@ -1087,7 +1087,7 @@ XftFontFindNthUnref (XftDisplayInfo *info, int n)
{
XftFont *public;
XftFontInt *font;
-
+
for (public = info->fonts; public; public = font->next)
{
font = (XftFontInt*) public;
@@ -1148,10 +1148,10 @@ XftFontClose (Display *dpy, XftFont *public)
{
XftDisplayInfo *info = _XftDisplayInfoGet (dpy, False);
XftFontInt *font = (XftFontInt *) public;
-
+
if (--font->ref != 0)
return;
-
+
if (info)
{
++info->num_unref_fonts;
diff --git a/libXft/src/xftglyphs.c b/libXft/src/xftglyphs.c
index 10adb1587..8e0d247a0 100644
--- a/libXft/src/xftglyphs.c
+++ b/libXft/src/xftglyphs.c
@@ -106,7 +106,7 @@ XftFontLoadGlyphs (Display *dpy,
return;
face = XftLockFace (&font->public);
-
+
if (!face)
return;
@@ -137,7 +137,7 @@ XftFontLoadGlyphs (Display *dpy,
xftg = font->glyphs[glyphindex];
if (!xftg)
continue;
-
+
if (XftDebug() & XFT_DBG_CACHE)
_XftFontValidateMemory (dpy, pub);
/*
@@ -147,7 +147,7 @@ XftFontLoadGlyphs (Display *dpy,
*/
if (xftg->glyph_memory)
continue;
-
+
error = FT_Load_Glyph (face, glyphindex, font->info.load_flags);
if (error)
{
@@ -168,7 +168,7 @@ XftFontLoadGlyphs (Display *dpy,
#define CEIL(x) (((x)+63) & -64)
#define TRUNC(x) ((x) >> 6)
#define ROUND(x) (((x)+32) & -64)
-
+
glyphslot = face->glyph;
#if HAVE_FT_GLYPHSLOT_EMBOLDEN
@@ -181,7 +181,7 @@ XftFontLoadGlyphs (Display *dpy,
/*
* Compute glyph metrics from FreeType information
*/
- if(font->info.transform && glyphslot->format != ft_glyph_format_bitmap)
+ if(font->info.transform && glyphslot->format != ft_glyph_format_bitmap)
{
/*
* calculate the true width by transforming all four corners.
@@ -192,9 +192,9 @@ XftFontLoadGlyphs (Display *dpy,
for(yc = 0; yc <= 1; yc++) {
vector.x = glyphslot->metrics.horiBearingX + xc * glyphslot->metrics.width;
vector.y = glyphslot->metrics.horiBearingY - yc * glyphslot->metrics.height;
- FT_Vector_Transform(&vector, &font->info.matrix);
+ FT_Vector_Transform(&vector, &font->info.matrix);
if (XftDebug() & XFT_DBG_GLYPH)
- printf("Trans %d %d: %d %d\n", (int) xc, (int) yc,
+ printf("Trans %d %d: %d %d\n", (int) xc, (int) yc,
(int) vector.x, (int) vector.y);
if(xc == 0 && yc == 0) {
left = right = vector.x;
@@ -235,7 +235,7 @@ XftFontLoadGlyphs (Display *dpy,
if (TRUNC(bottom) > font->public.max_advance_width)
{
int adjust;
-
+
adjust = bottom - (font->public.max_advance_width << 6);
if (adjust > top)
adjust = top;
@@ -249,7 +249,7 @@ XftFontLoadGlyphs (Display *dpy,
if (TRUNC(right) > font->public.max_advance_width)
{
int adjust;
-
+
adjust = right - (font->public.max_advance_width << 6);
if (adjust > left)
adjust = left;
@@ -309,14 +309,14 @@ XftFontLoadGlyphs (Display *dpy,
xftg->metrics.xOff = TRUNC(ROUND(glyphslot->advance.x));
xftg->metrics.yOff = -TRUNC(ROUND(glyphslot->advance.y));
}
-
+
/*
* If the glyph is relatively large (> 1% of server memory),
* don't send it until necessary
*/
if (!need_bitmaps && size > info->max_glyph_memory / 100)
continue;
-
+
/*
* Make sure there's enough buffer space for the glyph
*/
@@ -343,9 +343,9 @@ XftFontLoadGlyphs (Display *dpy,
ftbit.pixel_mode = ft_pixel_mode_grays;
else
ftbit.pixel_mode = ft_pixel_mode_mono;
-
+
ftbit.buffer = bufBitmap;
-
+
if (subpixel)
FT_Outline_Transform (&glyphslot->outline, &matrix);
@@ -407,7 +407,7 @@ XftFontLoadGlyphs (Display *dpy,
(int) glyphindex);
continue;
}
-
+
if (XftDebug() & XFT_DBG_GLYPH)
{
printf ("glyph %d:\n", (int) glyphindex);
@@ -426,7 +426,7 @@ XftFontLoadGlyphs (Display *dpy,
line = bufBitmap;
for (y = 0; y < height * vmul; y++)
{
- if (font->info.antialias)
+ if (font->info.antialias)
{
static char den[] = { " .:;=+*#" };
for (x = 0; x < pitch; x++)
@@ -464,7 +464,7 @@ XftFontLoadGlyphs (Display *dpy,
int rf, gf, bf;
int s;
int o, os;
-
+
/*
* Filter the glyph to soften the color fringes
*/
@@ -525,7 +525,7 @@ XftFontLoadGlyphs (Display *dpy,
*out++ = (green << 24) | (red << 16) | (green << 8) | blue;
}
}
-
+
xftg->glyph_memory = sizergba + sizeof (XftGlyph);
if (font->format)
{
@@ -534,7 +534,7 @@ XftFontLoadGlyphs (Display *dpy,
if (ImageByteOrder (dpy) != XftNativeByteOrder ())
XftSwapCARD32 ((CARD32 *) bufBitmapRgba, sizergba >> 2);
XRenderAddGlyphs (dpy, font->glyphset, &glyph,
- &xftg->metrics, 1,
+ &xftg->metrics, 1,
(char *) bufBitmapRgba, sizergba);
}
else
@@ -580,7 +580,7 @@ XftFontLoadGlyphs (Display *dpy,
if (!font->glyphset)
font->glyphset = XRenderCreateGlyphSet (dpy, font->format);
XRenderAddGlyphs (dpy, font->glyphset, &glyph,
- &xftg->metrics, 1,
+ &xftg->metrics, 1,
(char *) bufBitmap, size);
}
else
@@ -622,7 +622,7 @@ XftFontUnloadGlyphs (Display *dpy,
FT_UInt glyphindex;
Glyph glyphBuf[1024];
int nused;
-
+
nused = 0;
while (nglyph--)
{
@@ -656,7 +656,7 @@ XftFontUnloadGlyphs (Display *dpy,
free (xftg);
XftMemFree (XFT_MEM_GLYPH, sizeof (XftGlyph));
font->glyphs[glyphindex] = NULL;
- }
+ }
if (font->glyphset && nused)
XRenderFreeGlyphs (dpy, font->glyphset, glyphBuf, nused);
}
@@ -672,7 +672,7 @@ XftFontCheckGlyph (Display *dpy,
XftFontInt *font = (XftFontInt *) pub;
XftGlyph *xftg;
int n;
-
+
if (glyph >= font->num_glyphs)
return FcFalse;
xftg = font->glyphs[glyph];
@@ -715,14 +715,14 @@ XftCharExists (Display *dpy,
#define Missing ((FT_UInt) ~0)
_X_EXPORT FT_UInt
-XftCharIndex (Display *dpy,
+XftCharIndex (Display *dpy,
XftFont *pub,
FcChar32 ucs4)
{
XftFontInt *font = (XftFontInt *) pub;
FcChar32 ent, offset;
FT_Face face;
-
+
if (!font->hash_value)
return 0;
@@ -765,7 +765,7 @@ _XftFontUncacheGlyph (Display *dpy, XftFont *pub)
unsigned long glyph_memory;
FT_UInt glyphindex;
XftGlyph *xftg;
-
+
if (!font->glyph_memory)
return;
if (font->use_free_glyphs)
@@ -781,7 +781,7 @@ _XftFontUncacheGlyph (Display *dpy, XftFont *pub)
}
glyph_memory = 0;
}
-
+
if (XftDebug() & XFT_DBG_CACHE)
_XftFontValidateMemory (dpy, pub);
for (glyphindex = 0; glyphindex < font->num_glyphs; glyphindex++)
diff --git a/libXft/src/xftint.h b/libXft/src/xftint.h
index 3aafecf86..43f9ebec9 100644
--- a/libXft/src/xftint.h
+++ b/libXft/src/xftint.h
@@ -115,14 +115,14 @@ typedef struct _XftUcsHash {
typedef struct _XftFtFile {
struct _XftFtFile *next;
int ref; /* number of font infos using this file */
-
+
char *file; /* file name */
int id; /* font index within that file */
FT_F26Dot6 xsize; /* current xsize setting */
FT_F26Dot6 ysize; /* current ysize setting */
FT_Matrix matrix; /* current matrix setting */
-
+
int lock; /* lock count; can't unload unless 0 */
FT_Face face; /* pointer to face; only valid when lock */
} XftFtFile;
@@ -337,7 +337,7 @@ FcFontSet *XftListFontSets (FcFontSet **sets, int nsets, FcPattern *p, FcObjectS
void
XftRectCore (XftDraw *draw,
_Xconst XftColor *color,
- int x,
+ int x,
int y,
unsigned int width,
unsigned int height);
@@ -401,7 +401,7 @@ FcBool
XftDrawRenderPrepare (XftDraw *draw);
/* xftextent.c */
-
+
/* xftfont.c */
/* xftfreetype.c */
@@ -436,7 +436,7 @@ XftListFontsPatternObjects (Display *dpy,
FcObjectSet *os);
/* xftname.c */
-void
+void
_XftNameInit (void);
/* xftrender.c */
diff --git a/libXft/src/xftlist.c b/libXft/src/xftlist.c
index 0780f7ca8..f15974530 100644
--- a/libXft/src/xftlist.c
+++ b/libXft/src/xftlist.c
@@ -45,12 +45,12 @@ XftListFonts (Display *dpy,
va_start (va, screen);
FcPatternVapBuild (pattern, NULL, va);
-
+
first = va_arg (va, const char *);
FcObjectSetVapBuild (os, first, va);
-
+
va_end (va);
-
+
fs = XftListFontsPatternObjects (dpy, screen, pattern, os);
FcPatternDestroy (pattern);
FcObjectSetDestroy (os);
diff --git a/libXft/src/xftname.c b/libXft/src/xftname.c
index a0c6be704..30dd6e06c 100644
--- a/libXft/src/xftname.c
+++ b/libXft/src/xftname.c
@@ -33,7 +33,7 @@ static const FcObjectType _XftObjectTypes[] = {
static FcBool _XftNameInitialized;
-_X_HIDDEN void
+_X_HIDDEN void
_XftNameInit (void)
{
if (_XftNameInitialized)
@@ -42,11 +42,11 @@ _XftNameInit (void)
FcNameRegisterObjectTypes (_XftObjectTypes, NUM_OBJECT_TYPES);
}
-_X_EXPORT FcPattern
+_X_EXPORT FcPattern
*XftNameParse (const char *name)
-{
+{
_XftNameInit ();
- return FcNameParse ((FcChar8 *) name);
+ return FcNameParse ((FcChar8 *) name);
}
_X_EXPORT FcBool
diff --git a/libXft/src/xftrender.c b/libXft/src/xftrender.c
index 94c211bde..b280c0313 100644
--- a/libXft/src/xftrender.c
+++ b/libXft/src/xftrender.c
@@ -55,10 +55,10 @@ XftGlyphRender (Display *dpy,
unsigned int char_local[NUM_LOCAL];
unsigned int *chars;
FcBool glyphs_loaded;
-
+
if (!font->format)
return;
-
+
/*
* Load missing glyphs
*/
@@ -75,7 +75,7 @@ XftGlyphRender (Display *dpy,
}
if (nmissing)
XftFontLoadGlyphs (dpy, pub, FcTrue, missing, nmissing);
-
+
if (!font->glyphset)
goto bail1;
if (max < 0x100)
@@ -169,12 +169,12 @@ XftGlyphSpecRender (Display *dpy,
FcBool glyphs_loaded;
int nelt;
int x, y;
-
+
if (!font->format)
return;
if (!nglyphs)
return;
-
+
/*
* Load missing glyphs
*/
@@ -192,7 +192,7 @@ XftGlyphSpecRender (Display *dpy,
}
if (nmissing)
XftFontLoadGlyphs (dpy, pub, FcTrue, missing, nmissing);
-
+
if (!font->glyphset)
goto bail1;
@@ -224,7 +224,7 @@ XftGlyphSpecRender (Display *dpy,
char8 = (char *) chars;
char16 = (unsigned short *) chars;
char32 = (unsigned int *) chars;
-
+
/*
* Compute the number of glyph elts needed
*/
@@ -249,7 +249,7 @@ XftGlyphSpecRender (Display *dpy,
/* Substitute default for non-existant glyphs */
if (g >= font->num_glyphs || !font->glyphs[g])
g = 0;
- /*
+ /*
* check to see if the glyph is placed where it would
* fall using the normal spacing
*/
@@ -354,7 +354,7 @@ XftCharSpecRender (Display *dpy,
Picture src,
XftFont *pub,
Picture dst,
- int srcx,
+ int srcx,
int srcy,
_Xconst XftCharSpec *chars,
int len)
@@ -396,7 +396,7 @@ static XRenderPictFormat *
XftPreferFormat (Display *dpy, XRenderPictFormat *a, XRenderPictFormat *b)
{
XRenderPictFormat *prefer = NULL;
-
+
if (a == b)
prefer = a;
else if (XftIsARGBFormat(a) != XftIsARGBFormat(b))
@@ -439,10 +439,10 @@ XftGlyphFontSpecRender (Display *dpy,
FcBool glyphs_loaded;
int nelt;
int x, y;
-
+
if (!nglyphs)
return;
-
+
/*
* Load missing glyphs. Have to load them
* one at a time in case the font changes
@@ -467,7 +467,7 @@ XftGlyphFontSpecRender (Display *dpy,
if (!font->glyphset)
goto bail1;
}
-
+
/*
* See what encoding size is needed
*/
@@ -496,7 +496,7 @@ XftGlyphFontSpecRender (Display *dpy,
char8 = (char *) chars;
char16 = (unsigned short *) chars;
char32 = (unsigned int *) chars;
-
+
/*
* Compute the number of glyph elts needed
*/
@@ -531,7 +531,7 @@ XftGlyphFontSpecRender (Display *dpy,
/* Substitute default for non-existant glyphs */
if (g >= font->num_glyphs || !font->glyphs[g])
g = 0;
- /*
+ /*
* check to see if the glyph is placed where it would
* fall using the normal spacing
*/
@@ -571,7 +571,7 @@ XftGlyphFontSpecRender (Display *dpy,
{
XftFont *pub = glyphs[i].font;
XftFontInt *font = (XftFontInt *) pub;
-
+
g = glyphs[i].glyph;
/* Substitute default for non-existant glyphs */
if (g >= font->num_glyphs || !font->glyphs[g])
@@ -699,7 +699,7 @@ XftTextRender8 (Display *dpy,
}
for (i = 0; i < len; i++)
glyphs[i] = XftCharIndex (dpy, pub, string[i]);
- XftGlyphRender (dpy, op, src, pub, dst,
+ XftGlyphRender (dpy, op, src, pub, dst,
srcx, srcy, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
@@ -731,7 +731,7 @@ XftTextRender16 (Display *dpy,
}
for (i = 0; i < len; i++)
glyphs[i] = XftCharIndex (dpy, pub, string[i]);
- XftGlyphRender (dpy, op, src, pub, dst,
+ XftGlyphRender (dpy, op, src, pub, dst,
srcx, srcy, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
@@ -762,9 +762,9 @@ XftTextRender16BE (Display *dpy,
return;
}
for (i = 0; i < len; i++)
- glyphs[i] = XftCharIndex (dpy, pub,
+ glyphs[i] = XftCharIndex (dpy, pub,
(string[i*2]<<8) | string[i*2+1]);
- XftGlyphRender (dpy, op, src, pub, dst,
+ XftGlyphRender (dpy, op, src, pub, dst,
srcx, srcy, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
@@ -795,9 +795,9 @@ XftTextRender16LE (Display *dpy,
return;
}
for (i = 0; i < len; i++)
- glyphs[i] = XftCharIndex (dpy, pub,
+ glyphs[i] = XftCharIndex (dpy, pub,
string[i*2] | (string[i*2+1]<<8));
- XftGlyphRender (dpy, op, src, pub, dst,
+ XftGlyphRender (dpy, op, src, pub, dst,
srcx, srcy, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
@@ -829,7 +829,7 @@ XftTextRender32 (Display *dpy,
}
for (i = 0; i < len; i++)
glyphs[i] = XftCharIndex (dpy, pub, string[i]);
- XftGlyphRender (dpy, op, src, pub, dst,
+ XftGlyphRender (dpy, op, src, pub, dst,
srcx, srcy, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
@@ -860,12 +860,12 @@ XftTextRender32BE (Display *dpy,
return;
}
for (i = 0; i < len; i++)
- glyphs[i] = XftCharIndex (dpy, pub,
+ glyphs[i] = XftCharIndex (dpy, pub,
(string[i*4] << 24) |
(string[i*4+1] << 16) |
(string[i*4+2] << 8) |
(string[i*4+3]));
- XftGlyphRender (dpy, op, src, pub, dst,
+ XftGlyphRender (dpy, op, src, pub, dst,
srcx, srcy, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
@@ -896,12 +896,12 @@ XftTextRender32LE (Display *dpy,
return;
}
for (i = 0; i < len; i++)
- glyphs[i] = XftCharIndex (dpy, pub,
+ glyphs[i] = XftCharIndex (dpy, pub,
(string[i*4]) |
(string[i*4+1] << 8) |
(string[i*4+2] << 16) |
(string[i*4+3] << 24));
- XftGlyphRender (dpy, op, src, pub, dst,
+ XftGlyphRender (dpy, op, src, pub, dst,
srcx, srcy, x, y, glyphs, len);
if (glyphs != glyphs_local)
free (glyphs);
diff --git a/libXft/src/xftswap.c b/libXft/src/xftswap.c
index 942efdb31..e7748c93f 100644
--- a/libXft/src/xftswap.c
+++ b/libXft/src/xftswap.c
@@ -101,7 +101,7 @@ XftSwapImage (XImage *image)
{
switch (image->bits_per_pixel) {
case 32:
- XftSwapCARD32 ((CARD32 *) image->data,
+ XftSwapCARD32 ((CARD32 *) image->data,
image->height * image->bytes_per_line >> 2);
break;
case 24:
diff --git a/libXft/src/xftxlfd.c b/libXft/src/xftxlfd.c
index 7c1991163..dee2f44de 100644
--- a/libXft/src/xftxlfd.c
+++ b/libXft/src/xftxlfd.c
@@ -119,42 +119,42 @@ XftXlfdParse (const char *xlfd_orig, FcBool ignore_scalable, FcBool complete)
if (!pixel)
return NULL;
-
+
pat = FcPatternCreate ();
if (!pat)
return NULL;
-
+
save = (char *) malloc (strlen (foundry) + 1);
-
+
if (!save) {
FcPatternDestroy (pat);
return NULL;
}
if (!FcPatternAddString (pat, XFT_XLFD, (FcChar8 *) xlfd_orig)) goto bail;
-
+
XftSplitStr (foundry, save);
if (save[0] && strcmp (save, "*") != 0)
if (!FcPatternAddString (pat, FC_FOUNDRY, (FcChar8 *) save)) goto bail;
-
+
XftSplitStr (family, save);
if (save[0] && strcmp (save, "*") != 0)
if (!FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) save)) goto bail;
-
+
weight_value = _XftMatchSymbolic (XftXlfdWeights, NUM_XLFD_WEIGHTS,
XftSplitStr (weight_name, save),
FC_WEIGHT_MEDIUM);
- if (!FcPatternAddInteger (pat, FC_WEIGHT, weight_value))
+ if (!FcPatternAddInteger (pat, FC_WEIGHT, weight_value))
goto bail;
-
+
slant_value = _XftMatchSymbolic (XftXlfdSlants, NUM_XLFD_SLANTS,
XftSplitStr (slant, save),
FC_SLANT_ROMAN);
- if (!FcPatternAddInteger (pat, FC_SLANT, slant_value))
+ if (!FcPatternAddInteger (pat, FC_SLANT, slant_value))
goto bail;
-
+
dpixel = (double) pixel;
-
+
if (point > 0)
{
if (!FcPatternAddDouble (pat, FC_SIZE, ((double) point) / 10.0)) goto bail;
@@ -163,13 +163,13 @@ XftXlfdParse (const char *xlfd_orig, FcBool ignore_scalable, FcBool complete)
dpixel = (double) point * (double) resy / 720.0;
}
}
-
+
if (dpixel > 0)
if (!FcPatternAddDouble (pat, FC_PIXEL_SIZE, dpixel)) goto bail;
-
+
free (save);
return pat;
-
+
bail:
free (save);
FcPatternDestroy (pat);
diff --git a/libXinerama/Makefile.am b/libXinerama/Makefile.am
index 86f6e7fd8..d744d0f91 100644
--- a/libXinerama/Makefile.am
+++ b/libXinerama/Makefile.am
@@ -1,42 +1,42 @@
-#
-# Copyright 2005 Red Hat, 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 Red Hat not be used in
-# advertising or publicity pertaining to distribution of the software without
-# specific, written prior permission. Red Hat makes no
-# representations about the suitability of this software for any purpose. It
-# is provided "as is" without express or implied warranty.
-#
-# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-# EVENT SHALL RED HAT 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.
-
-SUBDIRS = src man
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = xinerama.pc
-
-MAINTAINERCLEANFILES = ChangeLog INSTALL
-
-.PHONY: ChangeLog INSTALL
-
-INSTALL:
- $(INSTALL_CMD)
-
-ChangeLog:
- $(CHANGELOG_CMD)
-
-dist-hook: ChangeLog INSTALL
-
-if LINT
-lint:
- (cd src && $(MAKE) $(MFLAGS) lint)
-endif LINT
+#
+# Copyright 2005 Red Hat, 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 Red Hat not be used in
+# advertising or publicity pertaining to distribution of the software without
+# specific, written prior permission. Red Hat makes no
+# representations about the suitability of this software for any purpose. It
+# is provided "as is" without express or implied warranty.
+#
+# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL RED HAT 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.
+
+SUBDIRS = src man
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xinerama.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+ $(INSTALL_CMD)
+
+ChangeLog:
+ $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
+
+if LINT
+lint:
+ (cd src && $(MAKE) $(MFLAGS) lint)
+endif LINT
diff --git a/libXinerama/configure.ac b/libXinerama/configure.ac
index 04dfc9d1b..872771969 100644
--- a/libXinerama/configure.ac
+++ b/libXinerama/configure.ac
@@ -46,7 +46,7 @@ PKG_CHECK_MODULES(XINERAMA, x11 xext xextproto [xineramaproto >= 1.1.99.1])
# Allow checking code with lint, sparse, etc.
XORG_WITH_LINT
LINT_FLAGS="${LINT_FLAGS} ${XINERAMA_CFLAGS}"
-
+
AC_CONFIG_FILES([Makefile
src/Makefile
man/Makefile
diff --git a/libXinerama/include/X11/extensions/Xinerama.h b/libXinerama/include/X11/extensions/Xinerama.h
index 666f52a78..8c0f8296a 100644
--- a/libXinerama/include/X11/extensions/Xinerama.h
+++ b/libXinerama/include/X11/extensions/Xinerama.h
@@ -54,15 +54,15 @@ Status XineramaQueryVersion(
Bool XineramaIsActive(Display *dpy);
-/*
+/*
Returns the number of heads and a pointer to an array of
structures describing the position and size of the individual
heads. Returns NULL and number = 0 if Xinerama is not active.
-
+
Returned array should be freed with XFree().
*/
-XineramaScreenInfo *
+XineramaScreenInfo *
XineramaQueryScreens(
Display *dpy,
int *number
diff --git a/libXinerama/include/X11/extensions/panoramiXext.h b/libXinerama/include/X11/extensions/panoramiXext.h
index aacc4fc43..8312a173b 100644
--- a/libXinerama/include/X11/extensions/panoramiXext.h
+++ b/libXinerama/include/X11/extensions/panoramiXext.h
@@ -1,85 +1,85 @@
-/*****************************************************************
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-******************************************************************/
-/*
- * PanoramiX definitions
- */
-
-/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
-
-#ifndef _panoramiXext_h
-#define _panoramiXext_h
-
-#include <X11/Xfuncproto.h>
-
-typedef struct {
- Window window; /* PanoramiX window - may not exist */
- int screen;
- int State; /* PanoramiXOff, PanoramiXOn */
- int width; /* width of this screen */
- int height; /* height of this screen */
- int ScreenCount; /* real physical number of screens */
- XID eventMask; /* selected events for this client */
-} XPanoramiXInfo;
-
-_XFUNCPROTOBEGIN
-
-extern Bool XPanoramiXQueryExtension (
- Display * /* dpy */,
- int * /* event_base_return */,
- int * /* error_base_return */
-);
-
-extern Status XPanoramiXQueryVersion(
- Display * /* dpy */,
- int * /* major_version_return */,
- int * /* minor_version_return */
-);
-
-extern XPanoramiXInfo *XPanoramiXAllocInfo (
- void
-);
-
-extern Status XPanoramiXGetState (
- Display * /* dpy */,
- Drawable /* drawable */,
- XPanoramiXInfo * /* panoramiX_info */
-);
-
-extern Status XPanoramiXGetScreenCount (
- Display * /* dpy */,
- Drawable /* drawable */,
- XPanoramiXInfo * /* panoramiX_info */
-);
-
-extern Status XPanoramiXGetScreenSize (
- Display * /* dpy */,
- Drawable /* drawable */,
- int /* screen_num */,
- XPanoramiXInfo * /* panoramiX_info */
-);
-
-_XFUNCPROTOEND
-
-#endif /* _panoramiXext_h */
+/*****************************************************************
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+******************************************************************/
+/*
+ * PanoramiX definitions
+ */
+
+/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _panoramiXext_h
+#define _panoramiXext_h
+
+#include <X11/Xfuncproto.h>
+
+typedef struct {
+ Window window; /* PanoramiX window - may not exist */
+ int screen;
+ int State; /* PanoramiXOff, PanoramiXOn */
+ int width; /* width of this screen */
+ int height; /* height of this screen */
+ int ScreenCount; /* real physical number of screens */
+ XID eventMask; /* selected events for this client */
+} XPanoramiXInfo;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XPanoramiXQueryExtension (
+ Display * /* dpy */,
+ int * /* event_base_return */,
+ int * /* error_base_return */
+);
+
+extern Status XPanoramiXQueryVersion(
+ Display * /* dpy */,
+ int * /* major_version_return */,
+ int * /* minor_version_return */
+);
+
+extern XPanoramiXInfo *XPanoramiXAllocInfo (
+ void
+);
+
+extern Status XPanoramiXGetState (
+ Display * /* dpy */,
+ Drawable /* drawable */,
+ XPanoramiXInfo * /* panoramiX_info */
+);
+
+extern Status XPanoramiXGetScreenCount (
+ Display * /* dpy */,
+ Drawable /* drawable */,
+ XPanoramiXInfo * /* panoramiX_info */
+);
+
+extern Status XPanoramiXGetScreenSize (
+ Display * /* dpy */,
+ Drawable /* drawable */,
+ int /* screen_num */,
+ XPanoramiXInfo * /* panoramiX_info */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _panoramiXext_h */
diff --git a/libXinerama/man/Xinerama.man b/libXinerama/man/Xinerama.man
index a68fd943f..37741310d 100644
--- a/libXinerama/man/Xinerama.man
+++ b/libXinerama/man/Xinerama.man
@@ -1,123 +1,123 @@
-.\"
-.\" Copyright (c) 2007, 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.
-.\"
-.de TQ
-.br
-.ns
-.TP \\$1
-..
-.TH XINERAMA __libmansuffix__ __vendorversion__
-.SH NAME
-Xinerama \- API for Xinerama extension to X11 Protocol
-.SH SYNOPSIS
-\&#include <X11/extensions/Xinerama.h>
-.nf
-.sp
-Bool XineramaQueryExtension \^(\^Display *\fIdpy\fP,
- int *\fIevent_base_return\fP, int *\fIerror_base_return\fP\^);
-.sp
-Status XineramaQueryVersion \^(\^Display *\fIdpy\fP,
- int *\fImajor_version_return\fP,
- int *\fIminor_version_return\fP\^);
-.sp
-Bool XineramaIsActive \^(\^Display *\fIdpy\fP\^);
-.sp
-XineramaScreenInfo * XineramaQueryScreens \^(\^Display *\fIdpy\fP,
- int *\fInumber\fP\^);
-.fi
-.SH ARGUMENTS
-.IP \fIdisplay\fP 1i
-Specifies the connection to the X server.
-.IP \fIevent_base_return\fP 1i
-Specifies the return location for the assigned base event code
-.IP \fIerror_base_return\fP 1i
-Specifies the return location for the assigned base error code
-.IP \fImajor_version_return\fP 1i
-Returns the major version supported by the server
-.IP \fIminor_version_return\fP 1i
-Returns the minor version supported by the server
-.IP \fInumber\fP 1i
-Returns the number of entries in the returned XineramaScreenInfo array.
-.SH DESCRIPTION
-.B Xinerama
-is a simple library designed to interface the Xinerama Extension for
-retrieving information about physical output devices which may be combined
-into a single logical X screen.
-
-.SH FUNCTIONS
-
-.SS \fBXineramaQueryExtension()\fR
-
-.LP
-The XineramaQueryExtension function queries the Xserver to determine the
-availability of the Xinerama Extension. If the extension is available, the
-return value is True, and event_base_return and error_base_return are set to
-the base event number and base error number for the extension, respectively.
-Otherwise, the return value is False, and the values of event_base_return and
-error_base_return are undefined.
-.sp
-
-.SS \fBXineramaQueryVersion()\fR
-
-.LP
-The XineramaQueryVersion function returns the version of the Xinerama extension
-implemented by the Xserver. The version is returned in major_version_return
-and minor_version_return. The major version will be incremented for protocol
-incompatible changes, and the minor version will be incremented for small,
-upwardly compatible changes.
-.LP
-If the Xinerama library is compatible with the version returned by the
-server, it returns nonzero. If the server does not support the
-XINERAMA extension, or if there was an error during communications
-with the server, or if the server and library protocol versions are
-incompatible, it returns zero.
-.sp
-
-.SS \fBXineramaIsActive()\fR
-
-.LP
-The XineramaIsActive function returns a Boolean operator used to determine if
-Xinerama is activated on the screen. Returns True for active and False for
-not active.
-.sp
-
-.SS \fBXineramaQueryScreens()\fR
-
-.LP
-The \fBXineramaQueryScreens()\fR function returns info about each
-individual output device within the Xinerama Screen. The integer
-pointed to by the \fInumber\fR argument is updated to the number of
-output devices listed in the returned array of \fIXineramaScreenInfo\fR
-structures. \fBXineramaQueryScreens()\fR returns NULL and sets \fInumber\fR
-to 0 if Xinerama is not active.
-
-The pointer returned should be released with XFree(__libmansuffix__)
-when no longer needed.
-.sp
-
-.SH NOTE
-The original API provided for interacting with the XINERAMA extension used
-function names beginning with \fIXPanoramiX\fR. That API is now deprecated
-and this API should be used instead in new software.
-
-
-
+.\"
+.\" Copyright (c) 2007, 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.
+.\"
+.de TQ
+.br
+.ns
+.TP \\$1
+..
+.TH XINERAMA __libmansuffix__ __vendorversion__
+.SH NAME
+Xinerama \- API for Xinerama extension to X11 Protocol
+.SH SYNOPSIS
+\&#include <X11/extensions/Xinerama.h>
+.nf
+.sp
+Bool XineramaQueryExtension \^(\^Display *\fIdpy\fP,
+ int *\fIevent_base_return\fP, int *\fIerror_base_return\fP\^);
+.sp
+Status XineramaQueryVersion \^(\^Display *\fIdpy\fP,
+ int *\fImajor_version_return\fP,
+ int *\fIminor_version_return\fP\^);
+.sp
+Bool XineramaIsActive \^(\^Display *\fIdpy\fP\^);
+.sp
+XineramaScreenInfo * XineramaQueryScreens \^(\^Display *\fIdpy\fP,
+ int *\fInumber\fP\^);
+.fi
+.SH ARGUMENTS
+.IP \fIdisplay\fP 1i
+Specifies the connection to the X server.
+.IP \fIevent_base_return\fP 1i
+Specifies the return location for the assigned base event code
+.IP \fIerror_base_return\fP 1i
+Specifies the return location for the assigned base error code
+.IP \fImajor_version_return\fP 1i
+Returns the major version supported by the server
+.IP \fIminor_version_return\fP 1i
+Returns the minor version supported by the server
+.IP \fInumber\fP 1i
+Returns the number of entries in the returned XineramaScreenInfo array.
+.SH DESCRIPTION
+.B Xinerama
+is a simple library designed to interface the Xinerama Extension for
+retrieving information about physical output devices which may be combined
+into a single logical X screen.
+
+.SH FUNCTIONS
+
+.SS \fBXineramaQueryExtension()\fR
+
+.LP
+The XineramaQueryExtension function queries the Xserver to determine the
+availability of the Xinerama Extension. If the extension is available, the
+return value is True, and event_base_return and error_base_return are set to
+the base event number and base error number for the extension, respectively.
+Otherwise, the return value is False, and the values of event_base_return and
+error_base_return are undefined.
+.sp
+
+.SS \fBXineramaQueryVersion()\fR
+
+.LP
+The XineramaQueryVersion function returns the version of the Xinerama extension
+implemented by the Xserver. The version is returned in major_version_return
+and minor_version_return. The major version will be incremented for protocol
+incompatible changes, and the minor version will be incremented for small,
+upwardly compatible changes.
+.LP
+If the Xinerama library is compatible with the version returned by the
+server, it returns nonzero. If the server does not support the
+XINERAMA extension, or if there was an error during communications
+with the server, or if the server and library protocol versions are
+incompatible, it returns zero.
+.sp
+
+.SS \fBXineramaIsActive()\fR
+
+.LP
+The XineramaIsActive function returns a Boolean operator used to determine if
+Xinerama is activated on the screen. Returns True for active and False for
+not active.
+.sp
+
+.SS \fBXineramaQueryScreens()\fR
+
+.LP
+The \fBXineramaQueryScreens()\fR function returns info about each
+individual output device within the Xinerama Screen. The integer
+pointed to by the \fInumber\fR argument is updated to the number of
+output devices listed in the returned array of \fIXineramaScreenInfo\fR
+structures. \fBXineramaQueryScreens()\fR returns NULL and sets \fInumber\fR
+to 0 if Xinerama is not active.
+
+The pointer returned should be released with XFree(__libmansuffix__)
+when no longer needed.
+.sp
+
+.SH NOTE
+The original API provided for interacting with the XINERAMA extension used
+function names beginning with \fIXPanoramiX\fR. That API is now deprecated
+and this API should be used instead in new software.
+
+
+
diff --git a/libXinerama/src/Xinerama.c b/libXinerama/src/Xinerama.c
index ac5ecb7af..93b1a9f21 100644
--- a/libXinerama/src/Xinerama.c
+++ b/libXinerama/src/Xinerama.c
@@ -1,313 +1,313 @@
-/*****************************************************************
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-******************************************************************/
-
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/panoramiXext.h>
-#include <X11/extensions/panoramiXproto.h>
-#include <X11/extensions/Xinerama.h>
-
-
-static XExtensionInfo _panoramiX_ext_info_data;
-static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data;
-static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME;
-
-#define PanoramiXCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, panoramiX_extension_name, val)
-#define PanoramiXSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, panoramiX_extension_name)
-
-static int close_display(Display *dpy, XExtCodes *codes);
-
-static /* const */ XExtensionHooks panoramiX_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info,
- panoramiX_extension_name,
- &panoramiX_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info)
-
-
-
-/****************************************************************************
- * *
- * PanoramiX public interfaces *
- * *
- ****************************************************************************/
-
-Bool XPanoramiXQueryExtension (
- Display *dpy,
- int *event_base_return,
- int *error_base_return
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_base_return = info->codes->first_event;
- *error_base_return = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status XPanoramiXQueryVersion(
- Display *dpy,
- int *major_version_return,
- int *minor_version_return
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXQueryVersionReply rep;
- register xPanoramiXQueryVersionReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXQueryVersion;
- req->clientMajor = PANORAMIX_MAJOR_VERSION;
- req->clientMinor = PANORAMIX_MINOR_VERSION;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_version_return = rep.majorVersion;
- *minor_version_return = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-XPanoramiXInfo *XPanoramiXAllocInfo(void)
-{
- return (XPanoramiXInfo *) Xmalloc (sizeof (XPanoramiXInfo));
-}
-
-Status XPanoramiXGetState (
- Display *dpy,
- Drawable drawable,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetStateReply rep;
- register xPanoramiXGetStateReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetState, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetState;
- req->window = drawable;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->State = rep.state;
- return 1;
-}
-
-Status XPanoramiXGetScreenCount (
- Display *dpy,
- Drawable drawable,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetScreenCountReply rep;
- register xPanoramiXGetScreenCountReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetScreenCount, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetScreenCount;
- req->window = drawable;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->ScreenCount = rep.ScreenCount;
- return 1;
-}
-
-Status XPanoramiXGetScreenSize (
- Display *dpy,
- Drawable drawable,
- int screen_num,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetScreenSizeReply rep;
- register xPanoramiXGetScreenSizeReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetScreenSize, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetScreenSize;
- req->window = drawable;
- req->screen = screen_num; /* need to define */
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->screen = rep.screen;
- panoramiX_info->width = rep.width;
- panoramiX_info->height = rep.height;
- return 1;
-}
-
-/*******************************************************************\
- Alternate interface to make up for shortcomings in the original,
- namely, the omission of the screen origin. The new interface is
- in the "Xinerama" namespace instead of "PanoramiX".
-\*******************************************************************/
-
-Bool XineramaQueryExtension (
- Display *dpy,
- int *event_base_return,
- int *error_base_return
-)
-{
- return XPanoramiXQueryExtension(dpy, event_base_return, error_base_return);
-}
-
-Status XineramaQueryVersion(
- Display *dpy,
- int *major,
- int *minor
-)
-{
- return XPanoramiXQueryVersion(dpy, major, minor);
-}
-
-Bool XineramaIsActive(Display *dpy)
-{
- xXineramaIsActiveReply rep;
- xXineramaIsActiveReq *req;
- XExtDisplayInfo *info = find_display (dpy);
-
- if(!XextHasExtension(info))
- return False; /* server doesn't even have the extension */
-
- LockDisplay (dpy);
- GetReq (XineramaIsActive, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_XineramaIsActive;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- return rep.state;
-}
-
-XineramaScreenInfo *
-XineramaQueryScreens(
- Display *dpy,
- int *number
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXineramaQueryScreensReply rep;
- xXineramaQueryScreensReq *req;
- XineramaScreenInfo *scrnInfo = NULL;
-
- PanoramiXCheckExtension (dpy, info, NULL);
-
- LockDisplay (dpy);
- GetReq (XineramaQueryScreens, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_XineramaQueryScreens;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
-
- if(rep.number) {
- if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) {
- xXineramaScreenInfo scratch;
- int i;
-
- for(i = 0; i < rep.number; i++) {
- _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
- scrnInfo[i].screen_number = i;
- scrnInfo[i].x_org = scratch.x_org;
- scrnInfo[i].y_org = scratch.y_org;
- scrnInfo[i].width = scratch.width;
- scrnInfo[i].height = scratch.height;
- }
-
- *number = rep.number;
- } else
- _XEatData(dpy, rep.length << 2);
- } else {
- *number = 0;
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return scrnInfo;
-}
+/*****************************************************************
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+******************************************************************/
+
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/panoramiXext.h>
+#include <X11/extensions/panoramiXproto.h>
+#include <X11/extensions/Xinerama.h>
+
+
+static XExtensionInfo _panoramiX_ext_info_data;
+static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data;
+static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME;
+
+#define PanoramiXCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, panoramiX_extension_name, val)
+#define PanoramiXSimpleCheckExtension(dpy,i) \
+ XextSimpleCheckExtension (dpy, i, panoramiX_extension_name)
+
+static int close_display(Display *dpy, XExtCodes *codes);
+
+static /* const */ XExtensionHooks panoramiX_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info,
+ panoramiX_extension_name,
+ &panoramiX_extension_hooks,
+ 0, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info)
+
+
+
+/****************************************************************************
+ * *
+ * PanoramiX public interfaces *
+ * *
+ ****************************************************************************/
+
+Bool XPanoramiXQueryExtension (
+ Display *dpy,
+ int *event_base_return,
+ int *error_base_return
+)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if (XextHasExtension(info)) {
+ *event_base_return = info->codes->first_event;
+ *error_base_return = info->codes->first_error;
+ return True;
+ } else {
+ return False;
+ }
+}
+
+
+Status XPanoramiXQueryVersion(
+ Display *dpy,
+ int *major_version_return,
+ int *minor_version_return
+)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xPanoramiXQueryVersionReply rep;
+ register xPanoramiXQueryVersionReq *req;
+
+ PanoramiXCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ GetReq (PanoramiXQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->panoramiXReqType = X_PanoramiXQueryVersion;
+ req->clientMajor = PANORAMIX_MAJOR_VERSION;
+ req->clientMinor = PANORAMIX_MINOR_VERSION;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ *major_version_return = rep.majorVersion;
+ *minor_version_return = rep.minorVersion;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 1;
+}
+
+XPanoramiXInfo *XPanoramiXAllocInfo(void)
+{
+ return (XPanoramiXInfo *) Xmalloc (sizeof (XPanoramiXInfo));
+}
+
+Status XPanoramiXGetState (
+ Display *dpy,
+ Drawable drawable,
+ XPanoramiXInfo *panoramiX_info
+)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xPanoramiXGetStateReply rep;
+ register xPanoramiXGetStateReq *req;
+
+ PanoramiXCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ GetReq (PanoramiXGetState, req);
+ req->reqType = info->codes->major_opcode;
+ req->panoramiXReqType = X_PanoramiXGetState;
+ req->window = drawable;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ panoramiX_info->window = rep.window;
+ panoramiX_info->State = rep.state;
+ return 1;
+}
+
+Status XPanoramiXGetScreenCount (
+ Display *dpy,
+ Drawable drawable,
+ XPanoramiXInfo *panoramiX_info
+)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xPanoramiXGetScreenCountReply rep;
+ register xPanoramiXGetScreenCountReq *req;
+
+ PanoramiXCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ GetReq (PanoramiXGetScreenCount, req);
+ req->reqType = info->codes->major_opcode;
+ req->panoramiXReqType = X_PanoramiXGetScreenCount;
+ req->window = drawable;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ panoramiX_info->window = rep.window;
+ panoramiX_info->ScreenCount = rep.ScreenCount;
+ return 1;
+}
+
+Status XPanoramiXGetScreenSize (
+ Display *dpy,
+ Drawable drawable,
+ int screen_num,
+ XPanoramiXInfo *panoramiX_info
+)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xPanoramiXGetScreenSizeReply rep;
+ register xPanoramiXGetScreenSizeReq *req;
+
+ PanoramiXCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ GetReq (PanoramiXGetScreenSize, req);
+ req->reqType = info->codes->major_opcode;
+ req->panoramiXReqType = X_PanoramiXGetScreenSize;
+ req->window = drawable;
+ req->screen = screen_num; /* need to define */
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ panoramiX_info->window = rep.window;
+ panoramiX_info->screen = rep.screen;
+ panoramiX_info->width = rep.width;
+ panoramiX_info->height = rep.height;
+ return 1;
+}
+
+/*******************************************************************\
+ Alternate interface to make up for shortcomings in the original,
+ namely, the omission of the screen origin. The new interface is
+ in the "Xinerama" namespace instead of "PanoramiX".
+\*******************************************************************/
+
+Bool XineramaQueryExtension (
+ Display *dpy,
+ int *event_base_return,
+ int *error_base_return
+)
+{
+ return XPanoramiXQueryExtension(dpy, event_base_return, error_base_return);
+}
+
+Status XineramaQueryVersion(
+ Display *dpy,
+ int *major,
+ int *minor
+)
+{
+ return XPanoramiXQueryVersion(dpy, major, minor);
+}
+
+Bool XineramaIsActive(Display *dpy)
+{
+ xXineramaIsActiveReply rep;
+ xXineramaIsActiveReq *req;
+ XExtDisplayInfo *info = find_display (dpy);
+
+ if(!XextHasExtension(info))
+ return False; /* server doesn't even have the extension */
+
+ LockDisplay (dpy);
+ GetReq (XineramaIsActive, req);
+ req->reqType = info->codes->major_opcode;
+ req->panoramiXReqType = X_XineramaIsActive;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return False;
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return rep.state;
+}
+
+XineramaScreenInfo *
+XineramaQueryScreens(
+ Display *dpy,
+ int *number
+)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXineramaQueryScreensReply rep;
+ xXineramaQueryScreensReq *req;
+ XineramaScreenInfo *scrnInfo = NULL;
+
+ PanoramiXCheckExtension (dpy, info, NULL);
+
+ LockDisplay (dpy);
+ GetReq (XineramaQueryScreens, req);
+ req->reqType = info->codes->major_opcode;
+ req->panoramiXReqType = X_XineramaQueryScreens;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+
+ if(rep.number) {
+ if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) {
+ xXineramaScreenInfo scratch;
+ int i;
+
+ for(i = 0; i < rep.number; i++) {
+ _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
+ scrnInfo[i].screen_number = i;
+ scrnInfo[i].x_org = scratch.x_org;
+ scrnInfo[i].y_org = scratch.y_org;
+ scrnInfo[i].width = scratch.width;
+ scrnInfo[i].height = scratch.height;
+ }
+
+ *number = rep.number;
+ } else
+ _XEatData(dpy, rep.length << 2);
+ } else {
+ *number = 0;
+ }
+
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return scrnInfo;
+}
diff --git a/libXmu/COPYING b/libXmu/COPYING
index ab822fb3c..67a8b748f 100644
--- a/libXmu/COPYING
+++ b/libXmu/COPYING
@@ -28,13 +28,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+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
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
diff --git a/libXmu/include/X11/Xmu/Atoms.h b/libXmu/include/X11/Xmu/Atoms.h
index 3d8691025..fc59b3180 100644
--- a/libXmu/include/X11/Xmu/Atoms.h
+++ b/libXmu/include/X11/Xmu/Atoms.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1988, 1998 The Open Group
diff --git a/libXmu/include/X11/Xmu/CharSet.h b/libXmu/include/X11/Xmu/CharSet.h
index 1ce9166a0..9d9e53a8f 100644
--- a/libXmu/include/X11/Xmu/CharSet.h
+++ b/libXmu/include/X11/Xmu/CharSet.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1988, 1998 The Open Group
diff --git a/libXmu/include/X11/Xmu/CloseHook.h b/libXmu/include/X11/Xmu/CloseHook.h
index 2481ebf3e..1b895a96e 100644
--- a/libXmu/include/X11/Xmu/CloseHook.h
+++ b/libXmu/include/X11/Xmu/CloseHook.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1988, 1998 The Open Group
diff --git a/libXmu/include/X11/Xmu/Converters.h b/libXmu/include/X11/Xmu/Converters.h
index 3779750c6..19ece564c 100644
--- a/libXmu/include/X11/Xmu/Converters.h
+++ b/libXmu/include/X11/Xmu/Converters.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/include/X11/Xmu/CurUtil.h b/libXmu/include/X11/Xmu/CurUtil.h
index 3524d7704..ab577a252 100644
--- a/libXmu/include/X11/Xmu/CurUtil.h
+++ b/libXmu/include/X11/Xmu/CurUtil.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/include/X11/Xmu/CvtCache.h b/libXmu/include/X11/Xmu/CvtCache.h
index 7441e2f2e..714a4984e 100644
--- a/libXmu/include/X11/Xmu/CvtCache.h
+++ b/libXmu/include/X11/Xmu/CvtCache.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -26,7 +26,7 @@ in this Software without prior written authorization from The Open Group.
/*
* Public Interfaces
- *
+ *
* XmuCvtCache *XmuCvtCacheLookupDisplay (dpy)
* Display *dpy;
*/
diff --git a/libXmu/include/X11/Xmu/DisplayQue.h b/libXmu/include/X11/Xmu/DisplayQue.h
index b37a58133..ffc82a2c0 100644
--- a/libXmu/include/X11/Xmu/DisplayQue.h
+++ b/libXmu/include/X11/Xmu/DisplayQue.h
@@ -32,13 +32,13 @@ in this Software without prior written authorization from The Open Group.
/*
* Public Entry Points
- *
- *
+ *
+ *
* XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
* XmuCloseDisplayQueueProc closefunc;
* XmuFreeDisplayQueueProc freefunc;
* XPointer data;
- *
+ *
* Creates and returns a queue into which displays may be placed. When
* the display is closed, the closefunc (if non-NULL) is upcalled with
* as follows:
@@ -53,12 +53,12 @@ in this Software without prior written authorization from The Open Group.
* Bool XmuDQDestroy (q, docallbacks)
* XmuDisplayQueue *q;
* Bool docallbacks;
- *
+ *
* Releases all memory for the indicated display queue. If docallbacks
- * is true, then the closefunc (if non-NULL) is called for each
+ * is true, then the closefunc (if non-NULL) is called for each
* display.
- *
- *
+ *
+ *
* XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
* XmuDisplayQueue *q;
* Display *dpy;
@@ -66,7 +66,7 @@ in this Software without prior written authorization from The Open Group.
* Returns the queue entry for the specified display or NULL if the
* display is not in the queue.
*
- *
+ *
* XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
* XmuDisplayQueue *q;
* Display *dpy;
@@ -77,13 +77,13 @@ in this Software without prior written authorization from The Open Group.
* caller to attach arbitrary data to this display in this queue. The
* caller should use XmuDQLookupDisplay to make sure that the display
* hasn't already been added.
- *
- *
+ *
+ *
* Bool XmuDQRemoveDisplay (q, dpy)
* XmuDisplayQueue *q;
* Display *dpy;
*
- * Removes the specified display from the given queue. If the
+ * Removes the specified display from the given queue. If the
* indicated display is not found on this queue, False is returned,
* otherwise True is returned.
*/
diff --git a/libXmu/include/X11/Xmu/Drawing.h b/libXmu/include/X11/Xmu/Drawing.h
index 91d764b77..717292aec 100644
--- a/libXmu/include/X11/Xmu/Drawing.h
+++ b/libXmu/include/X11/Xmu/Drawing.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/include/X11/Xmu/EditresP.h b/libXmu/include/X11/Xmu/EditresP.h
index 6f7c739ab..61ec51dbe 100644
--- a/libXmu/include/X11/Xmu/EditresP.h
+++ b/libXmu/include/X11/Xmu/EditresP.h
@@ -55,22 +55,22 @@ in this Software without prior written authorization from The Open Group.
Window: 32-bit value
Widget: 32-bit value
String8: ListOfCard8
-
+
[a][b][c] represent an exclusive list of choices.
- All widgets are passed as a list of widgets, containing the
+ All widgets are passed as a list of widgets, containing the
full instance heirarch of this widget. The hierarchy is ordered
from parent to child. Thus the first element of each list is
the root of the widget tree (this makes verifying that the widget
still exists, MUCH faster).
ListOfFoo comprises a list of things in the following format:
-
+
number: Card16
<number> things: ????
-
+
This is a synchronous protocol, every request MUST be followed by a
- reply.
+ reply.
Request:
@@ -82,7 +82,7 @@ in this Software without prior written authorization from The Open Group.
FindChild = 4,
GetValues = 5 }
Length: Card32
- Data:
+ Data:
Reply:
@@ -132,7 +132,7 @@ in this Software without prior written authorization from The Open Group.
of widgets for each widget in the tree. This is enough information
to completely reconstruct the entire widget heirarchy.
- The window return value contains the Xid of the window currently
+ The window return value contains the Xid of the window currently
used by this widget. If the widget is unrealized then 0 is returned,
and if widget is a non-windowed object a value of 2 is returned.
@@ -152,20 +152,20 @@ in this Software without prior written authorization from The Open Group.
widget: ListOfWidgets
message: String8
- SetValues will allow the same resource to be set on a number of
+ SetValues will allow the same resource to be set on a number of
widgets. This function will return an error message if the SetValues
request caused an Xt error.
-
+
GetValues:
- names: ListOfString8
+ names: ListOfString8
widget: Widget
--->
novalues: ListOfCard16
values: ListOfString8
-
- GetValues will allow a number of resource values to be read
+
+ GetValues will allow a number of resource values to be read
on a particular widget. The request specifies the names of
the resources wanted and the widget id these resources are
from. The reply returns a list of indices from the requests
@@ -191,10 +191,10 @@ in this Software without prior written authorization from The Open Group.
Resource:
Kind: {normal, constraint}
Name: String8
- Class: String8
+ Class: String8
Type: String8 ]
- GetResource retrieves the kind, name, class and type for every
+ GetResource retrieves the kind, name, class and type for every
widget passed to it. If an error occured with the resource fetch
Error will be set to True for the given widget and a message
is returned rather than the resource info.
@@ -221,23 +221,23 @@ in this Software without prior written authorization from The Open Group.
BorderWidth: Card16 ]
GetGeometry retreives the mapping state, x, y, width, height
- and border width for each widget specified. If an error occured
- with the geometry fetch "Error" will be set to True for the given
- widget and a message is returned rather than the geometry info.
+ and border width for each widget specified. If an error occured
+ with the geometry fetch "Error" will be set to True for the given
+ widget and a message is returned rather than the geometry info.
X an Y corrospond to the root coordinates of the upper left corner
of the widget (outside the window border).
-
+
FindChild:
Widget: ListOfWidgets
X: Int16
Y: Int16
-
+
--->
Widget: ListOfWidgets
- Find Child returns a descendent of the widget specified that
+ Find Child returns a descendent of the widget specified that
is at the root coordinates specified.
NOTE:
@@ -247,20 +247,20 @@ in this Software without prior written authorization from The Open Group.
GetValues:
- names: ListOfString8
+ names: ListOfString8
widget: Widget
--->
-
+
values: ListOfString8
- GetValues will allow a number of resource values to be read
- on a particular widget. Currently only InterViews 3.0.1 Styles
+ GetValues will allow a number of resource values to be read
+ on a particular widget. Currently only InterViews 3.0.1 Styles
and their attributes are supported. In addition, the current
user interface only supports the return of 1 resource. The ability
to specify and return multiple resources is defined for future editres
interfaces where some or all of a widgets resource values are returned
- and displayed at once.
+ and displayed at once.
************************************************************/
@@ -295,7 +295,7 @@ typedef enum {
SendWidgetTree = 0,
SetValues = 1,
GetResources = 2,
- GetGeometry = 3,
+ GetGeometry = 3,
FindChild = 4,
GetValues = 5
} EditresCommand;
diff --git a/libXmu/include/X11/Xmu/Error.h b/libXmu/include/X11/Xmu/Error.h
index c69bf141e..e275fea1d 100644
--- a/libXmu/include/X11/Xmu/Error.h
+++ b/libXmu/include/X11/Xmu/Error.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/include/X11/Xmu/Initer.h b/libXmu/include/X11/Xmu/Initer.h
index 2ba86e833..415885d0d 100644
--- a/libXmu/include/X11/Xmu/Initer.h
+++ b/libXmu/include/X11/Xmu/Initer.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/include/X11/Xmu/Misc.h b/libXmu/include/X11/Xmu/Misc.h
index 650771b19..6ae6227c4 100644
--- a/libXmu/include/X11/Xmu/Misc.h
+++ b/libXmu/include/X11/Xmu/Misc.h
@@ -30,13 +30,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+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
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
diff --git a/libXmu/include/X11/Xmu/StdCmap.h b/libXmu/include/X11/Xmu/StdCmap.h
index afad78f6d..326167375 100644
--- a/libXmu/include/X11/Xmu/StdCmap.h
+++ b/libXmu/include/X11/Xmu/StdCmap.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/include/X11/Xmu/StdSel.h b/libXmu/include/X11/Xmu/StdSel.h
index c61214dd9..b7808753f 100644
--- a/libXmu/include/X11/Xmu/StdSel.h
+++ b/libXmu/include/X11/Xmu/StdSel.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/include/X11/Xmu/WinUtil.h b/libXmu/include/X11/Xmu/WinUtil.h
index c3d11a86a..3d187b9b8 100644
--- a/libXmu/include/X11/Xmu/WinUtil.h
+++ b/libXmu/include/X11/Xmu/WinUtil.h
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/include/X11/Xmu/Xmu.h b/libXmu/include/X11/Xmu/Xmu.h
index ad7948846..e49ad6fe9 100644
--- a/libXmu/include/X11/Xmu/Xmu.h
+++ b/libXmu/include/X11/Xmu/Xmu.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1988, 1998 The Open Group
@@ -49,14 +49,14 @@ typedef struct _XmuSegment {
struct _XmuSegment *next;
} XmuSegment;
-typedef struct _XmuScanline {
+typedef struct _XmuScanline {
int y;
XmuSegment *segment;
struct _XmuScanline *next;
} XmuScanline;
-
+
typedef struct _XmuArea {
- XmuScanline *scanline;
+ XmuScanline *scanline;
} XmuArea;
#define XmuCreateArea() XmuNewArea(0, 0, 0, 0)
diff --git a/libXmu/src/AllCmap.c b/libXmu/src/AllCmap.c
index 1daa8de7c..a974ce08f 100644
--- a/libXmu/src/AllCmap.c
+++ b/libXmu/src/AllCmap.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -32,7 +32,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xmu/StdCmap.h>
-
+
static XVisualInfo *getDeepestVisual(int, XVisualInfo*, int);
/*
@@ -41,7 +41,7 @@ static XVisualInfo *getDeepestVisual(int, XVisualInfo*, int);
*
* Define and retain as permanent resources all standard colormaps which are
* meaningful for the visuals of each screen of the display. Return 0 on
- * failure, non-zero on success. If the property of any standard colormap
+ * failure, non-zero on success. If the property of any standard colormap
* is already defined, redefine it.
*
* This interface is intended to be used by window managers or a client
@@ -51,7 +51,7 @@ static XVisualInfo *getDeepestVisual(int, XVisualInfo*, int);
* with the screen's root window. Each screen has exactly one root window.
* The property names of standard colormaps are predefined, and each property
* name may describe at most one colormap.
- *
+ *
* The standard colormaps are
* RGB_BEST_MAP
* RGB_RED_MAP
@@ -71,8 +71,8 @@ static XVisualInfo *getDeepestVisual(int, XVisualInfo*, int);
* how the standard colormap is defined. Because a standard colormap is
* associated with a specific visual, there must be a method of determining
* which visuals take precedence in defining standard colormaps.
- *
- * The method used here is: for the visual of greatest depth, define all
+ *
+ * The method used here is: for the visual of greatest depth, define all
* standard colormaps meaningful to that visual class, according to this
* order of (descending) precedence:
* 1. DirectColor
@@ -124,9 +124,9 @@ XmuAllStandardColormaps(Display *dpy)
NULL))
status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
(unsigned) v1->depth, 1, 1);
- if (status &&
+ if (status &&
(((v1 = getDeepestVisual(GrayScale, vinfo, nvisuals)) != NULL)
- || ((v1 = getDeepestVisual(StaticGray, vinfo, nvisuals)) !=
+ || ((v1 = getDeepestVisual(StaticGray, vinfo, nvisuals)) !=
NULL)))
status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
(unsigned) v1->depth, 1, 1);
@@ -143,7 +143,7 @@ getDeepestVisual(int visual_class, XVisualInfo *vinfo, int nvisuals)
register int i;
register int maxdepth = 0;
XVisualInfo *v = NULL;
-
+
for (i=0; i < nvisuals; i++, vinfo++)
if (vinfo->class == visual_class && vinfo->depth > maxdepth)
{
diff --git a/libXmu/src/Atoms.c b/libXmu/src/Atoms.c
index 48e243194..412f399e7 100644
--- a/libXmu/src/Atoms.c
+++ b/libXmu/src/Atoms.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1988, 1998 The Open Group
diff --git a/libXmu/src/ClientWin.c b/libXmu/src/ClientWin.c
index 3af323e0a..38ade28a5 100644
--- a/libXmu/src/ClientWin.c
+++ b/libXmu/src/ClientWin.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/Clip.c b/libXmu/src/Clip.c
index ff87a80c0..232e4c569 100644
--- a/libXmu/src/Clip.c
+++ b/libXmu/src/Clip.c
@@ -444,7 +444,7 @@ XmuAreaAnd(XmuArea *dst, XmuArea *src)
Z = Z->next;
if (Z->y >= p->y)
{
- XmuScanline *q = XmuNewScanline(Z->y, 0, 0);
+ XmuScanline *q = XmuNewScanline(Z->y, 0, 0);
XmuScanlineCopy(q, Z);
XmuScanlineAnd(q, top);
diff --git a/libXmu/src/CloseHook.c b/libXmu/src/CloseHook.c
index ca9d9def6..01a1beb4b 100644
--- a/libXmu/src/CloseHook.c
+++ b/libXmu/src/CloseHook.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -28,27 +28,27 @@ in this Software without prior written authorization from The Open Group.
*
* *
* Author: Jim Fulton, MIT X Consortium
- *
- *
+ *
+ *
* Public Entry Points
- *
+ *
* CloseHook XmuAddCloseDisplayHook (dpy, func, arg)
* Display *dpy;
* XmuCloseHookProc func;
* XPointer arg;
- *
+ *
* Bool XmuRemoveCloseDisplayHook (dpy, hook, func, arg)
* Display *dpy;
* CloseHook hook;
* XmuCloseHookProc func;
* XPointer arg;
- *
+ *
* Bool XmuLookupCloseDisplayHook (dpy, hook, func, arg)
* Display *dpy;
* CloseHook hook;
* XmuCloseHookProc func;
* XPointer arg;
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -188,8 +188,8 @@ XmuRemoveCloseDisplayHook(Display *dpy, CloseHook handle,
/*
- * Lookup - see whether or not a handle has been installed. If handle is
- * non-NULL, look for an entry that matches it; otherwise look for an entry
+ * Lookup - see whether or not a handle has been installed. If handle is
+ * non-NULL, look for an entry that matches it; otherwise look for an entry
* with the same function/argument pair.
*/
Bool
diff --git a/libXmu/src/CmapAlloc.c b/libXmu/src/CmapAlloc.c
index 3877512e0..96ec3cf0b 100644
--- a/libXmu/src/CmapAlloc.c
+++ b/libXmu/src/CmapAlloc.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1989, 1994, 1998 The Open Group
@@ -52,11 +52,11 @@ static int icbrt(int);
static int icbrt_with_bits(int, int);
static int icbrt_with_guess(int, int);
-/* To determine the best allocation of reds, greens, and blues in a
+/* To determine the best allocation of reds, greens, and blues in a
* standard colormap, use XmuGetColormapAllocation.
* vinfo specifies visual information for a chosen visual
* property specifies one of the standard colormap property names
- * red_max returns maximum red value
+ * red_max returns maximum red value
* green_max returns maximum green value
* blue_max returns maximum blue value
*
@@ -115,15 +115,15 @@ gray_allocation(int n, unsigned long *red_max, unsigned long *green_max,
unsigned long *blue_max)
{
*red_max = (n * 30) / 100;
- *green_max = (n * 59) / 100;
- *blue_max = (n * 11) / 100;
+ *green_max = (n * 59) / 100;
+ *blue_max = (n * 11) / 100;
*green_max += ((n - 1) - (*red_max + *green_max + *blue_max));
}
/****************************************************************************/
/* Determine an appropriate color allocation for the RGB_DEFAULT_MAP.
* If a map has less than a minimum number of definable entries, we do not
- * produce an allocation for an RGB_DEFAULT_MAP.
+ * produce an allocation for an RGB_DEFAULT_MAP.
*
* For 16 planes, the default colormap will have 27 each RGB; for 12 planes,
* 12 each. For 8 planes, let n = the number of colormap entries, which may
@@ -183,7 +183,7 @@ default_allocation(XVisualInfo *vinfo, unsigned long *red,
ngrays = 12;
gray_allocation(ngrays, red, green, blue);
break;
-
+
default:
return 0;
}
@@ -207,7 +207,7 @@ default_allocation(XVisualInfo *vinfo, unsigned long *red,
* Which, on a GPX, allows for 252 entries in the best map, out of 254
* defineable colormap entries.
*/
-
+
static void
best_allocation(XVisualInfo *vinfo, unsigned long *red, unsigned long *green,
unsigned long *blue)
@@ -228,7 +228,7 @@ best_allocation(XVisualInfo *vinfo, unsigned long *red, unsigned long *green,
else
{
register int bits, n;
-
+
/* Determine n such that n is the least integral power of 2 which is
* greater than or equal to the number of entries in the colormap.
*/
@@ -239,11 +239,11 @@ best_allocation(XVisualInfo *vinfo, unsigned long *red, unsigned long *green,
n = n << 1;
bits++;
}
-
+
/* If the number of entries in the colormap is a power of 2, determine
* the allocation by "dealing" the bits, first to green, then red, then
* blue. If not, find the maximum integral red, green, and blue values
- * which, when multiplied together, do not exceed the number of
+ * which, when multiplied together, do not exceed the number of
* colormap entries.
*/
@@ -260,7 +260,7 @@ best_allocation(XVisualInfo *vinfo, unsigned long *red, unsigned long *green,
else
{
*red = icbrt_with_bits(vinfo->colormap_size, bits);
- *blue = *red;
+ *blue = *red;
*green = (vinfo->colormap_size / ((*red) * (*blue)));
}
(*red)--;
diff --git a/libXmu/src/CrCmap.c b/libXmu/src/CrCmap.c
index 4343f5f0f..9cb5c81c0 100644
--- a/libXmu/src/CrCmap.c
+++ b/libXmu/src/CrCmap.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1989, 1998 The Open Group
@@ -84,7 +84,7 @@ static Status readwrite_map(Display*, XVisualInfo*, XStandardColormap*);
*
* All colormaps are created with read only allocations, with the exception
* of read only allocations of colors in the default map or otherwise
- * which fail to return the expected pixel value, and these are individually
+ * which fail to return the expected pixel value, and these are individually
* defined as read/write allocations. This is done so that all the cells
* defined in the default map are contiguous, for use in image processing.
* This typically happens with White and Black in the default map.
@@ -93,7 +93,7 @@ static Status readwrite_map(Display*, XVisualInfo*, XStandardColormap*);
* the map of the static visual matches the definition given in the
* standard colormap structure.
*/
-
+
Status
XmuCreateColormap(Display *dpy, XStandardColormap *colormap)
/* dpy - specifies the connection under which the map is created
@@ -107,15 +107,15 @@ XmuCreateColormap(Display *dpy, XStandardColormap *colormap)
XVisualInfo *vpointer; /* for freeing the entire list */
long vinfo_mask; /* specifies the visual mask value */
int n; /* number of matching visuals */
- int status;
+ int status;
vinfo_template.visualid = colormap->visualid;
vinfo_mask = VisualIDMask;
if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
return 0;
- /* A visual id may be valid on multiple screens. Also, there may
- * be multiple visuals with identical visual ids at different depths.
+ /* A visual id may be valid on multiple screens. Also, there may
+ * be multiple visuals with identical visual ids at different depths.
* If the colormap is the Default Colormap, use the Default Visual.
* Otherwise, arbitrarily, use the deepest visual.
*/
@@ -158,9 +158,9 @@ XmuCreateColormap(Display *dpy, XStandardColormap *colormap)
status = TRUEMATCH(red_mult, red_max, red_mask) &&
TRUEMATCH(green_mult, green_max, green_mask) &&
TRUEMATCH(blue_mult, blue_max, blue_mask);
- else
+ else
status = readonly_map(dpy, vinfo, colormap);
-
+
XFree((char *) vpointer);
return status;
}
@@ -178,7 +178,7 @@ readwrite_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
unsigned long *pixels; /* array of colormap pixels */
unsigned long delta;
-
+
/* Determine ncolors, the number of colors to be defined.
* Insure that 1 < ncolors <= the colormap size.
*/
@@ -201,16 +201,16 @@ readwrite_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
if (ncolors <= 1 || (int) ncolors > vinfo->colormap_size) return 0;
/* Allocate Read/Write as much of the colormap as we can possibly get.
- * Then insure that the pixels we were allocated are given in
+ * Then insure that the pixels we were allocated are given in
* monotonically increasing order, using a quicksort. Next, insure
* that our allocation includes a subset of contiguous pixels at least
- * as long as the number of colors to be defined. Now we know that
+ * as long as the number of colors to be defined. Now we know that
* these conditions are met:
* 1) There are no free cells in the colormap.
- * 2) We have a contiguous sequence of pixels, monotonically
+ * 2) We have a contiguous sequence of pixels, monotonically
* increasing, of length >= the number of colors requested.
*
- * One cell at a time, we will free, compute the next color value,
+ * One cell at a time, we will free, compute the next color value,
* then allocate read only. This takes a long time.
* This is done to insure that cells are allocated read only in the
* contiguous order which we prefer. If the server has a choice of
@@ -319,7 +319,7 @@ readwrite_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
*/
if (first_index)
- XFreeColors(dpy, colormap->colormap, pixels, first_index,
+ XFreeColors(dpy, colormap->colormap, pixels, first_index,
(unsigned long) 0);
if (remainder)
XFreeColors(dpy, colormap->colormap,
@@ -345,7 +345,7 @@ ROmap(Display *dpy, Colormap cmap, unsigned long pixels[], int m, int n)
register int p;
/* first try to allocate the entire colormap */
- if (XAllocColorCells(dpy, cmap, 1, (unsigned long *) NULL,
+ if (XAllocColorCells(dpy, cmap, 1, (unsigned long *) NULL,
(unsigned) 0, pixels, (unsigned) m))
return m;
@@ -369,7 +369,7 @@ ROmap(Display *dpy, Colormap cmap, unsigned long pixels[], int m, int n)
}
return 0;
}
-
+
/****************************************************************************/
static Status
@@ -424,20 +424,20 @@ ROorRWcell(Display *dpy, Colormap cmap, unsigned long pixels[],
* If the read only allocation is granted, but gives us a cell which
* is not the one that we just freed, it is probably the case that
* we are trying allocate White or Black or some other color which
- * already has a read-only allocation in the map. So we try to
+ * already has a read-only allocation in the map. So we try to
* allocate the previously freed cell with a read/write allocation,
* because we want contiguous cells for image processing algorithms.
*/
-
+
pixel = color->pixel;
request.red = color->red;
request.green = color->green;
request.blue = color->blue;
XFreeColors(dpy, cmap, &pixel, 1, (unsigned long) 0);
- if (! XAllocColor(dpy, cmap, color)
+ if (! XAllocColor(dpy, cmap, color)
|| (color->pixel != pixel &&
- (!RWcell(dpy, cmap, color, &request, &pixel))))
+ (!RWcell(dpy, cmap, color, &request, &pixel))))
{
free_cells(dpy, cmap, pixels, npixels, (int)p);
return 0;
@@ -507,7 +507,7 @@ readonly_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
int i, last_pixel;
XColor color;
- last_pixel = (colormap->red_max + 1) * (colormap->green_max + 1) *
+ last_pixel = (colormap->red_max + 1) * (colormap->green_max + 1) *
(colormap->blue_max + 1) + colormap->base_pixel - 1;
for(i=colormap->base_pixel; i <= last_pixel; i++) {
diff --git a/libXmu/src/CursorName.c b/libXmu/src/CursorName.c
index 8867e8fa4..635ae51b2 100644
--- a/libXmu/src/CursorName.c
+++ b/libXmu/src/CursorName.c
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -121,7 +121,7 @@ XmuCursorNameToIndex(_Xconst char *name)
register _Xconst struct _CursorName *table;
register int i;
char tmp[40];
-
+
if (strlen (name) >= sizeof tmp) return -1;
XmuCopyISOLatin1Lowered (tmp, name);
diff --git a/libXmu/src/CvtCache.c b/libXmu/src/CvtCache.c
index 39a5d0caf..921b51a1f 100644
--- a/libXmu/src/CvtCache.c
+++ b/libXmu/src/CvtCache.c
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -24,7 +24,7 @@ in this Software without prior written authorization from The Open Group.
*/
-/*
+/*
* Author: Jim Fulton, MIT X Consortium
*/
@@ -100,7 +100,7 @@ _XmuCCLookupDisplay(Display *dpy)
dq = XmuDQCreate (_CloseDisplay, _FreeCCDQ, NULL);
if (!dq) return NULL;
}
-
+
/*
* See if the display is already there
*/
diff --git a/libXmu/src/CvtStdSel.c b/libXmu/src/CvtStdSel.c
index 81d1a8474..141dfe8df 100644
--- a/libXmu/src/CvtStdSel.c
+++ b/libXmu/src/CvtStdSel.c
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -110,7 +110,7 @@ get_os_name(void)
#ifdef OS_NAME
return XtNewString(OS_NAME);
#else
-#if defined(X_OS_FILE) || defined(MOTD_FILE)
+#if defined(X_OS_FILE) || defined(MOTD_FILE)
FILE *f = NULL;
#endif
diff --git a/libXmu/src/DefErrMsg.c b/libXmu/src/DefErrMsg.c
index 37fe0aa31..091d2c4aa 100644
--- a/libXmu/src/DefErrMsg.c
+++ b/libXmu/src/DefErrMsg.c
@@ -34,7 +34,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xmu/SysUtil.h>
/*
- * XmuPrintDefaultErrorMessage - print a nice error that looks like the usual
+ * XmuPrintDefaultErrorMessage - print a nice error that looks like the usual
* message. Returns 1 if the caller should consider exitting else 0.
*/
int
@@ -49,7 +49,7 @@ XmuPrintDefaultErrorMessage(Display *dpy, XErrorEvent *event, FILE *fp)
XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
(void) fprintf(fp, "%s: %s\n ", mesg, buffer);
- XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
+ XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
mesg, BUFSIZ);
(void) fprintf(fp, mesg, event->request_code);
if (event->request_code < 128) {
@@ -84,7 +84,7 @@ XmuPrintDefaultErrorMessage(Display *dpy, XErrorEvent *event, FILE *fp)
/* kludge, try to find the extension that caused it */
buffer[0] = '\0';
for (ext = dpy->ext_procs; ext; ext = ext->next) {
- if (ext->error_string)
+ if (ext->error_string)
(*ext->error_string)(dpy, event->error_code, &ext->codes,
buffer, BUFSIZ);
if (buffer[0]) {
@@ -95,7 +95,7 @@ XmuPrintDefaultErrorMessage(Display *dpy, XErrorEvent *event, FILE *fp)
ext->codes.first_error < event->error_code &&
(!bext || ext->codes.first_error > bext->codes.first_error))
bext = ext;
- }
+ }
if (bext)
XmuSnprintf(buffer, sizeof(buffer), "%s.%d", bext->name,
event->error_code - bext->codes.first_error);
@@ -134,7 +134,7 @@ XmuPrintDefaultErrorMessage(Display *dpy, XErrorEvent *event, FILE *fp)
(void) fprintf(fp, mesg, event->resourceid);
fputs("\n ", fp);
}
- XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
+ XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
mesg, BUFSIZ);
(void) fprintf(fp, mesg, event->serial);
fputs("\n ", fp);
@@ -166,4 +166,4 @@ XmuSimpleErrorHandler(Display *dpy, XErrorEvent *errorp)
}
/* got a "real" X error */
return XmuPrintDefaultErrorMessage (dpy, errorp, stderr);
-}
+}
diff --git a/libXmu/src/DelCmap.c b/libXmu/src/DelCmap.c
index f29ae00f0..462c812b1 100644
--- a/libXmu/src/DelCmap.c
+++ b/libXmu/src/DelCmap.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/DisplayQue.c b/libXmu/src/DisplayQue.c
index de76a69c4..7eea9f240 100644
--- a/libXmu/src/DisplayQue.c
+++ b/libXmu/src/DisplayQue.c
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -65,7 +65,7 @@ XmuDQCreate(XmuCloseDisplayQueueProc closefunc,
/*
- * XmuDQDestroy - free all storage associated with this display queue,
+ * XmuDQDestroy - free all storage associated with this display queue,
* optionally invoking the close callbacks.
*/
diff --git a/libXmu/src/DrawLogo.c b/libXmu/src/DrawLogo.c
index 4af89b530..21dbe3855 100644
--- a/libXmu/src/DrawLogo.c
+++ b/libXmu/src/DrawLogo.c
@@ -27,7 +27,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <X11/Xlib.h>
+#include <X11/Xlib.h>
#include <X11/Xmu/Drawing.h>
/*
@@ -57,10 +57,10 @@ XmuDrawLogo(Display *dpy, Drawable drawable, GC gcFore, GC gcBack,
x += (width - size) >> 1;
y += (height - size) >> 1;
-/*
+/*
* Draw what will be the thin strokes.
*
- * -----
+ * -----
* / /
* / /
* / /
@@ -81,10 +81,10 @@ XmuDrawLogo(Display *dpy, Drawable drawable, GC gcFore, GC gcBack,
poly[3].x = x + d31; poly[3].y = y + size;
XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
-/*
+/*
* Erase area not needed for lower thin stroke.
*
- * ------
+ * ------
* / /
* / __ /
* / / /
@@ -98,10 +98,10 @@ XmuDrawLogo(Display *dpy, Drawable drawable, GC gcFore, GC gcBack,
poly[3].x = x + d31; poly[3].y = y + size;
XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
-/*
+/*
* Erase area not needed for upper thin stroke.
*
- * ------
+ * ------
* / / /
* /--/ /
* / /
@@ -134,7 +134,7 @@ XmuDrawLogo(Display *dpy, Drawable drawable, GC gcFore, GC gcBack,
poly[3].x = x + size - size/4; poly[3].y = y + size;
XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
-/*
+/*
* Erase to create gap.
*
* /
diff --git a/libXmu/src/ExtAgent.c b/libXmu/src/ExtAgent.c
index 6b0dfdbd8..16a709ba1 100644
--- a/libXmu/src/ExtAgent.c
+++ b/libXmu/src/ExtAgent.c
@@ -35,7 +35,7 @@ void
XmuRegisterExternalAgent(Widget w, XtPointer data,
XEvent *event, Boolean *cont)
{
-/*
+/*
* This is a stub. Writers of protocol libraries
* that want to add protocol to Xaw, such as RAP, will reimplement this
* procedure in their own libraries.
diff --git a/libXmu/src/FToCback.c b/libXmu/src/FToCback.c
index 4ca8d459a..07c00fe05 100644
--- a/libXmu/src/FToCback.c
+++ b/libXmu/src/FToCback.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988,1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/GrayPixmap.c b/libXmu/src/GrayPixmap.c
index ccea46116..8005c3a0b 100644
--- a/libXmu/src/GrayPixmap.c
+++ b/libXmu/src/GrayPixmap.c
@@ -30,13 +30,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+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
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -99,7 +99,7 @@ XmuCreateStippledPixmap(Screen *screen, Pixel fore, Pixel back,
}
stippled_pixmap = XCreatePixmapFromBitmapData (display,
- RootWindowOfScreen(screen), (char *)pixmap_bits,
+ RootWindowOfScreen(screen), (char *)pixmap_bits,
pixmap_width, pixmap_height, fore, back, depth);
/* and insert it at the head of the cache */
diff --git a/libXmu/src/Initer.c b/libXmu/src/Initer.c
index bd7678480..42b2cd6b3 100644
--- a/libXmu/src/Initer.c
+++ b/libXmu/src/Initer.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988, 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -40,12 +40,12 @@ struct InitializerList {
XPointer data; /* Data to pass the function. */
XtAppContext * app_con_list; /* a null terminated list of app_contexts. */
};
-
+
/*
* Prototypes
*/
static Bool AddToAppconList(XtAppContext**, XtAppContext);
-
+
static struct InitializerList * init_list = NULL;
static Cardinal init_list_length = 0;
@@ -53,8 +53,8 @@ void
XmuAddInitializer(XmuInitializerProc func, XPointer data)
{
init_list_length++;
- init_list = (struct InitializerList *) XtRealloc( (char *) init_list,
- (sizeof(struct InitializerList) *
+ init_list = (struct InitializerList *) XtRealloc( (char *) init_list,
+ (sizeof(struct InitializerList) *
init_list_length) );
init_list[init_list_length - 1].function = func;
@@ -111,4 +111,4 @@ AddToAppconList(XtAppContext **app_list, XtAppContext app_con)
return (True);
}
-
+
diff --git a/libXmu/src/LocBitmap.c b/libXmu/src/LocBitmap.c
index 0cfbdaa23..b587de7be 100644
--- a/libXmu/src/LocBitmap.c
+++ b/libXmu/src/LocBitmap.c
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -75,10 +75,10 @@ static char **split_path_string(char*);
Pixmap
XmuLocateBitmapFile(Screen *screen, _Xconst char *name, char *srcname,
- int srcnamelen, int *widthp, int *heightp,
+ int srcnamelen, int *widthp, int *heightp,
int *xhotp, int *yhotp)
{
- return XmuLocatePixmapFile (screen, name,
+ return XmuLocatePixmapFile (screen, name,
(unsigned long) 1, (unsigned long) 0,
(unsigned int) 1, srcname, srcnamelen,
widthp, heightp, xhotp, yhotp);
@@ -89,9 +89,9 @@ XmuLocateBitmapFile(Screen *screen, _Xconst char *name, char *srcname,
* version that reads pixmap data as well as bitmap data
*/
Pixmap
-XmuLocatePixmapFile(Screen *screen, _Xconst char *name,
- unsigned long fore, unsigned long back,
- unsigned int depth,
+XmuLocatePixmapFile(Screen *screen, _Xconst char *name,
+ unsigned long fore, unsigned long back,
+ unsigned int depth,
char *srcname, int srcnamelen,
int *widthp, int *heightp, int *xhotp, int *yhotp)
{
@@ -131,10 +131,10 @@ XmuLocatePixmapFile(Screen *screen, _Xconst char *name,
/* what a hack; need to initialize it */
(void) XGetDefault (dpy, "", "");
}
- if (XrmQGetResource (XrmGetDatabase(dpy), xrm_name, xrm_class,
+ if (XrmQGetResource (XrmGetDatabase(dpy), xrm_name, xrm_class,
&rep_type, &value) &&
rep_type == XrmPermStringToQuark("String")) {
- cache->string_to_bitmap.bitmapFilePath =
+ cache->string_to_bitmap.bitmapFilePath =
split_path_string (value.addr);
}
}
@@ -262,7 +262,7 @@ void
_XmuStringToBitmapFreeCache(register XmuCvtCache *c)
{
if (c->string_to_bitmap.bitmapFilePath) {
- if (c->string_to_bitmap.bitmapFilePath[0])
+ if (c->string_to_bitmap.bitmapFilePath[0])
free (c->string_to_bitmap.bitmapFilePath[0]);
free ((char *) (c->string_to_bitmap.bitmapFilePath));
}
diff --git a/libXmu/src/Lookup.c b/libXmu/src/Lookup.c
index 75b546df4..023b33e47 100644
--- a/libXmu/src/Lookup.c
+++ b/libXmu/src/Lookup.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988, 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/LookupCmap.c b/libXmu/src/LookupCmap.c
index 5756b83ec..4a522907e 100644
--- a/libXmu/src/LookupCmap.c
+++ b/libXmu/src/LookupCmap.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -45,7 +45,7 @@ static Status lookup(Display*, int, VisualID, Atom, XStandardColormap*, Bool);
/*
* To create a standard colormap if one does not currently exist, or
- * replace the currently existing standard colormap, use
+ * replace the currently existing standard colormap, use
* XmuLookupStandardColormap().
*
* Given a screen, a visual, and a property, XmuLookupStandardColormap()
@@ -54,14 +54,14 @@ static Status lookup(Display*, int, VisualID, Atom, XStandardColormap*, Bool);
* the default colormap of the screen. It will call XmuStandardColormap()
* to create the standard colormap.
*
- * If replace is true, any previous definition of the property will be
+ * If replace is true, any previous definition of the property will be
* replaced. If retain is true, the property and the colormap will be
* made permanent for the duration of the server session. However,
* pre-existing property definitions which are not replaced cannot be made
- * permanent by a call to XmuLookupStandardColormap(); a request to retain
+ * permanent by a call to XmuLookupStandardColormap(); a request to retain
* resources pertains to newly created resources.
*
- * Returns 0 on failure, non-zero on success. A request to create a
+ * Returns 0 on failure, non-zero on success. A request to create a
* standard colormap upon a visual which cannot support such a map is
* considered a failure. An example of this would be requesting any
* standard colormap property on a monochrome visual, or, requesting an
@@ -83,18 +83,18 @@ XmuLookupStandardColormap(Display *dpy, int screen, VisualID visualid,
*/
{
Display *odpy; /* original display connection */
- XStandardColormap *colormap;
+ XStandardColormap *colormap;
XVisualInfo vinfo_template, *vinfo; /* visual */
long vinfo_mask;
unsigned long r_max, g_max, b_max; /* allocation */
- int count;
+ int count;
Colormap cmap; /* colormap ID */
Status status = 0;
/* Match the requested visual */
- vinfo_template.visualid = visualid;
+ vinfo_template.visualid = visualid;
vinfo_template.screen = screen;
vinfo_template.depth = depth;
vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
@@ -106,10 +106,10 @@ XmuLookupStandardColormap(Display *dpy, int screen, VisualID visualid,
if (vinfo->colormap_size <= 2) {
XFree((char *) vinfo);
- return 0;
+ return 0;
}
- /* If the requested property already exists on this screen, and,
+ /* If the requested property already exists on this screen, and,
* if the replace flag has not been set to true, return success.
* lookup() will remove a pre-existing map if replace is true.
*/
@@ -158,7 +158,7 @@ XmuLookupStandardColormap(Display *dpy, int screen, VisualID visualid,
!replace) {
/* Someone has defined the property since we last looked.
* Since we will not replace it, release our own resources.
- * If this is the default map, our allocations will be freed
+ * If this is the default map, our allocations will be freed
* when this connection closes.
*/
if (colormap->killid == ReleaseByFreeingColormap)
@@ -190,7 +190,7 @@ XmuLookupStandardColormap(Display *dpy, int screen, VisualID visualid,
*
* If new is not NULL, new points to an XStandardColormap structure which
* describes a standard colormap of the specified property. It will be made
- * a standard colormap of the screen if none already exists, or if replace
+ * a standard colormap of the screen if none already exists, or if replace
* is true.
*/
@@ -232,7 +232,7 @@ lookup(Display *dpy, int screen, VisualID visualid, Atom property,
}
/* The property exists and is RGB_DEFAULT_MAP */
-
+
for (i=0, s=stdcmaps; (i < count) && (s->visualid != visualid); i++, s++)
;
@@ -278,9 +278,9 @@ lookup(Display *dpy, int screen, VisualID visualid, Atom property,
/* Found an RGB_DEFAULT_MAP property with a matching visualid */
if (replace) {
- /* Free old resources first - we may need them, particularly in
+ /* Free old resources first - we may need them, particularly in
* the default colormap of the screen. However, because of this,
- * it is possible that we will destroy the old resource and fail
+ * it is possible that we will destroy the old resource and fail
* to create a new one if XmuStandardColormap() fails.
*/
diff --git a/libXmu/src/Lower.c b/libXmu/src/Lower.c
index 7522cc161..d3aaaf3ee 100644
--- a/libXmu/src/Lower.c
+++ b/libXmu/src/Lower.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/Makefile.am b/libXmu/src/Makefile.am
index ad5b55ddd..7e3185309 100644
--- a/libXmu/src/Makefile.am
+++ b/libXmu/src/Makefile.am
@@ -80,8 +80,8 @@ lintlibdir = $(libdir)
lintlib_DATA = $(LINTLIB) $(LINTLIBUU)
$(LINTLIB): $(libXmu_la_SOURCES)
- $(LINT) -y -oXmu -x $(ALL_LINT_FLAGS) $(libXmu_la_SOURCES)
+ $(LINT) -y -oXmu -x $(ALL_LINT_FLAGS) $(libXmu_la_SOURCES)
$(LINTLIBUU): $(libXmuu_la_SOURCES)
- $(LINT) -y -oXmuu -x $(ALL_LINT_FLAGS) $(libXmuu_la_SOURCES)
+ $(LINT) -y -oXmuu -x $(ALL_LINT_FLAGS) $(libXmuu_la_SOURCES)
endif MAKE_LINT_LIB
diff --git a/libXmu/src/RdBitF.c b/libXmu/src/RdBitF.c
index ece6d53ce..ea447c3c8 100644
--- a/libXmu/src/RdBitF.c
+++ b/libXmu/src/RdBitF.c
@@ -35,7 +35,7 @@ in this Software without prior written authorization from The Open Group.
* and return data
*
* Note that this file and ../X/XRdBitF.c look very similar.... Keep them
- * that way (but don't use common source code so that people can have one
+ * that way (but don't use common source code so that people can have one
* without the other).
*/
@@ -102,7 +102,7 @@ initHexTable(void)
hexTable[' '] = -1; hexTable[','] = -1;
hexTable['}'] = -1; hexTable['\n'] = -1;
hexTable['\t'] = -1;
-
+
initialized = True;
}
@@ -116,7 +116,7 @@ NextInt(FILE *fstream)
int value = 0;
int gotone = 0;
int done = 0;
-
+
/* loop, accumulate hex value until find delimiter */
/* skip any initial delimiters found in read stream */
@@ -196,7 +196,7 @@ XmuReadBitmapData(FILE *fstream, unsigned int *width, unsigned int *height,
}
continue;
}
-
+
if (sscanf(line, "static short %s = {", name_and_type) == 1)
version10p = 1;
else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1)
@@ -213,7 +213,7 @@ XmuReadBitmapData(FILE *fstream, unsigned int *width, unsigned int *height,
if (strcmp("bits[]", type))
continue;
-
+
if (!ww || !hh)
RETURN (BitmapFileInvalid);
@@ -226,7 +226,7 @@ XmuReadBitmapData(FILE *fstream, unsigned int *width, unsigned int *height,
size = bytes_per_line * hh;
data = (unsigned char *) Xmalloc ((unsigned int) size);
- if (!data)
+ if (!data)
RETURN (BitmapNoMemory);
if (version10p) {
@@ -245,7 +245,7 @@ XmuReadBitmapData(FILE *fstream, unsigned int *width, unsigned int *height,
int bytes;
for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) {
- if ((value = NextInt(fstream)) < 0)
+ if ((value = NextInt(fstream)) < 0)
RETURN (BitmapFileInvalid);
*ptr=value;
}
@@ -319,7 +319,7 @@ AccessFile(_Xconst char *path, char *pathbuf, int len_pathbuf, char **pathret)
return 1;
}
-#ifndef __UNIXOS2__
+#ifndef __UNIXOS2__
/* one last place to look */
drive = getenv ("HOMEDRIVE");
if (drive) {
@@ -382,7 +382,7 @@ fopen_file(_Xconst char *path, char *mode)
int
-XmuReadBitmapDataFromFile(_Xconst char *filename, unsigned int *width,
+XmuReadBitmapDataFromFile(_Xconst char *filename, unsigned int *width,
unsigned int *height, unsigned char **datap,
int *x_hot, int *y_hot)
{
diff --git a/libXmu/src/ShapeWidg.c b/libXmu/src/ShapeWidg.c
index bb8c4fbb3..32388ee46 100644
--- a/libXmu/src/ShapeWidg.c
+++ b/libXmu/src/ShapeWidg.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -142,7 +142,7 @@ ShapeOval(Widget w)
rad = height >> 1;
XDrawLine(dpy, p, gc, rad, rad, width - rad - 1, rad);
}
- XShapeCombineMask(dpy, XtWindow(w), ShapeBounding,
+ XShapeCombineMask(dpy, XtWindow(w), ShapeBounding,
-(int)w->core.border_width, -(int)w->core.border_width,
p, ShapeSet);
if (w->core.border_width)
diff --git a/libXmu/src/StdCmap.c b/libXmu/src/StdCmap.c
index 5d2ce6160..ccc822e17 100644
--- a/libXmu/src/StdCmap.c
+++ b/libXmu/src/StdCmap.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1989, 1998 The Open Group
@@ -54,7 +54,7 @@ static Status valid_args(XVisualInfo*, unsigned long, unsigned long,
* given standard property name. Return a pointer to an XStandardColormap
* structure which describes the newly created colormap, upon success.
* Upon failure, return NULL.
- *
+ *
* XmuStandardColormap() calls XmuCreateColormap() to create the map.
*
* Resources created by this function are not made permanent; that is the
@@ -83,7 +83,7 @@ XmuStandardColormap(Display *dpy, int screen, VisualID visualid,
int n;
/* Match the required visual information to an actual visual */
- vinfo_template.visualid = visualid;
+ vinfo_template.visualid = visualid;
vinfo_template.screen = screen;
vinfo_template.depth = depth;
vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
@@ -120,7 +120,7 @@ XmuStandardColormap(Display *dpy, int screen, VisualID visualid,
stdcmap->red_max = red_max;
stdcmap->green_max = green_max;
stdcmap->blue_max = blue_max;
- if (property == XA_RGB_GRAY_MAP)
+ if (property == XA_RGB_GRAY_MAP)
stdcmap->red_mult = stdcmap->green_mult = stdcmap->blue_mult = 1;
else if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
stdcmap->red_mult = lowbit(vinfo->red_mask);
@@ -149,7 +149,7 @@ XmuStandardColormap(Display *dpy, int screen, VisualID visualid,
XFreeColormap(dpy, stdcmap->colormap);
else if (stdcmap->killid != None)
XFreePixmap(dpy, stdcmap->killid);
-
+
XFree((char *) stdcmap);
return (XStandardColormap *) NULL;
}
@@ -197,7 +197,7 @@ valid_args(XVisualInfo *vinfo, unsigned long red_max, unsigned long green_max,
if (ncolors > vinfo->colormap_size)
return 0;
}
-
+
/* Determine that the allocation and visual make sense for the property */
switch (property)
@@ -214,7 +214,7 @@ valid_args(XVisualInfo *vinfo, unsigned long red_max, unsigned long green_max,
if (green_max == 0)
return 0;
break;
- case XA_RGB_BLUE_MAP:
+ case XA_RGB_BLUE_MAP:
if (blue_max == 0)
return 0;
break;
diff --git a/libXmu/src/StrToBS.c b/libXmu/src/StrToBS.c
index 0dd0be519..c515109d2 100644
--- a/libXmu/src/StrToBS.c
+++ b/libXmu/src/StrToBS.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/StrToBmap.c b/libXmu/src/StrToBmap.c
index 80df74bc7..c2b49e3f4 100644
--- a/libXmu/src/StrToBmap.c
+++ b/libXmu/src/StrToBmap.c
@@ -30,13 +30,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+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
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -66,7 +66,7 @@ SOFTWARE.
* BitmapFilePath. If the resource is not defined, the default
* value is the build symbol BITMAPDIR.
*
- * shares lots of code with XmuConvertStringToCursor.
+ * shares lots of code with XmuConvertStringToCursor.
*
* To use, include the following in your ClassInitialize procedure:
diff --git a/libXmu/src/StrToCurs.c b/libXmu/src/StrToCurs.c
index 5645f2ef9..714b004ee 100644
--- a/libXmu/src/StrToCurs.c
+++ b/libXmu/src/StrToCurs.c
@@ -30,13 +30,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+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
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -97,7 +97,7 @@ SOFTWARE.
* XmuConvertStringToCursor:
*
* allows String to specify a standard cursor name (from cursorfont.h), a
- * font name and glyph index of the form "FONT fontname index [[font] index]",
+ * font name and glyph index of the form "FONT fontname index [[font] index]",
* or a bitmap file name (absolute, or relative to the global resource
* bitmapFilePath, class BitmapFilePath). If the resource is not
* defined, the default value is the build symbol BITMAPDIR.
@@ -112,7 +112,7 @@ static XtConvertArgRec screenConvertArg[] = {
sizeof(Screen *)}
};
- XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
+ XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
screenConvertArg, XtNumber(screenConvertArg));
*
*/
@@ -251,7 +251,7 @@ XmuCvtStringToCursor(XrmValuePtr args, Cardinal *num_args,
return;
}
- if ((source = XmuLocateBitmapFile (screen, name,
+ if ((source = XmuLocateBitmapFile (screen, name,
maskname, (sizeof maskname) - 4,
NULL, NULL, &xhot, &yhot)) == None) {
XtStringConversionWarning (name, XtRCursor);
@@ -262,7 +262,7 @@ XmuCvtStringToCursor(XrmValuePtr args, Cardinal *num_args,
len = strlen (maskname);
for (i = 0; i < 2; i++) {
strcpy (maskname + len, i == 0 ? "Mask" : "msk");
- if ((mask = XmuLocateBitmapFile (screen, maskname, NULL, 0,
+ if ((mask = XmuLocateBitmapFile (screen, maskname, NULL, 0,
NULL, NULL, NULL, NULL)) != None)
break;
}
@@ -333,7 +333,7 @@ XmuCvtStringToColorCursor(Display *dpy, XrmValuePtr args, Cardinal *num_args,
number = 1;
XmuCvtStringToCursor(args, &number, fromVal, &ret_val);
-
+
cursor = *((Cursor *) ret_val.addr);
if (cursor == None || (fg == BlackPixelOfScreen(screen)
@@ -348,5 +348,5 @@ XmuCvtStringToColorCursor(Display *dpy, XrmValuePtr args, Cardinal *num_args,
new_done(Cursor, cursor);
}
-
-
+
+
diff --git a/libXmu/src/StrToGrav.c b/libXmu/src/StrToGrav.c
index 8d86fe51d..44cc13bb0 100644
--- a/libXmu/src/StrToGrav.c
+++ b/libXmu/src/StrToGrav.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1989, 1998 The Open Group
@@ -62,7 +62,7 @@ static struct _namepair {
};
/*
- * This function is deprecated as of the addition of
+ * This function is deprecated as of the addition of
* XtCvtStringToGravity in R6
*/
void
diff --git a/libXmu/src/StrToJust.c b/libXmu/src/StrToJust.c
index 03b38545d..234f3a37f 100644
--- a/libXmu/src/StrToJust.c
+++ b/libXmu/src/StrToJust.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/StrToLong.c b/libXmu/src/StrToLong.c
index c0663f5ce..8ee2ee4e4 100644
--- a/libXmu/src/StrToLong.c
+++ b/libXmu/src/StrToLong.c
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/StrToOrnt.c b/libXmu/src/StrToOrnt.c
index 0c41c116c..5d54b1acc 100644
--- a/libXmu/src/StrToOrnt.c
+++ b/libXmu/src/StrToOrnt.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/StrToShap.c b/libXmu/src/StrToShap.c
index 298c91522..0773404a1 100644
--- a/libXmu/src/StrToShap.c
+++ b/libXmu/src/StrToShap.c
@@ -1,5 +1,5 @@
-/*
-
+/*
+
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
diff --git a/libXmu/src/UpdMapHint.c b/libXmu/src/UpdMapHint.c
index 389b80213..d68ee609b 100644
--- a/libXmu/src/UpdMapHint.c
+++ b/libXmu/src/UpdMapHint.c
@@ -56,4 +56,4 @@ XmuUpdateMapHints(Display *dpy, Window w, XSizeHints *hints)
XSetWMNormalHints (dpy, w, hints);
return True;
}
-
+
diff --git a/libXmu/src/VisCmap.c b/libXmu/src/VisCmap.c
index 0a35713ba..c3198de38 100644
--- a/libXmu/src/VisCmap.c
+++ b/libXmu/src/VisCmap.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1989, 1998 The Open Group
@@ -41,7 +41,7 @@ in this Software without prior written authorization from The Open Group.
/*
* To create all of the appropriate standard colormaps for a given visual on
* a given screen, use XmuVisualStandardColormaps.
- *
+ *
* Define all appropriate standard colormap properties for the given visual.
* If replace is true, any previous definition will be removed.
* If retain is true, new properties will be retained for the duration of
@@ -147,7 +147,7 @@ XmuVisualStandardColormaps(Display *dpy, int screen, VisualID visualid,
status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
XA_RGB_BEST_MAP, replace, retain);
- if (!status && (vinfo->class == PseudoColor ||
+ if (!status && (vinfo->class == PseudoColor ||
vinfo->class == DirectColor)) {
XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
diff --git a/libXmu/src/WidgetNode.c b/libXmu/src/WidgetNode.c
index 8ce169eb5..0cf0bb6c9 100644
--- a/libXmu/src/WidgetNode.c
+++ b/libXmu/src/WidgetNode.c
@@ -1,5 +1,5 @@
/*
-
+
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -101,7 +101,7 @@ find_resource(XmuWidgetNode *node, char *name, Bool cons)
#define nreslist (int) (cons ? sup->nconstraints : sup->nresources)
res.resource_name = name;
- for (sup = node->superclass;
+ for (sup = node->superclass;
sup && (XtResourceList) binsearch ((char *) &res,
reslist, nreslist,
sizeof(XtResource),
@@ -195,7 +195,7 @@ XmuWnInitializeNodes(XmuWidgetNode *nodearray, int nnodes)
*/
superclass = superclass->core_class.superclass;
}
- done:
+ done:
if (wn->superclass) {
wn->siblings = wn->superclass->children;
wn->superclass->children = wn;
diff --git a/libXmu/src/Xct.c b/libXmu/src/Xct.c
index 1db470ebb..9ff8d3cb0 100644
--- a/libXmu/src/Xct.c
+++ b/libXmu/src/Xct.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 1989, 1998 The Open Group
@@ -334,7 +334,7 @@ ShiftGRToGL(register XctData data, int hasCdata)
else
priv->itembuf = (XctString)malloc(priv->buf_count);
}
- (void) memmove((char *)priv->itembuf, (char *)data->item,
+ (void) memmove((char *)priv->itembuf, (char *)data->item,
data->item_length);
data->item = priv->itembuf;
if (hasCdata) {
diff --git a/libfontenc/Makefile.am b/libfontenc/Makefile.am
index bff1adecc..481f272e6 100644
--- a/libfontenc/Makefile.am
+++ b/libfontenc/Makefile.am
@@ -1,42 +1,42 @@
-#
-# Copyright 2005 Red Hat, 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 Red Hat not be used in
-# advertising or publicity pertaining to distribution of the software without
-# specific, written prior permission. Red Hat makes no
-# representations about the suitability of this software for any purpose. It
-# is provided "as is" without express or implied warranty.
-#
-# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-# EVENT SHALL RED HAT 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.
-
-SUBDIRS = src
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = fontenc.pc
-
-MAINTAINERCLEANFILES = ChangeLog INSTALL
-
-.PHONY: ChangeLog INSTALL
-
-INSTALL:
- $(INSTALL_CMD)
-
-ChangeLog:
- $(CHANGELOG_CMD)
-
-dist-hook: ChangeLog INSTALL
-
-if LINT
-lint:
- (cd src && $(MAKE) $(MFLAGS) lint)
-endif LINT
+#
+# Copyright 2005 Red Hat, 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 Red Hat not be used in
+# advertising or publicity pertaining to distribution of the software without
+# specific, written prior permission. Red Hat makes no
+# representations about the suitability of this software for any purpose. It
+# is provided "as is" without express or implied warranty.
+#
+# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL RED HAT 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.
+
+SUBDIRS = src
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = fontenc.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+ $(INSTALL_CMD)
+
+ChangeLog:
+ $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
+
+if LINT
+lint:
+ (cd src && $(MAKE) $(MFLAGS) lint)
+endif LINT
diff --git a/libfontenc/src/encparse.c b/libfontenc/src/encparse.c
index af65f3219..23a6dd673 100644
--- a/libfontenc/src/encparse.c
+++ b/libfontenc/src/encparse.c
@@ -86,7 +86,7 @@ skipEndOfLine(FontFilePtr f, int c)
{
if(c == 0)
c = FontFileGetc(f);
-
+
for(;;)
if(c <= 0 || c == '\n')
return;
@@ -126,7 +126,7 @@ getnum(FontFilePtr f, int c, int *cp)
*cp = c; return n;
}
-
+
/* Skip to beginning of new line; return 1 if only whitespace was found. */
static int
endOfLine(FontFilePtr f, int c)
@@ -363,7 +363,7 @@ getnextline(FontFilePtr f)
return ERROR_LINE;
}
} else if(!strcasecmp(keyword_value, "ENDENCODING")) {
- if(endOfLine(f,c))
+ if(endOfLine(f,c))
return EOF_LINE;
else
return ERROR_LINE;
@@ -381,7 +381,7 @@ getnextline(FontFilePtr f)
}
}
-static void
+static void
install_mapping(FontEncPtr encoding, FontMapPtr mapping)
{
FontMapPtr m;
@@ -638,7 +638,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
goto error;
}
goto mapping;
-
+
case CODE_UNDEFINE_LINE:
if(value1 > 0x10000)
value1 = 0x10000;
@@ -659,7 +659,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
default: goto mapping; /* ignore unknown lines */
}
-
+
string_mapping:
line = getnextline(f);
switch(line) {
@@ -792,16 +792,16 @@ parseFontFileName(const char *fontFileName, char *buf, char *dir)
{
const char *p;
char *q, *lastslash;
-
+
for(p = fontFileName, q = dir, lastslash = NULL; *p; p++, q++) {
*q = *p;
if(*p == '/')
lastslash = q+1;
}
-
+
if(!lastslash)
lastslash = dir;
-
+
*lastslash = '\0';
if(buf && strlen(dir) + 14 < MAXFONTFILENAMELEN) {
@@ -811,7 +811,7 @@ parseFontFileName(const char *fontFileName, char *buf, char *dir)
}
static FontEncPtr
-FontEncReallyReallyLoad(const char *charset,
+FontEncReallyReallyLoad(const char *charset,
const char *dirname, const char *dir)
{
FontFilePtr f;
@@ -821,14 +821,14 @@ FontEncReallyReallyLoad(const char *charset,
buf[MAXFONTFILENAMELEN];
int count, n;
static char format[24] = "";
-
+
/* As we don't really expect to open encodings that often, we don't
take the trouble of caching encodings directories. */
if((file = fopen(dirname, "r")) == NULL) {
return NULL;
}
-
+
count = fscanf(file, "%d\n", &n);
if(count == EOF || count != 1) {
fclose(file);
@@ -862,7 +862,7 @@ FontEncReallyReallyLoad(const char *charset,
f = FontFileOpen(buf);
if(f == NULL) {
- fclose(file);
+ fclose(file);
return NULL;
}
encoding = parseEncodingFile(f, 0);
@@ -876,7 +876,7 @@ FontEncReallyReallyLoad(const char *charset,
return encoding;
}
-/* Parser ntrypoint -- used by FontEncLoad */
+/* Parser ntrypoint -- used by FontEncLoad */
FontEncPtr
FontEncReallyLoad(const char *charset, const char *fontFileName)
{
@@ -890,14 +890,14 @@ FontEncReallyLoad(const char *charset, const char *fontFileName)
if(encoding)
return(encoding);
}
-
+
d = FontEncDirectory();
if(d) {
parseFontFileName(d, NULL, dir);
encoding = FontEncReallyReallyLoad(charset, d, dir);
return encoding;
}
-
+
return NULL;
}
@@ -912,7 +912,7 @@ FontEncIdentify(const char *fileName)
FontEncPtr encoding;
char **names, **name, **alias;
int numaliases;
-
+
if((f = FontFileOpen(fileName))==NULL) {
return NULL;
}
diff --git a/libfontenc/src/fontenc.c b/libfontenc/src/fontenc.c
index b87602c49..1f6f5f302 100644
--- a/libfontenc/src/fontenc.c
+++ b/libfontenc/src/fontenc.c
@@ -1,936 +1,936 @@
-/*
-Copyright (c) 1998-2001 by Juliusz Chroboczek
-
-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 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.
-*/
-
-/* Backend-independent encoding code */
-
-#include <string.h>
-
-#if defined(__SCO__) || defined(__UNIXWARE__)
-#include <strings.h>
-#endif
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#define FALSE 0
-#define TRUE 1
-#define MAXFONTNAMELEN 1024
-#define MAXFONTFILENAMELEN 1024
-
-#include <X11/fonts/fontenc.h>
-#include "fontencI.h"
-
-/* Functions local to this file */
-
-static FontEncPtr FontEncLoad(const char*, const char*);
-
-/* Early versions of this code only knew about hardwired encodings,
- hence the following data. Now that the code knows how to load an
- encoding from a file, most of these tables could go away. */
-
-/* At any rate, no new hardcoded encodings will be added. */
-
-static FontMapRec iso10646[]=
-{
- {FONT_ENCODING_UNICODE,0,0,NULL,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-/* Notice that the Apple encodings do not have all the characters in
- the corresponding ISO 8859, and therefore the table has some holes.
- There's not much more we can do with fonts without a Unicode cmap
- unless we are willing to combine cmaps (which we are not). */
-
-static const unsigned short
-iso8859_1_apple_roman[]=
-{ 0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x00, 0xA4,
- 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8,
- 0xA1, 0xB1, 0x00, 0x00, 0xAB, 0xB5, 0xA6, 0xE1,
- 0xFC, 0x00, 0xBC, 0xC8, 0x00, 0x00, 0x00, 0xC0,
- 0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82,
- 0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC,
- 0x00, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0x00,
- 0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0x00, 0x00, 0xA7,
- 0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D,
- 0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95,
- 0x00, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6,
- 0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0x00, 0x00, 0xD8 };
-
-/* Cannot use simple_recode because need to eliminate 0x80<=code<0xA0 */
-static unsigned
-iso8859_1_to_apple_roman(unsigned isocode, void *client_data)
-{
- if(isocode<=0x80)
- return isocode;
- else if(isocode>=0xA0)
- return iso8859_1_apple_roman[isocode-0xA0];
- else
- return 0;
-}
-
-static FontMapRec iso8859_1[]=
-{
- {FONT_ENCODING_TRUETYPE,2,2,NULL,NULL,NULL,NULL,NULL}, /* ISO 8859-1 */
- {FONT_ENCODING_UNICODE,0,0,NULL,NULL,NULL,NULL,NULL}, /* ISO 8859-1 coincides with Unicode*/
- {FONT_ENCODING_TRUETYPE,1,0,iso8859_1_to_apple_roman,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static const unsigned short iso8859_2_tophalf[]=
-{ 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7,
- 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B,
- 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7,
- 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C,
- 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
- 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
- 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
- 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
- 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
- 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
- 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
- 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 };
-
-static FontEncSimpleMapRec iso8859_2_to_unicode_map=
-{0x60, 0, 0xA0, iso8859_2_tophalf };
-
-static const unsigned short iso8859_2_apple_centeuro[]=
-{ 0xCA, 0x84, 0x00, 0xFC, 0x00, 0xBB, 0xE5, 0xA4,
- 0xAC, 0xE1, 0x00, 0xE8, 0x8F, 0x00, 0xEB, 0xFB,
- 0xA1, 0x88, 0x00, 0xB8, 0x00, 0xBC, 0xE6, 0xFF,
- 0x00, 0xE4, 0x00, 0xE9, 0x90, 0x00, 0xEC, 0xFD,
- 0xD9, 0xE7, 0x00, 0x00, 0x80, 0xBD, 0x8C, 0x00,
- 0x89, 0x83, 0xA2, 0x00, 0x9D, 0xEA, 0x00, 0x91,
- 0x00, 0xC1, 0xC5, 0xEE, 0xEF, 0xCC, 0x85, 0x00,
- 0xDB, 0xF1, 0xF2, 0xF4, 0x86, 0xF8, 0x00, 0xA7,
- 0xDA, 0x87, 0x00, 0x00, 0x8A, 0xBE, 0x8D, 0x00,
- 0x8B, 0x8E, 0xAB, 0x00, 0x9E, 0x92, 0x00, 0x93,
- 0x00, 0xC4, 0xCB, 0x97, 0x99, 0xCE, 0x9A, 0xD6,
- 0xDE, 0xF3, 0x9C, 0xF5, 0x9F, 0xF9, 0x00, 0x00 };
-
-static unsigned
-iso8859_2_to_apple_centeuro(unsigned isocode, void *client_data)
-{
- if(isocode<=0x80)
- return isocode;
- else if(isocode>=0xA0)
- return iso8859_2_apple_centeuro[isocode-0xA0];
- else
- return 0;
-}
-
-
-static FontMapRec iso8859_2[]=
-{
- {FONT_ENCODING_UNICODE,0,0,
- FontEncSimpleRecode,NULL,&iso8859_2_to_unicode_map,NULL,NULL},
- {FONT_ENCODING_TRUETYPE,1,29,iso8859_2_to_apple_centeuro,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static const unsigned short iso8859_3_tophalf[]=
-{ 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7,
- 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B,
- 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7,
- 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C,
- 0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7,
- 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
- 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7,
- 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF,
- 0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7,
- 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
- 0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7,
- 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9};
-
-static FontEncSimpleMapRec iso8859_3_to_unicode_map=
-{ 0x60, 0, 0xA0, iso8859_3_tophalf };
-
-static FontMapRec iso8859_3[]=
-{
- {FONT_ENCODING_UNICODE,0,0,
- FontEncSimpleRecode,NULL,&iso8859_3_to_unicode_map,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-
-static const unsigned short iso8859_4_tophalf[]=
-{ 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7,
- 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF,
- 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7,
- 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B,
- 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E,
- 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A,
- 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
- 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF,
- 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F,
- 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B,
- 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
- 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9,
-};
-
-static FontEncSimpleMapRec iso8859_4_to_unicode_map=
-{ 0x60, 0, 0xA0, iso8859_4_tophalf };
-
-static FontMapRec iso8859_4[]=
-{
- {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL,
- &iso8859_4_to_unicode_map,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static const unsigned short iso8859_5_tophalf[]=
-{ 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
- 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F,
- 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
- 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
- 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
- 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
- 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
- 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
- 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
- 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
- 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
- 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F};
-
-static FontEncSimpleMapRec iso8859_5_to_unicode_map=
-{ 0x60, 0, 0xA0, iso8859_5_tophalf };
-
-static const unsigned short
-iso8859_5_apple_cyrillic[]=
-{ 0xCA, 0xDD, 0xAB, 0xAE, 0xB8, 0xC1, 0xA7, 0xBA,
- 0xB7, 0xBC, 0xBE, 0xCB, 0xCD, 0x00, 0xD8, 0xDA,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
- 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
- 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
- 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
- 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF,
- 0xDC, 0xDE, 0xAC, 0xAF, 0xB9, 0xCF, 0xB4, 0xBB,
- 0xC0, 0xBD, 0xBF, 0xCC, 0xCE, 0xA4, 0xD9, 0xDB };
-
-static unsigned
-iso8859_5_to_apple_cyrillic(unsigned isocode, void *client_data)
-{
- if(isocode<=0x80)
- return isocode;
- else if(isocode>=0xA0)
- return iso8859_5_apple_cyrillic[isocode-0x80];
- else return 0;
-}
-
-static FontMapRec iso8859_5[]=
-{
- {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL,
- &iso8859_5_to_unicode_map,NULL,NULL},
- {FONT_ENCODING_TRUETYPE,1,7,iso8859_5_to_apple_cyrillic,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-/* ISO 8859-6 seems useless for serving fonts (not enough presentation
- * forms). What do Arabic-speakers use? */
-
-static unsigned
-iso8859_6_to_unicode(unsigned isocode, void *client_data)
-{
- if(isocode<=0xA0 || isocode==0xA4 || isocode==0xAD)
- return isocode;
- else if(isocode==0xAC || isocode==0xBB ||
- (isocode>=0xBF && isocode<=0xDA) ||
- (isocode>=0xE0 && isocode<=0xEF) ||
- (isocode>=0xF0 && isocode<=0xF2))
- return isocode-0xA0+0x0600;
- else
- return 0;
-}
-
-static FontMapRec iso8859_6[]=
-{
- {FONT_ENCODING_UNICODE,0,0,iso8859_6_to_unicode,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static unsigned
-iso8859_7_to_unicode(unsigned isocode, void *client_data)
-{
- if(isocode<=0xA0 ||
- (isocode>=0xA3 && isocode<=0xAD) ||
- (isocode>=0xB0 && isocode<=0xB3) ||
- isocode==0xB7 || isocode==0xBB || isocode==0xBD)
- return isocode;
- else if(isocode==0xA1)
- return 0x02BD;
- else if(isocode==0xA2)
- return 0x02BC;
- else if(isocode==0xAF)
- return 0x2015;
- else if(isocode>=0xB4)
- return isocode-0xA0+0x0370;
- else
- return 0;
-}
-
-static FontMapRec iso8859_7[]=
-{
- {FONT_ENCODING_UNICODE,0,0,iso8859_7_to_unicode,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static unsigned
-iso8859_8_to_unicode(unsigned isocode, void *client_data)
-{
- if(isocode==0xA1)
- return 0;
- else if(isocode<0xBF)
- return isocode;
- else if(isocode==0xDF)
- return 0x2017;
- else if(isocode>=0xE0 && isocode<=0xFA)
- return isocode+0x04F0;
- else
- return 0;
-}
-
-static FontMapRec iso8859_8[]=
-{
- {FONT_ENCODING_UNICODE,0,0,iso8859_8_to_unicode,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static unsigned
-iso8859_9_to_unicode(unsigned isocode, void *client_data)
-{
- switch(isocode) {
- case 0xD0: return 0x011E;
- case 0xDD: return 0x0130;
- case 0xDE: return 0x015E;
- case 0xF0: return 0x011F;
- case 0xFD: return 0x0131;
- case 0xFE: return 0x015F;
- default: return isocode;
- }
-}
-
-static FontMapRec iso8859_9[]=
-{
- {FONT_ENCODING_UNICODE,0,0,iso8859_9_to_unicode,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static const unsigned short iso8859_10_tophalf[]=
-{ 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7,
- 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A,
- 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7,
- 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2014, 0x016B, 0x014B,
- 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E,
- 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF,
- 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168,
- 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
- 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F,
- 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF,
- 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169,
- 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138};
-
-static FontEncSimpleMapRec iso8859_10_to_unicode_map=
-{ 0x60, 0, 0xA0, iso8859_10_tophalf };
-
-static FontMapRec iso8859_10[]=
-{
- {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL,
- &iso8859_10_to_unicode_map,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static unsigned
-iso8859_15_to_unicode(unsigned isocode, void *client_data)
-{
- switch(isocode) {
- case 0xA4: return 0x20AC;
- case 0xA6: return 0x0160;
- case 0xA8: return 0x0161;
- case 0xB4: return 0x017D;
- case 0xB8: return 0x017E;
- case 0xBC: return 0x0152;
- case 0xBD: return 0x0153;
- case 0xBE: return 0x0178;
- default: return isocode;
- }
-}
-
-static FontMapRec iso8859_15[]=
-{
- {FONT_ENCODING_UNICODE,0,0,iso8859_15_to_unicode,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static const unsigned short koi8_r_tophalf[]=
-{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
- 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
- 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2022, 0x221A, 0x2248,
- 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7,
- 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556,
- 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E,
- 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565,
- 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9,
- 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
- 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
- 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
- 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,
- 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
- 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
- 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
- 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A};
-
-static FontEncSimpleMapRec koi8_r_to_unicode_map=
-{ 0x80, 0, 0x80, koi8_r_tophalf };
-
-
-static FontMapRec koi8_r[]=
-{
- {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL,
- &koi8_r_to_unicode_map,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-static unsigned
-koi8_ru_to_unicode(unsigned koicode, void *client_data)
-{
- switch(koicode) {
- case 0x93: return 0x201C;
- case 0x96: return 0x201D;
- case 0x97: return 0x2014;
- case 0x98: return 0x2116;
- case 0x99: return 0x2122;
- case 0x9B: return 0x00BB;
- case 0x9C: return 0x00AE;
- case 0x9D: return 0x00AB;
- case 0x9F: return 0x00A4;
- case 0xA4: return 0x0454;
- case 0xA6: return 0x0456;
- case 0xA7: return 0x0457;
- case 0xAD: return 0x0491;
- case 0xAE: return 0x045E;
- case 0xB4: return 0x0404;
- case 0xB6: return 0x0406;
- case 0xB7: return 0x0407;
- case 0xBD: return 0x0490;
- case 0xBE: return 0x040E;
- default: return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map);
- }
-}
-
-static FontMapRec koi8_ru[]=
-{
- {FONT_ENCODING_UNICODE,0,0,koi8_ru_to_unicode,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-/* koi8-e, ISO-IR-111 or ECMA-Cyrillic */
-
-static const unsigned short koi8_e_A0_BF[]=
-{ 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457,
- 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00AD, 0x045E, 0x045F,
- 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407,
- 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00A4, 0x040E, 0x040F };
-
-static unsigned
-koi8_e_to_unicode(unsigned koicode, void *client_data)
-{
- if(koicode<0xA0)
- return koicode;
- else if(koicode<0xC0)
- return koi8_e_A0_BF[koicode-0xA0];
- else
- return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map);
-}
-
-static FontMapRec koi8_e[]=
-{
- {FONT_ENCODING_UNICODE,0,0,koi8_e_to_unicode,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-/* Koi8 unified */
-
-static const unsigned short koi8_uni_80_BF[]=
-{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
- 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
- 0x2591, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
- 0x00A9, 0x2122, 0x00A0, 0x00BB, 0x00AE, 0x00AB, 0x00B7, 0x00A4,
- 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457,
- 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x0491, 0x045E, 0x045F,
- 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407,
- 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x0490, 0x040E, 0x040F };
-
-static unsigned
-koi8_uni_to_unicode(unsigned koicode, void *client_data)
-{
- if(koicode<0x80)
- return koicode;
- else if(koicode<0xC0)
- return koi8_uni_80_BF[koicode-0x80];
- else
- return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map);
-}
-
-static FontMapRec koi8_uni[]=
-{
- {FONT_ENCODING_UNICODE,0,0,koi8_uni_to_unicode,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-/* Ukrainian variant of Koi8-R; see RFC 2319 */
-
-static unsigned
-koi8_u_to_unicode(unsigned koicode, void *client_data)
-{
- switch(koicode) {
- case 0xA4: return 0x0454;
- case 0xA6: return 0x0456;
- case 0xA7: return 0x0457;
- case 0xAD: return 0x0491;
- case 0xB4: return 0x0404;
- case 0xB6: return 0x0406;
- case 0xB7: return 0x0407;
- case 0xBD: return 0x0490;
- default: return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map);
- }
-}
-
-static FontMapRec koi8_u[]=
-{
- {FONT_ENCODING_UNICODE,0,0,koi8_u_to_unicode,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}
-};
-
-/* Microsoft Symbol, which is only meaningful for TrueType fonts, is
- treated specially in ftenc.c, where we add usFirstCharIndex-0x20 to
- the glyph index before applying the cmap. Lovely design. */
-
-static FontMapRec microsoft_symbol[]=
-{{FONT_ENCODING_TRUETYPE,3,0,NULL,NULL,NULL,NULL,NULL},
- /* You never know */
- {FONT_ENCODING_TRUETYPE,3,1,NULL,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}};
-
-static FontMapRec apple_roman[]=
-{{FONT_ENCODING_TRUETYPE,1,0,NULL,NULL,NULL,NULL,NULL},
- {0,0,0,NULL,NULL,NULL,NULL,NULL}};
-
-/* The data for recodings */
-
-/* For compatibility with X11R6.4. Losers. */
-static char *iso8859_15_aliases[2]={"fcd8859-15",NULL};
-
-static FontEncRec initial_encodings[]=
-{
- {"iso10646-1",NULL,256*256,0,iso10646,NULL,0,0}, /* Unicode */
- {"iso8859-1",NULL,256,0,iso8859_1,NULL,0,0}, /* Latin 1 (West European) */
- {"iso8859-2",NULL,256,0,iso8859_2,NULL,0,0}, /* Latin 2 (East European) */
- {"iso8859-3",NULL,256,0,iso8859_3,NULL,0,0}, /* Latin 3 (South European) */
- {"iso8859-4",NULL,256,0,iso8859_4,NULL,0,0}, /* Latin 4 (North European) */
- {"iso8859-5",NULL,256,0,iso8859_5,NULL,0,0}, /* Cyrillic */
- {"iso8859-6",NULL,256,0,iso8859_6,NULL,0,0}, /* Arabic */
- {"iso8859-7",NULL,256,0,iso8859_7,NULL,0,0}, /* Greek */
- {"iso8859-8",NULL,256,0,iso8859_8,NULL,0,0}, /* Hebrew */
- {"iso8859-9",NULL,256,0,iso8859_9,NULL,0,0}, /* Latin 5 (Turkish) */
- {"iso8859-10",NULL,256,0,iso8859_10,NULL,0,0}, /* Latin 6 (Nordic) */
- {"iso8859-15",iso8859_15_aliases,256,0,iso8859_15,NULL,0,0}, /* Latin 9 */
- {"koi8-r",NULL,256,0,koi8_r,NULL,0,0}, /* Russian */
- {"koi8-ru",NULL,256,0,koi8_ru,NULL,0,0}, /* Ukrainian */
- {"koi8-uni",NULL,256,0,koi8_uni,NULL,0,0}, /* Russian/Ukrainian/Bielorussian */
- {"koi8-e",NULL,256,0,koi8_e,NULL,0,0}, /* ``European'' */
- {"koi8-u",NULL,256,0,koi8_u,NULL,0,0}, /* Ukrainian too */
- {"microsoft-symbol",NULL,256,0,microsoft_symbol,NULL,0,0},
- {"apple-roman",NULL,256,0,apple_roman,NULL,0,0},
- {NULL,NULL,0,0,NULL,NULL,0,0}
-};
-
-static FontEncPtr font_encodings=NULL;
-
-static void
-define_initial_encoding_info(void)
-{
- FontEncPtr encoding;
- FontMapPtr mapping;
-
- font_encodings = initial_encodings;
- for(encoding = font_encodings; ; encoding++) {
- encoding->next = encoding + 1;
- for(mapping = encoding->mappings; ; mapping++) {
- mapping->next = mapping+1;
- mapping->encoding = encoding;
- if(mapping->next->type == 0) {
- mapping->next = NULL;
- break;
- }
- }
- if(!encoding->next->name) {
- encoding->next = NULL;
- break;
- }
- }
-}
-
-
-char*
-FontEncFromXLFD(const char *name, int length)
-{
- const char *p;
- char *q;
- static char charset[MAXFONTNAMELEN];
- int len;
-
- if(length > MAXFONTNAMELEN - 1)
- return NULL;
-
- if(name == NULL)
- p = NULL;
- else {
- p = name + length - 1;
- while(p > name && *p != '-')
- p--;
- p--;
- while(p >= name && *p != '-')
- p--;
- if(p <= name)
- p = NULL;
- }
-
- /* now p either is null or points at the '-' before the charset registry */
-
- if(p == NULL)
- return NULL;
-
- len = length - (p - name) - 1;
- memcpy(charset, p+1, len);
- charset[len] = 0;
-
- /* check for a subset specification */
- if((q = strchr(charset, (int)'[')))
- *q = 0;
-
- return charset;
-}
-
-unsigned
-FontEncRecode(unsigned code, FontMapPtr mapping)
-{
- FontEncPtr encoding = mapping->encoding;
- if(encoding && mapping->recode) {
- if(encoding->row_size == 0) {
- /* linear encoding */
- if(code < encoding->first || code>=encoding->size)
- return 0;
- } else {
- /* matrix encoding */
- int row = code/0x100, col = code&0xFF;
- if(row < encoding->first || row >= encoding->size ||
- col < encoding->first_col || col >= encoding->row_size)
- return 0;
- }
- return (*mapping->recode)(code, mapping->client_data);
- } else
- return code;
-}
-
-char*
-FontEncName(unsigned code, FontMapPtr mapping)
-{
- FontEncPtr encoding = mapping->encoding;
- if(encoding && mapping->name) {
- if((encoding->row_size == 0 && code >= encoding->size) ||
- (encoding->row_size != 0 &&
- (code/0x100 >= encoding->size ||
- (code&0xFF) >= encoding->row_size)))
- return NULL;
- return (*mapping->name)(code, mapping->client_data);
- } else
- return NULL;
-}
-
-FontEncPtr
-FontEncFind(const char *encoding_name, const char *filename)
-{
- FontEncPtr encoding;
- char **alias;
-
- if(font_encodings == NULL) define_initial_encoding_info();
-
- for(encoding = font_encodings; encoding; encoding = encoding->next) {
- if(!strcasecmp(encoding->name, encoding_name))
- return encoding;
- if(encoding->aliases)
- for(alias=encoding->aliases; *alias; alias++)
- if(!strcasecmp(*alias, encoding_name))
- return encoding;
- }
-
- /* Unknown charset, try to load a definition file */
- return FontEncLoad(encoding_name, filename);
-}
-
-FontMapPtr
-FontMapFind(FontEncPtr encoding, int type, int pid, int eid)
-{
- FontMapPtr mapping;
- if(encoding == NULL)
- return NULL;
-
- for(mapping = encoding->mappings; mapping; mapping = mapping->next) {
- if(mapping->type != type)
- continue;
- if(pid > 0 && mapping->pid != pid)
- continue;
- if(eid > 0 && mapping->eid != eid)
- continue;
- return mapping;
- }
- return NULL;
-}
-
-FontMapPtr
-FontEncMapFind(const char *encoding_name, int type, int pid, int eid,
- const char *filename)
-{
- FontEncPtr encoding;
- FontMapPtr mapping;
-
- encoding = FontEncFind(encoding_name, filename);
- if(encoding == NULL)
- return NULL;
- mapping = FontMapFind(encoding, type, pid, eid);
- return mapping;
-}
-
-static FontEncPtr
-FontEncLoad(const char *encoding_name, const char *filename)
-{
- FontEncPtr encoding;
-
- encoding = FontEncReallyLoad(encoding_name, filename);
- if (encoding == NULL) {
- return NULL;
- } else {
- char **alias;
- int found = 0;
-
- /* Check whether the name is already known for this encoding */
- if(strcasecmp(encoding->name, encoding_name) == 0) {
- found = 1;
- } else {
- if(encoding->aliases) {
- for(alias=encoding->aliases; *alias; alias++)
- if(!strcasecmp(*alias, encoding_name)) {
- found = 1;
- break;
- }
- }
- }
-
- if(!found) {
- /* Add a new alias. This works because we know that this
- particular encoding has been allocated dynamically */
- char **new_aliases;
- char *new_name;
- int numaliases = 0;
-
- new_name = strdup(encoding_name);
- if(new_name == NULL)
- return NULL;
- if(encoding->aliases) {
- for(alias = encoding->aliases; *alias; alias++)
- numaliases++;
- }
- new_aliases = malloc((numaliases+2)*sizeof(char*));
- if(new_aliases == NULL) {
- free(new_name);
- return NULL;
- }
- if(encoding->aliases) {
- memcpy(new_aliases, encoding->aliases, numaliases*sizeof(char*));
- free(encoding->aliases);
- }
- new_aliases[numaliases] = new_name;
- new_aliases[numaliases+1] = NULL;
- encoding->aliases = new_aliases;
- }
-
- /* register the new encoding */
- encoding->next=font_encodings;
- font_encodings=encoding;
-
- return encoding;
- }
-}
-
-unsigned
-FontEncSimpleRecode(unsigned code, void *client_data)
-{
- FontEncSimpleMapPtr map;
- unsigned index;
-
- map = client_data;
-
- if(code > 0xFFFF || (map->row_size && (code&0xFF) >= map->row_size))
- return 0;
-
- if(map->row_size)
- index = (code&0xFF)+(code>>8)*map->row_size;
- else
- index = code;
-
- if(map->map && index>=map->first && index<map->first+map->len)
- return map->map[index-map->first];
- else
- return code;
-}
-
-char *
-FontEncSimpleName(unsigned code, void *client_data)
-{
- FontEncSimpleNamePtr map;
-
- map = client_data;
- if(map && code >= map->first && code<map->first+map->len)
- return map->map[code-map->first];
- else
- return NULL;
-}
-
-unsigned
-FontEncUndefinedRecode(unsigned code, void *client_data)
-{
- return code;
-}
-
-char *
-FontEncUndefinedName(unsigned code, void *client_data)
-{
- return NULL;
-}
-
-#define FONTENC_SEGMENT_SIZE 256
-#define FONTENC_SEGMENTS 256
-#define FONTENC_INVERSE_CODES (FONTENC_SEGMENT_SIZE * FONTENC_SEGMENTS)
-
-static unsigned int
-reverse_reverse(unsigned i, void* data)
-{
- int s, j;
- unsigned **map = (unsigned**)data;
-
- if(i >= FONTENC_INVERSE_CODES)
- return 0;
-
- if(map == NULL)
- return 0;
-
- s = i / FONTENC_SEGMENT_SIZE;
- j = i % FONTENC_SEGMENT_SIZE;
-
- if(map[s] == NULL)
- return 0;
- else
- return map[s][j];
-}
-
-static int
-tree_set(unsigned int **map, unsigned int i, unsigned int j)
-{
- int s, c;
-
- if(i >= FONTENC_INVERSE_CODES)
- return FALSE;
-
- s = i / FONTENC_SEGMENT_SIZE;
- c = i % FONTENC_SEGMENT_SIZE;
-
- if(map[s] == NULL) {
- map[s] = calloc(FONTENC_SEGMENT_SIZE, sizeof(int));
- if(map[s] == NULL)
- return FALSE;
- }
-
- map[s][c] = j;
- return TRUE;
-}
-
-FontMapReversePtr
-FontMapReverse(FontMapPtr mapping)
-{
- FontEncPtr encoding = mapping->encoding;
- FontMapReversePtr reverse = NULL;
- unsigned int **map = NULL;
- int i, j, k;
-
- if(encoding == NULL) goto bail;
-
- map = calloc(FONTENC_SEGMENTS, sizeof(int*));
- if(map == NULL) goto bail;
-
- if(encoding->row_size == 0) {
- for(i = encoding->first; i < encoding->size; i++) {
- k = FontEncRecode(i, mapping);
- if(k != 0)
- if(!tree_set(map, k, i))
- goto bail;
- }
- } else {
- for(i = encoding->first; i < encoding->size; i++) {
- for(j = encoding->first_col; j < encoding->row_size; j++) {
- k = FontEncRecode(i*256 + j, mapping);
- if(k != 0)
- if(!tree_set(map, k, i*256+j))
- goto bail;
- }
- }
- }
-
- reverse = malloc(sizeof(FontMapReverseRec));
- if(!reverse) goto bail;
-
- reverse->reverse = reverse_reverse;
- reverse->data = map;
- return reverse;
-
- bail:
- free(map);
- free(reverse);
- return NULL;
-}
-
-void
-FontMapReverseFree(FontMapReversePtr delendum)
-{
- unsigned int **map = (unsigned int**)delendum;
- int i;
-
- if(map == NULL)
- return;
-
- for(i = 0; i < FONTENC_SEGMENTS; i++)
- free(map[i]);
-
- free(map);
- return;
-}
+/*
+Copyright (c) 1998-2001 by Juliusz Chroboczek
+
+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 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.
+*/
+
+/* Backend-independent encoding code */
+
+#include <string.h>
+
+#if defined(__SCO__) || defined(__UNIXWARE__)
+#include <strings.h>
+#endif
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#define FALSE 0
+#define TRUE 1
+#define MAXFONTNAMELEN 1024
+#define MAXFONTFILENAMELEN 1024
+
+#include <X11/fonts/fontenc.h>
+#include "fontencI.h"
+
+/* Functions local to this file */
+
+static FontEncPtr FontEncLoad(const char*, const char*);
+
+/* Early versions of this code only knew about hardwired encodings,
+ hence the following data. Now that the code knows how to load an
+ encoding from a file, most of these tables could go away. */
+
+/* At any rate, no new hardcoded encodings will be added. */
+
+static FontMapRec iso10646[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,NULL,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+/* Notice that the Apple encodings do not have all the characters in
+ the corresponding ISO 8859, and therefore the table has some holes.
+ There's not much more we can do with fonts without a Unicode cmap
+ unless we are willing to combine cmaps (which we are not). */
+
+static const unsigned short
+iso8859_1_apple_roman[]=
+{ 0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x00, 0xA4,
+ 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8,
+ 0xA1, 0xB1, 0x00, 0x00, 0xAB, 0xB5, 0xA6, 0xE1,
+ 0xFC, 0x00, 0xBC, 0xC8, 0x00, 0x00, 0x00, 0xC0,
+ 0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82,
+ 0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC,
+ 0x00, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0x00,
+ 0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0x00, 0x00, 0xA7,
+ 0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D,
+ 0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95,
+ 0x00, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6,
+ 0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0x00, 0x00, 0xD8 };
+
+/* Cannot use simple_recode because need to eliminate 0x80<=code<0xA0 */
+static unsigned
+iso8859_1_to_apple_roman(unsigned isocode, void *client_data)
+{
+ if(isocode<=0x80)
+ return isocode;
+ else if(isocode>=0xA0)
+ return iso8859_1_apple_roman[isocode-0xA0];
+ else
+ return 0;
+}
+
+static FontMapRec iso8859_1[]=
+{
+ {FONT_ENCODING_TRUETYPE,2,2,NULL,NULL,NULL,NULL,NULL}, /* ISO 8859-1 */
+ {FONT_ENCODING_UNICODE,0,0,NULL,NULL,NULL,NULL,NULL}, /* ISO 8859-1 coincides with Unicode*/
+ {FONT_ENCODING_TRUETYPE,1,0,iso8859_1_to_apple_roman,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static const unsigned short iso8859_2_tophalf[]=
+{ 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7,
+ 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B,
+ 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7,
+ 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C,
+ 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
+ 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
+ 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
+ 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
+ 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
+ 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
+ 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
+ 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 };
+
+static FontEncSimpleMapRec iso8859_2_to_unicode_map=
+{0x60, 0, 0xA0, iso8859_2_tophalf };
+
+static const unsigned short iso8859_2_apple_centeuro[]=
+{ 0xCA, 0x84, 0x00, 0xFC, 0x00, 0xBB, 0xE5, 0xA4,
+ 0xAC, 0xE1, 0x00, 0xE8, 0x8F, 0x00, 0xEB, 0xFB,
+ 0xA1, 0x88, 0x00, 0xB8, 0x00, 0xBC, 0xE6, 0xFF,
+ 0x00, 0xE4, 0x00, 0xE9, 0x90, 0x00, 0xEC, 0xFD,
+ 0xD9, 0xE7, 0x00, 0x00, 0x80, 0xBD, 0x8C, 0x00,
+ 0x89, 0x83, 0xA2, 0x00, 0x9D, 0xEA, 0x00, 0x91,
+ 0x00, 0xC1, 0xC5, 0xEE, 0xEF, 0xCC, 0x85, 0x00,
+ 0xDB, 0xF1, 0xF2, 0xF4, 0x86, 0xF8, 0x00, 0xA7,
+ 0xDA, 0x87, 0x00, 0x00, 0x8A, 0xBE, 0x8D, 0x00,
+ 0x8B, 0x8E, 0xAB, 0x00, 0x9E, 0x92, 0x00, 0x93,
+ 0x00, 0xC4, 0xCB, 0x97, 0x99, 0xCE, 0x9A, 0xD6,
+ 0xDE, 0xF3, 0x9C, 0xF5, 0x9F, 0xF9, 0x00, 0x00 };
+
+static unsigned
+iso8859_2_to_apple_centeuro(unsigned isocode, void *client_data)
+{
+ if(isocode<=0x80)
+ return isocode;
+ else if(isocode>=0xA0)
+ return iso8859_2_apple_centeuro[isocode-0xA0];
+ else
+ return 0;
+}
+
+
+static FontMapRec iso8859_2[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,
+ FontEncSimpleRecode,NULL,&iso8859_2_to_unicode_map,NULL,NULL},
+ {FONT_ENCODING_TRUETYPE,1,29,iso8859_2_to_apple_centeuro,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static const unsigned short iso8859_3_tophalf[]=
+{ 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7,
+ 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B,
+ 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7,
+ 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C,
+ 0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7,
+ 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
+ 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7,
+ 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF,
+ 0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7,
+ 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
+ 0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7,
+ 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9};
+
+static FontEncSimpleMapRec iso8859_3_to_unicode_map=
+{ 0x60, 0, 0xA0, iso8859_3_tophalf };
+
+static FontMapRec iso8859_3[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,
+ FontEncSimpleRecode,NULL,&iso8859_3_to_unicode_map,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+
+static const unsigned short iso8859_4_tophalf[]=
+{ 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7,
+ 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF,
+ 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7,
+ 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B,
+ 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E,
+ 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A,
+ 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
+ 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF,
+ 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F,
+ 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B,
+ 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
+ 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9,
+};
+
+static FontEncSimpleMapRec iso8859_4_to_unicode_map=
+{ 0x60, 0, 0xA0, iso8859_4_tophalf };
+
+static FontMapRec iso8859_4[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL,
+ &iso8859_4_to_unicode_map,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static const unsigned short iso8859_5_tophalf[]=
+{ 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
+ 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F,
+ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
+ 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
+ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
+ 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
+ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
+ 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
+ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
+ 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
+ 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
+ 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F};
+
+static FontEncSimpleMapRec iso8859_5_to_unicode_map=
+{ 0x60, 0, 0xA0, iso8859_5_tophalf };
+
+static const unsigned short
+iso8859_5_apple_cyrillic[]=
+{ 0xCA, 0xDD, 0xAB, 0xAE, 0xB8, 0xC1, 0xA7, 0xBA,
+ 0xB7, 0xBC, 0xBE, 0xCB, 0xCD, 0x00, 0xD8, 0xDA,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF,
+ 0xDC, 0xDE, 0xAC, 0xAF, 0xB9, 0xCF, 0xB4, 0xBB,
+ 0xC0, 0xBD, 0xBF, 0xCC, 0xCE, 0xA4, 0xD9, 0xDB };
+
+static unsigned
+iso8859_5_to_apple_cyrillic(unsigned isocode, void *client_data)
+{
+ if(isocode<=0x80)
+ return isocode;
+ else if(isocode>=0xA0)
+ return iso8859_5_apple_cyrillic[isocode-0x80];
+ else return 0;
+}
+
+static FontMapRec iso8859_5[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL,
+ &iso8859_5_to_unicode_map,NULL,NULL},
+ {FONT_ENCODING_TRUETYPE,1,7,iso8859_5_to_apple_cyrillic,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+/* ISO 8859-6 seems useless for serving fonts (not enough presentation
+ * forms). What do Arabic-speakers use? */
+
+static unsigned
+iso8859_6_to_unicode(unsigned isocode, void *client_data)
+{
+ if(isocode<=0xA0 || isocode==0xA4 || isocode==0xAD)
+ return isocode;
+ else if(isocode==0xAC || isocode==0xBB ||
+ (isocode>=0xBF && isocode<=0xDA) ||
+ (isocode>=0xE0 && isocode<=0xEF) ||
+ (isocode>=0xF0 && isocode<=0xF2))
+ return isocode-0xA0+0x0600;
+ else
+ return 0;
+}
+
+static FontMapRec iso8859_6[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,iso8859_6_to_unicode,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static unsigned
+iso8859_7_to_unicode(unsigned isocode, void *client_data)
+{
+ if(isocode<=0xA0 ||
+ (isocode>=0xA3 && isocode<=0xAD) ||
+ (isocode>=0xB0 && isocode<=0xB3) ||
+ isocode==0xB7 || isocode==0xBB || isocode==0xBD)
+ return isocode;
+ else if(isocode==0xA1)
+ return 0x02BD;
+ else if(isocode==0xA2)
+ return 0x02BC;
+ else if(isocode==0xAF)
+ return 0x2015;
+ else if(isocode>=0xB4)
+ return isocode-0xA0+0x0370;
+ else
+ return 0;
+}
+
+static FontMapRec iso8859_7[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,iso8859_7_to_unicode,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static unsigned
+iso8859_8_to_unicode(unsigned isocode, void *client_data)
+{
+ if(isocode==0xA1)
+ return 0;
+ else if(isocode<0xBF)
+ return isocode;
+ else if(isocode==0xDF)
+ return 0x2017;
+ else if(isocode>=0xE0 && isocode<=0xFA)
+ return isocode+0x04F0;
+ else
+ return 0;
+}
+
+static FontMapRec iso8859_8[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,iso8859_8_to_unicode,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static unsigned
+iso8859_9_to_unicode(unsigned isocode, void *client_data)
+{
+ switch(isocode) {
+ case 0xD0: return 0x011E;
+ case 0xDD: return 0x0130;
+ case 0xDE: return 0x015E;
+ case 0xF0: return 0x011F;
+ case 0xFD: return 0x0131;
+ case 0xFE: return 0x015F;
+ default: return isocode;
+ }
+}
+
+static FontMapRec iso8859_9[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,iso8859_9_to_unicode,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static const unsigned short iso8859_10_tophalf[]=
+{ 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7,
+ 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A,
+ 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7,
+ 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2014, 0x016B, 0x014B,
+ 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E,
+ 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF,
+ 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168,
+ 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
+ 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F,
+ 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF,
+ 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169,
+ 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138};
+
+static FontEncSimpleMapRec iso8859_10_to_unicode_map=
+{ 0x60, 0, 0xA0, iso8859_10_tophalf };
+
+static FontMapRec iso8859_10[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL,
+ &iso8859_10_to_unicode_map,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static unsigned
+iso8859_15_to_unicode(unsigned isocode, void *client_data)
+{
+ switch(isocode) {
+ case 0xA4: return 0x20AC;
+ case 0xA6: return 0x0160;
+ case 0xA8: return 0x0161;
+ case 0xB4: return 0x017D;
+ case 0xB8: return 0x017E;
+ case 0xBC: return 0x0152;
+ case 0xBD: return 0x0153;
+ case 0xBE: return 0x0178;
+ default: return isocode;
+ }
+}
+
+static FontMapRec iso8859_15[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,iso8859_15_to_unicode,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static const unsigned short koi8_r_tophalf[]=
+{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
+ 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
+ 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2022, 0x221A, 0x2248,
+ 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7,
+ 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556,
+ 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E,
+ 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565,
+ 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9,
+ 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
+ 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
+ 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
+ 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,
+ 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
+ 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
+ 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
+ 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A};
+
+static FontEncSimpleMapRec koi8_r_to_unicode_map=
+{ 0x80, 0, 0x80, koi8_r_tophalf };
+
+
+static FontMapRec koi8_r[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL,
+ &koi8_r_to_unicode_map,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+static unsigned
+koi8_ru_to_unicode(unsigned koicode, void *client_data)
+{
+ switch(koicode) {
+ case 0x93: return 0x201C;
+ case 0x96: return 0x201D;
+ case 0x97: return 0x2014;
+ case 0x98: return 0x2116;
+ case 0x99: return 0x2122;
+ case 0x9B: return 0x00BB;
+ case 0x9C: return 0x00AE;
+ case 0x9D: return 0x00AB;
+ case 0x9F: return 0x00A4;
+ case 0xA4: return 0x0454;
+ case 0xA6: return 0x0456;
+ case 0xA7: return 0x0457;
+ case 0xAD: return 0x0491;
+ case 0xAE: return 0x045E;
+ case 0xB4: return 0x0404;
+ case 0xB6: return 0x0406;
+ case 0xB7: return 0x0407;
+ case 0xBD: return 0x0490;
+ case 0xBE: return 0x040E;
+ default: return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map);
+ }
+}
+
+static FontMapRec koi8_ru[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,koi8_ru_to_unicode,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+/* koi8-e, ISO-IR-111 or ECMA-Cyrillic */
+
+static const unsigned short koi8_e_A0_BF[]=
+{ 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457,
+ 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00AD, 0x045E, 0x045F,
+ 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407,
+ 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00A4, 0x040E, 0x040F };
+
+static unsigned
+koi8_e_to_unicode(unsigned koicode, void *client_data)
+{
+ if(koicode<0xA0)
+ return koicode;
+ else if(koicode<0xC0)
+ return koi8_e_A0_BF[koicode-0xA0];
+ else
+ return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map);
+}
+
+static FontMapRec koi8_e[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,koi8_e_to_unicode,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+/* Koi8 unified */
+
+static const unsigned short koi8_uni_80_BF[]=
+{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
+ 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
+ 0x2591, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
+ 0x00A9, 0x2122, 0x00A0, 0x00BB, 0x00AE, 0x00AB, 0x00B7, 0x00A4,
+ 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457,
+ 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x0491, 0x045E, 0x045F,
+ 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407,
+ 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x0490, 0x040E, 0x040F };
+
+static unsigned
+koi8_uni_to_unicode(unsigned koicode, void *client_data)
+{
+ if(koicode<0x80)
+ return koicode;
+ else if(koicode<0xC0)
+ return koi8_uni_80_BF[koicode-0x80];
+ else
+ return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map);
+}
+
+static FontMapRec koi8_uni[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,koi8_uni_to_unicode,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+/* Ukrainian variant of Koi8-R; see RFC 2319 */
+
+static unsigned
+koi8_u_to_unicode(unsigned koicode, void *client_data)
+{
+ switch(koicode) {
+ case 0xA4: return 0x0454;
+ case 0xA6: return 0x0456;
+ case 0xA7: return 0x0457;
+ case 0xAD: return 0x0491;
+ case 0xB4: return 0x0404;
+ case 0xB6: return 0x0406;
+ case 0xB7: return 0x0407;
+ case 0xBD: return 0x0490;
+ default: return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map);
+ }
+}
+
+static FontMapRec koi8_u[]=
+{
+ {FONT_ENCODING_UNICODE,0,0,koi8_u_to_unicode,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}
+};
+
+/* Microsoft Symbol, which is only meaningful for TrueType fonts, is
+ treated specially in ftenc.c, where we add usFirstCharIndex-0x20 to
+ the glyph index before applying the cmap. Lovely design. */
+
+static FontMapRec microsoft_symbol[]=
+{{FONT_ENCODING_TRUETYPE,3,0,NULL,NULL,NULL,NULL,NULL},
+ /* You never know */
+ {FONT_ENCODING_TRUETYPE,3,1,NULL,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}};
+
+static FontMapRec apple_roman[]=
+{{FONT_ENCODING_TRUETYPE,1,0,NULL,NULL,NULL,NULL,NULL},
+ {0,0,0,NULL,NULL,NULL,NULL,NULL}};
+
+/* The data for recodings */
+
+/* For compatibility with X11R6.4. Losers. */
+static char *iso8859_15_aliases[2]={"fcd8859-15",NULL};
+
+static FontEncRec initial_encodings[]=
+{
+ {"iso10646-1",NULL,256*256,0,iso10646,NULL,0,0}, /* Unicode */
+ {"iso8859-1",NULL,256,0,iso8859_1,NULL,0,0}, /* Latin 1 (West European) */
+ {"iso8859-2",NULL,256,0,iso8859_2,NULL,0,0}, /* Latin 2 (East European) */
+ {"iso8859-3",NULL,256,0,iso8859_3,NULL,0,0}, /* Latin 3 (South European) */
+ {"iso8859-4",NULL,256,0,iso8859_4,NULL,0,0}, /* Latin 4 (North European) */
+ {"iso8859-5",NULL,256,0,iso8859_5,NULL,0,0}, /* Cyrillic */
+ {"iso8859-6",NULL,256,0,iso8859_6,NULL,0,0}, /* Arabic */
+ {"iso8859-7",NULL,256,0,iso8859_7,NULL,0,0}, /* Greek */
+ {"iso8859-8",NULL,256,0,iso8859_8,NULL,0,0}, /* Hebrew */
+ {"iso8859-9",NULL,256,0,iso8859_9,NULL,0,0}, /* Latin 5 (Turkish) */
+ {"iso8859-10",NULL,256,0,iso8859_10,NULL,0,0}, /* Latin 6 (Nordic) */
+ {"iso8859-15",iso8859_15_aliases,256,0,iso8859_15,NULL,0,0}, /* Latin 9 */
+ {"koi8-r",NULL,256,0,koi8_r,NULL,0,0}, /* Russian */
+ {"koi8-ru",NULL,256,0,koi8_ru,NULL,0,0}, /* Ukrainian */
+ {"koi8-uni",NULL,256,0,koi8_uni,NULL,0,0}, /* Russian/Ukrainian/Bielorussian */
+ {"koi8-e",NULL,256,0,koi8_e,NULL,0,0}, /* ``European'' */
+ {"koi8-u",NULL,256,0,koi8_u,NULL,0,0}, /* Ukrainian too */
+ {"microsoft-symbol",NULL,256,0,microsoft_symbol,NULL,0,0},
+ {"apple-roman",NULL,256,0,apple_roman,NULL,0,0},
+ {NULL,NULL,0,0,NULL,NULL,0,0}
+};
+
+static FontEncPtr font_encodings=NULL;
+
+static void
+define_initial_encoding_info(void)
+{
+ FontEncPtr encoding;
+ FontMapPtr mapping;
+
+ font_encodings = initial_encodings;
+ for(encoding = font_encodings; ; encoding++) {
+ encoding->next = encoding + 1;
+ for(mapping = encoding->mappings; ; mapping++) {
+ mapping->next = mapping+1;
+ mapping->encoding = encoding;
+ if(mapping->next->type == 0) {
+ mapping->next = NULL;
+ break;
+ }
+ }
+ if(!encoding->next->name) {
+ encoding->next = NULL;
+ break;
+ }
+ }
+}
+
+
+char*
+FontEncFromXLFD(const char *name, int length)
+{
+ const char *p;
+ char *q;
+ static char charset[MAXFONTNAMELEN];
+ int len;
+
+ if(length > MAXFONTNAMELEN - 1)
+ return NULL;
+
+ if(name == NULL)
+ p = NULL;
+ else {
+ p = name + length - 1;
+ while(p > name && *p != '-')
+ p--;
+ p--;
+ while(p >= name && *p != '-')
+ p--;
+ if(p <= name)
+ p = NULL;
+ }
+
+ /* now p either is null or points at the '-' before the charset registry */
+
+ if(p == NULL)
+ return NULL;
+
+ len = length - (p - name) - 1;
+ memcpy(charset, p+1, len);
+ charset[len] = 0;
+
+ /* check for a subset specification */
+ if((q = strchr(charset, (int)'[')))
+ *q = 0;
+
+ return charset;
+}
+
+unsigned
+FontEncRecode(unsigned code, FontMapPtr mapping)
+{
+ FontEncPtr encoding = mapping->encoding;
+ if(encoding && mapping->recode) {
+ if(encoding->row_size == 0) {
+ /* linear encoding */
+ if(code < encoding->first || code>=encoding->size)
+ return 0;
+ } else {
+ /* matrix encoding */
+ int row = code/0x100, col = code&0xFF;
+ if(row < encoding->first || row >= encoding->size ||
+ col < encoding->first_col || col >= encoding->row_size)
+ return 0;
+ }
+ return (*mapping->recode)(code, mapping->client_data);
+ } else
+ return code;
+}
+
+char*
+FontEncName(unsigned code, FontMapPtr mapping)
+{
+ FontEncPtr encoding = mapping->encoding;
+ if(encoding && mapping->name) {
+ if((encoding->row_size == 0 && code >= encoding->size) ||
+ (encoding->row_size != 0 &&
+ (code/0x100 >= encoding->size ||
+ (code&0xFF) >= encoding->row_size)))
+ return NULL;
+ return (*mapping->name)(code, mapping->client_data);
+ } else
+ return NULL;
+}
+
+FontEncPtr
+FontEncFind(const char *encoding_name, const char *filename)
+{
+ FontEncPtr encoding;
+ char **alias;
+
+ if(font_encodings == NULL) define_initial_encoding_info();
+
+ for(encoding = font_encodings; encoding; encoding = encoding->next) {
+ if(!strcasecmp(encoding->name, encoding_name))
+ return encoding;
+ if(encoding->aliases)
+ for(alias=encoding->aliases; *alias; alias++)
+ if(!strcasecmp(*alias, encoding_name))
+ return encoding;
+ }
+
+ /* Unknown charset, try to load a definition file */
+ return FontEncLoad(encoding_name, filename);
+}
+
+FontMapPtr
+FontMapFind(FontEncPtr encoding, int type, int pid, int eid)
+{
+ FontMapPtr mapping;
+ if(encoding == NULL)
+ return NULL;
+
+ for(mapping = encoding->mappings; mapping; mapping = mapping->next) {
+ if(mapping->type != type)
+ continue;
+ if(pid > 0 && mapping->pid != pid)
+ continue;
+ if(eid > 0 && mapping->eid != eid)
+ continue;
+ return mapping;
+ }
+ return NULL;
+}
+
+FontMapPtr
+FontEncMapFind(const char *encoding_name, int type, int pid, int eid,
+ const char *filename)
+{
+ FontEncPtr encoding;
+ FontMapPtr mapping;
+
+ encoding = FontEncFind(encoding_name, filename);
+ if(encoding == NULL)
+ return NULL;
+ mapping = FontMapFind(encoding, type, pid, eid);
+ return mapping;
+}
+
+static FontEncPtr
+FontEncLoad(const char *encoding_name, const char *filename)
+{
+ FontEncPtr encoding;
+
+ encoding = FontEncReallyLoad(encoding_name, filename);
+ if (encoding == NULL) {
+ return NULL;
+ } else {
+ char **alias;
+ int found = 0;
+
+ /* Check whether the name is already known for this encoding */
+ if(strcasecmp(encoding->name, encoding_name) == 0) {
+ found = 1;
+ } else {
+ if(encoding->aliases) {
+ for(alias=encoding->aliases; *alias; alias++)
+ if(!strcasecmp(*alias, encoding_name)) {
+ found = 1;
+ break;
+ }
+ }
+ }
+
+ if(!found) {
+ /* Add a new alias. This works because we know that this
+ particular encoding has been allocated dynamically */
+ char **new_aliases;
+ char *new_name;
+ int numaliases = 0;
+
+ new_name = strdup(encoding_name);
+ if(new_name == NULL)
+ return NULL;
+ if(encoding->aliases) {
+ for(alias = encoding->aliases; *alias; alias++)
+ numaliases++;
+ }
+ new_aliases = malloc((numaliases+2)*sizeof(char*));
+ if(new_aliases == NULL) {
+ free(new_name);
+ return NULL;
+ }
+ if(encoding->aliases) {
+ memcpy(new_aliases, encoding->aliases, numaliases*sizeof(char*));
+ free(encoding->aliases);
+ }
+ new_aliases[numaliases] = new_name;
+ new_aliases[numaliases+1] = NULL;
+ encoding->aliases = new_aliases;
+ }
+
+ /* register the new encoding */
+ encoding->next=font_encodings;
+ font_encodings=encoding;
+
+ return encoding;
+ }
+}
+
+unsigned
+FontEncSimpleRecode(unsigned code, void *client_data)
+{
+ FontEncSimpleMapPtr map;
+ unsigned index;
+
+ map = client_data;
+
+ if(code > 0xFFFF || (map->row_size && (code&0xFF) >= map->row_size))
+ return 0;
+
+ if(map->row_size)
+ index = (code&0xFF)+(code>>8)*map->row_size;
+ else
+ index = code;
+
+ if(map->map && index>=map->first && index<map->first+map->len)
+ return map->map[index-map->first];
+ else
+ return code;
+}
+
+char *
+FontEncSimpleName(unsigned code, void *client_data)
+{
+ FontEncSimpleNamePtr map;
+
+ map = client_data;
+ if(map && code >= map->first && code<map->first+map->len)
+ return map->map[code-map->first];
+ else
+ return NULL;
+}
+
+unsigned
+FontEncUndefinedRecode(unsigned code, void *client_data)
+{
+ return code;
+}
+
+char *
+FontEncUndefinedName(unsigned code, void *client_data)
+{
+ return NULL;
+}
+
+#define FONTENC_SEGMENT_SIZE 256
+#define FONTENC_SEGMENTS 256
+#define FONTENC_INVERSE_CODES (FONTENC_SEGMENT_SIZE * FONTENC_SEGMENTS)
+
+static unsigned int
+reverse_reverse(unsigned i, void* data)
+{
+ int s, j;
+ unsigned **map = (unsigned**)data;
+
+ if(i >= FONTENC_INVERSE_CODES)
+ return 0;
+
+ if(map == NULL)
+ return 0;
+
+ s = i / FONTENC_SEGMENT_SIZE;
+ j = i % FONTENC_SEGMENT_SIZE;
+
+ if(map[s] == NULL)
+ return 0;
+ else
+ return map[s][j];
+}
+
+static int
+tree_set(unsigned int **map, unsigned int i, unsigned int j)
+{
+ int s, c;
+
+ if(i >= FONTENC_INVERSE_CODES)
+ return FALSE;
+
+ s = i / FONTENC_SEGMENT_SIZE;
+ c = i % FONTENC_SEGMENT_SIZE;
+
+ if(map[s] == NULL) {
+ map[s] = calloc(FONTENC_SEGMENT_SIZE, sizeof(int));
+ if(map[s] == NULL)
+ return FALSE;
+ }
+
+ map[s][c] = j;
+ return TRUE;
+}
+
+FontMapReversePtr
+FontMapReverse(FontMapPtr mapping)
+{
+ FontEncPtr encoding = mapping->encoding;
+ FontMapReversePtr reverse = NULL;
+ unsigned int **map = NULL;
+ int i, j, k;
+
+ if(encoding == NULL) goto bail;
+
+ map = calloc(FONTENC_SEGMENTS, sizeof(int*));
+ if(map == NULL) goto bail;
+
+ if(encoding->row_size == 0) {
+ for(i = encoding->first; i < encoding->size; i++) {
+ k = FontEncRecode(i, mapping);
+ if(k != 0)
+ if(!tree_set(map, k, i))
+ goto bail;
+ }
+ } else {
+ for(i = encoding->first; i < encoding->size; i++) {
+ for(j = encoding->first_col; j < encoding->row_size; j++) {
+ k = FontEncRecode(i*256 + j, mapping);
+ if(k != 0)
+ if(!tree_set(map, k, i*256+j))
+ goto bail;
+ }
+ }
+ }
+
+ reverse = malloc(sizeof(FontMapReverseRec));
+ if(!reverse) goto bail;
+
+ reverse->reverse = reverse_reverse;
+ reverse->data = map;
+ return reverse;
+
+ bail:
+ free(map);
+ free(reverse);
+ return NULL;
+}
+
+void
+FontMapReverseFree(FontMapReversePtr delendum)
+{
+ unsigned int **map = (unsigned int**)delendum;
+ int i;
+
+ if(map == NULL)
+ return;
+
+ for(i = 0; i < FONTENC_SEGMENTS; i++)
+ free(map[i]);
+
+ free(map);
+ return;
+}
diff --git a/mesalib/src/SConscript b/mesalib/src/SConscript
index 87e244403..1eee8761a 100644
--- a/mesalib/src/SConscript
+++ b/mesalib/src/SConscript
@@ -21,7 +21,7 @@ SConscript('mesa/SConscript')
SConscript('mapi/vgapi/SConscript')
-if env['platform'] != 'embedded':
+if not env['embedded']:
SConscript('glx/SConscript')
SConscript('egl/main/SConscript')
SConscript('glu/sgi/SConscript')
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index d69fb1a11..58a52b3f2 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -111,7 +111,7 @@ static void blitter_draw_rectangle(struct blitter_context *blitter,
unsigned width, unsigned height,
float depth,
enum blitter_attrib_type type,
- const float attrib[4]);
+ const union pipe_color_union *attrib);
struct blitter_context *util_blitter_create(struct pipe_context *pipe)
@@ -398,16 +398,16 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx,
}
static void blitter_set_clear_color(struct blitter_context_priv *ctx,
- const float *rgba)
+ const union pipe_color_union *color)
{
int i;
- if (rgba) {
+ if (color) {
for (i = 0; i < 4; i++) {
- ctx->vertices[i][1][0] = rgba[0];
- ctx->vertices[i][1][1] = rgba[1];
- ctx->vertices[i][1][2] = rgba[2];
- ctx->vertices[i][1][3] = rgba[3];
+ ctx->vertices[i][1][0] = color->f[0];
+ ctx->vertices[i][1][1] = color->f[1];
+ ctx->vertices[i][1][2] = color->f[2];
+ ctx->vertices[i][1][3] = color->f[3];
}
} else {
for (i = 0; i < 4; i++) {
@@ -647,7 +647,7 @@ static void blitter_draw_rectangle(struct blitter_context *blitter,
unsigned x2, unsigned y2,
float depth,
enum blitter_attrib_type type,
- const float attrib[4])
+ const union pipe_color_union *attrib)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
@@ -657,7 +657,7 @@ static void blitter_draw_rectangle(struct blitter_context *blitter,
break;
case UTIL_BLITTER_ATTRIB_TEXCOORD:
- set_texcoords_in_vertices(attrib, &ctx->vertices[0][1][0], 8);
+ set_texcoords_in_vertices(attrib->f, &ctx->vertices[0][1][0], 8);
break;
default:;
@@ -674,7 +674,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
unsigned width, unsigned height,
unsigned num_cbufs,
unsigned clear_buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth, unsigned stencil,
void *custom_blend, void *custom_dsa)
{
@@ -717,7 +717,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
blitter_set_dst_dimensions(ctx, width, height);
blitter->draw_rectangle(blitter, 0, 0, width, height, depth,
- UTIL_BLITTER_ATTRIB_COLOR, rgba);
+ UTIL_BLITTER_ATTRIB_COLOR, color);
blitter_restore_CSOs(ctx);
}
@@ -725,11 +725,11 @@ void util_blitter_clear(struct blitter_context *blitter,
unsigned width, unsigned height,
unsigned num_cbufs,
unsigned clear_buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth, unsigned stencil)
{
util_blitter_clear_custom(blitter, width, height, num_cbufs,
- clear_buffers, rgba, depth, stencil,
+ clear_buffers, color, depth, stencil,
NULL, NULL);
}
@@ -737,9 +737,9 @@ void util_blitter_clear_depth_custom(struct blitter_context *blitter,
unsigned width, unsigned height,
double depth, void *custom_dsa)
{
- const float rgba[4] = {0, 0, 0, 0};
+ static const union pipe_color_union color;
util_blitter_clear_custom(blitter, width, height, 0,
- 0, rgba, depth, 0, NULL, custom_dsa);
+ 0, &color, depth, 0, NULL, custom_dsa);
}
static
@@ -869,14 +869,16 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_RECT:
{
- /* Set texture coordinates. */
- float coord[4];
+ /* Set texture coordinates. - use a pipe color union
+ * for interface purposes
+ */
+ union pipe_color_union coord;
get_texcoords(src, srclevel, srcbox->x, srcbox->y,
- srcbox->x+width, srcbox->y+height, normalized, coord);
+ srcbox->x+width, srcbox->y+height, normalized, coord.f);
/* Draw. */
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
- UTIL_BLITTER_ATTRIB_TEXCOORD, coord);
+ UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
}
break;
@@ -925,7 +927,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
/* Clear a region of a color surface to a constant value. */
void util_blitter_clear_render_target(struct blitter_context *blitter,
struct pipe_surface *dstsurf,
- const float *rgba,
+ const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
@@ -959,7 +961,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
- UTIL_BLITTER_ATTRIB_COLOR, rgba);
+ UTIL_BLITTER_ATTRIB_COLOR, color);
blitter_restore_CSOs(ctx);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h
index df6f023a6..a9ad02364 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.h
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h
@@ -77,7 +77,7 @@ struct blitter_context
unsigned x1, unsigned y1, unsigned x2, unsigned y2,
float depth,
enum blitter_attrib_type type,
- const float attrib[4]);
+ const union pipe_color_union *color);
/* Whether the blitter is running. */
boolean running;
@@ -144,7 +144,7 @@ void util_blitter_clear(struct blitter_context *blitter,
unsigned width, unsigned height,
unsigned num_cbufs,
unsigned clear_buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth, unsigned stencil);
void util_blitter_clear_depth_custom(struct blitter_context *blitter,
@@ -190,7 +190,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
*/
void util_blitter_clear_render_target(struct blitter_context *blitter,
struct pipe_surface *dst,
- const float *rgba,
+ const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height);
diff --git a/mesalib/src/gallium/auxiliary/util/u_clear.h b/mesalib/src/gallium/auxiliary/util/u_clear.h
index c2f303261..e9fd874b1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_clear.h
+++ b/mesalib/src/gallium/auxiliary/util/u_clear.h
@@ -1,59 +1,59 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc. 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, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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:
- * Michel Dänzer
- */
-
-
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-
-
-/**
- * Clear the given buffers to the specified values.
- * No masking, no scissor (clear entire buffer).
- */
-static INLINE void
-util_clear(struct pipe_context *pipe,
- struct pipe_framebuffer_state *framebuffer, unsigned buffers,
- const float *rgba, double depth, unsigned stencil)
-{
- if (buffers & PIPE_CLEAR_COLOR) {
- unsigned i;
- for (i = 0; i < framebuffer->nr_cbufs; i++) {
- struct pipe_surface *ps = framebuffer->cbufs[i];
- pipe->clear_render_target(pipe, ps, rgba, 0, 0, ps->width, ps->height);
- }
- }
-
- if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
- struct pipe_surface *ps = framebuffer->zsbuf;
- pipe->clear_depth_stencil(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL,
- depth, stencil,
- 0, 0, ps->width, ps->height);
- }
-}
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc. 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, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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:
+ * Michel Dänzer
+ */
+
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+
+
+/**
+ * Clear the given buffers to the specified values.
+ * No masking, no scissor (clear entire buffer).
+ */
+static INLINE void
+util_clear(struct pipe_context *pipe,
+ struct pipe_framebuffer_state *framebuffer, unsigned buffers,
+ const union pipe_color_union *color, double depth, unsigned stencil)
+{
+ if (buffers & PIPE_CLEAR_COLOR) {
+ unsigned i;
+ for (i = 0; i < framebuffer->nr_cbufs; i++) {
+ struct pipe_surface *ps = framebuffer->cbufs[i];
+ pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width, ps->height);
+ }
+ }
+
+ if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+ struct pipe_surface *ps = framebuffer->zsbuf;
+ pipe->clear_depth_stencil(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL,
+ depth, stencil,
+ 0, 0, ps->width, ps->height);
+ }
+}
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c
index 8e123867d..308511b33 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.c
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.c
@@ -228,7 +228,7 @@ util_resource_copy_region(struct pipe_context *pipe,
void
util_clear_render_target(struct pipe_context *pipe,
struct pipe_surface *dst,
- const float *rgba,
+ const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
@@ -254,7 +254,7 @@ util_clear_render_target(struct pipe_context *pipe,
if (dst_map) {
assert(dst_trans->stride > 0);
- util_pack_color(rgba, dst->texture->format, &uc);
+ util_pack_color(color->f, dst->texture->format, &uc);
util_fill_rect(dst_map, dst->texture->format,
dst_trans->stride,
0, 0, width, height, &uc);
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.h b/mesalib/src/gallium/auxiliary/util/u_surface.h
index e02931bbe..1117b78da 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.h
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.h
@@ -1,90 +1,90 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc. 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, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
- *
- **************************************************************************/
-
-
-#ifndef U_SURFACE_H
-#define U_SURFACE_H
-
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_state.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-extern void
-u_surface_default_template(struct pipe_surface *view,
- const struct pipe_resource *texture,
- unsigned bind);
-
-extern boolean
-util_create_rgba_surface(struct pipe_context *ctx,
- uint width, uint height, uint bind,
- struct pipe_resource **textureOut,
- struct pipe_surface **surfaceOut);
-
-
-extern void
-util_destroy_rgba_surface(struct pipe_resource *texture,
- struct pipe_surface *surface);
-
-
-
-extern void
-util_resource_copy_region(struct pipe_context *pipe,
- struct pipe_resource *dst,
- unsigned dst_level,
- unsigned dst_x, unsigned dst_y, unsigned dst_z,
- struct pipe_resource *src,
- unsigned src_level,
- const struct pipe_box *src_box);
-
-extern void
-util_clear_render_target(struct pipe_context *pipe,
- struct pipe_surface *dst,
- const float *rgba,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height);
-
-extern void
-util_clear_depth_stencil(struct pipe_context *pipe,
- struct pipe_surface *dst,
- unsigned clear_flags,
- double depth,
- unsigned stencil,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* U_SURFACE_H */
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc. 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, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
+ *
+ **************************************************************************/
+
+
+#ifndef U_SURFACE_H
+#define U_SURFACE_H
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern void
+u_surface_default_template(struct pipe_surface *view,
+ const struct pipe_resource *texture,
+ unsigned bind);
+
+extern boolean
+util_create_rgba_surface(struct pipe_context *ctx,
+ uint width, uint height, uint bind,
+ struct pipe_resource **textureOut,
+ struct pipe_surface **surfaceOut);
+
+
+extern void
+util_destroy_rgba_surface(struct pipe_resource *texture,
+ struct pipe_surface *surface);
+
+
+
+extern void
+util_resource_copy_region(struct pipe_context *pipe,
+ struct pipe_resource *dst,
+ unsigned dst_level,
+ unsigned dst_x, unsigned dst_y, unsigned dst_z,
+ struct pipe_resource *src,
+ unsigned src_level,
+ const struct pipe_box *src_box);
+
+extern void
+util_clear_render_target(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ const union pipe_color_union *color,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height);
+
+extern void
+util_clear_depth_stencil(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ unsigned clear_flags,
+ double depth,
+ unsigned stencil,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* U_SURFACE_H */
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index dfc8bd441..ff1ffe008 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -114,7 +114,6 @@ main_sources = [
'main/texcompress_s3tc.c',
'main/texcompress_fxt1.c',
'main/texenv.c',
- 'main/texfetch.c',
'main/texformat.c',
'main/texgen.c',
'main/texgetimage.c',
@@ -173,6 +172,7 @@ swrast_sources = [
'swrast/s_span.c',
'swrast/s_stencil.c',
'swrast/s_texcombine.c',
+ 'swrast/s_texfetch.c',
'swrast/s_texfilter.c',
'swrast/s_texrender.c',
'swrast/s_texture.c',
diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c
index 36ed4f892..3e2896980 100644
--- a/mesalib/src/mesa/drivers/common/driverfuncs.c
+++ b/mesalib/src/mesa/drivers/common/driverfuncs.c
@@ -110,8 +110,10 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->BindTexture = NULL;
driver->NewTextureObject = _mesa_new_texture_object;
driver->DeleteTexture = _mesa_delete_texture_object;
- driver->NewTextureImage = _mesa_new_texture_image;
- driver->FreeTextureImageBuffer = _mesa_free_texture_image_data;
+ driver->NewTextureImage = _swrast_new_texture_image;
+ driver->DeleteTextureImage = _swrast_delete_texture_image;
+ driver->AllocTextureImageBuffer = _swrast_alloc_texture_image_buffer;
+ driver->FreeTextureImageBuffer = _swrast_free_texture_image_buffer;
driver->MapTextureImage = _swrast_map_teximage;
driver->UnmapTextureImage = _swrast_unmap_teximage;
driver->MapTexture = NULL;
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 482bd98a2..1b71aa194 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -1222,7 +1222,9 @@ blitframebuffer_texture(struct gl_context *ctx,
_mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT,
GL_SKIP_DECODE_EXT);
}
- _mesa_Disable(GL_FRAMEBUFFER_SRGB_EXT);
+ if (ctx->Extensions.EXT_framebuffer_sRGB) {
+ _mesa_Disable(GL_FRAMEBUFFER_SRGB_EXT);
+ }
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
_mesa_set_enable(ctx, target, GL_TRUE);
@@ -1288,7 +1290,7 @@ blitframebuffer_texture(struct gl_context *ctx,
if (ctx->Extensions.EXT_texture_sRGB_decode) {
_mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT, srgbSave);
}
- if (ctx->Extensions.EXT_texture_sRGB_decode && fbo_srgb_save) {
+ if (ctx->Extensions.EXT_framebuffer_sRGB && fbo_srgb_save) {
_mesa_Enable(GL_FRAMEBUFFER_SRGB_EXT);
}
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index d6cc0196d..720e4f53d 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -476,6 +476,16 @@ struct dd_function_table {
*/
struct gl_texture_image * (*NewTextureImage)( struct gl_context *ctx );
+ /** Called to free a texture image object returned by NewTextureImage() */
+ void (*DeleteTextureImage)(struct gl_context *ctx,
+ struct gl_texture_image *);
+
+ /** Called to allocate memory for a single texture image */
+ GLboolean (*AllocTextureImageBuffer)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ gl_format format, GLsizei width,
+ GLsizei height, GLsizei depth);
+
/**
* Called to free tImage->Data.
*/
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index c5146f72d..dadff0556 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -921,7 +921,11 @@ unpack_SIGNED_R16(const void *src, GLfloat dst[4])
static void
unpack_SIGNED_GR1616(const void *src, GLfloat dst[4])
{
- /* XXX TODO */
+ const GLuint s = *((const GLuint *) src);
+ dst[RCOMP] = SHORT_TO_FLOAT_TEX( s & 0xffff );
+ dst[GCOMP] = SHORT_TO_FLOAT_TEX( s >> 16 );
+ dst[BCOMP] = 0.0F;
+ dst[ACOMP] = 1.0F;
}
static void
@@ -947,7 +951,7 @@ unpack_SIGNED_RGBA_16(const void *src, GLfloat dst[4])
static void
unpack_RGBA_16(const void *src, GLfloat dst[4])
{
- const GLshort *s = (const GLshort *) src;
+ const GLushort *s = (const GLushort *) src;
dst[RCOMP] = USHORT_TO_FLOAT( s[0] );
dst[GCOMP] = USHORT_TO_FLOAT( s[1] );
dst[BCOMP] = USHORT_TO_FLOAT( s[2] );
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index 869243d1c..f170d235a 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -1955,23 +1955,17 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target,
dstDepth, border, srcImage->InternalFormat,
srcImage->TexFormat);
dstImage->DriverData = NULL;
- dstImage->FetchTexelc = srcImage->FetchTexelc;
- dstImage->FetchTexelf = srcImage->FetchTexelf;
- /* Alloc new teximage data buffer */
- {
- GLuint size = _mesa_format_image_size(dstImage->TexFormat,
- dstWidth, dstHeight, dstDepth);
- dstImage->Data = _mesa_alloc_texmemory(size);
- if (!dstImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
- return;
- }
+ /* Alloc storage for new texture image */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, dstImage,
+ dstImage->TexFormat,
+ dstWidth, dstHeight,
+ dstDepth)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
+ return;
}
ASSERT(dstImage->TexFormat);
- ASSERT(dstImage->FetchTexelc);
- ASSERT(dstImage->FetchTexelf);
_mesa_generate_mipmap_level(target, datatype, comps, border,
srcWidth, srcHeight, srcDepth,
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 8671ecda9..429c8b430 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1253,37 +1253,6 @@ typedef enum
/**
- * Texel fetch function prototype. We use texel fetch functions to
- * extract RGBA, color indexes and depth components out of 1D, 2D and 3D
- * texture images. These functions help to isolate us from the gritty
- * details of all the various texture image encodings.
- *
- * \param texImage texture image.
- * \param col texel column.
- * \param row texel row.
- * \param img texel image level/layer.
- * \param texelOut output texel (up to 4 GLchans)
- */
-typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage,
- GLint col, GLint row, GLint img,
- GLchan *texelOut );
-
-/**
- * As above, but returns floats.
- * Used for depth component images and for upcoming signed/float
- * texture images.
- */
-typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage,
- GLint col, GLint row, GLint img,
- GLfloat *texelOut );
-
-
-typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage,
- GLint col, GLint row, GLint img,
- const void *texel);
-
-
-/**
* Texture image state. Describes the dimensions of a texture image,
* the texel format and pointers to Texel Fetch functions.
*/
@@ -1320,9 +1289,6 @@ struct gl_texture_image
/** Cube map face: index into gl_texture_object::Image[] array */
GLuint Face;
- FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */
- FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */
-
GLuint RowStride; /**< Padded width in units of texels */
GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
each 2D slice in 'Data', in texels */
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index 4e5c14cbb..b49d1b1ca 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -40,6 +40,7 @@
#include "texcompress_fxt1.h"
#include "texcompress_rgtc.h"
#include "texcompress_s3tc.h"
+#include "swrast/s_context.h"
/**
@@ -451,15 +452,15 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
const GLubyte *src, GLint srcRowStride,
GLfloat *dest)
{
- void (*fetch)(const struct gl_texture_image *texImage,
+ void (*fetch)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
- struct gl_texture_image texImage; /* dummy teximage */
+ struct swrast_texture_image texImage; /* dummy teximage */
GLuint i, j;
/* setup dummy texture image info */
memset(&texImage, 0, sizeof(texImage));
- texImage.Data = (void *) src;
- texImage.RowStride = srcRowStride;
+ texImage.Base.Data = (void *) src;
+ texImage.Base.RowStride = srcRowStride;
switch (format) {
/* DXT formats */
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c
index 261014d63..a75487ce2 100644
--- a/mesalib/src/mesa/main/texcompress_fxt1.c
+++ b/mesalib/src/mesa/main/texcompress_fxt1.c
@@ -1,1651 +1,1652 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2008 Brian Paul 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 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
- * BRIAN PAUL 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.
- */
-
-
-/**
- * \file texcompress_fxt1.c
- * GL_3DFX_texture_compression_FXT1 support.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "image.h"
-#include "macros.h"
-#include "mfeatures.h"
-#include "mipmap.h"
-#include "texcompress.h"
-#include "texcompress_fxt1.h"
-#include "texstore.h"
-
-
-#if FEATURE_texture_fxt1
-
-
-static void
-fxt1_encode (GLuint width, GLuint height, GLint comps,
- const void *source, GLint srcRowStride,
- void *dest, GLint destRowStride);
-
-void
-fxt1_decode_1 (const void *texture, GLint stride,
- GLint i, GLint j, GLchan *rgba);
-
-
-/**
- * Store user's image in rgb_fxt1 format.
- */
-GLboolean
-_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
-{
- const GLchan *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
- const GLchan *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1);
- ASSERT(dstXoffset % 8 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- if (srcFormat != GL_RGB ||
- srcType != CHAN_TYPE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGB/GLchan */
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 3 * srcWidth;
- srcFormat = GL_RGB;
- }
- else {
- pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
- }
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride,
- dst, dstRowStride);
-
- if (tempImage)
- free((void*) tempImage);
-
- return GL_TRUE;
-}
-
-
-/**
- * Store user's image in rgba_fxt1 format.
- */
-GLboolean
-_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
-{
- const GLchan *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
- const GLchan *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1);
- ASSERT(dstXoffset % 8 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- if (srcFormat != GL_RGBA ||
- srcType != CHAN_TYPE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGBA/GLchan */
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 4 * srcWidth;
- srcFormat = GL_RGBA;
- }
- else {
- pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
- }
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride,
- dst, dstRowStride);
-
- if (tempImage)
- free((void*) tempImage);
-
- return GL_TRUE;
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- (void) k;
- fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
- texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- (void) k;
- fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
- texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = 1.0F;
-}
-
-
-
-/***************************************************************************\
- * FXT1 encoder
- *
- * The encoder was built by reversing the decoder,
- * and is vaguely based on Texus2 by 3dfx. Note that this code
- * is merely a proof of concept, since it is highly UNoptimized;
- * moreover, it is sub-optimal due to initial conditions passed
- * to Lloyd's algorithm (the interpolation modes are even worse).
-\***************************************************************************/
-
-
-#define MAX_COMP 4 /* ever needed maximum number of components in texel */
-#define MAX_VECT 4 /* ever needed maximum number of base vectors to find */
-#define N_TEXELS 32 /* number of texels in a block (always 32) */
-#define LL_N_REP 50 /* number of iterations in lloyd's vq */
-#define LL_RMS_D 10 /* fault tolerance (maximum delta) */
-#define LL_RMS_E 255 /* fault tolerance (maximum error) */
-#define ALPHA_TS 2 /* alpha threshold: (255 - ALPHA_TS) deemed opaque */
-#define ISTBLACK(v) (*((GLuint *)(v)) == 0)
-
-
-/*
- * Define a 64-bit unsigned integer type and macros
- */
-#if 1
-
-#define FX64_NATIVE 1
-
-typedef uint64_t Fx64;
-
-#define FX64_MOV32(a, b) a = b
-#define FX64_OR32(a, b) a |= b
-#define FX64_SHL(a, c) a <<= c
-
-#else
-
-#define FX64_NATIVE 0
-
-typedef struct {
- GLuint lo, hi;
-} Fx64;
-
-#define FX64_MOV32(a, b) a.lo = b
-#define FX64_OR32(a, b) a.lo |= b
-
-#define FX64_SHL(a, c) \
- do { \
- if ((c) >= 32) { \
- a.hi = a.lo << ((c) - 32); \
- a.lo = 0; \
- } else { \
- a.hi = (a.hi << (c)) | (a.lo >> (32 - (c))); \
- a.lo <<= (c); \
- } \
- } while (0)
-
-#endif
-
-
-#define F(i) (GLfloat)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */
-#define SAFECDOT 1 /* for paranoids */
-
-#define MAKEIVEC(NV, NC, IV, B, V0, V1) \
- do { \
- /* compute interpolation vector */ \
- GLfloat d2 = 0.0F; \
- GLfloat rd2; \
- \
- for (i = 0; i < NC; i++) { \
- IV[i] = (V1[i] - V0[i]) * F(i); \
- d2 += IV[i] * IV[i]; \
- } \
- rd2 = (GLfloat)NV / d2; \
- B = 0; \
- for (i = 0; i < NC; i++) { \
- IV[i] *= F(i); \
- B -= IV[i] * V0[i]; \
- IV[i] *= rd2; \
- } \
- B = B * rd2 + 0.5f; \
- } while (0)
-
-#define CALCCDOT(TEXEL, NV, NC, IV, B, V)\
- do { \
- GLfloat dot = 0.0F; \
- for (i = 0; i < NC; i++) { \
- dot += V[i] * IV[i]; \
- } \
- TEXEL = (GLint)(dot + B); \
- if (SAFECDOT) { \
- if (TEXEL < 0) { \
- TEXEL = 0; \
- } else if (TEXEL > NV) { \
- TEXEL = NV; \
- } \
- } \
- } while (0)
-
-
-static GLint
-fxt1_bestcol (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[MAX_COMP], GLint nc)
-{
- GLint i, j, best = -1;
- GLfloat err = 1e9; /* big enough */
-
- for (j = 0; j < nv; j++) {
- GLfloat e = 0.0F;
- for (i = 0; i < nc; i++) {
- e += (vec[j][i] - input[i]) * (vec[j][i] - input[i]);
- }
- if (e < err) {
- err = e;
- best = j;
- }
- }
-
- return best;
-}
-
-
-static GLint
-fxt1_worst (GLfloat vec[MAX_COMP],
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- GLint i, k, worst = -1;
- GLfloat err = -1.0F; /* small enough */
-
- for (k = 0; k < n; k++) {
- GLfloat e = 0.0F;
- for (i = 0; i < nc; i++) {
- e += (vec[i] - input[k][i]) * (vec[i] - input[k][i]);
- }
- if (e > err) {
- err = e;
- worst = k;
- }
- }
-
- return worst;
-}
-
-
-static GLint
-fxt1_variance (GLdouble variance[MAX_COMP],
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- GLint i, k, best = 0;
- GLint sx, sx2;
- GLdouble var, maxvar = -1; /* small enough */
- GLdouble teenth = 1.0 / n;
-
- for (i = 0; i < nc; i++) {
- sx = sx2 = 0;
- for (k = 0; k < n; k++) {
- GLint t = input[k][i];
- sx += t;
- sx2 += t * t;
- }
- var = sx2 * teenth - sx * sx * teenth * teenth;
- if (maxvar < var) {
- maxvar = var;
- best = i;
- }
- if (variance) {
- variance[i] = var;
- }
- }
-
- return best;
-}
-
-
-static GLint
-fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
-#if 0
- /* Choose colors from a grid.
- */
- GLint i, j;
-
- for (j = 0; j < nv; j++) {
- GLint m = j * (n - 1) / (nv - 1);
- for (i = 0; i < nc; i++) {
- vec[j][i] = input[m][i];
- }
- }
-#else
- /* Our solution here is to find the darkest and brightest colors in
- * the 8x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- GLint i, j, k;
- GLint minSum = 2000; /* big enough */
- GLint maxSum = -1; /* small enough */
- GLint minCol = 0; /* phoudoin: silent compiler! */
- GLint maxCol = 0; /* phoudoin: silent compiler! */
-
- struct {
- GLint flag;
- GLint key;
- GLint freq;
- GLint idx;
- } hist[N_TEXELS];
- GLint lenh = 0;
-
- memset(hist, 0, sizeof(hist));
-
- for (k = 0; k < n; k++) {
- GLint l;
- GLint key = 0;
- GLint sum = 0;
- for (i = 0; i < nc; i++) {
- key <<= 8;
- key |= input[k][i];
- sum += input[k][i];
- }
- for (l = 0; l < n; l++) {
- if (!hist[l].flag) {
- /* alloc new slot */
- hist[l].flag = !0;
- hist[l].key = key;
- hist[l].freq = 1;
- hist[l].idx = k;
- lenh = l + 1;
- break;
- } else if (hist[l].key == key) {
- hist[l].freq++;
- break;
- }
- }
- if (minSum > sum) {
- minSum = sum;
- minCol = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxCol = k;
- }
- }
-
- if (lenh <= nv) {
- for (j = 0; j < lenh; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = (GLfloat)input[hist[j].idx][i];
- }
- }
- for (; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = vec[0][i];
- }
- }
- return 0;
- }
-
- for (j = 0; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = ((nv - 1 - j) * input[minCol][i] + j * input[maxCol][i] + (nv - 1) / 2) / (GLfloat)(nv - 1);
- }
- }
-#endif
-
- return !0;
-}
-
-
-static GLint
-fxt1_lloyd (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- /* Use the generalized lloyd's algorithm for VQ:
- * find 4 color vectors.
- *
- * for each sample color
- * sort to nearest vector.
- *
- * replace each vector with the centroid of its matching colors.
- *
- * repeat until RMS doesn't improve.
- *
- * if a color vector has no samples, or becomes the same as another
- * vector, replace it with the color which is farthest from a sample.
- *
- * vec[][MAX_COMP] initial vectors and resulting colors
- * nv number of resulting colors required
- * input[N_TEXELS][MAX_COMP] input texels
- * nc number of components in input / vec
- * n number of input samples
- */
-
- GLint sum[MAX_VECT][MAX_COMP]; /* used to accumulate closest texels */
- GLint cnt[MAX_VECT]; /* how many times a certain vector was chosen */
- GLfloat error, lasterror = 1e9;
-
- GLint i, j, k, rep;
-
- /* the quantizer */
- for (rep = 0; rep < LL_N_REP; rep++) {
- /* reset sums & counters */
- for (j = 0; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- sum[j][i] = 0;
- }
- cnt[j] = 0;
- }
- error = 0;
-
- /* scan whole block */
- for (k = 0; k < n; k++) {
-#if 1
- GLint best = -1;
- GLfloat err = 1e9; /* big enough */
- /* determine best vector */
- for (j = 0; j < nv; j++) {
- GLfloat e = (vec[j][0] - input[k][0]) * (vec[j][0] - input[k][0]) +
- (vec[j][1] - input[k][1]) * (vec[j][1] - input[k][1]) +
- (vec[j][2] - input[k][2]) * (vec[j][2] - input[k][2]);
- if (nc == 4) {
- e += (vec[j][3] - input[k][3]) * (vec[j][3] - input[k][3]);
- }
- if (e < err) {
- err = e;
- best = j;
- }
- }
-#else
- GLint best = fxt1_bestcol(vec, nv, input[k], nc, &err);
-#endif
- assert(best >= 0);
- /* add in closest color */
- for (i = 0; i < nc; i++) {
- sum[best][i] += input[k][i];
- }
- /* mark this vector as used */
- cnt[best]++;
- /* accumulate error */
- error += err;
- }
-
- /* check RMS */
- if ((error < LL_RMS_E) ||
- ((error < lasterror) && ((lasterror - error) < LL_RMS_D))) {
- return !0; /* good match */
- }
- lasterror = error;
-
- /* move each vector to the barycenter of its closest colors */
- for (j = 0; j < nv; j++) {
- if (cnt[j]) {
- GLfloat div = 1.0F / cnt[j];
- for (i = 0; i < nc; i++) {
- vec[j][i] = div * sum[j][i];
- }
- } else {
- /* this vec has no samples or is identical with a previous vec */
- GLint worst = fxt1_worst(vec[j], input, nc, n);
- for (i = 0; i < nc; i++) {
- vec[j][i] = input[worst][i];
- }
- }
- }
- }
-
- return 0; /* could not converge fast enough */
-}
-
-
-static void
-fxt1_quantize_CHROMA (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 4; /* 4 base vectors to find */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLfloat vec[MAX_VECT][MAX_COMP];
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- if (fxt1_choose(vec, n_vect, input, n_comp, N_TEXELS) != 0) {
- fxt1_lloyd(vec, n_vect, input, n_comp, N_TEXELS);
- }
-
- FX64_MOV32(hi, 4); /* cc-chroma = "010" + unused bit */
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-
- lohi = lolo = 0;
- /* right microtile */
- for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
- lohi <<= 2;
- lohi |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
- }
- /* left microtile */
- for (; k >= 0; k--) {
- lolo <<= 2;
- lolo |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
- }
- cc[1] = lohi;
- cc[0] = lolo;
-}
-
-
-static void
-fxt1_quantize_ALPHA0 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP],
- GLubyte reord[N_TEXELS][MAX_COMP], GLint n)
-{
- const GLint n_vect = 3; /* 3 base vectors to find */
- const GLint n_comp = 4; /* 4 components: R, G, B, A */
- GLfloat vec[MAX_VECT][MAX_COMP];
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- /* the last vector indicates zero */
- for (i = 0; i < n_comp; i++) {
- vec[n_vect][i] = 0;
- }
-
- /* the first n texels in reord are guaranteed to be non-zero */
- if (fxt1_choose(vec, n_vect, reord, n_comp, n) != 0) {
- fxt1_lloyd(vec, n_vect, reord, n_comp, n);
- }
-
- FX64_MOV32(hi, 6); /* alpha = "011" + lerp = 0 */
- for (j = n_vect - 1; j >= 0; j--) {
- /* add in alphas */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F));
- }
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp - 1; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-
- lohi = lolo = 0;
- /* right microtile */
- for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
- lohi <<= 2;
- lohi |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
- }
- /* left microtile */
- for (; k >= 0; k--) {
- lolo <<= 2;
- lolo |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
- }
- cc[1] = lohi;
- cc[0] = lolo;
-}
-
-
-static void
-fxt1_quantize_ALPHA1 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 3; /* highest vector number in each microtile */
- const GLint n_comp = 4; /* 4 components: R, G, B, A */
- GLfloat vec[1 + 1 + 1][MAX_COMP]; /* 1.5 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minSum;
- GLint maxSum;
- GLint minColL = 0, maxColL = 0;
- GLint minColR = 0, maxColR = 0;
- GLint sumL = 0, sumR = 0;
- GLint nn_comp;
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- nn_comp = n_comp;
- while ((minColL == maxColL) && nn_comp) {
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint sum = 0;
- for (i = 0; i < nn_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- sumL += sum;
- }
-
- nn_comp--;
- }
-
- nn_comp = n_comp;
- while ((minColR == maxColR) && nn_comp) {
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = N_TEXELS / 2; k < N_TEXELS; k++) {
- GLint sum = 0;
- for (i = 0; i < nn_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- sumR += sum;
- }
-
- nn_comp--;
- }
-
- /* choose the common vector (yuck!) */
- {
- GLint j1, j2;
- GLint v1 = 0, v2 = 0;
- GLfloat err = 1e9; /* big enough */
- GLfloat tv[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- for (i = 0; i < n_comp; i++) {
- tv[0][i] = input[minColL][i];
- tv[1][i] = input[maxColL][i];
- tv[2][i] = input[minColR][i];
- tv[3][i] = input[maxColR][i];
- }
- for (j1 = 0; j1 < 2; j1++) {
- for (j2 = 2; j2 < 4; j2++) {
- GLfloat e = 0.0F;
- for (i = 0; i < n_comp; i++) {
- e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] - tv[j2][i]);
- }
- if (e < err) {
- err = e;
- v1 = j1;
- v2 = j2;
- }
- }
- }
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = tv[1 - v1][i];
- vec[1][i] = (tv[v1][i] * sumL + tv[v2][i] * sumR) / (sumL + sumR);
- vec[2][i] = tv[5 - v2][i];
- }
- }
-
- /* left microtile */
- cc[0] = 0;
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
-
- cc[0] = lolo;
- }
-
- /* right microtile */
- cc[1] = 0;
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[1]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
-
- cc[1] = lohi;
- }
-
- FX64_MOV32(hi, 7); /* alpha = "011" + lerp = 1 */
- for (j = n_vect - 1; j >= 0; j--) {
- /* add in alphas */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F));
- }
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp - 1; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize_HI (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP],
- GLubyte reord[N_TEXELS][MAX_COMP], GLint n)
-{
- const GLint n_vect = 6; /* highest vector number */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLfloat b = 0.0F; /* phoudoin: silent compiler! */
- GLfloat iv[MAX_COMP]; /* interpolation vector */
- GLint i, k;
- GLuint hihi; /* high quadword: hi dword */
-
- GLint minSum = 2000; /* big enough */
- GLint maxSum = -1; /* small enough */
- GLint minCol = 0; /* phoudoin: silent compiler! */
- GLint maxCol = 0; /* phoudoin: silent compiler! */
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 8x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- for (k = 0; k < n; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += reord[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minCol = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxCol = k;
- }
- }
-
- hihi = 0; /* cc-hi = "00" */
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- hihi <<= 5;
- hihi |= reord[maxCol][i] >> 3;
- }
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- hihi <<= 5;
- hihi |= reord[minCol][i] >> 3;
- }
- cc[3] = hihi;
- cc[0] = cc[1] = cc[2] = 0;
-
- /* compute interpolation vector */
- if (minCol != maxCol) {
- MAKEIVEC(n_vect, n_comp, iv, b, reord[minCol], reord[maxCol]);
- }
-
- /* add in texels */
- for (k = N_TEXELS - 1; k >= 0; k--) {
- GLint t = k * 3;
- GLuint *kk = (GLuint *)((char *)cc + t / 8);
- GLint texel = n_vect + 1; /* transparent black */
-
- if (!ISTBLACK(input[k])) {
- if (minCol != maxCol) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- kk[0] |= texel << (t & 7);
- }
- } else {
- /* add in texel */
- kk[0] |= texel << (t & 7);
- }
- }
-}
-
-
-static void
-fxt1_quantize_MIXED1 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 2; /* highest vector number in each microtile */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minSum;
- GLint maxSum;
- GLint minColL = 0, maxColL = -1;
- GLint minColR = 0, maxColR = -1;
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- if (!ISTBLACK(input[k])) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- }
- }
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- if (!ISTBLACK(input[k])) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- }
- }
-
- /* left microtile */
- if (maxColL == -1) {
- /* all transparent black */
- cc[0] = ~0u;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = 0;
- vec[1][i] = 0;
- }
- } else {
- cc[0] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = input[minColL][i];
- vec[1][i] = input[maxColL][i];
- }
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel = n_vect + 1; /* transparent black */
- if (!ISTBLACK(input[k])) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- }
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
- cc[0] = lolo;
- }
- }
-
- /* right microtile */
- if (maxColR == -1) {
- /* all transparent black */
- cc[1] = ~0u;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = 0;
- vec[3][i] = 0;
- }
- } else {
- cc[1] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = input[minColR][i];
- vec[3][i] = input[maxColR][i];
- }
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel = n_vect + 1; /* transparent black */
- if (!ISTBLACK(input[k])) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- }
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
- cc[1] = lohi;
- }
- }
-
- FX64_MOV32(hi, 9 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
- for (j = 2 * 2 - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, vec[j][i] >> 3);
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize_MIXED0 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 3; /* highest vector number in each microtile */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minColL = 0, maxColL = 0;
- GLint minColR = 0, maxColR = 0;
-#if 0
- GLint minSum;
- GLint maxSum;
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- }
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- }
-#else
- GLint minVal;
- GLint maxVal;
- GLint maxVarL = fxt1_variance(NULL, input, n_comp, N_TEXELS / 2);
- GLint maxVarR = fxt1_variance(NULL, &input[N_TEXELS / 2], n_comp, N_TEXELS / 2);
-
- /* Scan the channel with max variance for lo & hi
- * and use those as the two representative colors.
- */
- minVal = 2000; /* big enough */
- maxVal = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint t = input[k][maxVarL];
- if (minVal > t) {
- minVal = t;
- minColL = k;
- }
- if (maxVal < t) {
- maxVal = t;
- maxColL = k;
- }
- }
- minVal = 2000; /* big enough */
- maxVal = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- GLint t = input[k][maxVarR];
- if (minVal > t) {
- minVal = t;
- minColR = k;
- }
- if (maxVal < t) {
- maxVal = t;
- maxColR = k;
- }
- }
-#endif
-
- /* left microtile */
- cc[0] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = input[minColL][i];
- vec[1][i] = input[maxColL][i];
- }
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
-
- /* funky encoding for LSB of green */
- if ((GLint)((lolo >> 1) & 1) != (((vec[1][GCOMP] ^ vec[0][GCOMP]) >> 2) & 1)) {
- for (i = 0; i < n_comp; i++) {
- vec[1][i] = input[minColL][i];
- vec[0][i] = input[maxColL][i];
- }
- lolo = ~lolo;
- }
-
- cc[0] = lolo;
- }
-
- /* right microtile */
- cc[1] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = input[minColR][i];
- vec[3][i] = input[maxColR][i];
- }
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
-
- /* funky encoding for LSB of green */
- if ((GLint)((lohi >> 1) & 1) != (((vec[3][GCOMP] ^ vec[2][GCOMP]) >> 2) & 1)) {
- for (i = 0; i < n_comp; i++) {
- vec[3][i] = input[minColR][i];
- vec[2][i] = input[maxColR][i];
- }
- lohi = ~lohi;
- }
-
- cc[1] = lohi;
- }
-
- FX64_MOV32(hi, 8 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
- for (j = 2 * 2 - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, vec[j][i] >> 3);
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps)
-{
- GLint trualpha;
- GLubyte reord[N_TEXELS][MAX_COMP];
-
- GLubyte input[N_TEXELS][MAX_COMP];
- GLint i, k, l;
-
- if (comps == 3) {
- /* make the whole block opaque */
- memset(input, -1, sizeof(input));
- }
-
- /* 8 texels each line */
- for (l = 0; l < 4; l++) {
- for (k = 0; k < 4; k++) {
- for (i = 0; i < comps; i++) {
- input[k + l * 4][i] = *lines[l]++;
- }
- }
- for (; k < 8; k++) {
- for (i = 0; i < comps; i++) {
- input[k + l * 4 + 12][i] = *lines[l]++;
- }
- }
- }
-
- /* block layout:
- * 00, 01, 02, 03, 08, 09, 0a, 0b
- * 10, 11, 12, 13, 18, 19, 1a, 1b
- * 04, 05, 06, 07, 0c, 0d, 0e, 0f
- * 14, 15, 16, 17, 1c, 1d, 1e, 1f
- */
-
- /* [dBorca]
- * stupidity flows forth from this
- */
- l = N_TEXELS;
- trualpha = 0;
- if (comps == 4) {
- /* skip all transparent black texels */
- l = 0;
- for (k = 0; k < N_TEXELS; k++) {
- /* test all components against 0 */
- if (!ISTBLACK(input[k])) {
- /* texel is not transparent black */
- COPY_4UBV(reord[l], input[k]);
- if (reord[l][ACOMP] < (255 - ALPHA_TS)) {
- /* non-opaque texel */
- trualpha = !0;
- }
- l++;
- }
- }
- }
-
-#if 0
- if (trualpha) {
- fxt1_quantize_ALPHA0(cc, input, reord, l);
- } else if (l == 0) {
- cc[0] = cc[1] = cc[2] = -1;
- cc[3] = 0;
- } else if (l < N_TEXELS) {
- fxt1_quantize_HI(cc, input, reord, l);
- } else {
- fxt1_quantize_CHROMA(cc, input);
- }
- (void)fxt1_quantize_ALPHA1;
- (void)fxt1_quantize_MIXED1;
- (void)fxt1_quantize_MIXED0;
-#else
- if (trualpha) {
- fxt1_quantize_ALPHA1(cc, input);
- } else if (l == 0) {
- cc[0] = cc[1] = cc[2] = ~0u;
- cc[3] = 0;
- } else if (l < N_TEXELS) {
- fxt1_quantize_MIXED1(cc, input);
- } else {
- fxt1_quantize_MIXED0(cc, input);
- }
- (void)fxt1_quantize_ALPHA0;
- (void)fxt1_quantize_HI;
- (void)fxt1_quantize_CHROMA;
-#endif
-}
-
-
-static void
-fxt1_encode (GLuint width, GLuint height, GLint comps,
- const void *source, GLint srcRowStride,
- void *dest, GLint destRowStride)
-{
- GLuint x, y;
- const GLubyte *data;
- GLuint *encoded = (GLuint *)dest;
- void *newSource = NULL;
-
- assert(comps == 3 || comps == 4);
-
- /* Replicate image if width is not M8 or height is not M4 */
- if ((width & 7) | (height & 3)) {
- GLint newWidth = (width + 7) & ~7;
- GLint newHeight = (height + 3) & ~3;
- newSource = malloc(comps * newWidth * newHeight * sizeof(GLchan));
- if (!newSource) {
- GET_CURRENT_CONTEXT(ctx);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
- goto cleanUp;
- }
- _mesa_upscale_teximage2d(width, height, newWidth, newHeight,
- comps, (const GLchan *) source,
- srcRowStride, (GLchan *) newSource);
- source = newSource;
- width = newWidth;
- height = newHeight;
- srcRowStride = comps * newWidth;
- }
-
- /* convert from 16/32-bit channels to GLubyte if needed */
- if (CHAN_TYPE != GL_UNSIGNED_BYTE) {
- const GLuint n = width * height * comps;
- const GLchan *src = (const GLchan *) source;
- GLubyte *dest = (GLubyte *) malloc(n * sizeof(GLubyte));
- GLuint i;
- if (!dest) {
- GET_CURRENT_CONTEXT(ctx);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
- goto cleanUp;
- }
- for (i = 0; i < n; i++) {
- dest[i] = CHAN_TO_UBYTE(src[i]);
- }
- if (newSource != NULL) {
- free(newSource);
- }
- newSource = dest; /* we'll free this buffer before returning */
- source = dest; /* the new, GLubyte incoming image */
- }
-
- data = (const GLubyte *) source;
- destRowStride = (destRowStride - width * 2) / 4;
- for (y = 0; y < height; y += 4) {
- GLuint offs = 0 + (y + 0) * srcRowStride;
- for (x = 0; x < width; x += 8) {
- const GLubyte *lines[4];
- lines[0] = &data[offs];
- lines[1] = lines[0] + srcRowStride;
- lines[2] = lines[1] + srcRowStride;
- lines[3] = lines[2] + srcRowStride;
- offs += 8 * comps;
- fxt1_quantize(encoded, lines, comps);
- /* 128 bits per 8x4 block */
- encoded += 4;
- }
- encoded += destRowStride;
- }
-
- cleanUp:
- if (newSource != NULL) {
- free(newSource);
- }
-}
-
-
-/***************************************************************************\
- * FXT1 decoder
- *
- * The decoder is based on GL_3DFX_texture_compression_FXT1
- * specification and serves as a concept for the encoder.
-\***************************************************************************/
-
-
-/* lookup table for scaling 5 bit colors up to 8 bits */
-static const GLubyte _rgb_scale_5[] = {
- 0, 8, 16, 25, 33, 41, 49, 58,
- 66, 74, 82, 90, 99, 107, 115, 123,
- 132, 140, 148, 156, 165, 173, 181, 189,
- 197, 206, 214, 222, 230, 239, 247, 255
-};
-
-/* lookup table for scaling 6 bit colors up to 8 bits */
-static const GLubyte _rgb_scale_6[] = {
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 36, 40, 45, 49, 53, 57, 61,
- 65, 69, 73, 77, 81, 85, 89, 93,
- 97, 101, 105, 109, 113, 117, 121, 125,
- 130, 134, 138, 142, 146, 150, 154, 158,
- 162, 166, 170, 174, 178, 182, 186, 190,
- 194, 198, 202, 206, 210, 215, 219, 223,
- 227, 231, 235, 239, 243, 247, 251, 255
-};
-
-
-#define CC_SEL(cc, which) (((GLuint *)(cc))[(which) / 32] >> ((which) & 31))
-#define UP5(c) _rgb_scale_5[(c) & 31]
-#define UP6(c, b) _rgb_scale_6[(((c) & 31) << 1) | ((b) & 1)]
-#define LERP(n, t, c0, c1) (((n) - (t)) * (c0) + (t) * (c1) + (n) / 2) / (n)
-
-
-static void
-fxt1_decode_1HI (const GLubyte *code, GLint t, GLchan *rgba)
-{
- const GLuint *cc;
-
- t *= 3;
- cc = (const GLuint *)(code + t / 8);
- t = (cc[0] >> (t & 7)) & 7;
-
- if (t == 7) {
- rgba[RCOMP] = rgba[GCOMP] = rgba[BCOMP] = rgba[ACOMP] = 0;
- } else {
- GLubyte r, g, b;
- cc = (const GLuint *)(code + 12);
- if (t == 0) {
- b = UP5(CC_SEL(cc, 0));
- g = UP5(CC_SEL(cc, 5));
- r = UP5(CC_SEL(cc, 10));
- } else if (t == 6) {
- b = UP5(CC_SEL(cc, 15));
- g = UP5(CC_SEL(cc, 20));
- r = UP5(CC_SEL(cc, 25));
- } else {
- b = LERP(6, t, UP5(CC_SEL(cc, 0)), UP5(CC_SEL(cc, 15)));
- g = LERP(6, t, UP5(CC_SEL(cc, 5)), UP5(CC_SEL(cc, 20)));
- r = LERP(6, t, UP5(CC_SEL(cc, 10)), UP5(CC_SEL(cc, 25)));
- }
- rgba[RCOMP] = UBYTE_TO_CHAN(r);
- rgba[GCOMP] = UBYTE_TO_CHAN(g);
- rgba[BCOMP] = UBYTE_TO_CHAN(b);
- rgba[ACOMP] = CHAN_MAX;
- }
-}
-
-
-static void
-fxt1_decode_1CHROMA (const GLubyte *code, GLint t, GLchan *rgba)
-{
- const GLuint *cc;
- GLuint kk;
-
- cc = (const GLuint *)code;
- if (t & 16) {
- cc++;
- t &= 15;
- }
- t = (cc[0] >> (t * 2)) & 3;
-
- t *= 15;
- cc = (const GLuint *)(code + 8 + t / 8);
- kk = cc[0] >> (t & 7);
- rgba[BCOMP] = UBYTE_TO_CHAN( UP5(kk) );
- rgba[GCOMP] = UBYTE_TO_CHAN( UP5(kk >> 5) );
- rgba[RCOMP] = UBYTE_TO_CHAN( UP5(kk >> 10) );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-
-static void
-fxt1_decode_1MIXED (const GLubyte *code, GLint t, GLchan *rgba)
-{
- const GLuint *cc;
- GLuint col[2][3];
- GLint glsb, selb;
-
- cc = (const GLuint *)code;
- if (t & 16) {
- t &= 15;
- t = (cc[1] >> (t * 2)) & 3;
- /* col 2 */
- col[0][BCOMP] = (*(const GLuint *)(code + 11)) >> 6;
- col[0][GCOMP] = CC_SEL(cc, 99);
- col[0][RCOMP] = CC_SEL(cc, 104);
- /* col 3 */
- col[1][BCOMP] = CC_SEL(cc, 109);
- col[1][GCOMP] = CC_SEL(cc, 114);
- col[1][RCOMP] = CC_SEL(cc, 119);
- glsb = CC_SEL(cc, 126);
- selb = CC_SEL(cc, 33);
- } else {
- t = (cc[0] >> (t * 2)) & 3;
- /* col 0 */
- col[0][BCOMP] = CC_SEL(cc, 64);
- col[0][GCOMP] = CC_SEL(cc, 69);
- col[0][RCOMP] = CC_SEL(cc, 74);
- /* col 1 */
- col[1][BCOMP] = CC_SEL(cc, 79);
- col[1][GCOMP] = CC_SEL(cc, 84);
- col[1][RCOMP] = CC_SEL(cc, 89);
- glsb = CC_SEL(cc, 125);
- selb = CC_SEL(cc, 1);
- }
-
- if (CC_SEL(cc, 124) & 1) {
- /* alpha[0] == 1 */
-
- if (t == 3) {
- /* zero */
- rgba[RCOMP] = rgba[BCOMP] = rgba[GCOMP] = rgba[ACOMP] = 0;
- } else {
- GLubyte r, g, b;
- if (t == 0) {
- b = UP5(col[0][BCOMP]);
- g = UP5(col[0][GCOMP]);
- r = UP5(col[0][RCOMP]);
- } else if (t == 2) {
- b = UP5(col[1][BCOMP]);
- g = UP6(col[1][GCOMP], glsb);
- r = UP5(col[1][RCOMP]);
- } else {
- b = (UP5(col[0][BCOMP]) + UP5(col[1][BCOMP])) / 2;
- g = (UP5(col[0][GCOMP]) + UP6(col[1][GCOMP], glsb)) / 2;
- r = (UP5(col[0][RCOMP]) + UP5(col[1][RCOMP])) / 2;
- }
- rgba[RCOMP] = UBYTE_TO_CHAN(r);
- rgba[GCOMP] = UBYTE_TO_CHAN(g);
- rgba[BCOMP] = UBYTE_TO_CHAN(b);
- rgba[ACOMP] = CHAN_MAX;
- }
- } else {
- /* alpha[0] == 0 */
- GLubyte r, g, b;
- if (t == 0) {
- b = UP5(col[0][BCOMP]);
- g = UP6(col[0][GCOMP], glsb ^ selb);
- r = UP5(col[0][RCOMP]);
- } else if (t == 3) {
- b = UP5(col[1][BCOMP]);
- g = UP6(col[1][GCOMP], glsb);
- r = UP5(col[1][RCOMP]);
- } else {
- b = LERP(3, t, UP5(col[0][BCOMP]), UP5(col[1][BCOMP]));
- g = LERP(3, t, UP6(col[0][GCOMP], glsb ^ selb),
- UP6(col[1][GCOMP], glsb));
- r = LERP(3, t, UP5(col[0][RCOMP]), UP5(col[1][RCOMP]));
- }
- rgba[RCOMP] = UBYTE_TO_CHAN(r);
- rgba[GCOMP] = UBYTE_TO_CHAN(g);
- rgba[BCOMP] = UBYTE_TO_CHAN(b);
- rgba[ACOMP] = CHAN_MAX;
- }
-}
-
-
-static void
-fxt1_decode_1ALPHA (const GLubyte *code, GLint t, GLchan *rgba)
-{
- const GLuint *cc;
- GLubyte r, g, b, a;
-
- cc = (const GLuint *)code;
- if (CC_SEL(cc, 124) & 1) {
- /* lerp == 1 */
- GLuint col0[4];
-
- if (t & 16) {
- t &= 15;
- t = (cc[1] >> (t * 2)) & 3;
- /* col 2 */
- col0[BCOMP] = (*(const GLuint *)(code + 11)) >> 6;
- col0[GCOMP] = CC_SEL(cc, 99);
- col0[RCOMP] = CC_SEL(cc, 104);
- col0[ACOMP] = CC_SEL(cc, 119);
- } else {
- t = (cc[0] >> (t * 2)) & 3;
- /* col 0 */
- col0[BCOMP] = CC_SEL(cc, 64);
- col0[GCOMP] = CC_SEL(cc, 69);
- col0[RCOMP] = CC_SEL(cc, 74);
- col0[ACOMP] = CC_SEL(cc, 109);
- }
-
- if (t == 0) {
- b = UP5(col0[BCOMP]);
- g = UP5(col0[GCOMP]);
- r = UP5(col0[RCOMP]);
- a = UP5(col0[ACOMP]);
- } else if (t == 3) {
- b = UP5(CC_SEL(cc, 79));
- g = UP5(CC_SEL(cc, 84));
- r = UP5(CC_SEL(cc, 89));
- a = UP5(CC_SEL(cc, 114));
- } else {
- b = LERP(3, t, UP5(col0[BCOMP]), UP5(CC_SEL(cc, 79)));
- g = LERP(3, t, UP5(col0[GCOMP]), UP5(CC_SEL(cc, 84)));
- r = LERP(3, t, UP5(col0[RCOMP]), UP5(CC_SEL(cc, 89)));
- a = LERP(3, t, UP5(col0[ACOMP]), UP5(CC_SEL(cc, 114)));
- }
- } else {
- /* lerp == 0 */
-
- if (t & 16) {
- cc++;
- t &= 15;
- }
- t = (cc[0] >> (t * 2)) & 3;
-
- if (t == 3) {
- /* zero */
- r = g = b = a = 0;
- } else {
- GLuint kk;
- cc = (const GLuint *)code;
- a = UP5(cc[3] >> (t * 5 + 13));
- t *= 15;
- cc = (const GLuint *)(code + 8 + t / 8);
- kk = cc[0] >> (t & 7);
- b = UP5(kk);
- g = UP5(kk >> 5);
- r = UP5(kk >> 10);
- }
- }
- rgba[RCOMP] = UBYTE_TO_CHAN(r);
- rgba[GCOMP] = UBYTE_TO_CHAN(g);
- rgba[BCOMP] = UBYTE_TO_CHAN(b);
- rgba[ACOMP] = UBYTE_TO_CHAN(a);
-}
-
-
-void
-fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */
- GLint i, GLint j, GLchan *rgba)
-{
- static void (*decode_1[]) (const GLubyte *, GLint, GLchan *) = {
- fxt1_decode_1HI, /* cc-high = "00?" */
- fxt1_decode_1HI, /* cc-high = "00?" */
- fxt1_decode_1CHROMA, /* cc-chroma = "010" */
- fxt1_decode_1ALPHA, /* alpha = "011" */
- fxt1_decode_1MIXED, /* mixed = "1??" */
- fxt1_decode_1MIXED, /* mixed = "1??" */
- fxt1_decode_1MIXED, /* mixed = "1??" */
- fxt1_decode_1MIXED /* mixed = "1??" */
- };
-
- const GLubyte *code = (const GLubyte *)texture +
- ((j / 4) * (stride / 8) + (i / 8)) * 16;
- GLint mode = CC_SEL(code, 125);
- GLint t = i & 7;
-
- if (t & 4) {
- t += 12;
- }
- t += (j & 3) * 4;
-
- decode_1[mode](code, t, rgba);
-}
-
-
-#endif /* FEATURE_texture_fxt1 */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 Brian Paul 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 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
+ * BRIAN PAUL 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.
+ */
+
+
+/**
+ * \file texcompress_fxt1.c
+ * GL_3DFX_texture_compression_FXT1 support.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "image.h"
+#include "macros.h"
+#include "mfeatures.h"
+#include "mipmap.h"
+#include "texcompress.h"
+#include "texcompress_fxt1.h"
+#include "texstore.h"
+#include "swrast/s_context.h"
+
+
+#if FEATURE_texture_fxt1
+
+
+static void
+fxt1_encode (GLuint width, GLuint height, GLint comps,
+ const void *source, GLint srcRowStride,
+ void *dest, GLint destRowStride);
+
+void
+fxt1_decode_1 (const void *texture, GLint stride,
+ GLint i, GLint j, GLchan *rgba);
+
+
+/**
+ * Store user's image in rgb_fxt1 format.
+ */
+GLboolean
+_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
+{
+ const GLchan *pixels;
+ GLint srcRowStride;
+ GLubyte *dst;
+ const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+
+ ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1);
+ ASSERT(dstXoffset % 8 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset == 0);
+ (void) dstZoffset;
+ (void) dstImageOffsets;
+
+ if (srcFormat != GL_RGB ||
+ srcType != CHAN_TYPE ||
+ ctx->_ImageTransferState ||
+ srcPacking->SwapBytes) {
+ /* convert image to RGB/GLchan */
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ _mesa_get_format_base_format(dstFormat),
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+ pixels = tempImage;
+ srcRowStride = 3 * srcWidth;
+ srcFormat = GL_RGB;
+ }
+ else {
+ pixels = (const GLchan *) srcAddr;
+ srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
+ srcType) / sizeof(GLchan);
+ }
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ dstFormat,
+ texWidth, (GLubyte *) dstAddr);
+
+ fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride,
+ dst, dstRowStride);
+
+ if (tempImage)
+ free((void*) tempImage);
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Store user's image in rgba_fxt1 format.
+ */
+GLboolean
+_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
+{
+ const GLchan *pixels;
+ GLint srcRowStride;
+ GLubyte *dst;
+ GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+
+ ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1);
+ ASSERT(dstXoffset % 8 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset == 0);
+ (void) dstZoffset;
+ (void) dstImageOffsets;
+
+ if (srcFormat != GL_RGBA ||
+ srcType != CHAN_TYPE ||
+ ctx->_ImageTransferState ||
+ srcPacking->SwapBytes) {
+ /* convert image to RGBA/GLchan */
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ _mesa_get_format_base_format(dstFormat),
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+ pixels = tempImage;
+ srcRowStride = 4 * srcWidth;
+ srcFormat = GL_RGBA;
+ }
+ else {
+ pixels = (const GLchan *) srcAddr;
+ srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
+ srcType) / sizeof(GLchan);
+ }
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ dstFormat,
+ texWidth, (GLubyte *) dstAddr);
+
+ fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride,
+ dst, dstRowStride);
+
+ if (tempImage)
+ free((void*) tempImage);
+
+ return GL_TRUE;
+}
+
+
+void
+_mesa_fetch_texel_2d_f_rgba_fxt1( const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* just sample as GLchan and convert to float here */
+ GLchan rgba[4];
+ (void) k;
+ fxt1_decode_1(texImage->Base.Data, texImage->Base.RowStride, i, j, rgba);
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
+}
+
+
+void
+_mesa_fetch_texel_2d_f_rgb_fxt1( const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* just sample as GLchan and convert to float here */
+ GLchan rgba[4];
+ (void) k;
+ fxt1_decode_1(texImage->Base.Data, texImage->Base.RowStride, i, j, rgba);
+ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
+ texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
+ texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
+ texel[ACOMP] = 1.0F;
+}
+
+
+
+/***************************************************************************\
+ * FXT1 encoder
+ *
+ * The encoder was built by reversing the decoder,
+ * and is vaguely based on Texus2 by 3dfx. Note that this code
+ * is merely a proof of concept, since it is highly UNoptimized;
+ * moreover, it is sub-optimal due to initial conditions passed
+ * to Lloyd's algorithm (the interpolation modes are even worse).
+\***************************************************************************/
+
+
+#define MAX_COMP 4 /* ever needed maximum number of components in texel */
+#define MAX_VECT 4 /* ever needed maximum number of base vectors to find */
+#define N_TEXELS 32 /* number of texels in a block (always 32) */
+#define LL_N_REP 50 /* number of iterations in lloyd's vq */
+#define LL_RMS_D 10 /* fault tolerance (maximum delta) */
+#define LL_RMS_E 255 /* fault tolerance (maximum error) */
+#define ALPHA_TS 2 /* alpha threshold: (255 - ALPHA_TS) deemed opaque */
+#define ISTBLACK(v) (*((GLuint *)(v)) == 0)
+
+
+/*
+ * Define a 64-bit unsigned integer type and macros
+ */
+#if 1
+
+#define FX64_NATIVE 1
+
+typedef uint64_t Fx64;
+
+#define FX64_MOV32(a, b) a = b
+#define FX64_OR32(a, b) a |= b
+#define FX64_SHL(a, c) a <<= c
+
+#else
+
+#define FX64_NATIVE 0
+
+typedef struct {
+ GLuint lo, hi;
+} Fx64;
+
+#define FX64_MOV32(a, b) a.lo = b
+#define FX64_OR32(a, b) a.lo |= b
+
+#define FX64_SHL(a, c) \
+ do { \
+ if ((c) >= 32) { \
+ a.hi = a.lo << ((c) - 32); \
+ a.lo = 0; \
+ } else { \
+ a.hi = (a.hi << (c)) | (a.lo >> (32 - (c))); \
+ a.lo <<= (c); \
+ } \
+ } while (0)
+
+#endif
+
+
+#define F(i) (GLfloat)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */
+#define SAFECDOT 1 /* for paranoids */
+
+#define MAKEIVEC(NV, NC, IV, B, V0, V1) \
+ do { \
+ /* compute interpolation vector */ \
+ GLfloat d2 = 0.0F; \
+ GLfloat rd2; \
+ \
+ for (i = 0; i < NC; i++) { \
+ IV[i] = (V1[i] - V0[i]) * F(i); \
+ d2 += IV[i] * IV[i]; \
+ } \
+ rd2 = (GLfloat)NV / d2; \
+ B = 0; \
+ for (i = 0; i < NC; i++) { \
+ IV[i] *= F(i); \
+ B -= IV[i] * V0[i]; \
+ IV[i] *= rd2; \
+ } \
+ B = B * rd2 + 0.5f; \
+ } while (0)
+
+#define CALCCDOT(TEXEL, NV, NC, IV, B, V)\
+ do { \
+ GLfloat dot = 0.0F; \
+ for (i = 0; i < NC; i++) { \
+ dot += V[i] * IV[i]; \
+ } \
+ TEXEL = (GLint)(dot + B); \
+ if (SAFECDOT) { \
+ if (TEXEL < 0) { \
+ TEXEL = 0; \
+ } else if (TEXEL > NV) { \
+ TEXEL = NV; \
+ } \
+ } \
+ } while (0)
+
+
+static GLint
+fxt1_bestcol (GLfloat vec[][MAX_COMP], GLint nv,
+ GLubyte input[MAX_COMP], GLint nc)
+{
+ GLint i, j, best = -1;
+ GLfloat err = 1e9; /* big enough */
+
+ for (j = 0; j < nv; j++) {
+ GLfloat e = 0.0F;
+ for (i = 0; i < nc; i++) {
+ e += (vec[j][i] - input[i]) * (vec[j][i] - input[i]);
+ }
+ if (e < err) {
+ err = e;
+ best = j;
+ }
+ }
+
+ return best;
+}
+
+
+static GLint
+fxt1_worst (GLfloat vec[MAX_COMP],
+ GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
+{
+ GLint i, k, worst = -1;
+ GLfloat err = -1.0F; /* small enough */
+
+ for (k = 0; k < n; k++) {
+ GLfloat e = 0.0F;
+ for (i = 0; i < nc; i++) {
+ e += (vec[i] - input[k][i]) * (vec[i] - input[k][i]);
+ }
+ if (e > err) {
+ err = e;
+ worst = k;
+ }
+ }
+
+ return worst;
+}
+
+
+static GLint
+fxt1_variance (GLdouble variance[MAX_COMP],
+ GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
+{
+ GLint i, k, best = 0;
+ GLint sx, sx2;
+ GLdouble var, maxvar = -1; /* small enough */
+ GLdouble teenth = 1.0 / n;
+
+ for (i = 0; i < nc; i++) {
+ sx = sx2 = 0;
+ for (k = 0; k < n; k++) {
+ GLint t = input[k][i];
+ sx += t;
+ sx2 += t * t;
+ }
+ var = sx2 * teenth - sx * sx * teenth * teenth;
+ if (maxvar < var) {
+ maxvar = var;
+ best = i;
+ }
+ if (variance) {
+ variance[i] = var;
+ }
+ }
+
+ return best;
+}
+
+
+static GLint
+fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv,
+ GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
+{
+#if 0
+ /* Choose colors from a grid.
+ */
+ GLint i, j;
+
+ for (j = 0; j < nv; j++) {
+ GLint m = j * (n - 1) / (nv - 1);
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = input[m][i];
+ }
+ }
+#else
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 8x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ GLint i, j, k;
+ GLint minSum = 2000; /* big enough */
+ GLint maxSum = -1; /* small enough */
+ GLint minCol = 0; /* phoudoin: silent compiler! */
+ GLint maxCol = 0; /* phoudoin: silent compiler! */
+
+ struct {
+ GLint flag;
+ GLint key;
+ GLint freq;
+ GLint idx;
+ } hist[N_TEXELS];
+ GLint lenh = 0;
+
+ memset(hist, 0, sizeof(hist));
+
+ for (k = 0; k < n; k++) {
+ GLint l;
+ GLint key = 0;
+ GLint sum = 0;
+ for (i = 0; i < nc; i++) {
+ key <<= 8;
+ key |= input[k][i];
+ sum += input[k][i];
+ }
+ for (l = 0; l < n; l++) {
+ if (!hist[l].flag) {
+ /* alloc new slot */
+ hist[l].flag = !0;
+ hist[l].key = key;
+ hist[l].freq = 1;
+ hist[l].idx = k;
+ lenh = l + 1;
+ break;
+ } else if (hist[l].key == key) {
+ hist[l].freq++;
+ break;
+ }
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minCol = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxCol = k;
+ }
+ }
+
+ if (lenh <= nv) {
+ for (j = 0; j < lenh; j++) {
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = (GLfloat)input[hist[j].idx][i];
+ }
+ }
+ for (; j < nv; j++) {
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = vec[0][i];
+ }
+ }
+ return 0;
+ }
+
+ for (j = 0; j < nv; j++) {
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = ((nv - 1 - j) * input[minCol][i] + j * input[maxCol][i] + (nv - 1) / 2) / (GLfloat)(nv - 1);
+ }
+ }
+#endif
+
+ return !0;
+}
+
+
+static GLint
+fxt1_lloyd (GLfloat vec[][MAX_COMP], GLint nv,
+ GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
+{
+ /* Use the generalized lloyd's algorithm for VQ:
+ * find 4 color vectors.
+ *
+ * for each sample color
+ * sort to nearest vector.
+ *
+ * replace each vector with the centroid of its matching colors.
+ *
+ * repeat until RMS doesn't improve.
+ *
+ * if a color vector has no samples, or becomes the same as another
+ * vector, replace it with the color which is farthest from a sample.
+ *
+ * vec[][MAX_COMP] initial vectors and resulting colors
+ * nv number of resulting colors required
+ * input[N_TEXELS][MAX_COMP] input texels
+ * nc number of components in input / vec
+ * n number of input samples
+ */
+
+ GLint sum[MAX_VECT][MAX_COMP]; /* used to accumulate closest texels */
+ GLint cnt[MAX_VECT]; /* how many times a certain vector was chosen */
+ GLfloat error, lasterror = 1e9;
+
+ GLint i, j, k, rep;
+
+ /* the quantizer */
+ for (rep = 0; rep < LL_N_REP; rep++) {
+ /* reset sums & counters */
+ for (j = 0; j < nv; j++) {
+ for (i = 0; i < nc; i++) {
+ sum[j][i] = 0;
+ }
+ cnt[j] = 0;
+ }
+ error = 0;
+
+ /* scan whole block */
+ for (k = 0; k < n; k++) {
+#if 1
+ GLint best = -1;
+ GLfloat err = 1e9; /* big enough */
+ /* determine best vector */
+ for (j = 0; j < nv; j++) {
+ GLfloat e = (vec[j][0] - input[k][0]) * (vec[j][0] - input[k][0]) +
+ (vec[j][1] - input[k][1]) * (vec[j][1] - input[k][1]) +
+ (vec[j][2] - input[k][2]) * (vec[j][2] - input[k][2]);
+ if (nc == 4) {
+ e += (vec[j][3] - input[k][3]) * (vec[j][3] - input[k][3]);
+ }
+ if (e < err) {
+ err = e;
+ best = j;
+ }
+ }
+#else
+ GLint best = fxt1_bestcol(vec, nv, input[k], nc, &err);
+#endif
+ assert(best >= 0);
+ /* add in closest color */
+ for (i = 0; i < nc; i++) {
+ sum[best][i] += input[k][i];
+ }
+ /* mark this vector as used */
+ cnt[best]++;
+ /* accumulate error */
+ error += err;
+ }
+
+ /* check RMS */
+ if ((error < LL_RMS_E) ||
+ ((error < lasterror) && ((lasterror - error) < LL_RMS_D))) {
+ return !0; /* good match */
+ }
+ lasterror = error;
+
+ /* move each vector to the barycenter of its closest colors */
+ for (j = 0; j < nv; j++) {
+ if (cnt[j]) {
+ GLfloat div = 1.0F / cnt[j];
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = div * sum[j][i];
+ }
+ } else {
+ /* this vec has no samples or is identical with a previous vec */
+ GLint worst = fxt1_worst(vec[j], input, nc, n);
+ for (i = 0; i < nc; i++) {
+ vec[j][i] = input[worst][i];
+ }
+ }
+ }
+ }
+
+ return 0; /* could not converge fast enough */
+}
+
+
+static void
+fxt1_quantize_CHROMA (GLuint *cc,
+ GLubyte input[N_TEXELS][MAX_COMP])
+{
+ const GLint n_vect = 4; /* 4 base vectors to find */
+ const GLint n_comp = 3; /* 3 components: R, G, B */
+ GLfloat vec[MAX_VECT][MAX_COMP];
+ GLint i, j, k;
+ Fx64 hi; /* high quadword */
+ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ if (fxt1_choose(vec, n_vect, input, n_comp, N_TEXELS) != 0) {
+ fxt1_lloyd(vec, n_vect, input, n_comp, N_TEXELS);
+ }
+
+ FX64_MOV32(hi, 4); /* cc-chroma = "010" + unused bit */
+ for (j = n_vect - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+
+ lohi = lolo = 0;
+ /* right microtile */
+ for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
+ lohi <<= 2;
+ lohi |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
+ }
+ /* left microtile */
+ for (; k >= 0; k--) {
+ lolo <<= 2;
+ lolo |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
+ }
+ cc[1] = lohi;
+ cc[0] = lolo;
+}
+
+
+static void
+fxt1_quantize_ALPHA0 (GLuint *cc,
+ GLubyte input[N_TEXELS][MAX_COMP],
+ GLubyte reord[N_TEXELS][MAX_COMP], GLint n)
+{
+ const GLint n_vect = 3; /* 3 base vectors to find */
+ const GLint n_comp = 4; /* 4 components: R, G, B, A */
+ GLfloat vec[MAX_VECT][MAX_COMP];
+ GLint i, j, k;
+ Fx64 hi; /* high quadword */
+ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ /* the last vector indicates zero */
+ for (i = 0; i < n_comp; i++) {
+ vec[n_vect][i] = 0;
+ }
+
+ /* the first n texels in reord are guaranteed to be non-zero */
+ if (fxt1_choose(vec, n_vect, reord, n_comp, n) != 0) {
+ fxt1_lloyd(vec, n_vect, reord, n_comp, n);
+ }
+
+ FX64_MOV32(hi, 6); /* alpha = "011" + lerp = 0 */
+ for (j = n_vect - 1; j >= 0; j--) {
+ /* add in alphas */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F));
+ }
+ for (j = n_vect - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp - 1; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+
+ lohi = lolo = 0;
+ /* right microtile */
+ for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
+ lohi <<= 2;
+ lohi |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
+ }
+ /* left microtile */
+ for (; k >= 0; k--) {
+ lolo <<= 2;
+ lolo |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
+ }
+ cc[1] = lohi;
+ cc[0] = lolo;
+}
+
+
+static void
+fxt1_quantize_ALPHA1 (GLuint *cc,
+ GLubyte input[N_TEXELS][MAX_COMP])
+{
+ const GLint n_vect = 3; /* highest vector number in each microtile */
+ const GLint n_comp = 4; /* 4 components: R, G, B, A */
+ GLfloat vec[1 + 1 + 1][MAX_COMP]; /* 1.5 extrema for each sub-block */
+ GLfloat b, iv[MAX_COMP]; /* interpolation vector */
+ GLint i, j, k;
+ Fx64 hi; /* high quadword */
+ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ GLint minSum;
+ GLint maxSum;
+ GLint minColL = 0, maxColL = 0;
+ GLint minColR = 0, maxColR = 0;
+ GLint sumL = 0, sumR = 0;
+ GLint nn_comp;
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 4x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ nn_comp = n_comp;
+ while ((minColL == maxColL) && nn_comp) {
+ minSum = 2000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ GLint sum = 0;
+ for (i = 0; i < nn_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColL = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColL = k;
+ }
+ sumL += sum;
+ }
+
+ nn_comp--;
+ }
+
+ nn_comp = n_comp;
+ while ((minColR == maxColR) && nn_comp) {
+ minSum = 2000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = N_TEXELS / 2; k < N_TEXELS; k++) {
+ GLint sum = 0;
+ for (i = 0; i < nn_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColR = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColR = k;
+ }
+ sumR += sum;
+ }
+
+ nn_comp--;
+ }
+
+ /* choose the common vector (yuck!) */
+ {
+ GLint j1, j2;
+ GLint v1 = 0, v2 = 0;
+ GLfloat err = 1e9; /* big enough */
+ GLfloat tv[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
+ for (i = 0; i < n_comp; i++) {
+ tv[0][i] = input[minColL][i];
+ tv[1][i] = input[maxColL][i];
+ tv[2][i] = input[minColR][i];
+ tv[3][i] = input[maxColR][i];
+ }
+ for (j1 = 0; j1 < 2; j1++) {
+ for (j2 = 2; j2 < 4; j2++) {
+ GLfloat e = 0.0F;
+ for (i = 0; i < n_comp; i++) {
+ e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] - tv[j2][i]);
+ }
+ if (e < err) {
+ err = e;
+ v1 = j1;
+ v2 = j2;
+ }
+ }
+ }
+ for (i = 0; i < n_comp; i++) {
+ vec[0][i] = tv[1 - v1][i];
+ vec[1][i] = (tv[v1][i] * sumL + tv[v2][i] * sumR) / (sumL + sumR);
+ vec[2][i] = tv[5 - v2][i];
+ }
+ }
+
+ /* left microtile */
+ cc[0] = 0;
+ if (minColL != maxColL) {
+ /* compute interpolation vector */
+ MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
+
+ /* add in texels */
+ lolo = 0;
+ for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
+ GLint texel;
+ /* interpolate color */
+ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
+ /* add in texel */
+ lolo <<= 2;
+ lolo |= texel;
+ }
+
+ cc[0] = lolo;
+ }
+
+ /* right microtile */
+ cc[1] = 0;
+ if (minColR != maxColR) {
+ /* compute interpolation vector */
+ MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[1]);
+
+ /* add in texels */
+ lohi = 0;
+ for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
+ GLint texel;
+ /* interpolate color */
+ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
+ /* add in texel */
+ lohi <<= 2;
+ lohi |= texel;
+ }
+
+ cc[1] = lohi;
+ }
+
+ FX64_MOV32(hi, 7); /* alpha = "011" + lerp = 1 */
+ for (j = n_vect - 1; j >= 0; j--) {
+ /* add in alphas */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F));
+ }
+ for (j = n_vect - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp - 1; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+}
+
+
+static void
+fxt1_quantize_HI (GLuint *cc,
+ GLubyte input[N_TEXELS][MAX_COMP],
+ GLubyte reord[N_TEXELS][MAX_COMP], GLint n)
+{
+ const GLint n_vect = 6; /* highest vector number */
+ const GLint n_comp = 3; /* 3 components: R, G, B */
+ GLfloat b = 0.0F; /* phoudoin: silent compiler! */
+ GLfloat iv[MAX_COMP]; /* interpolation vector */
+ GLint i, k;
+ GLuint hihi; /* high quadword: hi dword */
+
+ GLint minSum = 2000; /* big enough */
+ GLint maxSum = -1; /* small enough */
+ GLint minCol = 0; /* phoudoin: silent compiler! */
+ GLint maxCol = 0; /* phoudoin: silent compiler! */
+
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 8x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ for (k = 0; k < n; k++) {
+ GLint sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += reord[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minCol = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxCol = k;
+ }
+ }
+
+ hihi = 0; /* cc-hi = "00" */
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ hihi <<= 5;
+ hihi |= reord[maxCol][i] >> 3;
+ }
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ hihi <<= 5;
+ hihi |= reord[minCol][i] >> 3;
+ }
+ cc[3] = hihi;
+ cc[0] = cc[1] = cc[2] = 0;
+
+ /* compute interpolation vector */
+ if (minCol != maxCol) {
+ MAKEIVEC(n_vect, n_comp, iv, b, reord[minCol], reord[maxCol]);
+ }
+
+ /* add in texels */
+ for (k = N_TEXELS - 1; k >= 0; k--) {
+ GLint t = k * 3;
+ GLuint *kk = (GLuint *)((char *)cc + t / 8);
+ GLint texel = n_vect + 1; /* transparent black */
+
+ if (!ISTBLACK(input[k])) {
+ if (minCol != maxCol) {
+ /* interpolate color */
+ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
+ /* add in texel */
+ kk[0] |= texel << (t & 7);
+ }
+ } else {
+ /* add in texel */
+ kk[0] |= texel << (t & 7);
+ }
+ }
+}
+
+
+static void
+fxt1_quantize_MIXED1 (GLuint *cc,
+ GLubyte input[N_TEXELS][MAX_COMP])
+{
+ const GLint n_vect = 2; /* highest vector number in each microtile */
+ const GLint n_comp = 3; /* 3 components: R, G, B */
+ GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
+ GLfloat b, iv[MAX_COMP]; /* interpolation vector */
+ GLint i, j, k;
+ Fx64 hi; /* high quadword */
+ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ GLint minSum;
+ GLint maxSum;
+ GLint minColL = 0, maxColL = -1;
+ GLint minColR = 0, maxColR = -1;
+
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 4x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ minSum = 2000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ if (!ISTBLACK(input[k])) {
+ GLint sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColL = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColL = k;
+ }
+ }
+ }
+ minSum = 2000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (; k < N_TEXELS; k++) {
+ if (!ISTBLACK(input[k])) {
+ GLint sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColR = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColR = k;
+ }
+ }
+ }
+
+ /* left microtile */
+ if (maxColL == -1) {
+ /* all transparent black */
+ cc[0] = ~0u;
+ for (i = 0; i < n_comp; i++) {
+ vec[0][i] = 0;
+ vec[1][i] = 0;
+ }
+ } else {
+ cc[0] = 0;
+ for (i = 0; i < n_comp; i++) {
+ vec[0][i] = input[minColL][i];
+ vec[1][i] = input[maxColL][i];
+ }
+ if (minColL != maxColL) {
+ /* compute interpolation vector */
+ MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
+
+ /* add in texels */
+ lolo = 0;
+ for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
+ GLint texel = n_vect + 1; /* transparent black */
+ if (!ISTBLACK(input[k])) {
+ /* interpolate color */
+ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
+ }
+ /* add in texel */
+ lolo <<= 2;
+ lolo |= texel;
+ }
+ cc[0] = lolo;
+ }
+ }
+
+ /* right microtile */
+ if (maxColR == -1) {
+ /* all transparent black */
+ cc[1] = ~0u;
+ for (i = 0; i < n_comp; i++) {
+ vec[2][i] = 0;
+ vec[3][i] = 0;
+ }
+ } else {
+ cc[1] = 0;
+ for (i = 0; i < n_comp; i++) {
+ vec[2][i] = input[minColR][i];
+ vec[3][i] = input[maxColR][i];
+ }
+ if (minColR != maxColR) {
+ /* compute interpolation vector */
+ MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]);
+
+ /* add in texels */
+ lohi = 0;
+ for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
+ GLint texel = n_vect + 1; /* transparent black */
+ if (!ISTBLACK(input[k])) {
+ /* interpolate color */
+ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
+ }
+ /* add in texel */
+ lohi <<= 2;
+ lohi |= texel;
+ }
+ cc[1] = lohi;
+ }
+ }
+
+ FX64_MOV32(hi, 9 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
+ for (j = 2 * 2 - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, vec[j][i] >> 3);
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+}
+
+
+static void
+fxt1_quantize_MIXED0 (GLuint *cc,
+ GLubyte input[N_TEXELS][MAX_COMP])
+{
+ const GLint n_vect = 3; /* highest vector number in each microtile */
+ const GLint n_comp = 3; /* 3 components: R, G, B */
+ GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
+ GLfloat b, iv[MAX_COMP]; /* interpolation vector */
+ GLint i, j, k;
+ Fx64 hi; /* high quadword */
+ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
+
+ GLint minColL = 0, maxColL = 0;
+ GLint minColR = 0, maxColR = 0;
+#if 0
+ GLint minSum;
+ GLint maxSum;
+
+ /* Our solution here is to find the darkest and brightest colors in
+ * the 4x4 tile and use those as the two representative colors.
+ * There are probably better algorithms to use (histogram-based).
+ */
+ minSum = 2000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ GLint sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColL = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColL = k;
+ }
+ }
+ minSum = 2000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (; k < N_TEXELS; k++) {
+ GLint sum = 0;
+ for (i = 0; i < n_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColR = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColR = k;
+ }
+ }
+#else
+ GLint minVal;
+ GLint maxVal;
+ GLint maxVarL = fxt1_variance(NULL, input, n_comp, N_TEXELS / 2);
+ GLint maxVarR = fxt1_variance(NULL, &input[N_TEXELS / 2], n_comp, N_TEXELS / 2);
+
+ /* Scan the channel with max variance for lo & hi
+ * and use those as the two representative colors.
+ */
+ minVal = 2000; /* big enough */
+ maxVal = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ GLint t = input[k][maxVarL];
+ if (minVal > t) {
+ minVal = t;
+ minColL = k;
+ }
+ if (maxVal < t) {
+ maxVal = t;
+ maxColL = k;
+ }
+ }
+ minVal = 2000; /* big enough */
+ maxVal = -1; /* small enough */
+ for (; k < N_TEXELS; k++) {
+ GLint t = input[k][maxVarR];
+ if (minVal > t) {
+ minVal = t;
+ minColR = k;
+ }
+ if (maxVal < t) {
+ maxVal = t;
+ maxColR = k;
+ }
+ }
+#endif
+
+ /* left microtile */
+ cc[0] = 0;
+ for (i = 0; i < n_comp; i++) {
+ vec[0][i] = input[minColL][i];
+ vec[1][i] = input[maxColL][i];
+ }
+ if (minColL != maxColL) {
+ /* compute interpolation vector */
+ MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
+
+ /* add in texels */
+ lolo = 0;
+ for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
+ GLint texel;
+ /* interpolate color */
+ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
+ /* add in texel */
+ lolo <<= 2;
+ lolo |= texel;
+ }
+
+ /* funky encoding for LSB of green */
+ if ((GLint)((lolo >> 1) & 1) != (((vec[1][GCOMP] ^ vec[0][GCOMP]) >> 2) & 1)) {
+ for (i = 0; i < n_comp; i++) {
+ vec[1][i] = input[minColL][i];
+ vec[0][i] = input[maxColL][i];
+ }
+ lolo = ~lolo;
+ }
+
+ cc[0] = lolo;
+ }
+
+ /* right microtile */
+ cc[1] = 0;
+ for (i = 0; i < n_comp; i++) {
+ vec[2][i] = input[minColR][i];
+ vec[3][i] = input[maxColR][i];
+ }
+ if (minColR != maxColR) {
+ /* compute interpolation vector */
+ MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]);
+
+ /* add in texels */
+ lohi = 0;
+ for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
+ GLint texel;
+ /* interpolate color */
+ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
+ /* add in texel */
+ lohi <<= 2;
+ lohi |= texel;
+ }
+
+ /* funky encoding for LSB of green */
+ if ((GLint)((lohi >> 1) & 1) != (((vec[3][GCOMP] ^ vec[2][GCOMP]) >> 2) & 1)) {
+ for (i = 0; i < n_comp; i++) {
+ vec[3][i] = input[minColR][i];
+ vec[2][i] = input[maxColR][i];
+ }
+ lohi = ~lohi;
+ }
+
+ cc[1] = lohi;
+ }
+
+ FX64_MOV32(hi, 8 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
+ for (j = 2 * 2 - 1; j >= 0; j--) {
+ for (i = 0; i < n_comp; i++) {
+ /* add in colors */
+ FX64_SHL(hi, 5);
+ FX64_OR32(hi, vec[j][i] >> 3);
+ }
+ }
+ ((Fx64 *)cc)[1] = hi;
+}
+
+
+static void
+fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps)
+{
+ GLint trualpha;
+ GLubyte reord[N_TEXELS][MAX_COMP];
+
+ GLubyte input[N_TEXELS][MAX_COMP];
+ GLint i, k, l;
+
+ if (comps == 3) {
+ /* make the whole block opaque */
+ memset(input, -1, sizeof(input));
+ }
+
+ /* 8 texels each line */
+ for (l = 0; l < 4; l++) {
+ for (k = 0; k < 4; k++) {
+ for (i = 0; i < comps; i++) {
+ input[k + l * 4][i] = *lines[l]++;
+ }
+ }
+ for (; k < 8; k++) {
+ for (i = 0; i < comps; i++) {
+ input[k + l * 4 + 12][i] = *lines[l]++;
+ }
+ }
+ }
+
+ /* block layout:
+ * 00, 01, 02, 03, 08, 09, 0a, 0b
+ * 10, 11, 12, 13, 18, 19, 1a, 1b
+ * 04, 05, 06, 07, 0c, 0d, 0e, 0f
+ * 14, 15, 16, 17, 1c, 1d, 1e, 1f
+ */
+
+ /* [dBorca]
+ * stupidity flows forth from this
+ */
+ l = N_TEXELS;
+ trualpha = 0;
+ if (comps == 4) {
+ /* skip all transparent black texels */
+ l = 0;
+ for (k = 0; k < N_TEXELS; k++) {
+ /* test all components against 0 */
+ if (!ISTBLACK(input[k])) {
+ /* texel is not transparent black */
+ COPY_4UBV(reord[l], input[k]);
+ if (reord[l][ACOMP] < (255 - ALPHA_TS)) {
+ /* non-opaque texel */
+ trualpha = !0;
+ }
+ l++;
+ }
+ }
+ }
+
+#if 0
+ if (trualpha) {
+ fxt1_quantize_ALPHA0(cc, input, reord, l);
+ } else if (l == 0) {
+ cc[0] = cc[1] = cc[2] = -1;
+ cc[3] = 0;
+ } else if (l < N_TEXELS) {
+ fxt1_quantize_HI(cc, input, reord, l);
+ } else {
+ fxt1_quantize_CHROMA(cc, input);
+ }
+ (void)fxt1_quantize_ALPHA1;
+ (void)fxt1_quantize_MIXED1;
+ (void)fxt1_quantize_MIXED0;
+#else
+ if (trualpha) {
+ fxt1_quantize_ALPHA1(cc, input);
+ } else if (l == 0) {
+ cc[0] = cc[1] = cc[2] = ~0u;
+ cc[3] = 0;
+ } else if (l < N_TEXELS) {
+ fxt1_quantize_MIXED1(cc, input);
+ } else {
+ fxt1_quantize_MIXED0(cc, input);
+ }
+ (void)fxt1_quantize_ALPHA0;
+ (void)fxt1_quantize_HI;
+ (void)fxt1_quantize_CHROMA;
+#endif
+}
+
+
+static void
+fxt1_encode (GLuint width, GLuint height, GLint comps,
+ const void *source, GLint srcRowStride,
+ void *dest, GLint destRowStride)
+{
+ GLuint x, y;
+ const GLubyte *data;
+ GLuint *encoded = (GLuint *)dest;
+ void *newSource = NULL;
+
+ assert(comps == 3 || comps == 4);
+
+ /* Replicate image if width is not M8 or height is not M4 */
+ if ((width & 7) | (height & 3)) {
+ GLint newWidth = (width + 7) & ~7;
+ GLint newHeight = (height + 3) & ~3;
+ newSource = malloc(comps * newWidth * newHeight * sizeof(GLchan));
+ if (!newSource) {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
+ goto cleanUp;
+ }
+ _mesa_upscale_teximage2d(width, height, newWidth, newHeight,
+ comps, (const GLchan *) source,
+ srcRowStride, (GLchan *) newSource);
+ source = newSource;
+ width = newWidth;
+ height = newHeight;
+ srcRowStride = comps * newWidth;
+ }
+
+ /* convert from 16/32-bit channels to GLubyte if needed */
+ if (CHAN_TYPE != GL_UNSIGNED_BYTE) {
+ const GLuint n = width * height * comps;
+ const GLchan *src = (const GLchan *) source;
+ GLubyte *dest = (GLubyte *) malloc(n * sizeof(GLubyte));
+ GLuint i;
+ if (!dest) {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
+ goto cleanUp;
+ }
+ for (i = 0; i < n; i++) {
+ dest[i] = CHAN_TO_UBYTE(src[i]);
+ }
+ if (newSource != NULL) {
+ free(newSource);
+ }
+ newSource = dest; /* we'll free this buffer before returning */
+ source = dest; /* the new, GLubyte incoming image */
+ }
+
+ data = (const GLubyte *) source;
+ destRowStride = (destRowStride - width * 2) / 4;
+ for (y = 0; y < height; y += 4) {
+ GLuint offs = 0 + (y + 0) * srcRowStride;
+ for (x = 0; x < width; x += 8) {
+ const GLubyte *lines[4];
+ lines[0] = &data[offs];
+ lines[1] = lines[0] + srcRowStride;
+ lines[2] = lines[1] + srcRowStride;
+ lines[3] = lines[2] + srcRowStride;
+ offs += 8 * comps;
+ fxt1_quantize(encoded, lines, comps);
+ /* 128 bits per 8x4 block */
+ encoded += 4;
+ }
+ encoded += destRowStride;
+ }
+
+ cleanUp:
+ if (newSource != NULL) {
+ free(newSource);
+ }
+}
+
+
+/***************************************************************************\
+ * FXT1 decoder
+ *
+ * The decoder is based on GL_3DFX_texture_compression_FXT1
+ * specification and serves as a concept for the encoder.
+\***************************************************************************/
+
+
+/* lookup table for scaling 5 bit colors up to 8 bits */
+static const GLubyte _rgb_scale_5[] = {
+ 0, 8, 16, 25, 33, 41, 49, 58,
+ 66, 74, 82, 90, 99, 107, 115, 123,
+ 132, 140, 148, 156, 165, 173, 181, 189,
+ 197, 206, 214, 222, 230, 239, 247, 255
+};
+
+/* lookup table for scaling 6 bit colors up to 8 bits */
+static const GLubyte _rgb_scale_6[] = {
+ 0, 4, 8, 12, 16, 20, 24, 28,
+ 32, 36, 40, 45, 49, 53, 57, 61,
+ 65, 69, 73, 77, 81, 85, 89, 93,
+ 97, 101, 105, 109, 113, 117, 121, 125,
+ 130, 134, 138, 142, 146, 150, 154, 158,
+ 162, 166, 170, 174, 178, 182, 186, 190,
+ 194, 198, 202, 206, 210, 215, 219, 223,
+ 227, 231, 235, 239, 243, 247, 251, 255
+};
+
+
+#define CC_SEL(cc, which) (((GLuint *)(cc))[(which) / 32] >> ((which) & 31))
+#define UP5(c) _rgb_scale_5[(c) & 31]
+#define UP6(c, b) _rgb_scale_6[(((c) & 31) << 1) | ((b) & 1)]
+#define LERP(n, t, c0, c1) (((n) - (t)) * (c0) + (t) * (c1) + (n) / 2) / (n)
+
+
+static void
+fxt1_decode_1HI (const GLubyte *code, GLint t, GLchan *rgba)
+{
+ const GLuint *cc;
+
+ t *= 3;
+ cc = (const GLuint *)(code + t / 8);
+ t = (cc[0] >> (t & 7)) & 7;
+
+ if (t == 7) {
+ rgba[RCOMP] = rgba[GCOMP] = rgba[BCOMP] = rgba[ACOMP] = 0;
+ } else {
+ GLubyte r, g, b;
+ cc = (const GLuint *)(code + 12);
+ if (t == 0) {
+ b = UP5(CC_SEL(cc, 0));
+ g = UP5(CC_SEL(cc, 5));
+ r = UP5(CC_SEL(cc, 10));
+ } else if (t == 6) {
+ b = UP5(CC_SEL(cc, 15));
+ g = UP5(CC_SEL(cc, 20));
+ r = UP5(CC_SEL(cc, 25));
+ } else {
+ b = LERP(6, t, UP5(CC_SEL(cc, 0)), UP5(CC_SEL(cc, 15)));
+ g = LERP(6, t, UP5(CC_SEL(cc, 5)), UP5(CC_SEL(cc, 20)));
+ r = LERP(6, t, UP5(CC_SEL(cc, 10)), UP5(CC_SEL(cc, 25)));
+ }
+ rgba[RCOMP] = UBYTE_TO_CHAN(r);
+ rgba[GCOMP] = UBYTE_TO_CHAN(g);
+ rgba[BCOMP] = UBYTE_TO_CHAN(b);
+ rgba[ACOMP] = CHAN_MAX;
+ }
+}
+
+
+static void
+fxt1_decode_1CHROMA (const GLubyte *code, GLint t, GLchan *rgba)
+{
+ const GLuint *cc;
+ GLuint kk;
+
+ cc = (const GLuint *)code;
+ if (t & 16) {
+ cc++;
+ t &= 15;
+ }
+ t = (cc[0] >> (t * 2)) & 3;
+
+ t *= 15;
+ cc = (const GLuint *)(code + 8 + t / 8);
+ kk = cc[0] >> (t & 7);
+ rgba[BCOMP] = UBYTE_TO_CHAN( UP5(kk) );
+ rgba[GCOMP] = UBYTE_TO_CHAN( UP5(kk >> 5) );
+ rgba[RCOMP] = UBYTE_TO_CHAN( UP5(kk >> 10) );
+ rgba[ACOMP] = CHAN_MAX;
+}
+
+
+static void
+fxt1_decode_1MIXED (const GLubyte *code, GLint t, GLchan *rgba)
+{
+ const GLuint *cc;
+ GLuint col[2][3];
+ GLint glsb, selb;
+
+ cc = (const GLuint *)code;
+ if (t & 16) {
+ t &= 15;
+ t = (cc[1] >> (t * 2)) & 3;
+ /* col 2 */
+ col[0][BCOMP] = (*(const GLuint *)(code + 11)) >> 6;
+ col[0][GCOMP] = CC_SEL(cc, 99);
+ col[0][RCOMP] = CC_SEL(cc, 104);
+ /* col 3 */
+ col[1][BCOMP] = CC_SEL(cc, 109);
+ col[1][GCOMP] = CC_SEL(cc, 114);
+ col[1][RCOMP] = CC_SEL(cc, 119);
+ glsb = CC_SEL(cc, 126);
+ selb = CC_SEL(cc, 33);
+ } else {
+ t = (cc[0] >> (t * 2)) & 3;
+ /* col 0 */
+ col[0][BCOMP] = CC_SEL(cc, 64);
+ col[0][GCOMP] = CC_SEL(cc, 69);
+ col[0][RCOMP] = CC_SEL(cc, 74);
+ /* col 1 */
+ col[1][BCOMP] = CC_SEL(cc, 79);
+ col[1][GCOMP] = CC_SEL(cc, 84);
+ col[1][RCOMP] = CC_SEL(cc, 89);
+ glsb = CC_SEL(cc, 125);
+ selb = CC_SEL(cc, 1);
+ }
+
+ if (CC_SEL(cc, 124) & 1) {
+ /* alpha[0] == 1 */
+
+ if (t == 3) {
+ /* zero */
+ rgba[RCOMP] = rgba[BCOMP] = rgba[GCOMP] = rgba[ACOMP] = 0;
+ } else {
+ GLubyte r, g, b;
+ if (t == 0) {
+ b = UP5(col[0][BCOMP]);
+ g = UP5(col[0][GCOMP]);
+ r = UP5(col[0][RCOMP]);
+ } else if (t == 2) {
+ b = UP5(col[1][BCOMP]);
+ g = UP6(col[1][GCOMP], glsb);
+ r = UP5(col[1][RCOMP]);
+ } else {
+ b = (UP5(col[0][BCOMP]) + UP5(col[1][BCOMP])) / 2;
+ g = (UP5(col[0][GCOMP]) + UP6(col[1][GCOMP], glsb)) / 2;
+ r = (UP5(col[0][RCOMP]) + UP5(col[1][RCOMP])) / 2;
+ }
+ rgba[RCOMP] = UBYTE_TO_CHAN(r);
+ rgba[GCOMP] = UBYTE_TO_CHAN(g);
+ rgba[BCOMP] = UBYTE_TO_CHAN(b);
+ rgba[ACOMP] = CHAN_MAX;
+ }
+ } else {
+ /* alpha[0] == 0 */
+ GLubyte r, g, b;
+ if (t == 0) {
+ b = UP5(col[0][BCOMP]);
+ g = UP6(col[0][GCOMP], glsb ^ selb);
+ r = UP5(col[0][RCOMP]);
+ } else if (t == 3) {
+ b = UP5(col[1][BCOMP]);
+ g = UP6(col[1][GCOMP], glsb);
+ r = UP5(col[1][RCOMP]);
+ } else {
+ b = LERP(3, t, UP5(col[0][BCOMP]), UP5(col[1][BCOMP]));
+ g = LERP(3, t, UP6(col[0][GCOMP], glsb ^ selb),
+ UP6(col[1][GCOMP], glsb));
+ r = LERP(3, t, UP5(col[0][RCOMP]), UP5(col[1][RCOMP]));
+ }
+ rgba[RCOMP] = UBYTE_TO_CHAN(r);
+ rgba[GCOMP] = UBYTE_TO_CHAN(g);
+ rgba[BCOMP] = UBYTE_TO_CHAN(b);
+ rgba[ACOMP] = CHAN_MAX;
+ }
+}
+
+
+static void
+fxt1_decode_1ALPHA (const GLubyte *code, GLint t, GLchan *rgba)
+{
+ const GLuint *cc;
+ GLubyte r, g, b, a;
+
+ cc = (const GLuint *)code;
+ if (CC_SEL(cc, 124) & 1) {
+ /* lerp == 1 */
+ GLuint col0[4];
+
+ if (t & 16) {
+ t &= 15;
+ t = (cc[1] >> (t * 2)) & 3;
+ /* col 2 */
+ col0[BCOMP] = (*(const GLuint *)(code + 11)) >> 6;
+ col0[GCOMP] = CC_SEL(cc, 99);
+ col0[RCOMP] = CC_SEL(cc, 104);
+ col0[ACOMP] = CC_SEL(cc, 119);
+ } else {
+ t = (cc[0] >> (t * 2)) & 3;
+ /* col 0 */
+ col0[BCOMP] = CC_SEL(cc, 64);
+ col0[GCOMP] = CC_SEL(cc, 69);
+ col0[RCOMP] = CC_SEL(cc, 74);
+ col0[ACOMP] = CC_SEL(cc, 109);
+ }
+
+ if (t == 0) {
+ b = UP5(col0[BCOMP]);
+ g = UP5(col0[GCOMP]);
+ r = UP5(col0[RCOMP]);
+ a = UP5(col0[ACOMP]);
+ } else if (t == 3) {
+ b = UP5(CC_SEL(cc, 79));
+ g = UP5(CC_SEL(cc, 84));
+ r = UP5(CC_SEL(cc, 89));
+ a = UP5(CC_SEL(cc, 114));
+ } else {
+ b = LERP(3, t, UP5(col0[BCOMP]), UP5(CC_SEL(cc, 79)));
+ g = LERP(3, t, UP5(col0[GCOMP]), UP5(CC_SEL(cc, 84)));
+ r = LERP(3, t, UP5(col0[RCOMP]), UP5(CC_SEL(cc, 89)));
+ a = LERP(3, t, UP5(col0[ACOMP]), UP5(CC_SEL(cc, 114)));
+ }
+ } else {
+ /* lerp == 0 */
+
+ if (t & 16) {
+ cc++;
+ t &= 15;
+ }
+ t = (cc[0] >> (t * 2)) & 3;
+
+ if (t == 3) {
+ /* zero */
+ r = g = b = a = 0;
+ } else {
+ GLuint kk;
+ cc = (const GLuint *)code;
+ a = UP5(cc[3] >> (t * 5 + 13));
+ t *= 15;
+ cc = (const GLuint *)(code + 8 + t / 8);
+ kk = cc[0] >> (t & 7);
+ b = UP5(kk);
+ g = UP5(kk >> 5);
+ r = UP5(kk >> 10);
+ }
+ }
+ rgba[RCOMP] = UBYTE_TO_CHAN(r);
+ rgba[GCOMP] = UBYTE_TO_CHAN(g);
+ rgba[BCOMP] = UBYTE_TO_CHAN(b);
+ rgba[ACOMP] = UBYTE_TO_CHAN(a);
+}
+
+
+void
+fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */
+ GLint i, GLint j, GLchan *rgba)
+{
+ static void (*decode_1[]) (const GLubyte *, GLint, GLchan *) = {
+ fxt1_decode_1HI, /* cc-high = "00?" */
+ fxt1_decode_1HI, /* cc-high = "00?" */
+ fxt1_decode_1CHROMA, /* cc-chroma = "010" */
+ fxt1_decode_1ALPHA, /* alpha = "011" */
+ fxt1_decode_1MIXED, /* mixed = "1??" */
+ fxt1_decode_1MIXED, /* mixed = "1??" */
+ fxt1_decode_1MIXED, /* mixed = "1??" */
+ fxt1_decode_1MIXED /* mixed = "1??" */
+ };
+
+ const GLubyte *code = (const GLubyte *)texture +
+ ((j / 4) * (stride / 8) + (i / 8)) * 16;
+ GLint mode = CC_SEL(code, 125);
+ GLint t = i & 7;
+
+ if (t & 4) {
+ t += 12;
+ }
+ t += (j & 3) * 4;
+
+ decode_1[mode](code, t, rgba);
+}
+
+
+#endif /* FEATURE_texture_fxt1 */
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.h b/mesalib/src/mesa/main/texcompress_fxt1.h
index a6beb07e5..bd84082e9 100644
--- a/mesalib/src/mesa/main/texcompress_fxt1.h
+++ b/mesalib/src/mesa/main/texcompress_fxt1.h
@@ -1,62 +1,62 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2008 Brian Paul 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 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
- * BRIAN PAUL 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.
- */
-
-#ifndef TEXCOMPRESS_FXT1_H
-#define TEXCOMPRESS_FXT1_H
-
-#include "glheader.h"
-#include "mfeatures.h"
-#include "texstore.h"
-
-struct gl_texture_image;
-
-#if FEATURE_texture_fxt1
-
-extern GLboolean
-_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-#else /* FEATURE_texture_fxt1 */
-
-/* these are used only in texstore_funcs[] */
-#define _mesa_texstore_rgb_fxt1 NULL
-#define _mesa_texstore_rgba_fxt1 NULL
-
-/* these are used only in texfetch_funcs[] */
-#define _mesa_fetch_texel_2d_f_rgba_fxt1 NULL
-#define _mesa_fetch_texel_2d_f_rgb_fxt1 NULL
-
-#endif /* FEATURE_texture_fxt1 */
-
-#endif /* TEXCOMPRESS_FXT1_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 Brian Paul 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 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
+ * BRIAN PAUL 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.
+ */
+
+#ifndef TEXCOMPRESS_FXT1_H
+#define TEXCOMPRESS_FXT1_H
+
+#include "glheader.h"
+#include "mfeatures.h"
+#include "texstore.h"
+
+struct swrast_texture_image;
+
+#if FEATURE_texture_fxt1
+
+extern GLboolean
+_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_fxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgb_fxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+#else /* FEATURE_texture_fxt1 */
+
+/* these are used only in texstore_funcs[] */
+#define _mesa_texstore_rgb_fxt1 NULL
+#define _mesa_texstore_rgba_fxt1 NULL
+
+/* these are used only in texfetch_funcs[] */
+#define _mesa_fetch_texel_2d_f_rgba_fxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgb_fxt1 NULL
+
+#endif /* FEATURE_texture_fxt1 */
+
+#endif /* TEXCOMPRESS_FXT1_H */
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c
index d75546a92..7af3d6762 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.c
+++ b/mesalib/src/mesa/main/texcompress_rgtc.c
@@ -1,460 +1,462 @@
-/*
- * Copyright (C) 2011 Red Hat Inc.
- *
- * block compression parts are:
- * Copyright (C) 2004 Roland Scheidegger 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.
- *
- * Author:
- * Dave Airlie
- */
-
-/**
- * \file texcompress_rgtc.c
- * GL_EXT_texture_compression_rgtc support.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "image.h"
-#include "macros.h"
-#include "mfeatures.h"
-#include "mipmap.h"
-#include "texcompress.h"
-#include "texcompress_rgtc.h"
-#include "texstore.h"
-
-#define RGTC_DEBUG 0
-
-static void unsigned_encode_rgtc_chan(GLubyte *blkaddr, GLubyte srccolors[4][4],
- GLint numxpixels, GLint numypixels);
-static void signed_encode_rgtc_chan(GLbyte *blkaddr, GLbyte srccolors[4][4],
- GLint numxpixels, GLint numypixels);
-
-static void unsigned_fetch_texel_rgtc(unsigned srcRowStride, const GLubyte *pixdata,
- unsigned i, unsigned j, GLubyte *value, unsigned comps);
-
-static void signed_fetch_texel_rgtc(unsigned srcRowStride, const GLbyte *pixdata,
- unsigned i, unsigned j, GLbyte *value, unsigned comps);
-
-static void extractsrc_u( GLubyte srcpixels[4][4], const GLchan *srcaddr,
- GLint srcRowStride, GLint numxpixels, GLint numypixels, GLint comps)
-{
- GLubyte i, j;
- const GLchan *curaddr;
- for (j = 0; j < numypixels; j++) {
- curaddr = srcaddr + j * srcRowStride * comps;
- for (i = 0; i < numxpixels; i++) {
- srcpixels[j][i] = *curaddr / (CHAN_MAX / 255);
- curaddr += comps;
- }
- }
-}
-
-static void extractsrc_s( GLbyte srcpixels[4][4], const GLfloat *srcaddr,
- GLint srcRowStride, GLint numxpixels, GLint numypixels, GLint comps)
-{
- GLubyte i, j;
- const GLfloat *curaddr;
- for (j = 0; j < numypixels; j++) {
- curaddr = srcaddr + j * srcRowStride * comps;
- for (i = 0; i < numxpixels; i++) {
- srcpixels[j][i] = FLOAT_TO_BYTE_TEX(*curaddr);
- curaddr += comps;
- }
- }
-}
-
-
-GLboolean
-_mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
-{
- GLubyte *dst;
- const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
- const GLchan *tempImage = NULL;
- int i, j;
- int numxpixels, numypixels;
- const GLchan *srcaddr;
- GLubyte srcpixels[4][4];
- GLubyte *blkaddr;
- GLint dstRowDiff;
- ASSERT(dstFormat == MESA_FORMAT_RED_RGTC1 ||
- dstFormat == MESA_FORMAT_L_LATC1);
- ASSERT(dstXoffset % 4 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
-
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- blkaddr = dst;
- dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0;
- for (j = 0; j < srcHeight; j+=4) {
- if (srcHeight > j + 3) numypixels = 4;
- else numypixels = srcHeight - j;
- srcaddr = tempImage + j * srcWidth;
- for (i = 0; i < srcWidth; i += 4) {
- if (srcWidth > i + 3) numxpixels = 4;
- else numxpixels = srcWidth - i;
- extractsrc_u(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 1);
- unsigned_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
- srcaddr += numxpixels;
- blkaddr += 8;
- }
- blkaddr += dstRowDiff;
- }
- if (tempImage)
- free((void *) tempImage);
-
- return GL_TRUE;
-}
-
-GLboolean
-_mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS)
-{
- GLbyte *dst;
- const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
- const GLfloat *tempImage = NULL;
- int i, j;
- int numxpixels, numypixels;
- const GLfloat *srcaddr;
- GLbyte srcpixels[4][4];
- GLbyte *blkaddr;
- GLint dstRowDiff;
- ASSERT(dstFormat == MESA_FORMAT_SIGNED_RED_RGTC1 ||
- dstFormat == MESA_FORMAT_SIGNED_L_LATC1);
- ASSERT(dstXoffset % 4 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- tempImage = _mesa_make_temp_float_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking, 0x0);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
-
- dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- blkaddr = dst;
- dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0;
- for (j = 0; j < srcHeight; j+=4) {
- if (srcHeight > j + 3) numypixels = 4;
- else numypixels = srcHeight - j;
- srcaddr = tempImage + j * srcWidth;
- for (i = 0; i < srcWidth; i += 4) {
- if (srcWidth > i + 3) numxpixels = 4;
- else numxpixels = srcWidth - i;
- extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 1);
- signed_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
- srcaddr += numxpixels;
- blkaddr += 8;
- }
- blkaddr += dstRowDiff;
- }
- if (tempImage)
- free((void *) tempImage);
-
- return GL_TRUE;
-}
-
-GLboolean
-_mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
-{
- GLubyte *dst;
- const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
- const GLchan *tempImage = NULL;
- int i, j;
- int numxpixels, numypixels;
- const GLchan *srcaddr;
- GLubyte srcpixels[4][4];
- GLubyte *blkaddr;
- GLint dstRowDiff;
-
- ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2 ||
- dstFormat == MESA_FORMAT_LA_LATC2);
- ASSERT(dstXoffset % 4 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- blkaddr = dst;
- dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0;
- for (j = 0; j < srcHeight; j+=4) {
- if (srcHeight > j + 3) numypixels = 4;
- else numypixels = srcHeight - j;
- srcaddr = tempImage + j * srcWidth * 2;
- for (i = 0; i < srcWidth; i += 4) {
- if (srcWidth > i + 3) numxpixels = 4;
- else numxpixels = srcWidth - i;
- extractsrc_u(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
- unsigned_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
-
- blkaddr += 8;
- extractsrc_u(srcpixels, (GLchan *)srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
- unsigned_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
-
- blkaddr += 8;
-
- srcaddr += numxpixels * 2;
- }
- blkaddr += dstRowDiff;
- }
- if (tempImage)
- free((void *) tempImage);
-
- return GL_TRUE;
-}
-
-GLboolean
-_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
-{
- GLbyte *dst;
- const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
- const GLfloat *tempImage = NULL;
- int i, j;
- int numxpixels, numypixels;
- const GLfloat *srcaddr;
- GLbyte srcpixels[4][4];
- GLbyte *blkaddr;
- GLint dstRowDiff;
-
- ASSERT(dstFormat == MESA_FORMAT_SIGNED_RG_RGTC2 ||
- dstFormat == MESA_FORMAT_SIGNED_LA_LATC2);
- ASSERT(dstXoffset % 4 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- tempImage = _mesa_make_temp_float_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking, 0x0);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
-
- dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- blkaddr = dst;
- dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0;
- for (j = 0; j < srcHeight; j += 4) {
- if (srcHeight > j + 3) numypixels = 4;
- else numypixels = srcHeight - j;
- srcaddr = tempImage + j * srcWidth * 2;
- for (i = 0; i < srcWidth; i += 4) {
- if (srcWidth > i + 3) numxpixels = 4;
- else numxpixels = srcWidth - i;
-
- extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
- signed_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
- blkaddr += 8;
-
- extractsrc_s(srcpixels, srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
- signed_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
- blkaddr += 8;
-
- srcaddr += numxpixels * 2;
-
- }
- blkaddr += dstRowDiff;
- }
- if (tempImage)
- free((void *) tempImage);
-
- return GL_TRUE;
-}
-
-void
-_mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- GLubyte red;
- unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
- i, j, &red, 1);
- texel[RCOMP] = UBYTE_TO_FLOAT(red);
- texel[GCOMP] = 0.0;
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-void
-_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- GLbyte red;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
- i, j, &red, 1);
- texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
- texel[GCOMP] = 0.0;
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-void
-_mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- GLubyte red, green;
- unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
- i, j, &red, 2);
- unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data) + 8,
- i, j, &green, 2);
- texel[RCOMP] = UBYTE_TO_FLOAT(red);
- texel[GCOMP] = UBYTE_TO_FLOAT(green);
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-void
-_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- GLbyte red, green;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
- i, j, &red, 2);
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
- i, j, &green, 2);
- texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
- texel[GCOMP] = BYTE_TO_FLOAT_TEX(green);
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-void
-_mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- GLubyte red;
- unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
- i, j, &red, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_FLOAT(red);
- texel[ACOMP] = 1.0;
-}
-
-void
-_mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- GLbyte red;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
- i, j, &red, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
- texel[ACOMP] = 1.0;
-}
-
-void
-_mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- GLubyte red, green;
- unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
- i, j, &red, 2);
- unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data) + 8,
- i, j, &green, 2);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_FLOAT(red);
- texel[ACOMP] = UBYTE_TO_FLOAT(green);
-}
-
-void
-_mesa_fetch_texel_2d_f_signed_la_latc2(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- GLbyte red, green;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
- i, j, &red, 2);
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
- i, j, &green, 2);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
- texel[ACOMP] = BYTE_TO_FLOAT_TEX(green);
-}
-
-#define TAG(x) unsigned_##x
-
-#define TYPE GLubyte
-#define T_MIN 0
-#define T_MAX 0xff
-
-#include "texcompress_rgtc_tmp.h"
-
-#undef TAG
-#undef TYPE
-#undef T_MIN
-#undef T_MAX
-
-#define TAG(x) signed_##x
-#define TYPE GLbyte
-#define T_MIN (GLbyte)-128
-#define T_MAX (GLbyte)127
-
-#include "texcompress_rgtc_tmp.h"
-
-#undef TAG
-#undef TYPE
-#undef T_MIN
-#undef T_MAX
+/*
+ * Copyright (C) 2011 Red Hat Inc.
+ *
+ * block compression parts are:
+ * Copyright (C) 2004 Roland Scheidegger 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.
+ *
+ * Author:
+ * Dave Airlie
+ */
+
+/**
+ * \file texcompress_rgtc.c
+ * GL_EXT_texture_compression_rgtc support.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "image.h"
+#include "macros.h"
+#include "mfeatures.h"
+#include "mipmap.h"
+#include "texcompress.h"
+#include "texcompress_rgtc.h"
+#include "texstore.h"
+#include "swrast/s_context.h"
+
+
+#define RGTC_DEBUG 0
+
+static void unsigned_encode_rgtc_chan(GLubyte *blkaddr, GLubyte srccolors[4][4],
+ GLint numxpixels, GLint numypixels);
+static void signed_encode_rgtc_chan(GLbyte *blkaddr, GLbyte srccolors[4][4],
+ GLint numxpixels, GLint numypixels);
+
+static void unsigned_fetch_texel_rgtc(unsigned srcRowStride, const GLubyte *pixdata,
+ unsigned i, unsigned j, GLubyte *value, unsigned comps);
+
+static void signed_fetch_texel_rgtc(unsigned srcRowStride, const GLbyte *pixdata,
+ unsigned i, unsigned j, GLbyte *value, unsigned comps);
+
+static void extractsrc_u( GLubyte srcpixels[4][4], const GLchan *srcaddr,
+ GLint srcRowStride, GLint numxpixels, GLint numypixels, GLint comps)
+{
+ GLubyte i, j;
+ const GLchan *curaddr;
+ for (j = 0; j < numypixels; j++) {
+ curaddr = srcaddr + j * srcRowStride * comps;
+ for (i = 0; i < numxpixels; i++) {
+ srcpixels[j][i] = *curaddr / (CHAN_MAX / 255);
+ curaddr += comps;
+ }
+ }
+}
+
+static void extractsrc_s( GLbyte srcpixels[4][4], const GLfloat *srcaddr,
+ GLint srcRowStride, GLint numxpixels, GLint numypixels, GLint comps)
+{
+ GLubyte i, j;
+ const GLfloat *curaddr;
+ for (j = 0; j < numypixels; j++) {
+ curaddr = srcaddr + j * srcRowStride * comps;
+ for (i = 0; i < numxpixels; i++) {
+ srcpixels[j][i] = FLOAT_TO_BYTE_TEX(*curaddr);
+ curaddr += comps;
+ }
+ }
+}
+
+
+GLboolean
+_mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
+{
+ GLubyte *dst;
+ const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+ int i, j;
+ int numxpixels, numypixels;
+ const GLchan *srcaddr;
+ GLubyte srcpixels[4][4];
+ GLubyte *blkaddr;
+ GLint dstRowDiff;
+ ASSERT(dstFormat == MESA_FORMAT_RED_RGTC1 ||
+ dstFormat == MESA_FORMAT_L_LATC1);
+ ASSERT(dstXoffset % 4 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset % 4 == 0);
+ (void) dstZoffset;
+ (void) dstImageOffsets;
+
+
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ _mesa_get_format_base_format(dstFormat),
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ dstFormat,
+ texWidth, (GLubyte *) dstAddr);
+
+ blkaddr = dst;
+ dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0;
+ for (j = 0; j < srcHeight; j+=4) {
+ if (srcHeight > j + 3) numypixels = 4;
+ else numypixels = srcHeight - j;
+ srcaddr = tempImage + j * srcWidth;
+ for (i = 0; i < srcWidth; i += 4) {
+ if (srcWidth > i + 3) numxpixels = 4;
+ else numxpixels = srcWidth - i;
+ extractsrc_u(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 1);
+ unsigned_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ srcaddr += numxpixels;
+ blkaddr += 8;
+ }
+ blkaddr += dstRowDiff;
+ }
+ if (tempImage)
+ free((void *) tempImage);
+
+ return GL_TRUE;
+}
+
+GLboolean
+_mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS)
+{
+ GLbyte *dst;
+ const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
+ const GLfloat *tempImage = NULL;
+ int i, j;
+ int numxpixels, numypixels;
+ const GLfloat *srcaddr;
+ GLbyte srcpixels[4][4];
+ GLbyte *blkaddr;
+ GLint dstRowDiff;
+ ASSERT(dstFormat == MESA_FORMAT_SIGNED_RED_RGTC1 ||
+ dstFormat == MESA_FORMAT_SIGNED_L_LATC1);
+ ASSERT(dstXoffset % 4 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset % 4 == 0);
+ (void) dstZoffset;
+ (void) dstImageOffsets;
+
+ tempImage = _mesa_make_temp_float_image(ctx, dims,
+ baseInternalFormat,
+ _mesa_get_format_base_format(dstFormat),
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking, 0x0);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+
+ dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ dstFormat,
+ texWidth, (GLubyte *) dstAddr);
+
+ blkaddr = dst;
+ dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0;
+ for (j = 0; j < srcHeight; j+=4) {
+ if (srcHeight > j + 3) numypixels = 4;
+ else numypixels = srcHeight - j;
+ srcaddr = tempImage + j * srcWidth;
+ for (i = 0; i < srcWidth; i += 4) {
+ if (srcWidth > i + 3) numxpixels = 4;
+ else numxpixels = srcWidth - i;
+ extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 1);
+ signed_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ srcaddr += numxpixels;
+ blkaddr += 8;
+ }
+ blkaddr += dstRowDiff;
+ }
+ if (tempImage)
+ free((void *) tempImage);
+
+ return GL_TRUE;
+}
+
+GLboolean
+_mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
+{
+ GLubyte *dst;
+ const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
+ const GLchan *tempImage = NULL;
+ int i, j;
+ int numxpixels, numypixels;
+ const GLchan *srcaddr;
+ GLubyte srcpixels[4][4];
+ GLubyte *blkaddr;
+ GLint dstRowDiff;
+
+ ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2 ||
+ dstFormat == MESA_FORMAT_LA_LATC2);
+ ASSERT(dstXoffset % 4 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset % 4 == 0);
+ (void) dstZoffset;
+ (void) dstImageOffsets;
+
+ tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ baseInternalFormat,
+ _mesa_get_format_base_format(dstFormat),
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+
+ dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ dstFormat,
+ texWidth, (GLubyte *) dstAddr);
+
+ blkaddr = dst;
+ dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0;
+ for (j = 0; j < srcHeight; j+=4) {
+ if (srcHeight > j + 3) numypixels = 4;
+ else numypixels = srcHeight - j;
+ srcaddr = tempImage + j * srcWidth * 2;
+ for (i = 0; i < srcWidth; i += 4) {
+ if (srcWidth > i + 3) numxpixels = 4;
+ else numxpixels = srcWidth - i;
+ extractsrc_u(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
+ unsigned_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+
+ blkaddr += 8;
+ extractsrc_u(srcpixels, (GLchan *)srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
+ unsigned_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+
+ blkaddr += 8;
+
+ srcaddr += numxpixels * 2;
+ }
+ blkaddr += dstRowDiff;
+ }
+ if (tempImage)
+ free((void *) tempImage);
+
+ return GL_TRUE;
+}
+
+GLboolean
+_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
+{
+ GLbyte *dst;
+ const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
+ const GLfloat *tempImage = NULL;
+ int i, j;
+ int numxpixels, numypixels;
+ const GLfloat *srcaddr;
+ GLbyte srcpixels[4][4];
+ GLbyte *blkaddr;
+ GLint dstRowDiff;
+
+ ASSERT(dstFormat == MESA_FORMAT_SIGNED_RG_RGTC2 ||
+ dstFormat == MESA_FORMAT_SIGNED_LA_LATC2);
+ ASSERT(dstXoffset % 4 == 0);
+ ASSERT(dstYoffset % 4 == 0);
+ ASSERT(dstZoffset % 4 == 0);
+ (void) dstZoffset;
+ (void) dstImageOffsets;
+
+ tempImage = _mesa_make_temp_float_image(ctx, dims,
+ baseInternalFormat,
+ _mesa_get_format_base_format(dstFormat),
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking, 0x0);
+ if (!tempImage)
+ return GL_FALSE; /* out of memory */
+
+ dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
+ dstFormat,
+ texWidth, (GLubyte *) dstAddr);
+
+ blkaddr = dst;
+ dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0;
+ for (j = 0; j < srcHeight; j += 4) {
+ if (srcHeight > j + 3) numypixels = 4;
+ else numypixels = srcHeight - j;
+ srcaddr = tempImage + j * srcWidth * 2;
+ for (i = 0; i < srcWidth; i += 4) {
+ if (srcWidth > i + 3) numxpixels = 4;
+ else numxpixels = srcWidth - i;
+
+ extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
+ signed_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ blkaddr += 8;
+
+ extractsrc_s(srcpixels, srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
+ signed_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ blkaddr += 8;
+
+ srcaddr += numxpixels * 2;
+
+ }
+ blkaddr += dstRowDiff;
+ }
+ if (tempImage)
+ free((void *) tempImage);
+
+ return GL_TRUE;
+}
+
+void
+_mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLubyte red;
+ unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
+ i, j, &red, 1);
+ texel[RCOMP] = UBYTE_TO_FLOAT(red);
+ texel[GCOMP] = 0.0;
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+void
+_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLbyte red;
+ signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
+ i, j, &red, 1);
+ texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
+ texel[GCOMP] = 0.0;
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+void
+_mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLubyte red, green;
+ unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
+ i, j, &red, 2);
+ unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data) + 8,
+ i, j, &green, 2);
+ texel[RCOMP] = UBYTE_TO_FLOAT(red);
+ texel[GCOMP] = UBYTE_TO_FLOAT(green);
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+void
+_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLbyte red, green;
+ signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
+ i, j, &red, 2);
+ signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data) + 8,
+ i, j, &green, 2);
+ texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
+ texel[GCOMP] = BYTE_TO_FLOAT_TEX(green);
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+void
+_mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLubyte red;
+ unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
+ i, j, &red, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT(red);
+ texel[ACOMP] = 1.0;
+}
+
+void
+_mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLbyte red;
+ signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
+ i, j, &red, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
+ texel[ACOMP] = 1.0;
+}
+
+void
+_mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLubyte red, green;
+ unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
+ i, j, &red, 2);
+ unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data) + 8,
+ i, j, &green, 2);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT(red);
+ texel[ACOMP] = UBYTE_TO_FLOAT(green);
+}
+
+void
+_mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLbyte red, green;
+ signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
+ i, j, &red, 2);
+ signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data) + 8,
+ i, j, &green, 2);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
+ texel[ACOMP] = BYTE_TO_FLOAT_TEX(green);
+}
+
+#define TAG(x) unsigned_##x
+
+#define TYPE GLubyte
+#define T_MIN 0
+#define T_MAX 0xff
+
+#include "texcompress_rgtc_tmp.h"
+
+#undef TAG
+#undef TYPE
+#undef T_MIN
+#undef T_MAX
+
+#define TAG(x) signed_##x
+#define TYPE GLbyte
+#define T_MIN (GLbyte)-128
+#define T_MAX (GLbyte)127
+
+#include "texcompress_rgtc_tmp.h"
+
+#undef TAG
+#undef TYPE
+#undef T_MIN
+#undef T_MAX
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.h b/mesalib/src/mesa/main/texcompress_rgtc.h
index 18766770d..6be6ad9be 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.h
+++ b/mesalib/src/mesa/main/texcompress_rgtc.h
@@ -28,7 +28,7 @@
#include "mfeatures.h"
#include "texstore.h"
-struct gl_texture_image;
+struct swrast_texture_image;
extern GLboolean
_mesa_texstore_red_rgtc1(TEXSTORE_PARAMS);
@@ -43,35 +43,35 @@ extern GLboolean
_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS);
extern void
-_mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_signed_la_latc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
#endif
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index 5798406db..779e1a4c8 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -44,6 +44,7 @@
#include "texcompress.h"
#include "texcompress_s3tc.h"
#include "texstore.h"
+#include "swrast/s_context.h"
#if FEATURE_texture_s3tc
@@ -392,14 +393,14 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
static void
-fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
+fetch_texel_2d_rgb_dxt1( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
(void) k;
if (fetch_ext_rgb_dxt1) {
ASSERT (sizeof(GLchan) == sizeof(GLubyte));
- fetch_ext_rgb_dxt1(texImage->RowStride,
- (GLubyte *)(texImage)->Data, i, j, texel);
+ fetch_ext_rgb_dxt1(texImage->Base.RowStride,
+ (GLubyte *)(texImage)->Base.Data, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
@@ -407,7 +408,7 @@ fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
void
-_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
@@ -421,13 +422,13 @@ _mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
static void
-fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
+fetch_texel_2d_rgba_dxt1( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
(void) k;
if (fetch_ext_rgba_dxt1) {
- fetch_ext_rgba_dxt1(texImage->RowStride,
- (GLubyte *)(texImage)->Data, i, j, texel);
+ fetch_ext_rgba_dxt1(texImage->Base.RowStride,
+ (GLubyte *)(texImage)->Base.Data, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
@@ -435,7 +436,7 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
void
-_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
@@ -449,13 +450,14 @@ _mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
static void
-fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
+fetch_texel_2d_rgba_dxt3( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
(void) k;
if (fetch_ext_rgba_dxt3) {
ASSERT (sizeof(GLchan) == sizeof(GLubyte));
- fetch_ext_rgba_dxt3(texImage->RowStride, (GLubyte *)(texImage)->Data,
+ fetch_ext_rgba_dxt3(texImage->Base.RowStride,
+ (GLubyte *)(texImage)->Base.Data,
i, j, texel);
}
else
@@ -464,7 +466,7 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
void
-_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
@@ -478,12 +480,13 @@ _mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
static void
-fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
+fetch_texel_2d_rgba_dxt5( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
(void) k;
if (fetch_ext_rgba_dxt5) {
- fetch_ext_rgba_dxt5(texImage->RowStride, (GLubyte *)(texImage)->Data,
+ fetch_ext_rgba_dxt5(texImage->Base.RowStride,
+ (GLubyte *)(texImage)->Base.Data,
i, j, texel);
}
else
@@ -492,7 +495,7 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
void
-_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
@@ -506,7 +509,7 @@ _mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
#if FEATURE_EXT_texture_sRGB
void
-_mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgb_dxt1( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
/* just sample as GLchan and convert to float here */
@@ -519,7 +522,7 @@ _mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
@@ -532,7 +535,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
@@ -545,7 +548,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt5(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.h b/mesalib/src/mesa/main/texcompress_s3tc.h
index 555cff9c2..709c35ae7 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.h
+++ b/mesalib/src/mesa/main/texcompress_s3tc.h
@@ -1,110 +1,110 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2008 Brian Paul 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 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
- * BRIAN PAUL 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.
- */
-
-#ifndef TEXCOMPRESS_S3TC_H
-#define TEXCOMPRESS_S3TC_H
-
-#include "compiler.h"
-#include "glheader.h"
-#include "mfeatures.h"
-#include "texstore.h"
-
-struct gl_context;
-struct gl_texture_image;
-
-#if FEATURE_texture_s3tc
-
-extern GLboolean
-_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
-
-extern void
-_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_srgb_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_init_texture_s3tc(struct gl_context *ctx);
-
-#else /* FEATURE_texture_s3tc */
-
-/* these are used only in texstore_funcs[] */
-#define _mesa_texstore_rgb_dxt1 NULL
-#define _mesa_texstore_rgba_dxt1 NULL
-#define _mesa_texstore_rgba_dxt3 NULL
-#define _mesa_texstore_rgba_dxt5 NULL
-
-/* these are used only in texfetch_funcs[] */
-#define _mesa_fetch_texel_2d_f_rgb_dxt1 NULL
-#define _mesa_fetch_texel_2d_f_rgba_dxt1 NULL
-#define _mesa_fetch_texel_2d_f_rgba_dxt3 NULL
-#define _mesa_fetch_texel_2d_f_rgba_dxt5 NULL
-#define _mesa_fetch_texel_2d_f_srgb_dxt1 NULL
-#define _mesa_fetch_texel_2d_f_srgba_dxt1 NULL
-#define _mesa_fetch_texel_2d_f_srgba_dxt3 NULL
-#define _mesa_fetch_texel_2d_f_srgba_dxt5 NULL
-
-static INLINE void
-_mesa_init_texture_s3tc(struct gl_context *ctx)
-{
-}
-
-#endif /* FEATURE_texture_s3tc */
-
-#endif /* TEXCOMPRESS_S3TC_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 Brian Paul 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 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
+ * BRIAN PAUL 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.
+ */
+
+#ifndef TEXCOMPRESS_S3TC_H
+#define TEXCOMPRESS_S3TC_H
+
+#include "compiler.h"
+#include "glheader.h"
+#include "mfeatures.h"
+#include "texstore.h"
+
+struct gl_context;
+struct swrast_texture_image;
+
+#if FEATURE_texture_s3tc
+
+extern GLboolean
+_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
+
+extern void
+_mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_srgb_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_srgba_dxt5(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_init_texture_s3tc(struct gl_context *ctx);
+
+#else /* FEATURE_texture_s3tc */
+
+/* these are used only in texstore_funcs[] */
+#define _mesa_texstore_rgb_dxt1 NULL
+#define _mesa_texstore_rgba_dxt1 NULL
+#define _mesa_texstore_rgba_dxt3 NULL
+#define _mesa_texstore_rgba_dxt5 NULL
+
+/* these are used only in texfetch_funcs[] */
+#define _mesa_fetch_texel_2d_f_rgb_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt3 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt5 NULL
+#define _mesa_fetch_texel_2d_f_srgb_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt3 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt5 NULL
+
+static INLINE void
+_mesa_init_texture_s3tc(struct gl_context *ctx)
+{
+}
+
+#endif /* FEATURE_texture_s3tc */
+
+#endif /* TEXCOMPRESS_S3TC_H */
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index cb4a5b4e4..6113b2e9e 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -42,7 +42,6 @@
#include "mfeatures.h"
#include "state.h"
#include "texcompress.h"
-#include "texfetch.h"
#include "teximage.h"
#include "texstate.h"
#include "texpal.h"
@@ -602,7 +601,8 @@ _mesa_free_texture_image_data(struct gl_context *ctx,
/**
- * Free texture image.
+ * Free a gl_texture_image and associated data.
+ * This function is a fallback called via ctx->Driver.DeleteTextureImage().
*
* \param texImage texture image.
*
@@ -1076,8 +1076,6 @@ clear_teximage_fields(struct gl_texture_image *img)
img->DepthLog2 = 0;
img->Data = NULL;
img->TexFormat = MESA_FORMAT_NONE;
- img->FetchTexelc = NULL;
- img->FetchTexelf = NULL;
}
@@ -1104,7 +1102,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
GLint border, GLenum internalFormat,
gl_format format)
{
- GLint i, dims;
+ GLint i;
ASSERT(img);
ASSERT(width >= 0);
@@ -1176,10 +1174,6 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
}
img->TexFormat = format;
-
- dims = _mesa_get_texture_dimensions(target);
-
- _mesa_set_fetch_functions(img, dims);
}
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 1168f1842..1b90cca9b 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -202,7 +202,7 @@ _mesa_delete_texture_object(struct gl_context *ctx,
for (face = 0; face < 6; face++) {
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
if (texObj->Image[face][i]) {
- _mesa_delete_texture_image( ctx, texObj->Image[face][i] );
+ ctx->Driver.DeleteTextureImage(ctx, texObj->Image[face][i]);
}
}
}
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 19a01a14d..44dabe6de 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -43,7 +43,6 @@
#include "main/texparam.h"
#include "main/teximage.h"
#include "main/texstate.h"
-#include "main/texfetch.h"
#include "program/prog_instruction.h"
@@ -432,7 +431,6 @@ set_tex_parameteri(struct gl_context *ctx,
if (texObj->Sampler.sRGBDecode != decode) {
flush(ctx);
texObj->Sampler.sRGBDecode = decode;
- _mesa_update_fetch_functions(texObj);
}
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 2cdc8ed67..b958615b5 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -4508,16 +4508,6 @@ _mesa_texstore(TEXSTORE_PARAMS)
}
-/** Return texture size in bytes */
-static GLuint
-texture_size(const struct gl_texture_image *texImage)
-{
- GLuint sz = _mesa_format_image_size(texImage->TexFormat, texImage->Width,
- texImage->Height, texImage->Depth);
- return sz;
-}
-
-
/**
* Normally, we'll only _write_ texel data to a texture when we map it.
* But if the user is providing depth or stencil values and the texture
@@ -4549,7 +4539,6 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- GLuint sizeInBytes;
const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat);
const GLuint zeroImageOffset = 0;
GLubyte *dstMap;
@@ -4558,10 +4547,9 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
(void) border;
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
+ /* allocate storage for texture data */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
+ width, 1, 1)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
return;
}
@@ -4614,7 +4602,6 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- GLuint sizeInBytes;
const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat);
const GLuint zeroImageOffset = 0;
GLubyte *dstMap;
@@ -4623,10 +4610,9 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
(void) border;
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
+ /* allocate storage for texture data */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
+ width, height, 1)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
return;
}
@@ -4678,7 +4664,6 @@ _mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- GLuint sizeInBytes;
const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat);
GLboolean success;
GLint slice;
@@ -4689,13 +4674,10 @@ _mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
(void) border;
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
- /* Note: we check for a NULL image pointer here, _after_ we allocated
- * memory for the texture. That's what the GL spec calls for.
- */
+ /* allocate storage for texture data */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
+ width, height, depth)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
return;
}
@@ -4966,10 +4948,10 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx,
ASSERT(texImage->Depth == 1);
ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */
- /* allocate storage */
- texImage->Data = _mesa_alloc_texmemory(imageSize);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
+ /* allocate storage for texture data */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
+ width, height, 1)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
return;
}
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index 71f708f1e..19a105f15 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -85,7 +85,6 @@ MAIN_SOURCES = \
main/texcompress_s3tc.c \
main/texcompress_fxt1.c \
main/texenv.c \
- main/texfetch.c \
main/texformat.c \
main/texgen.c \
main/texgetimage.c \
@@ -144,6 +143,7 @@ SWRAST_SOURCES = \
swrast/s_span.c \
swrast/s_stencil.c \
swrast/s_texcombine.c \
+ swrast/s_texfetch.c \
swrast/s_texfilter.c \
swrast/s_texrender.c \
swrast/s_texture.c \
diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c
index a4799e3cc..83802a5ea 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_clear.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c
@@ -136,7 +136,7 @@ set_vertex_shader(struct st_context *st)
static void
draw_quad(struct st_context *st,
float x0, float y0, float x1, float y1, GLfloat z,
- const GLfloat color[4])
+ const union pipe_color_union *color)
{
struct pipe_context *pipe = st->pipe;
@@ -182,10 +182,10 @@ draw_quad(struct st_context *st,
for (i = 0; i < 4; i++) {
st->clear.vertices[i][0][2] = z;
st->clear.vertices[i][0][3] = 1.0;
- st->clear.vertices[i][1][0] = color[0];
- st->clear.vertices[i][1][1] = color[1];
- st->clear.vertices[i][1][2] = color[2];
- st->clear.vertices[i][1][3] = color[3];
+ st->clear.vertices[i][1][0] = color->f[0];
+ st->clear.vertices[i][1][1] = color->f[1];
+ st->clear.vertices[i][1][2] = color->f[2];
+ st->clear.vertices[i][1][3] = color->f[3];
}
/* put vertex data into vbuf */
@@ -227,7 +227,7 @@ clear_with_quad(struct gl_context *ctx,
const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax / fb_width * 2.0f - 1.0f;
const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin / fb_height * 2.0f - 1.0f;
const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax / fb_height * 2.0f - 1.0f;
- float clearColor[4];
+ union pipe_color_union clearColor;
/*
printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__,
@@ -325,11 +325,11 @@ clear_with_quad(struct gl_context *ctx,
if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
st_translate_color(ctx->Color.ClearColor.f,
ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- clearColor);
+ clearColor.f);
}
/* draw quad matching scissor rect */
- draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, clearColor);
+ draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, &clearColor);
/* Restore pipe state */
cso_restore_blend(st->cso_context);
@@ -572,7 +572,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
* required from the visual. Hence fix this up to avoid potential
* read-modify-write in the driver.
*/
- float clearColor[4];
+ union pipe_color_union clearColor;
if ((clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) &&
((clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) &&
@@ -584,10 +584,10 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
st_translate_color(ctx->Color.ClearColor.f,
ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- clearColor);
+ clearColor.f);
}
- st->pipe->clear(st->pipe, clear_buffers, clearColor,
+ st->pipe->clear(st->pipe, clear_buffers, &clearColor,
ctx->Depth.Clear, ctx->Stencil.Clear);
}
if (mask & BUFFER_BIT_ACCUM)
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index eab02fb3b..68323a35a 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -38,7 +38,6 @@
#include "main/pbo.h"
#include "main/pixeltransfer.h"
#include "main/texcompress.h"
-#include "main/texfetch.h"
#include "main/texgetimage.h"
#include "main/teximage.h"
#include "main/texobj.h"
@@ -106,6 +105,15 @@ st_NewTextureImage(struct gl_context * ctx)
}
+/** called via ctx->Driver.DeleteTextureImage() */
+static void
+st_DeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img)
+{
+ /* nothing special (yet) for st_texture_image */
+ _mesa_delete_texture_image(ctx, img);
+}
+
+
/** called via ctx->Driver.NewTextureObject() */
static struct gl_texture_object *
st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
@@ -552,8 +560,6 @@ st_TexImage(struct gl_context * ctx,
stImage->base.Face = _mesa_tex_target_to_face(target);
stImage->base.Level = level;
- _mesa_set_fetch_functions(texImage, dims);
-
/* Release the reference to a potentially orphaned buffer.
* Release any old malloced memory.
*/
@@ -975,8 +981,6 @@ st_get_tex_image(struct gl_context * ctx, GLenum target, GLint level,
dest = (GLubyte *) pixels;
- _mesa_set_fetch_functions(texImage, get_texture_dims(target));
-
for (i = 0; i < depth; i++) {
if (compressed_dst) {
_mesa_get_compressed_teximage(ctx, target, level, dest,
@@ -1923,6 +1927,7 @@ st_init_texture_functions(struct dd_function_table *functions)
functions->NewTextureObject = st_NewTextureObject;
functions->NewTextureImage = st_NewTextureImage;
+ functions->DeleteTextureImage = st_DeleteTextureImage;
functions->DeleteTexture = st_DeleteTextureObject;
functions->FreeTextureImageBuffer = st_FreeTextureImageBuffer;
functions->MapTextureImage = st_MapTextureImage;
diff --git a/mesalib/src/mesa/state_tracker/st_format.h b/mesalib/src/mesa/state_tracker/st_format.h
index 1c1f5965f..10ffeaa73 100644
--- a/mesalib/src/mesa/state_tracker/st_format.h
+++ b/mesalib/src/mesa/state_tracker/st_format.h
@@ -83,5 +83,4 @@ extern void
st_translate_color(const GLfloat colorIn[4], GLenum baseFormat,
GLfloat colorOut[4]);
-
#endif /* ST_FORMAT_H */
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index df213357f..7651eaf22 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -39,6 +39,7 @@
#include "s_lines.h"
#include "s_points.h"
#include "s_span.h"
+#include "s_texfetch.h"
#include "s_triangle.h"
#include "s_texfilter.h"
@@ -469,11 +470,14 @@ _swrast_update_texture_samplers(struct gl_context *ctx)
return; /* pipe hack */
for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
- const struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
+ struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
/* Note: If tObj is NULL, the sample function will be a simple
* function that just returns opaque black (0,0,0,1).
*/
- swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj);
+ if (tObj) {
+ _mesa_update_fetch_functions(tObj);
+ swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj);
+ }
}
}
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index 8d7458c2d..8357483a2 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -109,6 +109,73 @@ typedef void (*validate_texture_image_func)(struct gl_context *ctx,
_NEW_DEPTH)
+struct swrast_texture_image;
+
+
+typedef void (*FetchTexelFuncC)(const struct swrast_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ GLchan *texelOut);
+
+/**
+ * As above, but returns floats.
+ * Used for depth component images and for upcoming signed/float
+ * texture images.
+ */
+typedef void (*FetchTexelFuncF)(const struct swrast_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ GLfloat *texelOut);
+
+
+typedef void (*StoreTexelFunc)(struct swrast_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ const void *texel);
+
+/**
+ * Subclass of gl_texture_image.
+ * We need extra fields/info to keep tracking of mapped texture buffers,
+ * strides and Fetch/Store functions.
+ */
+struct swrast_texture_image
+{
+ struct gl_texture_image Base;
+
+#if 0
+ /** used for mipmap LOD computation */
+ GLfloat WidthScale, HeightScale, DepthScale;
+ GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
+
+ GLubyte *Data; /**< The actual texture data in malloc'd memory */
+
+ GLint TexelSize; /**< bytes per texel block */
+#endif
+
+ FetchTexelFuncC FetchTexelc;
+ FetchTexelFuncF FetchTexelf;
+ StoreTexelFunc Store;
+
+#if 0
+ /** These fields only valid when texture memory is mapped */
+ GLubyte **SliceMaps; /**< points to OneMap or a malloc'd array */
+ GLint RowStride; /**< bytes per row of blocks */
+#endif
+};
+
+
+/** cast wrapper */
+static INLINE struct swrast_texture_image *
+swrast_texture_image(struct gl_texture_image *img)
+{
+ return (struct swrast_texture_image *) img;
+}
+
+/** cast wrapper */
+static INLINE const struct swrast_texture_image *
+swrast_texture_image_const(const struct gl_texture_image *img)
+{
+ return (const struct swrast_texture_image *) img;
+}
+
+
/**
* \struct SWcontext
* \brief Per-context state that's private to the software rasterizer module.
diff --git a/mesalib/src/mesa/main/texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index 11cc8e047..ed17b4bda 100644
--- a/mesalib/src/mesa/main/texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -25,7 +25,7 @@
/**
- * \file texfetch.c
+ * \file s_texfetch.c
*
* Texel fetch/store functions
*
@@ -33,14 +33,15 @@
*/
-#include "colormac.h"
-#include "macros.h"
-#include "texcompress.h"
-#include "texcompress_fxt1.h"
-#include "texcompress_s3tc.h"
-#include "texcompress_rgtc.h"
-#include "texfetch.h"
-#include "teximage.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+#include "main/texcompress.h"
+#include "main/texcompress_fxt1.h"
+#include "main/texcompress_s3tc.h"
+#include "main/texcompress_rgtc.h"
+#include "main/teximage.h"
+#include "s_context.h"
+#include "s_texfetch.h"
#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
@@ -77,20 +78,20 @@ nonlinear_to_linear(GLubyte cs8)
/* Texel fetch routines for all supported formats
*/
#define DIM 1
-#include "texfetch_tmp.h"
+#include "s_texfetch_tmp.h"
#define DIM 2
-#include "texfetch_tmp.h"
+#include "s_texfetch_tmp.h"
#define DIM 3
-#include "texfetch_tmp.h"
+#include "s_texfetch_tmp.h"
/**
* Null texel fetch function.
*
* Have to have this so the FetchTexel function pointer is never NULL.
*/
-static void fetch_null_texelf( const struct gl_texture_image *texImage,
+static void fetch_null_texelf( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
(void) texImage; (void) i; (void) j; (void) k;
@@ -101,7 +102,7 @@ static void fetch_null_texelf( const struct gl_texture_image *texImage,
_mesa_warning(NULL, "fetch_null_texelf() called!");
}
-static void store_null_texel(struct gl_texture_image *texImage,
+static void store_null_texel(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
(void) texImage;
@@ -964,11 +965,11 @@ _mesa_get_texel_store_func(gl_format format)
* Adaptor for fetching a GLchan texel from a float-valued texture.
*/
static void
-fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
+fetch_texel_float_to_chan(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texelOut)
{
GLfloat temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
+ GLenum baseFormat = _mesa_get_format_base_format(texImage->Base.TexFormat);
ASSERT(texImage->FetchTexelf);
texImage->FetchTexelf(texImage, i, j, k, temp);
@@ -992,7 +993,7 @@ fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
* Adaptor for fetching a float texel from a GLchan-valued texture.
*/
static void
-fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
+fetch_texel_chan_to_float(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texelOut)
{
GLchan temp[4];
@@ -1019,14 +1020,14 @@ fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
/**
* Initialize the texture image's FetchTexelc and FetchTexelf methods.
*/
-void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
+static void
+set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims)
{
- gl_format format = texImage->TexFormat;
+ gl_format format = texImage->Base.TexFormat;
ASSERT(dims == 1 || dims == 2 || dims == 3);
- if (texImage->TexObject->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT &&
+ if (texImage->Base.TexObject->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT &&
_mesa_get_format_color_encoding(format) == GL_SRGB) {
format = _mesa_get_srgb_format_linear(format);
}
@@ -1050,7 +1051,8 @@ _mesa_update_fetch_functions(struct gl_texture_object *texObj)
for (face = 0; face < 6; face++) {
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
if (texObj->Image[face][i]) {
- _mesa_set_fetch_functions(texObj->Image[face][i], dims);
+ set_fetch_functions(swrast_texture_image(texObj->Image[face][i]),
+ dims);
}
}
}
diff --git a/mesalib/src/mesa/main/texfetch.h b/mesalib/src/mesa/swrast/s_texfetch.h
index dad19cee1..19b196a5a 100644
--- a/mesalib/src/mesa/main/texfetch.h
+++ b/mesalib/src/mesa/swrast/s_texfetch.h
@@ -1,45 +1,41 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2009 VMware, 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 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
- * BRIAN PAUL 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.
- */
-
-
-#ifndef TEXFETCH_H
-#define TEXFETCH_H
-
-#include "mtypes.h"
-#include "formats.h"
-
-
-extern StoreTexelFunc
-_mesa_get_texel_store_func(gl_format format);
-
-extern FetchTexelFuncF
-_mesa_get_texel_fetch_func(gl_format format, GLuint dims);
-
-extern void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
-
-void
-_mesa_update_fetch_functions(struct gl_texture_object *texObj);
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.7
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (c) 2009 VMware, 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 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
+ * BRIAN PAUL 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.
+ */
+
+
+#ifndef S_TEXFETCH_H
+#define S_TEXFETCH_H
+
+#include "swrast/s_context.h"
+
+extern StoreTexelFunc
+_mesa_get_texel_store_func(gl_format format);
+
+extern FetchTexelFuncF
+_mesa_get_texel_fetch_func(gl_format format, GLuint dims);
+
+void
+_mesa_update_fetch_functions(struct gl_texture_object *texObj);
+
+#endif /* S_TEXFETCH_H */
diff --git a/mesalib/src/mesa/main/texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
index dbed3dba9..3eebd13d7 100644
--- a/mesalib/src/mesa/main/texfetch_tmp.h
+++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
@@ -43,7 +43,7 @@
#if DIM == 1
#define TEXEL_ADDR( type, image, i, j, k, size ) \
- ((void) (j), (void) (k), ((type *)(image)->Data + (i) * (size)))
+ ((void) (j), (void) (k), ((type *)(image)->Base.Data + (i) * (size)))
#define FETCH(x) fetch_texel_1d_##x
@@ -51,15 +51,15 @@
#define TEXEL_ADDR( type, image, i, j, k, size ) \
((void) (k), \
- ((type *)(image)->Data + ((image)->RowStride * (j) + (i)) * (size)))
+ ((type *)(image)->Base.Data + ((image)->Base.RowStride * (j) + (i)) * (size)))
#define FETCH(x) fetch_texel_2d_##x
#elif DIM == 3
#define TEXEL_ADDR( type, image, i, j, k, size ) \
- ((type *)(image)->Data + ((image)->ImageOffsets[k] \
- + (image)->RowStride * (j) + (i)) * (size))
+ ((type *)(image)->Base.Data + ((image)->Base.ImageOffsets[k] \
+ + (image)->Base.RowStride * (j) + (i)) * (size))
#define FETCH(x) fetch_texel_3d_##x
@@ -74,7 +74,7 @@
* returning 1 GLfloat.
* Note: no GLchan version of this function.
*/
-static void FETCH(f_z32)( const struct gl_texture_image *texImage,
+static void FETCH(f_z32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -82,7 +82,7 @@ static void FETCH(f_z32)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_z32(struct gl_texture_image *texImage,
+static void store_texel_z32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLuint *depth = (const GLuint *) texel;
@@ -98,7 +98,7 @@ static void store_texel_z32(struct gl_texture_image *texImage,
* returning 1 GLfloat.
* Note: no GLchan version of this function.
*/
-static void FETCH(f_z16)(const struct gl_texture_image *texImage,
+static void FETCH(f_z16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -106,7 +106,7 @@ static void FETCH(f_z16)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_z16(struct gl_texture_image *texImage,
+static void store_texel_z16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLushort *depth = (const GLushort *) texel;
@@ -120,7 +120,7 @@ static void store_texel_z16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
*/
-static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
@@ -131,7 +131,7 @@ static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgba_f32(struct gl_texture_image *texImage,
+static void store_texel_rgba_f32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *depth = (const GLfloat *) texel;
@@ -149,7 +149,7 @@ static void store_texel_rgba_f32(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
@@ -160,7 +160,7 @@ static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgba_f16(struct gl_texture_image *texImage,
+static void store_texel_rgba_f16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *src = (const GLfloat *) texel;
@@ -177,7 +177,7 @@ static void store_texel_rgba_f16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
@@ -188,7 +188,7 @@ static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgb_f32(struct gl_texture_image *texImage,
+static void store_texel_rgb_f32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *src = (const GLfloat *) texel;
@@ -205,7 +205,7 @@ static void store_texel_rgb_f32(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
@@ -216,7 +216,7 @@ static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgb_f16(struct gl_texture_image *texImage,
+static void store_texel_rgb_f16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *src = (const GLfloat *) texel;
@@ -233,7 +233,7 @@ static void store_texel_rgb_f16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
@@ -244,7 +244,7 @@ static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_alpha_f32(struct gl_texture_image *texImage,
+static void store_texel_alpha_f32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -259,7 +259,7 @@ static void store_texel_alpha_f32(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
@@ -270,7 +270,7 @@ static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_alpha_f16(struct gl_texture_image *texImage,
+static void store_texel_alpha_f16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -285,7 +285,7 @@ static void store_texel_alpha_f16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
@@ -296,7 +296,7 @@ static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_luminance_f32(struct gl_texture_image *texImage,
+static void store_texel_luminance_f32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -311,7 +311,7 @@ static void store_texel_luminance_f32(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
@@ -322,7 +322,7 @@ static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_luminance_f16(struct gl_texture_image *texImage,
+static void store_texel_luminance_f16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -337,7 +337,7 @@ static void store_texel_luminance_f16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
@@ -348,7 +348,7 @@ static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImag
}
#if DIM == 3
-static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage,
+static void store_texel_luminance_alpha_f32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -364,7 +364,7 @@ static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
@@ -375,7 +375,7 @@ static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImag
}
#if DIM == 3
-static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage,
+static void store_texel_luminance_alpha_f16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -391,7 +391,7 @@ static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
@@ -402,7 +402,7 @@ static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_intensity_f32(struct gl_texture_image *texImage,
+static void store_texel_intensity_f32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -417,7 +417,7 @@ static void store_texel_intensity_f32(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
@@ -428,7 +428,7 @@ static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_intensity_f16(struct gl_texture_image *texImage,
+static void store_texel_intensity_f16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -443,7 +443,7 @@ static void store_texel_intensity_f16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D R_FLOAT32 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_r_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_r_f32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
@@ -454,7 +454,7 @@ static void FETCH(f_r_f32)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_r_f32(struct gl_texture_image *texImage,
+static void store_texel_r_f32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -469,7 +469,7 @@ static void store_texel_r_f32(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D R_FLOAT16 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_r_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_r_f16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
@@ -480,7 +480,7 @@ static void FETCH(f_r_f16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_r_f16(struct gl_texture_image *texImage,
+static void store_texel_r_f16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -495,7 +495,7 @@ static void store_texel_r_f16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D RG_FLOAT32 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_rg_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg_f32)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
@@ -506,7 +506,7 @@ static void FETCH(f_rg_f32)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rg_f32(struct gl_texture_image *texImage,
+static void store_texel_rg_f32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -522,7 +522,7 @@ static void store_texel_rg_f32(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D RG_FLOAT16 texture,
* returning 4 GLfloats.
*/
-static void FETCH(f_rg_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
@@ -533,7 +533,7 @@ static void FETCH(f_rg_f16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rg_f16(struct gl_texture_image *texImage,
+static void store_texel_rg_f16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
@@ -551,7 +551,7 @@ static void store_texel_rg_f16(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA8888 ******************************************************/
/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
-static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -564,7 +564,7 @@ static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
#if DIM == 3
-static void store_texel_rgba8888(struct gl_texture_image *texImage,
+static void store_texel_rgba8888(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -577,7 +577,7 @@ static void store_texel_rgba8888(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA888_REV ***************************************************/
/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
-static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -588,7 +588,7 @@ static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
+static void store_texel_rgba8888_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -601,7 +601,7 @@ static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_ARGB8888 ******************************************************/
/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
-static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -612,7 +612,7 @@ static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_argb8888(struct gl_texture_image *texImage,
+static void store_texel_argb8888(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -625,7 +625,7 @@ static void store_texel_argb8888(struct gl_texture_image *texImage,
/* MESA_FORMAT_ARGB8888_REV **************************************************/
/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -636,7 +636,7 @@ static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
+static void store_texel_argb8888_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -649,7 +649,7 @@ static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_XRGB8888 ******************************************************/
/* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */
-static void FETCH(f_xrgb8888)( const struct gl_texture_image *texImage,
+static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -660,7 +660,7 @@ static void FETCH(f_xrgb8888)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_xrgb8888(struct gl_texture_image *texImage,
+static void store_texel_xrgb8888(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -673,7 +673,7 @@ static void store_texel_xrgb8888(struct gl_texture_image *texImage,
/* MESA_FORMAT_XRGB8888_REV **************************************************/
/* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_xrgb8888_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -684,7 +684,7 @@ static void FETCH(f_xrgb8888_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_xrgb8888_rev(struct gl_texture_image *texImage,
+static void store_texel_xrgb8888_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -697,7 +697,7 @@ static void store_texel_xrgb8888_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGB888 ********************************************************/
/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
-static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
@@ -708,7 +708,7 @@ static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgb888(struct gl_texture_image *texImage,
+static void store_texel_rgb888(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -723,7 +723,7 @@ static void store_texel_rgb888(struct gl_texture_image *texImage,
/* MESA_FORMAT_BGR888 ********************************************************/
/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
-static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
+static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
@@ -734,7 +734,7 @@ static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_bgr888(struct gl_texture_image *texImage,
+static void store_texel_bgr888(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -752,7 +752,7 @@ static void store_texel_bgr888(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGB565 ********************************************************/
/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
-static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -764,7 +764,7 @@ static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgb565(struct gl_texture_image *texImage,
+static void store_texel_rgb565(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -777,7 +777,7 @@ static void store_texel_rgb565(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGB565_REV ****************************************************/
/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
-static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -789,7 +789,7 @@ static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
+static void store_texel_rgb565_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -805,7 +805,7 @@ static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_ARGB4444 ******************************************************/
/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -817,7 +817,7 @@ static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_argb4444(struct gl_texture_image *texImage,
+static void store_texel_argb4444(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -833,7 +833,7 @@ static void store_texel_argb4444(struct gl_texture_image *texImage,
/* MESA_FORMAT_ARGB4444_REV **************************************************/
/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
-static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -844,7 +844,7 @@ static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
+static void store_texel_argb4444_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -859,7 +859,7 @@ static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA5551 ******************************************************/
/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -871,7 +871,7 @@ static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgba5551(struct gl_texture_image *texImage,
+static void store_texel_rgba5551(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -883,7 +883,7 @@ static void store_texel_rgba5551(struct gl_texture_image *texImage,
/* MESA_FORMAT_ARGB1555 ******************************************************/
/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -895,7 +895,7 @@ static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_argb1555(struct gl_texture_image *texImage,
+static void store_texel_argb1555(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -908,7 +908,7 @@ static void store_texel_argb1555(struct gl_texture_image *texImage,
/* MESA_FORMAT_ARGB1555_REV **************************************************/
/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
-static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -920,7 +920,7 @@ static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
+static void store_texel_argb1555_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -933,7 +933,7 @@ static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_ARGB2101010 ***************************************************/
/* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */
-static void FETCH(f_argb2101010)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -945,7 +945,7 @@ static void FETCH(f_argb2101010)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_argb2101010(struct gl_texture_image *texImage,
+static void store_texel_argb2101010(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -962,7 +962,7 @@ static void store_texel_argb2101010(struct gl_texture_image *texImage,
/* MESA_FORMAT_RG88 **********************************************************/
/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_rg88)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg88)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -973,7 +973,7 @@ static void FETCH(f_rg88)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rg88(struct gl_texture_image *texImage,
+static void store_texel_rg88(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLubyte *) texel;
@@ -988,7 +988,7 @@ static void store_texel_rg88(struct gl_texture_image *texImage,
/* MESA_FORMAT_RG88_REV ******************************************************/
/* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */
-static void FETCH(f_rg88_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg88_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -999,7 +999,7 @@ static void FETCH(f_rg88_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rg88_rev(struct gl_texture_image *texImage,
+static void store_texel_rg88_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1012,7 +1012,7 @@ static void store_texel_rg88_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_AL44 **********************************************************/
/* Fetch texel from 1D, 2D or 3D al44 texture, return 4 GLchans */
-static void FETCH(f_al44)( const struct gl_texture_image *texImage,
+static void FETCH(f_al44)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1023,7 +1023,7 @@ static void FETCH(f_al44)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_al44(struct gl_texture_image *texImage,
+static void store_texel_al44(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1036,7 +1036,7 @@ static void store_texel_al44(struct gl_texture_image *texImage,
/* MESA_FORMAT_AL88 **********************************************************/
/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
-static void FETCH(f_al88)( const struct gl_texture_image *texImage,
+static void FETCH(f_al88)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1047,7 +1047,7 @@ static void FETCH(f_al88)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_al88(struct gl_texture_image *texImage,
+static void store_texel_al88(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1060,7 +1060,7 @@ static void store_texel_al88(struct gl_texture_image *texImage,
/* MESA_FORMAT_R8 ************************************************************/
/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_r8)(const struct gl_texture_image *texImage,
+static void FETCH(f_r8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1071,7 +1071,7 @@ static void FETCH(f_r8)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_r8(struct gl_texture_image *texImage,
+static void store_texel_r8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1084,7 +1084,7 @@ static void store_texel_r8(struct gl_texture_image *texImage,
/* MESA_FORMAT_R16 ***********************************************************/
/* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */
-static void FETCH(f_r16)(const struct gl_texture_image *texImage,
+static void FETCH(f_r16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1095,7 +1095,7 @@ static void FETCH(f_r16)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_r16(struct gl_texture_image *texImage,
+static void store_texel_r16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -1108,7 +1108,7 @@ static void store_texel_r16(struct gl_texture_image *texImage,
/* MESA_FORMAT_AL88_REV ******************************************************/
/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
-static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_al88_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1119,7 +1119,7 @@ static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_al88_rev(struct gl_texture_image *texImage,
+static void store_texel_al88_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1132,7 +1132,7 @@ static void store_texel_al88_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_RG1616 ********************************************************/
/* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */
-static void FETCH(f_rg1616)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1143,7 +1143,7 @@ static void FETCH(f_rg1616)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rg1616(struct gl_texture_image *texImage,
+static void store_texel_rg1616(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -1158,7 +1158,7 @@ static void store_texel_rg1616(struct gl_texture_image *texImage,
/* MESA_FORMAT_RG1616_REV ****************************************************/
/* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */
-static void FETCH(f_rg1616_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1169,7 +1169,7 @@ static void FETCH(f_rg1616_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rg1616_rev(struct gl_texture_image *texImage,
+static void store_texel_rg1616_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1182,7 +1182,7 @@ static void store_texel_rg1616_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_AL1616 ********************************************************/
/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */
-static void FETCH(f_al1616)( const struct gl_texture_image *texImage,
+static void FETCH(f_al1616)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1193,7 +1193,7 @@ static void FETCH(f_al1616)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_al1616(struct gl_texture_image *texImage,
+static void store_texel_al1616(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -1208,7 +1208,7 @@ static void store_texel_al1616(struct gl_texture_image *texImage,
/* MESA_FORMAT_AL1616_REV ****************************************************/
/* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */
-static void FETCH(f_al1616_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1219,7 +1219,7 @@ static void FETCH(f_al1616_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_al1616_rev(struct gl_texture_image *texImage,
+static void store_texel_al1616_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLushort *rgba = (const GLushort *) texel;
@@ -1232,7 +1232,7 @@ static void store_texel_al1616_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGB332 ********************************************************/
/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
-static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1244,7 +1244,7 @@ static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgb332(struct gl_texture_image *texImage,
+static void store_texel_rgb332(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1257,7 +1257,7 @@ static void store_texel_rgb332(struct gl_texture_image *texImage,
/* MESA_FORMAT_A8 ************************************************************/
/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a8)( const struct gl_texture_image *texImage,
+static void FETCH(f_a8)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1268,7 +1268,7 @@ static void FETCH(f_a8)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_a8(struct gl_texture_image *texImage,
+static void store_texel_a8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1281,7 +1281,7 @@ static void store_texel_a8(struct gl_texture_image *texImage,
/* MESA_FORMAT_A16 ************************************************************/
/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a16)( const struct gl_texture_image *texImage,
+static void FETCH(f_a16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1292,7 +1292,7 @@ static void FETCH(f_a16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_a16(struct gl_texture_image *texImage,
+static void store_texel_a16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -1305,7 +1305,7 @@ static void store_texel_a16(struct gl_texture_image *texImage,
/* MESA_FORMAT_L8 ************************************************************/
/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
-static void FETCH(f_l8)( const struct gl_texture_image *texImage,
+static void FETCH(f_l8)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1316,7 +1316,7 @@ static void FETCH(f_l8)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_l8(struct gl_texture_image *texImage,
+static void store_texel_l8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1329,7 +1329,7 @@ static void store_texel_l8(struct gl_texture_image *texImage,
/* MESA_FORMAT_L16 ***********************************************************/
/* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */
-static void FETCH(f_l16)( const struct gl_texture_image *texImage,
+static void FETCH(f_l16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1340,12 +1340,12 @@ static void FETCH(f_l16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_l16(struct gl_texture_image *texImage,
+static void store_texel_l16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLushort *rgba = (const GLushort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = rgba[RCOMP];
+ *dst = CHAN_TO_USHORT(rgba[RCOMP]);
}
#endif
@@ -1353,7 +1353,7 @@ static void store_texel_l16(struct gl_texture_image *texImage,
/* MESA_FORMAT_I8 ************************************************************/
/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
-static void FETCH(f_i8)( const struct gl_texture_image *texImage,
+static void FETCH(f_i8)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1364,7 +1364,7 @@ static void FETCH(f_i8)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_i8(struct gl_texture_image *texImage,
+static void store_texel_i8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1377,7 +1377,7 @@ static void store_texel_i8(struct gl_texture_image *texImage,
/* MESA_FORMAT_I16 ***********************************************************/
/* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */
-static void FETCH(f_i16)( const struct gl_texture_image *texImage,
+static void FETCH(f_i16)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1388,19 +1388,19 @@ static void FETCH(f_i16)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_i16(struct gl_texture_image *texImage,
+static void store_texel_i16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLushort *rgba = (const GLushort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = rgba[RCOMP];
+ *dst = CHAN_TO_USHORT(rgba[RCOMP]);
}
#endif
/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */
/* Note: component order is same as for MESA_FORMAT_RGB888 */
-static void FETCH(srgb8)(const struct gl_texture_image *texImage,
+static void FETCH(srgb8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
@@ -1411,7 +1411,7 @@ static void FETCH(srgb8)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_srgb8(struct gl_texture_image *texImage,
+static void store_texel_srgb8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1423,7 +1423,7 @@ static void store_texel_srgb8(struct gl_texture_image *texImage,
#endif
/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */
-static void FETCH(srgba8)(const struct gl_texture_image *texImage,
+static void FETCH(srgba8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1434,7 +1434,7 @@ static void FETCH(srgba8)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_srgba8(struct gl_texture_image *texImage,
+static void store_texel_srgba8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1444,7 +1444,7 @@ static void store_texel_srgba8(struct gl_texture_image *texImage,
#endif
/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
-static void FETCH(sargb8)(const struct gl_texture_image *texImage,
+static void FETCH(sargb8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1455,7 +1455,7 @@ static void FETCH(sargb8)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_sargb8(struct gl_texture_image *texImage,
+static void store_texel_sargb8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1465,7 +1465,7 @@ static void store_texel_sargb8(struct gl_texture_image *texImage,
#endif
/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */
-static void FETCH(sl8)(const struct gl_texture_image *texImage,
+static void FETCH(sl8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1476,7 +1476,7 @@ static void FETCH(sl8)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_sl8(struct gl_texture_image *texImage,
+static void store_texel_sl8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1486,7 +1486,7 @@ static void store_texel_sl8(struct gl_texture_image *texImage,
#endif
/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */
-static void FETCH(sla8)(const struct gl_texture_image *texImage,
+static void FETCH(sla8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
@@ -1497,7 +1497,7 @@ static void FETCH(sla8)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_sla8(struct gl_texture_image *texImage,
+static void store_texel_sla8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1511,7 +1511,7 @@ static void store_texel_sla8(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA_INT8 **************************************************/
static void
-FETCH(rgba_int8)(const struct gl_texture_image *texImage,
+FETCH(rgba_int8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 4);
@@ -1523,7 +1523,7 @@ FETCH(rgba_int8)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_rgba_int8(struct gl_texture_image *texImage,
+store_texel_rgba_int8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rgba = (const GLbyte *) texel;
@@ -1539,7 +1539,7 @@ store_texel_rgba_int8(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA_INT16 **************************************************/
static void
-FETCH(rgba_int16)(const struct gl_texture_image *texImage,
+FETCH(rgba_int16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLshort *src = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
@@ -1551,7 +1551,7 @@ FETCH(rgba_int16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_rgba_int16(struct gl_texture_image *texImage,
+store_texel_rgba_int16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLshort *rgba = (const GLshort *) texel;
@@ -1567,7 +1567,7 @@ store_texel_rgba_int16(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA_INT32 **************************************************/
static void
-FETCH(rgba_int32)(const struct gl_texture_image *texImage,
+FETCH(rgba_int32)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLint *src = TEXEL_ADDR(GLint, texImage, i, j, k, 4);
@@ -1579,7 +1579,7 @@ FETCH(rgba_int32)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_rgba_int32(struct gl_texture_image *texImage,
+store_texel_rgba_int32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLint *rgba = (const GLint *) texel;
@@ -1595,7 +1595,7 @@ store_texel_rgba_int32(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA_UINT8 **************************************************/
static void
-FETCH(rgba_uint8)(const struct gl_texture_image *texImage,
+FETCH(rgba_uint8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
@@ -1607,7 +1607,7 @@ FETCH(rgba_uint8)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_rgba_uint8(struct gl_texture_image *texImage,
+store_texel_rgba_uint8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1623,7 +1623,7 @@ store_texel_rgba_uint8(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA_UINT16 **************************************************/
static void
-FETCH(rgba_uint16)(const struct gl_texture_image *texImage,
+FETCH(rgba_uint16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
@@ -1635,7 +1635,7 @@ FETCH(rgba_uint16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_rgba_uint16(struct gl_texture_image *texImage,
+store_texel_rgba_uint16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLushort *rgba = (const GLushort *) texel;
@@ -1651,7 +1651,7 @@ store_texel_rgba_uint16(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA_UINT32 **************************************************/
static void
-FETCH(rgba_uint32)(const struct gl_texture_image *texImage,
+FETCH(rgba_uint32)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 4);
@@ -1663,7 +1663,7 @@ FETCH(rgba_uint32)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_rgba_uint32(struct gl_texture_image *texImage,
+store_texel_rgba_uint32(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLuint *rgba = (const GLuint *) texel;
@@ -1680,7 +1680,7 @@ store_texel_rgba_uint32(struct gl_texture_image *texImage,
/* this format by definition produces 0,0,0,1 as rgba values,
however we'll return the dudv values as rg and fix up elsewhere */
-static void FETCH(dudv8)(const struct gl_texture_image *texImage,
+static void FETCH(dudv8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
@@ -1693,7 +1693,7 @@ static void FETCH(dudv8)(const struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_R8 ***********************************************/
-static void FETCH(signed_r8)( const struct gl_texture_image *texImage,
+static void FETCH(signed_r8)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
@@ -1704,7 +1704,7 @@ static void FETCH(signed_r8)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_r8(struct gl_texture_image *texImage,
+static void store_texel_signed_r8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rgba = (const GLbyte *) texel;
@@ -1716,7 +1716,7 @@ static void store_texel_signed_r8(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_A8 ***********************************************/
-static void FETCH(signed_a8)( const struct gl_texture_image *texImage,
+static void FETCH(signed_a8)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
@@ -1727,7 +1727,7 @@ static void FETCH(signed_a8)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_a8(struct gl_texture_image *texImage,
+static void store_texel_signed_a8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rgba = (const GLbyte *) texel;
@@ -1739,7 +1739,7 @@ static void store_texel_signed_a8(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_L8 ***********************************************/
-static void FETCH(signed_l8)( const struct gl_texture_image *texImage,
+static void FETCH(signed_l8)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
@@ -1750,7 +1750,7 @@ static void FETCH(signed_l8)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_l8(struct gl_texture_image *texImage,
+static void store_texel_signed_l8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rgba = (const GLbyte *) texel;
@@ -1762,7 +1762,7 @@ static void store_texel_signed_l8(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_I8 ***********************************************/
-static void FETCH(signed_i8)( const struct gl_texture_image *texImage,
+static void FETCH(signed_i8)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
@@ -1773,7 +1773,7 @@ static void FETCH(signed_i8)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_i8(struct gl_texture_image *texImage,
+static void store_texel_signed_i8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rgba = (const GLbyte *) texel;
@@ -1785,7 +1785,7 @@ static void store_texel_signed_i8(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_RG88_REV ***********************************************/
-static void FETCH(signed_rg88_rev)( const struct gl_texture_image *texImage,
+static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1796,7 +1796,7 @@ static void FETCH(signed_rg88_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_rg88_rev(struct gl_texture_image *texImage,
+static void store_texel_signed_rg88_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rg = (const GLbyte *) texel;
@@ -1808,7 +1808,7 @@ static void store_texel_signed_rg88_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_AL88 ***********************************************/
-static void FETCH(signed_al88)( const struct gl_texture_image *texImage,
+static void FETCH(signed_al88)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1819,7 +1819,7 @@ static void FETCH(signed_al88)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_al88(struct gl_texture_image *texImage,
+static void store_texel_signed_al88(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rg = (const GLbyte *) texel;
@@ -1831,7 +1831,7 @@ static void store_texel_signed_al88(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_RGBX8888 ***********************************************/
-static void FETCH(signed_rgbx8888)( const struct gl_texture_image *texImage,
+static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1842,7 +1842,7 @@ static void FETCH(signed_rgbx8888)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_rgbx8888(struct gl_texture_image *texImage,
+static void store_texel_signed_rgbx8888(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rgba = (const GLbyte *) texel;
@@ -1854,7 +1854,7 @@ static void store_texel_signed_rgbx8888(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/
-static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
+static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1865,7 +1865,7 @@ static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_rgba8888(struct gl_texture_image *texImage,
+static void store_texel_signed_rgba8888(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLbyte *rgba = (const GLbyte *) texel;
@@ -1874,7 +1874,7 @@ static void store_texel_signed_rgba8888(struct gl_texture_image *texImage,
}
#endif
-static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
+static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1885,7 +1885,7 @@ static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
+static void store_texel_signed_rgba8888_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
@@ -1899,7 +1899,7 @@ static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_R16 ***********************************************/
static void
-FETCH(signed_r16)(const struct gl_texture_image *texImage,
+FETCH(signed_r16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1911,7 +1911,7 @@ FETCH(signed_r16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_signed_r16(struct gl_texture_image *texImage,
+store_texel_signed_r16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLshort *rgba = (const GLshort *) texel;
@@ -1924,7 +1924,7 @@ store_texel_signed_r16(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_A16 ***********************************************/
static void
-FETCH(signed_a16)(const struct gl_texture_image *texImage,
+FETCH(signed_a16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1936,7 +1936,7 @@ FETCH(signed_a16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_signed_a16(struct gl_texture_image *texImage,
+store_texel_signed_a16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLshort *rgba = (const GLshort *) texel;
@@ -1949,7 +1949,7 @@ store_texel_signed_a16(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_L16 ***********************************************/
static void
-FETCH(signed_l16)(const struct gl_texture_image *texImage,
+FETCH(signed_l16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1961,7 +1961,7 @@ FETCH(signed_l16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_signed_l16(struct gl_texture_image *texImage,
+store_texel_signed_l16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLshort *rgba = (const GLshort *) texel;
@@ -1974,7 +1974,7 @@ store_texel_signed_l16(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_I16 ***********************************************/
static void
-FETCH(signed_i16)(const struct gl_texture_image *texImage,
+FETCH(signed_i16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1986,7 +1986,7 @@ FETCH(signed_i16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_signed_i16(struct gl_texture_image *texImage,
+store_texel_signed_i16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLshort *rgba = (const GLshort *) texel;
@@ -1999,7 +1999,7 @@ store_texel_signed_i16(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_RG1616 ***********************************************/
static void
-FETCH(signed_rg1616)(const struct gl_texture_image *texImage,
+FETCH(signed_rg1616)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
@@ -2011,7 +2011,7 @@ FETCH(signed_rg1616)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_signed_rg1616(struct gl_texture_image *texImage,
+store_texel_signed_rg1616(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -2025,7 +2025,7 @@ store_texel_signed_rg1616(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_AL1616 ***********************************************/
static void
-FETCH(signed_al1616)(const struct gl_texture_image *texImage,
+FETCH(signed_al1616)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
@@ -2037,7 +2037,7 @@ FETCH(signed_al1616)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_signed_al1616(struct gl_texture_image *texImage,
+store_texel_signed_al1616(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -2051,7 +2051,7 @@ store_texel_signed_al1616(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_RGB_16 ***********************************************/
static void
-FETCH(signed_rgb_16)(const struct gl_texture_image *texImage,
+FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 3);
@@ -2063,7 +2063,7 @@ FETCH(signed_rgb_16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_signed_rgb_16(struct gl_texture_image *texImage,
+store_texel_signed_rgb_16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -2078,7 +2078,7 @@ store_texel_signed_rgb_16(struct gl_texture_image *texImage,
/* MESA_FORMAT_SIGNED_RGBA_16 ***********************************************/
static void
-FETCH(signed_rgba_16)(const struct gl_texture_image *texImage,
+FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
@@ -2090,7 +2090,7 @@ FETCH(signed_rgba_16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_signed_rgba_16(struct gl_texture_image *texImage,
+store_texel_signed_rgba_16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -2107,7 +2107,7 @@ store_texel_signed_rgba_16(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGBA_16 ***********************************************/
static void
-FETCH(rgba_16)(const struct gl_texture_image *texImage,
+FETCH(rgba_16)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
@@ -2119,7 +2119,7 @@ FETCH(rgba_16)(const struct gl_texture_image *texImage,
#if DIM == 3
static void
-store_texel_rgba_16(struct gl_texture_image *texImage,
+store_texel_rgba_16(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLchan *rgba = (const GLchan *) texel;
@@ -2138,7 +2138,7 @@ store_texel_rgba_16(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats.
* We convert YCbCr to RGB here.
*/
-static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
+static void FETCH(f_ycbcr)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
@@ -2161,7 +2161,7 @@ static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_ycbcr(struct gl_texture_image *texImage,
+static void store_texel_ycbcr(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
(void) texImage;
@@ -2179,7 +2179,7 @@ static void store_texel_ycbcr(struct gl_texture_image *texImage,
/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats.
* We convert YCbCr to RGB here.
*/
-static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_ycbcr_rev)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
@@ -2202,7 +2202,7 @@ static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
+static void store_texel_ycbcr_rev(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
(void) texImage;
@@ -2217,21 +2217,21 @@ static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
/* MESA_TEXFORMAT_Z24_S8 ***************************************************/
-static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage,
+static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
/* only return Z, not stencil data */
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
texel[0] = ((*src) >> 8) * scale;
- ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8 ||
- texImage->TexFormat == MESA_FORMAT_Z24_X8);
+ ASSERT(texImage->Base.TexFormat == MESA_FORMAT_Z24_S8 ||
+ texImage->Base.TexFormat == MESA_FORMAT_Z24_X8);
ASSERT(texel[0] >= 0.0F);
ASSERT(texel[0] <= 1.0F);
}
#if DIM == 3
-static void store_texel_z24_s8(struct gl_texture_image *texImage,
+static void store_texel_z24_s8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
/* only store Z, not stencil */
@@ -2245,21 +2245,21 @@ static void store_texel_z24_s8(struct gl_texture_image *texImage,
/* MESA_TEXFORMAT_S8_Z24 ***************************************************/
-static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage,
+static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
/* only return Z, not stencil data */
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
texel[0] = ((*src) & 0x00ffffff) * scale;
- ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24 ||
- texImage->TexFormat == MESA_FORMAT_X8_Z24);
+ ASSERT(texImage->Base.TexFormat == MESA_FORMAT_S8_Z24 ||
+ texImage->Base.TexFormat == MESA_FORMAT_X8_Z24);
ASSERT(texel[0] >= 0.0F);
ASSERT(texel[0] <= 1.0F);
}
#if DIM == 3
-static void store_texel_s8_z24(struct gl_texture_image *texImage,
+static void store_texel_s8_z24(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
/* only store Z, not stencil */
@@ -2273,7 +2273,7 @@ static void store_texel_s8_z24(struct gl_texture_image *texImage,
/* MESA_FORMAT_RGB9_E5 ******************************************************/
-static void FETCH(rgb9_e5)( const struct gl_texture_image *texImage,
+static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -2282,7 +2282,7 @@ static void FETCH(rgb9_e5)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_rgb9_e5(struct gl_texture_image *texImage,
+static void store_texel_rgb9_e5(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *src = (const GLfloat *) texel;
@@ -2294,7 +2294,7 @@ static void store_texel_rgb9_e5(struct gl_texture_image *texImage,
/* MESA_FORMAT_R11_G11_B10_FLOAT *********************************************/
-static void FETCH(r11_g11_b10f)( const struct gl_texture_image *texImage,
+static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -2303,7 +2303,7 @@ static void FETCH(r11_g11_b10f)( const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_r11_g11_b10f(struct gl_texture_image *texImage,
+static void store_texel_r11_g11_b10f(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *src = (const GLfloat *) texel;
@@ -2315,7 +2315,7 @@ static void store_texel_r11_g11_b10f(struct gl_texture_image *texImage,
/* MESA_FORMAT_Z32_FLOAT_X24S8 ***********************************************/
-static void FETCH(z32f_x24s8)(const struct gl_texture_image *texImage,
+static void FETCH(z32f_x24s8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
@@ -2326,7 +2326,7 @@ static void FETCH(z32f_x24s8)(const struct gl_texture_image *texImage,
}
#if DIM == 3
-static void store_texel_z32f_x24s8(struct gl_texture_image *texImage,
+static void store_texel_z32f_x24s8(struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *src = (const GLfloat *) texel;
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index ad31e3778..a7a190ab6 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -802,6 +802,7 @@ sample_1d_nearest(struct gl_context *ctx,
const struct gl_texture_image *img,
const GLfloat texcoord[4], GLfloat rgba[4])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2; /* without border, power of two */
GLint i;
i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]);
@@ -812,7 +813,7 @@ sample_1d_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- img->FetchTexelf(img, i, 0, 0, rgba);
+ swImg->FetchTexelf(swImg, i, 0, 0, rgba);
}
}
@@ -826,6 +827,7 @@ sample_1d_linear(struct gl_context *ctx,
const struct gl_texture_image *img,
const GLfloat texcoord[4], GLfloat rgba[4])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2;
GLint i0, i1;
GLbitfield useBorderColor = 0x0;
@@ -848,13 +850,13 @@ sample_1d_linear(struct gl_context *ctx,
get_border_color(tObj, img, t0);
}
else {
- img->FetchTexelf(img, i0, 0, 0, t0);
+ swImg->FetchTexelf(swImg, i0, 0, 0, t0);
}
if (useBorderColor & I1BIT) {
get_border_color(tObj, img, t1);
}
else {
- img->FetchTexelf(img, i1, 0, 0, t1);
+ swImg->FetchTexelf(swImg, i1, 0, 0, t1);
}
lerp_rgba(rgba, a, t0, t1);
@@ -1060,6 +1062,7 @@ sample_2d_nearest(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2; /* without border, power of two */
const GLint height = img->Height2; /* without border, power of two */
GLint i, j;
@@ -1077,7 +1080,7 @@ sample_2d_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- img->FetchTexelf(img, i, j, 0, rgba);
+ swImg->FetchTexelf(swImg, i, j, 0, rgba);
}
}
@@ -1093,6 +1096,7 @@ sample_2d_linear(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2;
const GLint height = img->Height2;
GLint i0, j0, i1, j1;
@@ -1121,25 +1125,25 @@ sample_2d_linear(struct gl_context *ctx,
get_border_color(tObj, img, t00);
}
else {
- img->FetchTexelf(img, i0, j0, 0, t00);
+ swImg->FetchTexelf(swImg, i0, j0, 0, t00);
}
if (useBorderColor & (I1BIT | J0BIT)) {
get_border_color(tObj, img, t10);
}
else {
- img->FetchTexelf(img, i1, j0, 0, t10);
+ swImg->FetchTexelf(swImg, i1, j0, 0, t10);
}
if (useBorderColor & (I0BIT | J1BIT)) {
get_border_color(tObj, img, t01);
}
else {
- img->FetchTexelf(img, i0, j1, 0, t01);
+ swImg->FetchTexelf(swImg, i0, j1, 0, t01);
}
if (useBorderColor & (I1BIT | J1BIT)) {
get_border_color(tObj, img, t11);
}
else {
- img->FetchTexelf(img, i1, j1, 0, t11);
+ swImg->FetchTexelf(swImg, i1, j1, 0, t11);
}
lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
@@ -1157,6 +1161,7 @@ sample_2d_linear_repeat(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2;
const GLint height = img->Height2;
GLint i0, j0, i1, j1;
@@ -1173,10 +1178,10 @@ sample_2d_linear_repeat(struct gl_context *ctx,
linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi);
linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
- img->FetchTexelf(img, i0, j0, 0, t00);
- img->FetchTexelf(img, i1, j0, 0, t10);
- img->FetchTexelf(img, i0, j1, 0, t01);
- img->FetchTexelf(img, i1, j1, 0, t11);
+ swImg->FetchTexelf(swImg, i0, j0, 0, t00);
+ swImg->FetchTexelf(swImg, i1, j0, 0, t10);
+ swImg->FetchTexelf(swImg, i0, j1, 0, t01);
+ swImg->FetchTexelf(swImg, i1, j1, 0, t11);
lerp_rgba_2d(rgba, wi, wj, t00, t10, t01, t11);
}
@@ -1934,6 +1939,7 @@ sample_3d_nearest(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[4])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2; /* without border, power of two */
const GLint height = img->Height2; /* without border, power of two */
const GLint depth = img->Depth2; /* without border, power of two */
@@ -1951,7 +1957,7 @@ sample_3d_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- img->FetchTexelf(img, i, j, k, rgba);
+ swImg->FetchTexelf(swImg, i, j, k, rgba);
}
}
@@ -1966,6 +1972,7 @@ sample_3d_linear(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[4])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2;
const GLint height = img->Height2;
const GLint depth = img->Depth2;
@@ -2002,50 +2009,50 @@ sample_3d_linear(struct gl_context *ctx,
get_border_color(tObj, img, t000);
}
else {
- img->FetchTexelf(img, i0, j0, k0, t000);
+ swImg->FetchTexelf(swImg, i0, j0, k0, t000);
}
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
get_border_color(tObj, img, t100);
}
else {
- img->FetchTexelf(img, i1, j0, k0, t100);
+ swImg->FetchTexelf(swImg, i1, j0, k0, t100);
}
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
get_border_color(tObj, img, t010);
}
else {
- img->FetchTexelf(img, i0, j1, k0, t010);
+ swImg->FetchTexelf(swImg, i0, j1, k0, t010);
}
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
get_border_color(tObj, img, t110);
}
else {
- img->FetchTexelf(img, i1, j1, k0, t110);
+ swImg->FetchTexelf(swImg, i1, j1, k0, t110);
}
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
get_border_color(tObj, img, t001);
}
else {
- img->FetchTexelf(img, i0, j0, k1, t001);
+ swImg->FetchTexelf(swImg, i0, j0, k1, t001);
}
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
get_border_color(tObj, img, t101);
}
else {
- img->FetchTexelf(img, i1, j0, k1, t101);
+ swImg->FetchTexelf(swImg, i1, j0, k1, t101);
}
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
get_border_color(tObj, img, t011);
}
else {
- img->FetchTexelf(img, i0, j1, k1, t011);
+ swImg->FetchTexelf(swImg, i0, j1, k1, t011);
}
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
get_border_color(tObj, img, t111);
}
else {
- img->FetchTexelf(img, i1, j1, k1, t111);
+ swImg->FetchTexelf(swImg, i1, j1, k1, t111);
}
/* trilinear interpolation of samples */
@@ -2544,6 +2551,7 @@ sample_nearest_rect(struct gl_context *ctx,
GLfloat rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][0];
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width;
const GLint height = img->Height;
GLuint i;
@@ -2565,7 +2573,7 @@ sample_nearest_rect(struct gl_context *ctx,
if (col < 0 || col >= width || row < 0 || row >= height)
get_border_color(tObj, img, rgba[i]);
else
- img->FetchTexelf(img, col, row, 0, rgba[i]);
+ swImg->FetchTexelf(swImg, col, row, 0, rgba[i]);
}
}
@@ -2577,6 +2585,7 @@ sample_linear_rect(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][0];
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width;
const GLint height = img->Height;
GLuint i;
@@ -2612,22 +2621,22 @@ sample_linear_rect(struct gl_context *ctx,
if (useBorderColor & (I0BIT | J0BIT))
get_border_color(tObj, img, t00);
else
- img->FetchTexelf(img, i0, j0, 0, t00);
+ swImg->FetchTexelf(swImg, i0, j0, 0, t00);
if (useBorderColor & (I1BIT | J0BIT))
get_border_color(tObj, img, t10);
else
- img->FetchTexelf(img, i1, j0, 0, t10);
+ swImg->FetchTexelf(swImg, i1, j0, 0, t10);
if (useBorderColor & (I0BIT | J1BIT))
get_border_color(tObj, img, t01);
else
- img->FetchTexelf(img, i0, j1, 0, t01);
+ swImg->FetchTexelf(swImg, i0, j1, 0, t01);
if (useBorderColor & (I1BIT | J1BIT))
get_border_color(tObj, img, t11);
else
- img->FetchTexelf(img, i1, j1, 0, t11);
+ swImg->FetchTexelf(swImg, i1, j1, 0, t11);
lerp_rgba_2d(rgba[i], a, b, t00, t10, t01, t11);
}
@@ -2686,6 +2695,7 @@ sample_2d_array_nearest(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[4])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2; /* without border, power of two */
const GLint height = img->Height2; /* without border, power of two */
const GLint depth = img->Depth;
@@ -2704,7 +2714,7 @@ sample_2d_array_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- img->FetchTexelf(img, i, j, array, rgba);
+ swImg->FetchTexelf(swImg, i, j, array, rgba);
}
}
@@ -2719,6 +2729,7 @@ sample_2d_array_linear(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[4])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2;
const GLint height = img->Height2;
const GLint depth = img->Depth;
@@ -2755,25 +2766,25 @@ sample_2d_array_linear(struct gl_context *ctx,
get_border_color(tObj, img, t00);
}
else {
- img->FetchTexelf(img, i0, j0, array, t00);
+ swImg->FetchTexelf(swImg, i0, j0, array, t00);
}
if (useBorderColor & (I1BIT | J0BIT)) {
get_border_color(tObj, img, t10);
}
else {
- img->FetchTexelf(img, i1, j0, array, t10);
+ swImg->FetchTexelf(swImg, i1, j0, array, t10);
}
if (useBorderColor & (I0BIT | J1BIT)) {
get_border_color(tObj, img, t01);
}
else {
- img->FetchTexelf(img, i0, j1, array, t01);
+ swImg->FetchTexelf(swImg, i0, j1, array, t01);
}
if (useBorderColor & (I1BIT | J1BIT)) {
get_border_color(tObj, img, t11);
}
else {
- img->FetchTexelf(img, i1, j1, array, t11);
+ swImg->FetchTexelf(swImg, i1, j1, array, t11);
}
/* trilinear interpolation of samples */
@@ -2996,6 +3007,7 @@ sample_1d_array_nearest(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[4])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2; /* without border, power of two */
const GLint height = img->Height;
GLint i;
@@ -3011,7 +3023,7 @@ sample_1d_array_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- img->FetchTexelf(img, i, array, 0, rgba);
+ swImg->FetchTexelf(swImg, i, array, 0, rgba);
}
}
@@ -3026,6 +3038,7 @@ sample_1d_array_linear(struct gl_context *ctx,
const GLfloat texcoord[4],
GLfloat rgba[4])
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2;
const GLint height = img->Height;
GLint i0, i1;
@@ -3054,13 +3067,13 @@ sample_1d_array_linear(struct gl_context *ctx,
get_border_color(tObj, img, t0);
}
else {
- img->FetchTexelf(img, i0, array, 0, t0);
+ swImg->FetchTexelf(swImg, i0, array, 0, t0);
}
if (useBorderColor & (I1BIT | K0BIT)) {
get_border_color(tObj, img, t1);
}
else {
- img->FetchTexelf(img, i1, array, 0, t1);
+ swImg->FetchTexelf(swImg, i1, array, 0, t1);
}
/* bilinear interpolation of samples */
@@ -3388,6 +3401,7 @@ sample_depth_texture( struct gl_context *ctx,
{
const GLint level = choose_depth_texture_level(tObj, lambda[0]);
const struct gl_texture_image *img = tObj->Image[0][level];
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width;
const GLint height = img->Height;
const GLint depth = img->Depth;
@@ -3423,7 +3437,7 @@ sample_depth_texture( struct gl_context *ctx,
if (col >= 0 && row >= 0 && col < width && row < height &&
slice >= 0 && slice < depth) {
- img->FetchTexelf(img, col, row, slice, &depthSample);
+ swImg->FetchTexelf(swImg, col, row, slice, &depthSample);
}
else {
depthSample = tObj->Sampler.BorderColor.f[0];
@@ -3492,13 +3506,13 @@ sample_depth_texture( struct gl_context *ctx,
depth00 = tObj->Sampler.BorderColor.f[0];
}
else {
- img->FetchTexelf(img, i0, j0, slice, &depth00);
+ swImg->FetchTexelf(swImg, i0, j0, slice, &depth00);
}
if (useBorderTexel & (I1BIT | J0BIT)) {
depth10 = tObj->Sampler.BorderColor.f[0];
}
else {
- img->FetchTexelf(img, i1, j0, slice, &depth10);
+ swImg->FetchTexelf(swImg, i1, j0, slice, &depth10);
}
if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) {
@@ -3506,13 +3520,13 @@ sample_depth_texture( struct gl_context *ctx,
depth01 = tObj->Sampler.BorderColor.f[0];
}
else {
- img->FetchTexelf(img, i0, j1, slice, &depth01);
+ swImg->FetchTexelf(swImg, i0, j1, slice, &depth01);
}
if (useBorderTexel & (I1BIT | J1BIT)) {
depth11 = tObj->Sampler.BorderColor.f[0];
}
else {
- img->FetchTexelf(img, i1, j1, slice, &depth11);
+ swImg->FetchTexelf(swImg, i1, j1, slice, &depth11);
}
}
else {
diff --git a/mesalib/src/mesa/swrast/s_texrender.c b/mesalib/src/mesa/swrast/s_texrender.c
index 52d03c92a..643952875 100644
--- a/mesalib/src/mesa/swrast/s_texrender.c
+++ b/mesalib/src/mesa/swrast/s_texrender.c
@@ -3,10 +3,11 @@
#include "main/colormac.h"
#include "main/fbobject.h"
#include "main/macros.h"
-#include "main/texfetch.h"
#include "main/teximage.h"
#include "main/renderbuffer.h"
#include "swrast/swrast.h"
+#include "swrast/s_context.h"
+#include "swrast/s_texfetch.h"
/*
@@ -20,7 +21,7 @@
struct texture_renderbuffer
{
struct gl_renderbuffer Base; /**< Base class object */
- struct gl_texture_image *TexImage;
+ struct swrast_texture_image *TexImage;
StoreTexelFunc Store;
FetchTexelFuncF Fetchf;
GLint Yoffset; /**< Layer for 1D array textures. */
@@ -42,8 +43,8 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
const GLint z = trb->Zoffset;
GLuint i;
- ASSERT(trb->TexImage->Width == rb->Width);
- ASSERT(trb->TexImage->Height == rb->Height);
+ ASSERT(trb->TexImage->Base.Width == rb->Width);
+ ASSERT(trb->TexImage->Base.Height == rb->Height);
y += trb->Yoffset;
@@ -468,7 +469,7 @@ texture_put_mono_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
static void
-store_nop(struct gl_texture_image *texImage,
+store_nop(struct swrast_texture_image *texImage,
GLint col, GLint row, GLint img,
const void *texel)
{
@@ -534,16 +535,20 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
(void) ctx;
ASSERT(trb);
- trb->TexImage = _mesa_get_attachment_teximage(att);
+ trb->TexImage = swrast_texture_image(_mesa_get_attachment_teximage(att));
ASSERT(trb->TexImage);
- trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat);
+ trb->Store = _mesa_get_texel_store_func(trb->TexImage->Base.TexFormat);
if (!trb->Store) {
/* we'll never draw into some textures (compressed formats) */
trb->Store = store_nop;
}
+ if (!trb->TexImage->FetchTexelf) {
+ _mesa_update_fetch_functions(trb->TexImage->Base.TexObject);
+ }
trb->Fetchf = trb->TexImage->FetchTexelf;
+ assert(trb->Fetchf);
if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) {
trb->Yoffset = att->Zoffset;
@@ -554,13 +559,13 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
trb->Zoffset = att->Zoffset;
}
- trb->Base.Width = trb->TexImage->Width;
- trb->Base.Height = trb->TexImage->Height;
- trb->Base.InternalFormat = trb->TexImage->InternalFormat;
- trb->Base.Format = trb->TexImage->TexFormat;
+ trb->Base.Width = trb->TexImage->Base.Width;
+ trb->Base.Height = trb->TexImage->Base.Height;
+ trb->Base.InternalFormat = trb->TexImage->Base.InternalFormat;
+ trb->Base.Format = trb->TexImage->Base.TexFormat;
/* XXX may need more special cases here */
- switch (trb->TexImage->TexFormat) {
+ switch (trb->TexImage->Base.TexFormat) {
case MESA_FORMAT_Z24_S8:
trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
trb->Base._BaseFormat = GL_DEPTH_STENCIL;
@@ -605,7 +610,7 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
}
- trb->Base.Data = trb->TexImage->Data;
+ trb->Base.Data = trb->TexImage->Base.Data;
}
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 6cc72c582..7e3fc2806 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -28,9 +28,74 @@
#include "main/context.h"
#include "main/fbobject.h"
+#include "main/teximage.h"
#include "swrast/swrast.h"
#include "swrast/s_context.h"
+
+/**
+ * Allocate a new swrast_texture_image (a subclass of gl_texture_image).
+ * Called via ctx->Driver.NewTextureImage().
+ */
+struct gl_texture_image *
+_swrast_new_texture_image( struct gl_context *ctx )
+{
+ (void) ctx;
+ return (struct gl_texture_image *) CALLOC_STRUCT(swrast_texture_image);
+}
+
+
+/**
+ * Free a swrast_texture_image (a subclass of gl_texture_image).
+ * Called via ctx->Driver.DeleteTextureImage().
+ */
+void
+_swrast_delete_texture_image(struct gl_context *ctx,
+ struct gl_texture_image *texImage)
+{
+ /* Nothing special for the subclass yet */
+ _mesa_delete_texture_image(ctx, texImage);
+}
+
+
+/**
+ * Called via ctx->Driver.AllocTextureImageBuffer()
+ */
+GLboolean
+_swrast_alloc_texture_image_buffer(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ gl_format format, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ GLuint bytes = _mesa_format_image_size(format, width, height, depth);
+
+ /* This _should_ be true (revisit if these ever fail) */
+ assert(texImage->Width == width);
+ assert(texImage->Height == height);
+ assert(texImage->Depth == depth);
+
+ assert(!texImage->Data);
+ texImage->Data = _mesa_align_malloc(bytes, 512);
+
+ return texImage->Data != NULL;
+}
+
+
+/**
+ * Called via ctx->Driver.FreeTextureImageBuffer()
+ */
+void
+_swrast_free_texture_image_buffer(struct gl_context *ctx,
+ struct gl_texture_image *texImage)
+{
+ if (texImage->Data && !texImage->IsClientData) {
+ _mesa_align_free(texImage->Data);
+ }
+
+ texImage->Data = NULL;
+}
+
+
/**
* Error checking for debugging only.
*/
diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h
index c8b998635..390b42264 100644
--- a/mesalib/src/mesa/swrast/swrast.h
+++ b/mesalib/src/mesa/swrast/swrast.h
@@ -182,6 +182,23 @@ _swrast_render_start( struct gl_context *ctx );
extern void
_swrast_render_finish( struct gl_context *ctx );
+extern struct gl_texture_image *
+_swrast_new_texture_image( struct gl_context *ctx );
+
+extern void
+_swrast_delete_texture_image(struct gl_context *ctx,
+ struct gl_texture_image *texImage);
+
+extern GLboolean
+_swrast_alloc_texture_image_buffer(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ gl_format format, GLsizei width,
+ GLsizei height, GLsizei depth);
+
+extern void
+_swrast_free_texture_image_buffer(struct gl_context *ctx,
+ struct gl_texture_image *texImage);
+
extern void
_swrast_map_teximage(struct gl_context *ctx,
struct gl_texture_image *texImage,