summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralanh <alanh>2003-09-12 18:38:12 +0000
committeralanh <alanh>2003-09-12 18:38:12 +0000
commitc6211df10426aba7d9f369b0335eceece91cdd7c (patch)
tree33db883d43e663177be053262c4a2f7135252caa
parent1ad5a2d4f7bc83b50df9168c61e8d7215926a5ab (diff)
third round.
-rw-r--r--xc/lib/Xv/Xv.c3
-rw-r--r--xc/lib/xkbfile/XKBfile.h7
-rw-r--r--xc/lib/xkbfile/xkbmisc.c89
-rw-r--r--xc/lib/xtrans/Xtrans.c155
-rw-r--r--xc/lib/xtrans/Xtrans.h49
-rw-r--r--xc/lib/xtrans/Xtransdnet.c14
-rw-r--r--xc/lib/xtrans/Xtransint.h192
-rw-r--r--xc/lib/xtrans/Xtranslcl.c482
-rw-r--r--xc/lib/xtrans/Xtranssock.c766
-rw-r--r--xc/lib/xtrans/Xtranstli.c49
-rw-r--r--xc/lib/xtrans/Xtransutil.c161
-rw-r--r--xc/lib/xtrans/transport.c22
-rw-r--r--xc/lib/zlib/Imakefile31
-rw-r--r--xc/programs/Imakefile24
-rw-r--r--xc/programs/Xserver/afb/afb.h66
-rw-r--r--xc/programs/Xserver/afb/afbbitblt.c9
-rw-r--r--xc/programs/Xserver/afb/afbclip.c25
-rw-r--r--xc/programs/Xserver/afb/afbfillarc.c4
-rw-r--r--xc/programs/Xserver/afb/afbfillrct.c3
-rw-r--r--xc/programs/Xserver/afb/afbpolypnt.c3
-rw-r--r--xc/programs/Xserver/afb/afbpushpxl.c5
-rw-r--r--xc/programs/Xserver/afb/afbzerarc.c5
-rw-r--r--xc/programs/Xserver/cfb/cfb.h376
-rw-r--r--xc/programs/Xserver/cfb/cfbbitblt.c429
-rw-r--r--xc/programs/Xserver/cfb/cfbblt.c60
-rw-r--r--xc/programs/Xserver/cfb/cfbcppl.c100
-rw-r--r--xc/programs/Xserver/cfb/cfbfillarc.c48
-rw-r--r--xc/programs/Xserver/cfb/cfbglblt8.c100
-rw-r--r--xc/programs/Xserver/cfb/cfbmap.h402
-rw-r--r--xc/programs/Xserver/cfb/cfbscrinit.c25
-rw-r--r--xc/programs/Xserver/cfb/cfbunmap.h46
-rw-r--r--xc/programs/Xserver/cfb/cfbzerarc.c20
-rw-r--r--xc/programs/Xserver/cfb/module/Imakefile5
-rw-r--r--xc/programs/Xserver/dix/Imakefile22
-rw-r--r--xc/programs/Xserver/dix/dispatch.c482
-rw-r--r--xc/programs/Xserver/dix/events.c1803
-rw-r--r--xc/programs/Xserver/dix/globals.c3
-rw-r--r--xc/programs/Xserver/dix/property.c33
-rw-r--r--xc/programs/Xserver/dix/window.c3
-rw-r--r--xc/programs/Xserver/fb/fb.h878
40 files changed, 4364 insertions, 2635 deletions
diff --git a/xc/lib/Xv/Xv.c b/xc/lib/Xv/Xv.c
index 767ecc69d..381cdb78a 100644
--- a/xc/lib/Xv/Xv.c
+++ b/xc/lib/Xv/Xv.c
@@ -21,7 +21,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
-/* $XFree86: xc/lib/Xv/Xv.c,v 1.16 2002/10/16 00:37:33 dawes Exp $ */
+/* $XFree86: xc/lib/Xv/Xv.c,v 1.17 2003/04/28 16:56:27 dawes Exp $ */
/*
** File:
**
@@ -267,6 +267,7 @@ XvQueryAdaptors(
*p_nAdaptors = rep.num_adaptors;
*p_pAdaptors = pas;
+ Xfree(buffer);
UnlockDisplay(dpy);
SyncHandle();
diff --git a/xc/lib/xkbfile/XKBfile.h b/xc/lib/xkbfile/XKBfile.h
index 6c4315378..d0bbd4b88 100644
--- a/xc/lib/xkbfile/XKBfile.h
+++ b/xc/lib/xkbfile/XKBfile.h
@@ -1,7 +1,7 @@
#ifndef _XKBFILE_H_
#define _XKBFILE_H_ 1
-/* $XConsortium: XKBfile.h /main/6 1996/08/31 12:44:58 kaleb $ */
+/* $Xorg: XKBfile.h,v 1.3 2000/08/17 19:46:43 cpqbld Exp $ */
/************************************************************
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
@@ -533,6 +533,11 @@ extern Bool XkbWriteXKBKeymapForNames(
#endif
);
+extern Status XkbMergeFile(
+ XkbDescPtr /* xkb */,
+ XkbFileInfo /* finfo */
+);
+
/***====================================================================***/
extern Bool XkmProbe(
diff --git a/xc/lib/xkbfile/xkbmisc.c b/xc/lib/xkbfile/xkbmisc.c
index 8f54cc4fa..25e47bc48 100644
--- a/xc/lib/xkbfile/xkbmisc.c
+++ b/xc/lib/xkbfile/xkbmisc.c
@@ -1,4 +1,4 @@
-/* $XConsortium: xkbmisc.c /main/7 1996/12/27 20:53:10 kaleb $ */
+/* $Xorg: xkbmisc.c,v 1.4 2000/08/17 19:46:44 cpqbld Exp $ */
/************************************************************
Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
@@ -24,14 +24,11 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/xkbfile/xkbmisc.c,v 1.7 2003/07/16 02:31:10 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
-
-#define XK_CYRILLIC
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
@@ -58,6 +55,7 @@
#define XKBSRV_NEED_FILE_FUNCS 1
#include "XKBsrv.h"
#include <X11/extensions/XKBgeom.h>
+#include "xkb.h"
#endif
@@ -70,19 +68,78 @@ _XkbKSCheckCase(ks)
#endif
{
unsigned set,rtrn;
-unsigned char ch;
- set= (ks & (~0xff));
- ch= (char)(ks&0xff);
+ set= (ks & (~0xff)) >> 8;
rtrn= 0;
switch (set) {
case 0: /* latin 1 */
- if (((ch>=XK_A)&&(ch<=XK_Z))||
- ((ch>=XK_Agrave)&&(ch<=XK_THORN)&&(ch!=XK_multiply))) {
+ if (((ks>=XK_A)&&(ks<=XK_Z))||
+ ((ks>=XK_Agrave)&&(ks<=XK_THORN)&&(ks!=XK_multiply))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if (((ks>=XK_a)&&(ks<=XK_z))||
+ ((ks>=XK_agrave)&&(ks<=XK_ydiaeresis))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 1: /* latin 2 */
+ if (((ks>=XK_Aogonek)&&(ks<=XK_Zabovedot)&&(ks!=XK_breve))||
+ ((ks>=XK_Racute)&&(ks<=XK_Tcedilla))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if (((ks>=XK_aogonek)&&(ks<=XK_zabovedot)&&(ks!=XK_caron))||
+ ((ks>=XK_racute)&&(ks<=XK_tcedilla))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 2: /* latin 3 */
+ if (((ks>=XK_Hstroke)&&(ks<=XK_Jcircumflex))||
+ ((ks>=XK_Cabovedot)&&(ks<=XK_Scircumflex))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if (((ks>=XK_hstroke)&&(ks<=XK_jcircumflex))||
+ ((ks>=XK_cabovedot)&&(ks<=XK_scircumflex))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 3: /* latin 4 */
+ if (((ks>=XK_Rcedilla)&&(ks<=XK_Tslash))||
+ (ks==XK_ENG)||
+ ((ks>=XK_Amacron)&&(ks<=XK_Umacron))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if (((ks>=XK_rcedilla)&&(ks<=XK_tslash))||
+ (ks==XK_eng)||
+ ((ks>=XK_amacron)&&(ks<=XK_umacron))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 18: /* latin 8 */
+ if ((ks==XK_Babovedot)||
+ ((ks>=XK_Dabovedot)&&(ks<=XK_Wacute))||
+ ((ks>=XK_Ygrave)&&(ks<=XK_Fabovedot))||
+ (ks==XK_Mabovedot)||
+ (ks==XK_Pabovedot)||
+ (ks==XK_Sabovedot)||
+ (ks==XK_Wdiaeresis)||
+ ((ks>=XK_Wcircumflex)&&(ks<=XK_Ycircumflex))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if ((ks==XK_babovedot)||
+ (ks==XK_dabovedot)||
+ (ks==XK_fabovedot)||
+ (ks==XK_mabovedot)||
+ ((ks>=XK_wgrave)&&(ks<=XK_wacute))||
+ (ks==XK_ygrave)||
+ ((ks>=XK_wdiaeresis)&&(ks<=XK_ycircumflex))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 19: /* latin 9 */
+ if ((ks==XK_OE)||(ks==XK_Ydiaeresis)) {
rtrn|= _XkbKSUpper;
}
- if (((ch>=XK_a)&&(ch<=XK_z))||
- ((ch>=XK_agrave)&&(ch<=XK_ydiaeresis))) {
+ if (ks==XK_oe) {
rtrn|= _XkbKSLower;
}
break;
@@ -105,7 +162,7 @@ _XkbStrCaseCmp(str1,str2)
char c, *s;
register int n;
- for (n=0, s = buf1; c = *str1++; n++) {
+ for (n=0, s = buf1; (c = *str1++); n++) {
if (isupper(c))
c = tolower(c);
if (n>510)
@@ -113,7 +170,7 @@ _XkbStrCaseCmp(str1,str2)
*s++ = c;
}
*s = '\0';
- for (n=0, s = buf2; c = *str2++; n++) {
+ for (n=0, s = buf2; (c = *str2++); n++) {
if (isupper(c))
c = tolower(c);
if (n>510)
@@ -241,7 +298,7 @@ _AddIncl(file,result,topLevel,showImplicit,index,priv)
void * priv;
#endif
{
- if ((priv)&&(strcmp(priv,"%")!=0))
+ if ((priv)&&(strcmp((char *)priv,"%")!=0))
fprintf(file," include \"%s\"\n",(char *)priv);
return;
}
@@ -452,7 +509,7 @@ XkbMergeFile(XkbDescPtr xkb,XkbFileInfo finfo)
#else
XkbMergeFile(xkb,finfo)
XkbDescPtr xkb;
- XkbFileInfo *finfo;
+ XkbFileInfo finfo;
#endif
{
return BadImplementation;
diff --git a/xc/lib/xtrans/Xtrans.c b/xc/lib/xtrans/Xtrans.c
index 650992499..23ff1c17a 100644
--- a/xc/lib/xtrans/Xtrans.c
+++ b/xc/lib/xtrans/Xtrans.c
@@ -1,9 +1,13 @@
-/* $TOG: Xtrans.c /main/34 1998/02/06 15:55:15 kaleb $ */
+/* $Xorg: Xtrans.c,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/xtrans/Xtrans.c,v 3.21 1999/06/20 08:41:20 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/Xtrans.c,v 3.33 2003/08/11 17:41:29 eich Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -74,9 +78,7 @@ from The Open Group.
#define TRANS_LOCAL_NAMED_INDEX 11
#define TRANS_LOCAL_ISC_INDEX 12
#define TRANS_LOCAL_SCO_INDEX 13
-#define TRANS_AMOEBA_INDEX 14
-#define TRANS_MNX_INET_INDEX 15
-#define TRANS_MNX_TCP_INDEX 16
+#define TRANS_SOCKET_INET6_INDEX 14
static
@@ -88,6 +90,9 @@ Xtransport_table Xtransports[] = {
#endif /* STREAMSCONN */
#if defined(TCPCONN)
{ &TRANS(SocketTCPFuncs), TRANS_SOCKET_TCP_INDEX },
+#if defined(IPv6) && defined(AF_INET6)
+ { &TRANS(SocketINET6Funcs), TRANS_SOCKET_INET6_INDEX },
+#endif /* IPv6 */
{ &TRANS(SocketINETFuncs), TRANS_SOCKET_INET_INDEX },
#endif /* TCPCONN */
#if defined(DNETCONN)
@@ -111,17 +116,12 @@ Xtransport_table Xtransports[] = {
{ &TRANS(NAMEDFuncs), TRANS_LOCAL_NAMED_INDEX },
#endif
#ifndef sun
+#ifndef SCO325
{ &TRANS(ISCFuncs), TRANS_LOCAL_ISC_INDEX },
+#endif
{ &TRANS(SCOFuncs), TRANS_LOCAL_SCO_INDEX },
#endif /* sun */
#endif /* LOCALCONN */
-#if defined(AMRPCCONN) || defined(AMTCPCONN)
- { &TRANS(AmConnFuncs), TRANS_AMOEBA_INDEX },
-#endif /* AMRPCCONN || AMTCPCONN */
-#if defined(MNX_TCPCONN)
- { &TRANS(MnxINETFuncs), TRANS_MNX_INET_INDEX },
- { &TRANS(MnxTCPFuncs), TRANS_MNX_TCP_INDEX },
-#endif /* MNX_TCPCONN */
};
#define NUMTRANS (sizeof(Xtransports)/sizeof(Xtransport_table))
@@ -141,7 +141,7 @@ void
TRANS(FreeConnInfo) (XtransConnInfo ciptr)
{
- PRMSG (3,"FreeConnInfo(%x)\n", ciptr, 0, 0);
+ PRMSG (3,"FreeConnInfo(%p)\n", ciptr, 0, 0);
if (ciptr->addr)
xfree (ciptr->addr);
@@ -172,7 +172,8 @@ TRANS(SelectTransport) (char *protocol)
* a case insensitive match.
*/
- strncpy (protobuf, protocol, PROTOBUFSIZE);
+ strncpy (protobuf, protocol, PROTOBUFSIZE - 1);
+ protobuf[PROTOBUFSIZE-1] = '\0';
for (i = 0; i < PROTOBUFSIZE && protobuf[i] != '\0'; i++)
if (isupper (protobuf[i]))
@@ -205,7 +206,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
* Other than fontlib, the address is a string formatted
* as "protocol/host:port".
*
- * If the protocol part is missing, then assume INET.
+ * If the protocol part is missing, then assume TCP.
* If the protocol part and host part are missing, then assume local.
* If a "::" is found then assume DNET.
*/
@@ -213,6 +214,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
char *mybuf, *tmpptr;
char *_protocol, *_host, *_port;
char hostnamebuf[256];
+ int _host_len;
PRMSG (3,"ParseAddress(%s)\n", address, 0, 0);
@@ -227,9 +229,11 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
_protocol = mybuf;
- if ((mybuf = strpbrk (mybuf,"/:")) == NULL)
- {
- /* adress is in a bad format */
+
+ if ( ((mybuf = strchr (mybuf,'/')) == NULL) &&
+ ((mybuf = strrchr (tmpptr,':')) == NULL) )
+ {
+ /* address is in a bad format */
*protocol = NULL;
*host = NULL;
*port = NULL;
@@ -240,7 +244,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
if (*mybuf == ':')
{
/*
- * If there is a hostname, then assume inet, otherwise
+ * If there is a hostname, then assume tcp, otherwise
* it must be local.
*/
if (mybuf == tmpptr)
@@ -250,8 +254,8 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
}
else
{
- /* Ther is a hostname specified */
- _protocol = "inet";
+ /* There is a hostname specified */
+ _protocol = "tcp";
mybuf = tmpptr; /* reset to the begining of the host ptr */
}
}
@@ -264,11 +268,11 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
if (strlen(_protocol) == 0)
{
/*
- * If there is a hostname, then assume inet, otherwise
+ * If there is a hostname, then assume tcp, otherwise
* it must be local.
*/
if (*mybuf != ':')
- _protocol = "inet";
+ _protocol = "tcp";
else
_protocol = "local";
}
@@ -278,7 +282,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
_host = mybuf;
- if ((mybuf = strchr (mybuf,':')) == NULL)
+ if ((mybuf = strrchr (mybuf,':')) == NULL)
{
*protocol = NULL;
*host = NULL;
@@ -287,21 +291,51 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
return 0;
}
- *mybuf ++= '\0';
+ /* Check for DECnet */
- if (strlen(_host) == 0)
+ if ((mybuf != _host) && (*(mybuf - 1) == ':')
+#if defined(IPv6) && defined(AF_INET6)
+ /* An IPv6 address can end in :: so three : in a row is assumed to be
+ an IPv6 host and not a DECnet node with a : in it's name, unless
+ DECnet is specifically requested */
+ && ( ((mybuf - 1) == _host) || (*(mybuf - 2) != ':') ||
+ ((_protocol != NULL) && (strcmp(_protocol, "dnet") == 0)) )
+#endif
+ )
{
- TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf));
- _host = hostnamebuf;
+ _protocol = "dnet";
+ *(mybuf - 1) = '\0';
}
- /* Check for DECnet */
+ *mybuf ++= '\0';
- if (*mybuf == ':')
+ _host_len = strlen(_host);
+ if (_host_len == 0)
{
- _protocol = "dnet";
- mybuf++;
+ TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf));
+ _host = hostnamebuf;
+ }
+#if defined(IPv6) && defined(AF_INET6)
+ /* hostname in IPv6 [numeric_addr]:0 form? */
+ else if ( (_host_len > 3) &&
+ ((strcmp(_protocol, "tcp") == 0) || (strcmp(_protocol, "inet6") == 0))
+ && (*_host == '[') && (*(_host + _host_len - 1) == ']') ) {
+ struct sockaddr_in6 sin6;
+
+ *(_host + _host_len - 1) = '\0';
+
+ /* Verify address is valid IPv6 numeric form */
+ if (inet_pton(AF_INET6, _host + 1, &sin6) == 1) {
+ /* It is. Use it as such. */
+ _host++;
+ _protocol = "inet6";
+ } else {
+ /* It's not, restore it just in case some other code can use it. */
+ *(_host + _host_len - 1) = ']';
+ }
}
+#endif
+
/* Get the port */
@@ -667,10 +701,6 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
* ret = ciptr->transptr->SetOption (ciptr, option, arg);
*/
-#ifdef MINIX
- return ciptr->transptr->SetOption(ciptr, option, arg);
-#else /* !MINIX */
-
switch (option)
{
case TRANS_NONBLOCKING:
@@ -681,7 +711,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
break;
case 1: /* Set to non-blocking mode */
-#if defined(O_NONBLOCK) && (!defined(ultrix) && !defined(hpux) && !defined(AIXV3) && !defined(uniosu) && !defined(__EMX__) && !defined(SCO))
+#if defined(O_NONBLOCK) && (!defined(ultrix) && !defined(hpux) && !defined(AIXV3) && !defined(uniosu) && !defined(__UNIXOS2__) && !defined(SCO)) && !defined(__QNX__)
ret = fcntl (fd, F_GETFL, 0);
if (ret != -1)
ret = fcntl (fd, F_SETFL, ret | O_NONBLOCK);
@@ -693,13 +723,13 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
ret = ioctl (fd, FIOSNBIO, &arg);
}
#else
-#if (defined(AIXV3) || defined(uniosu) || defined(WIN32) || defined(__EMX__)) && defined(FIONBIO)
+#if (defined(AIXV3) || defined(uniosu) || defined(WIN32) || defined(__UNIXOS2__) || defined(__QNX__)) && defined(FIONBIO)
{
int arg;
arg = 1;
/* IBM TCP/IP understands this option too well: it causes TRANS(Read) to fail
* eventually with EWOULDBLOCK */
-#ifndef __EMX__
+#ifndef __UNIXOS2__
ret = ioctl (fd, FIONBIO, &arg);
#else
/* ret = ioctl(fd, FIONBIO, &arg, sizeof(int));*/
@@ -733,16 +763,15 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
}
return ret;
-#endif /* MINIX */
}
#ifdef TRANS_SERVER
int
-TRANS(CreateListener) (XtransConnInfo ciptr, char *port)
+TRANS(CreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
{
- return ciptr->transptr->CreateListener (ciptr, port);
+ return ciptr->transptr->CreateListener (ciptr, port, flags);
}
int
@@ -750,6 +779,7 @@ TRANS(NoListen) (char * protocol)
{
Xtransport *trans;
+ int i = 0, ret = 0;
if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
{
@@ -758,9 +788,16 @@ TRANS(NoListen) (char * protocol)
return -1;
}
-
+ if (trans->flags & TRANS_ALIAS) {
+ if (trans->nolisten)
+ while (trans->nolisten[i]) {
+ ret |= TRANS(NoListen)(trans->nolisten[i]);
+ i++;
+ }
+ }
+
trans->flags |= TRANS_NOLISTEN;
- return 0;
+ return ret;
}
int
@@ -1008,8 +1045,11 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
char buffer[256]; /* ??? What size ?? */
XtransConnInfo ciptr, temp_ciptrs[NUMTRANS];
int status, i, j;
+#if defined(IPv6) && defined(AF_INET6)
+ int ipv6_succ = 0;
+#endif
- PRMSG (2,"MakeAllCOTSServerListeners(%s,%x)\n",
+ PRMSG (2,"MakeAllCOTSServerListeners(%s,%p)\n",
port ? port : "NULL", ciptrs_ret, 0);
*count_ret = 0;
@@ -1017,6 +1057,7 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
for (i = 0; i < NUMTRANS; i++)
{
Xtransport *trans = Xtransports[i].transport;
+ unsigned int flags = 0;
if (trans->flags&TRANS_ALIAS || trans->flags&TRANS_NOLISTEN)
continue;
@@ -1036,8 +1077,13 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
trans->TransName, 0, 0);
continue;
}
+#if defined(IPv6) && defined(AF_INET6)
+ if ((Xtransports[i].transport_id == TRANS_SOCKET_INET_INDEX
+ && ipv6_succ))
+ flags |= ADDR_IN_USE_ALLOWED;
+#endif
- if ((status = TRANS(CreateListener (ciptr, port))) < 0)
+ if ((status = TRANS(CreateListener (ciptr, port, flags))) < 0)
{
if (status == TRANS_ADDR_IN_USE)
{
@@ -1069,6 +1115,11 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
}
}
+#if defined(IPv6) && defined(AF_INET6)
+ 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);
@@ -1111,7 +1162,7 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
XtransConnInfo ciptr, temp_ciptrs[NUMTRANS];
int status, i, j;
- PRMSG (2,"MakeAllCLTSServerListeners(%s,%x)\n",
+ PRMSG (2,"MakeAllCLTSServerListeners(%s,%p)\n",
port ? port : "NULL", ciptrs_ret, 0);
*count_ret = 0;
@@ -1136,7 +1187,7 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
continue;
}
- if ((status = TRANS(CreateListener (ciptr, port))) < 0)
+ if ((status = TRANS(CreateListener (ciptr, port, 0))) < 0)
{
if (status == TRANS_ADDR_IN_USE)
{
@@ -1247,7 +1298,7 @@ static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
#endif /* CRAY */
-#if (defined(SYSV) && defined(i386) && !defined(SCO325)) || defined(WIN32) || defined(__sxg__) || defined(__EMX__)
+#if (defined(SYSV) && defined(i386) && !defined(SCO325)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
/*
* emulate readv
@@ -1279,7 +1330,7 @@ static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
#endif /* SYSV && i386 || WIN32 || __sxg__ */
-#if (defined(SYSV) && defined(i386) && !defined(SCO325)) || defined(WIN32) || defined(__sxg__) || defined(__EMX__)
+#if (defined(SYSV) && defined(i386) && !defined(SCO325)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
/*
* emulate writev
@@ -1312,7 +1363,7 @@ static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
#endif /* SYSV && i386 || WIN32 || __sxg__ */
-#if (defined(_POSIX_SOURCE) && !defined(AIXV3)) || defined(hpux) || defined(USG) || defined(SVR4) || defined(SCO)
+#if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(hpux) || defined(USG) || defined(SVR4) || defined(SCO)
#ifndef NEED_UTSNAME
#define NEED_UTSNAME
#endif
diff --git a/xc/lib/xtrans/Xtrans.h b/xc/lib/xtrans/Xtrans.h
index 8c7aa5db5..1e91180d7 100644
--- a/xc/lib/xtrans/Xtrans.h
+++ b/xc/lib/xtrans/Xtrans.h
@@ -1,9 +1,13 @@
-/* $TOG: Xtrans.h /main/31 1998/02/06 15:55:22 kaleb $ */
+/* $Xorg: Xtrans.h,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/xtrans/Xtrans.h,v 3.13 1999/06/20 08:41:21 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/Xtrans.h,v 3.22 2003/07/24 13:50:19 eich Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -53,13 +57,21 @@ from The Open Group.
#include <X11/Xfuncproto.h>
#include <X11/Xos.h>
+#ifndef WIN32
+#ifndef Lynx
+#include <sys/socket.h>
+#else
+#include <socket.h>
+#endif
+#endif
+
/*
* Set the functions names according to where this code is being compiled.
*/
#ifdef X11_t
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _X11Trans##func
#else
#define TRANS(func) _X11Trans/**/func
@@ -70,7 +82,7 @@ static char* __xtransname = "_X11Trans";
#endif /* X11_t */
#ifdef XSERV_t
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _XSERVTrans##func
#else
#define TRANS(func) _XSERVTrans/**/func
@@ -79,10 +91,10 @@ static char* __xtransname = "_X11Trans";
static char* __xtransname = "_XSERVTrans";
#endif
#define X11_t
-#endif /* X11_t */
+#endif /* XSERV_t */
#ifdef XIM_t
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _XimXTrans##func
#else
#define TRANS(func) _XimXTrans/**/func
@@ -93,7 +105,7 @@ static char* __xtransname = "_XimTrans";
#endif /* XIM_t */
#ifdef FS_t
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _FSTrans##func
#else
#define TRANS(func) _FSTrans/**/func
@@ -104,7 +116,7 @@ static char* __xtransname = "_FSTrans";
#endif /* FS_t */
#ifdef FONT_t
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _FontTrans##func
#else
#define TRANS(func) _FontTrans/**/func
@@ -115,7 +127,7 @@ static char* __xtransname = "_FontTrans";
#endif /* FONT_t */
#ifdef ICE_t
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _IceTrans##func
#else
#define TRANS(func) _IceTrans/**/func
@@ -126,7 +138,7 @@ static char* __xtransname = "_IceTrans";
#endif /* ICE_t */
#ifdef TEST_t
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _TESTTrans##func
#else
#define TRANS(func) _TESTTrans/**/func
@@ -137,7 +149,7 @@ static char* __xtransname = "_TESTTrans";
#endif /* TEST_t */
#ifdef LBXPROXY_t
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _LBXPROXYTrans##func
#else
#define TRANS(func) _LBXPROXYTrans/**/func
@@ -149,7 +161,7 @@ static char* __xtransname = "_LBXPROXYTrans";
#endif /* LBXPROXY_t */
#if !defined(TRANS)
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _XTrans##func
#else
#define TRANS(func) _XTrans/**/func
@@ -169,12 +181,15 @@ static char* __xtransname = "_XTrans";
* This structure needs to be independent of the socket/TLI interface used.
*/
+#if defined(IPv6) && defined(AF_INET6)
+typedef struct sockaddr_storage Xtransaddr;
+#else
#define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */
typedef struct {
unsigned char addr[XTRANS_MAX_ADDR_LEN];
} Xtransaddr;
-
+#endif
#ifdef LONG64
typedef int BytesReadable_t;
@@ -183,7 +198,7 @@ typedef long BytesReadable_t;
#endif
-#if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__)) || defined(MINIX)
+#if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__))
/*
* TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
@@ -221,6 +236,7 @@ typedef struct _XtransConnInfo *XtransConnInfo;
#define TRANS_CONNECT_FAILED -1
#define TRANS_TRY_CONNECT_AGAIN -2
+#define TRANS_IN_PROGRESS -3
/*
@@ -323,7 +339,8 @@ int TRANS(SetOption)(
int TRANS(CreateListener)(
XtransConnInfo, /* ciptr */
- char * /* port */
+ char *, /* port */
+ unsigned int /* flags */
);
int TRANS(NoListen) (
diff --git a/xc/lib/xtrans/Xtransdnet.c b/xc/lib/xtrans/Xtransdnet.c
index ebaadaa2e..40b08b30a 100644
--- a/xc/lib/xtrans/Xtransdnet.c
+++ b/xc/lib/xtrans/Xtransdnet.c
@@ -1,9 +1,13 @@
-/* $TOG: Xtransdnet.c /main/17 1998/02/06 15:54:33 kaleb $ */
+/* $Xorg: Xtransdnet.c,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/xtrans/Xtransdnet.c,v 3.4 1999/06/20 08:41:21 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/Xtransdnet.c,v 3.8 2003/08/26 15:38:39 tsi Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -336,7 +340,7 @@ TRANS(DNETSetOption) (XtransConnInfo ciptr, int option, int arg)
#ifdef TRANS_SERVER
static int
-TRANS(DNETCreateListener) (XtransConnInfo ciptr, char *port)
+TRANS(DNETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
{
struct sockaddr_dn dnsock;
@@ -373,7 +377,7 @@ TRANS(DNETCreateListener) (XtransConnInfo ciptr, char *port)
/* Set a flag to indicate that this connection is a listener */
- ciptr->flags = 1;
+ ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS);
return 0;
}
diff --git a/xc/lib/xtrans/Xtransint.h b/xc/lib/xtrans/Xtransint.h
index 2b67612a8..9b73f5ef5 100644
--- a/xc/lib/xtrans/Xtransint.h
+++ b/xc/lib/xtrans/Xtransint.h
@@ -1,9 +1,13 @@
-/* $TOG: Xtransint.h /main/27 1998/02/06 15:54:39 kaleb $ */
+/* $Xorg: Xtransint.h,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/xtrans/Xtransint.h,v 3.26 1999/06/20 08:41:21 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/Xtransint.h,v 3.41 2003/08/28 00:35:23 tsi Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -68,124 +72,120 @@ from The Open Group.
* message.
*/
-#ifndef __EMX__
+#ifndef XTRANSDEBUG
+# ifndef __UNIXOS2__
# define XTRANSDEBUG 1
-#else
-#define XTRANSDEBUG 1
+# else
+# define XTRANSDEBUG 1
+# endif
#endif
#ifdef WIN32
-#define _WILLWINSOCK_
+# define _WILLWINSOCK_
#endif
#include "Xtrans.h"
#ifdef XTRANSDEBUG
-#include <stdio.h>
+# include <stdio.h>
#endif /* XTRANSDEBUG */
#include <errno.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno; /* Internal system error number. */
-#endif
#ifndef WIN32
-#ifndef MINIX
-#ifndef Lynx
-#include <sys/socket.h>
-#else
-#include <socket.h>
-#endif
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#endif
-#ifdef __EMX__
-#include <sys/ioctl.h>
-#endif
+# ifndef Lynx
+# include <sys/socket.h>
+# else
+# include <socket.h>
+# endif
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# ifdef __UNIXOS2__
+# include <sys/ioctl.h>
+# endif
/*
* Moved the setting of NEED_UTSNAME to this header file from Xtrans.c,
* to avoid a race condition. JKJ (6/5/97)
*/
-#if (defined(_POSIX_SOURCE) && !defined(AIXV3)) || defined(hpux) || defined(USG) || defined(SVR4) || defined(SCO)
-#ifndef NEED_UTSNAME
-#define NEED_UTSNAME
-#endif
-#include <sys/utsname.h>
-#endif
+# if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(hpux) || defined(USG) || defined(SVR4) || defined(SCO)
+# ifndef NEED_UTSNAME
+# define NEED_UTSNAME
+# endif
+# include <sys/utsname.h>
+# endif
/*
* makedepend screws up on #undef OPEN_MAX, so we define a new symbol
*/
-#ifndef TRANS_OPEN_MAX
-
-#ifndef X_NOT_POSIX
-#ifdef _POSIX_SOURCE
-#include <limits.h>
-#else
-#define _POSIX_SOURCE
-#include <limits.h>
-#undef _POSIX_SOURCE
-#endif
-#endif
-#ifndef OPEN_MAX
-#ifdef __GNU__
-#define OPEN_MAX (sysconf(_SC_OPEN_MAX))
-#endif
-#ifdef SVR4
-#define OPEN_MAX 256
-#else
-#include <sys/param.h>
-#ifndef OPEN_MAX
-#ifdef __OSF1__
-#define OPEN_MAX 256
-#else
-#ifdef NOFILE
-#define OPEN_MAX NOFILE
-#else
-#ifndef __EMX__
-#define OPEN_MAX NOFILES_MAX
-#else
-#define OPEN_MAX 256
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#ifdef __GNU__
-#define TRANS_OPEN_MAX OPEN_MAX
-#else /* !__GNU__ */
-#if OPEN_MAX > 256
-#define TRANS_OPEN_MAX 256
-#else
-#define TRANS_OPEN_MAX OPEN_MAX
-#endif
-#endif /*__GNU__*/
-
-#endif /* TRANS_OPEN_MAX */
-
-#ifdef __EMX__
-#define ESET(val)
-#else
-#define ESET(val) errno = val
-#endif
-#define EGET() errno
+# ifndef TRANS_OPEN_MAX
+
+# ifndef X_NOT_POSIX
+# ifdef _POSIX_SOURCE
+# include <limits.h>
+# else
+# define _POSIX_SOURCE
+# include <limits.h>
+# undef _POSIX_SOURCE
+# endif
+# endif
+# ifndef OPEN_MAX
+# if defined(_SC_OPEN_MAX)
+# define OPEN_MAX (sysconf(_SC_OPEN_MAX))
+# else
+# ifdef SVR4
+# define OPEN_MAX 256
+# else
+# include <sys/param.h>
+# ifndef OPEN_MAX
+# ifdef __OSF1__
+# define OPEN_MAX 256
+# else
+# ifdef NOFILE
+# define OPEN_MAX NOFILE
+# else
+# if !defined(__UNIXOS2__) && !defined(__QNX__)
+# define OPEN_MAX NOFILES_MAX
+# else
+# define OPEN_MAX 256
+# endif
+# endif
+# endif
+# endif
+# endif
+# endif
+# endif
+# if defined(_SC_OPEN_MAX)
+# define TRANS_OPEN_MAX OPEN_MAX
+# else /* !__GNU__ */
+# if OPEN_MAX > 256
+# define TRANS_OPEN_MAX 256
+# else
+# define TRANS_OPEN_MAX OPEN_MAX
+# endif
+# endif /*__GNU__*/
+
+# endif /* TRANS_OPEN_MAX */
+
+# ifdef __UNIXOS2__
+# define ESET(val)
+# else
+# define ESET(val) errno = val
+# endif
+# define EGET() errno
#else /* WIN32 */
-#include <limits.h> /* for USHRT_MAX */
+# include <limits.h> /* for USHRT_MAX */
-#define ESET(val) WSASetLastError(val)
-#define EGET() WSAGetLastError()
+# define ESET(val) WSASetLastError(val)
+# define EGET() WSAGetLastError()
#endif /* WIN32 */
-#ifndef NULL
-#define NULL 0
-#endif
+#include <stddef.h>
#ifdef X11_t
#define X_TCP_PORT 6000
@@ -227,7 +227,7 @@ typedef struct _Xtransport {
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
-
+ char ** nolisten;
XtransConnInfo (*OpenCOTSServer)(
struct _Xtransport *, /* transport */
char *, /* protocol */
@@ -284,10 +284,13 @@ typedef struct _Xtransport {
);
#ifdef TRANS_SERVER
+/* Flags */
+# define ADDR_IN_USE_ALLOWED 1
int (*CreateListener)(
XtransConnInfo, /* connection */
- char * /* port */
+ char *, /* port */
+ unsigned int /* flags */
);
int (*ResetListener)(
@@ -369,14 +372,17 @@ typedef struct _Xtransport_table {
#define TRANS_LOCAL (1<<1) /* local transport */
#define TRANS_DISABLED (1<<2) /* Don't open this one */
#define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */
+#define TRANS_NOUNLINK (1<<4) /* Dont unlink transport endpoints */
+/* Flags to preserve when setting others */
+#define TRANS_KEEPFLAGS (TRANS_NOUNLINK)
/*
* readv() and writev() don't exist or don't work correctly on some
* systems, so they may be emulated.
*/
-#if defined(CRAY) || (defined(SYSV) && defined(i386) && !defined(SCO325)) || defined(WIN32) || defined(__sxg__) || defined(__EMX__)
+#if defined(CRAY) || (defined(SYSV) && defined(i386) && !defined(SCO325)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
#define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt)
@@ -393,7 +399,7 @@ static int TRANS(ReadV)(
#endif /* CRAY || (SYSV && i386) || WIN32 || __sxg__ || */
-#if defined(CRAY) || (defined(SYSV) && defined(i386) && !defined(SCO325)) || defined(WIN32) || defined(__sxg__) || defined(__EMX__)
+#if defined(CRAY) || (defined(SYSV) && defined(i386) && !defined(SCO325)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
#define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt)
diff --git a/xc/lib/xtrans/Xtranslcl.c b/xc/lib/xtrans/Xtranslcl.c
index 485994d5f..352f36061 100644
--- a/xc/lib/xtrans/Xtranslcl.c
+++ b/xc/lib/xtrans/Xtranslcl.c
@@ -1,9 +1,13 @@
-/* $TOG: Xtranslcl.c /main/37 1998/04/29 07:18:40 barstow $ */
+/* $Xorg: Xtranslcl.c,v 1.6 2001/02/09 02:04:06 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/xtrans/Xtranslcl.c,v 3.33 1999/06/20 08:41:22 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/Xtranslcl.c,v 3.41 2003/08/26 15:38:39 tsi Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -275,12 +279,14 @@ static int
TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
{
+#ifdef PTSNODENAME
int fd,server,exitval,alarm_time,ret;
char server_path[64];
char *slave, namelen;
char buf[20]; /* MAX_PATH_LEN?? */
PFV savef;
pid_t saved_pid;
+#endif
PRMSG(2,"PTSOpenClient(%s)\n", port, 0,0 );
@@ -415,9 +421,11 @@ static int
TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
{
+#ifdef PTSNODENAME
int fd, server;
char server_path[64], *slave;
int mode;
+#endif
PRMSG(2,"PTSOpenServer(%s)\n", port, 0,0 );
@@ -446,8 +454,8 @@ TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
return(-1);
}
- if( (fd=open(server_path, O_RDWR)) >= 0 ) {
#if 0
+ if( (fd=open(server_path, O_RDWR)) >= 0 ) {
/*
* This doesn't prevent the server from starting up, and doesn't
* prevent clients from trying to connect to the in-use PTS (which
@@ -457,11 +465,10 @@ TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
PRMSG(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path, 0,0 );
close(fd);
return(-1);
+ }
#else
- /* Just remove the old path (which is what happens with UNIXCONN) */
- ;
+ /* Just remove the old path (which is what happens with UNIXCONN) */
#endif
- }
unlink(server_path);
@@ -618,10 +625,12 @@ static int
TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
{
+#ifdef NAMEDNODENAME
int fd;
char server_path[64];
struct stat filestat;
extern int isastream();
+#endif
PRMSG(2,"NAMEDOpenClient(%s)\n", port, 0,0 );
@@ -636,7 +645,7 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
(void) sprintf(server_path, "%s%s", NAMEDNODENAME, port);
}
} else {
- (void) sprintf(server_path, "%s%d", NAMEDNODENAME, getpid());
+ (void) sprintf(server_path, "%s%ld", NAMEDNODENAME, (long)getpid());
}
if (stat(server_path, &filestat) < 0 ) {
@@ -687,10 +696,12 @@ static int
TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port)
{
+#ifdef NAMEDNODENAME
int fd, pipefd[2];
char server_path[64];
struct stat sbuf;
int mode;
+#endif
PRMSG(2,"NAMEDOpenServer(%s)\n", port, 0,0 );
@@ -705,7 +716,7 @@ TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port)
(void) sprintf(server_path, "%s%s", NAMEDNODENAME, port);
}
} else {
- (void) sprintf(server_path, "%s%d", NAMEDNODENAME, getpid());
+ (void) sprintf(server_path, "%s%ld", NAMEDNODENAME, (long)getpid());
}
#ifdef HAS_STICKY_DIR_BIT
@@ -761,9 +772,7 @@ TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port)
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
- PRMSG(1,"NAMEDOpenServer: failed to fill in addr info\n",
- 0,0,0);
- close(fd);
+ PRMSG(1,"NAMEDOpenServer: failed to fill in addr info\n", 0,0,0);
return -1;
}
@@ -827,12 +836,15 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
#ifndef sun
+
+/* SCO doesnt use the ISC transport type - it causes problems */
+#ifndef SCO325
+
/*
- * connect_spipe is used by both the SCO and ISC connection types.
+ * connect_spipe is used by the ISC connection type.
*/
static int
connect_spipe(int fd1, int fd2)
-
{
long temp;
struct strfdinsert sbuf;
@@ -854,7 +866,7 @@ connect_spipe(int fd1, int fd2)
}
/*
- * connect_spipe is used by both the SCO and ISC connection types.
+ * named_spipe is used by ISC connection type.
*/
static int
@@ -876,7 +888,7 @@ named_spipe(int fd, char *path)
} else {
ret = fd;
}
-
+
return(ret);
}
@@ -889,6 +901,7 @@ static int
TRANS(ISCOpenClient)(XtransConnInfo ciptr, char *port)
{
+#ifdef ISCDEVNODENAME
int fd,fds,server;
char server_path[64];
char server_dev_path[64];
@@ -896,9 +909,10 @@ TRANS(ISCOpenClient)(XtransConnInfo ciptr, char *port)
long temp;
mode_t spmode;
struct stat filestat;
-
+#endif
+
PRMSG(2,"ISCOpenClient(%s)\n", port, 0,0 );
-
+
#if !defined(ISCDEVNODENAME)
PRMSG(1,"ISCOpenClient: Protocol is not supported by a ISC connection\n", 0,0,0);
return -1;
@@ -923,7 +937,7 @@ TRANS(ISCOpenClient)(XtransConnInfo ciptr, char *port)
}
}
}
-
+
if (server < 0) {
/* try the alternate path */
if (stat(server_dev_path, &filestat) != -1) {
@@ -935,7 +949,7 @@ TRANS(ISCOpenClient)(XtransConnInfo ciptr, char *port)
}
}
}
-
+
if (server < 0) {
PRMSG(1,"ISCOpenClient: can't open either device %s or %s\n",
server_path, server_dev_path, 0 );
@@ -965,7 +979,7 @@ TRANS(ISCOpenClient)(XtransConnInfo ciptr, char *port)
buf.offset = 0;
buf.fildes = fd;
buf.flags = 0;
-
+
if (ioctl(fds, I_FDINSERT, &buf) < 0 ||
ioctl(server, I_SENDFD, fds) < 0) {
PRMSG(1,"ISCOpenClient: ioctl(I_FDINSERT or I_SENDFD) failed\n",
@@ -979,7 +993,7 @@ TRANS(ISCOpenClient)(XtransConnInfo ciptr, char *port)
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
+
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
PRMSG(1,"ISCOpenClient: failed to fill in addr info\n",
@@ -1002,19 +1016,21 @@ static int
TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port)
{
+#ifdef ISCDEVNODENAME
int fd = -1,fds = -1;
char server_path[64],server_unix_path[64];
unsigned int mode = 0;
-
+#endif
+
PRMSG(2,"ISCOpenServer(%s)\n", port, 0,0 );
-
+
#if !defined(ISCDEVNODENAME)
PRMSG(1,"ISCOpenServer: Protocol is not supported by a ISC connection\n", 0,0,0);
return -1;
#else
(void) sprintf(server_path, ISCDEVNODENAME, port);
(void) sprintf(server_unix_path, ISCTMPNODENAME, port);
-
+
#ifdef HAS_STICKY_DIR_BIT
mode = 01777;
#else
@@ -1033,15 +1049,15 @@ TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port)
X_ISC_DIR, errno, 0);
return(-1);
}
-
+
unlink(server_path);
-
+
if( ((fds=open(DEV_SPX, O_RDWR)) < 0) ||
((fd =open(DEV_SPX, O_RDWR)) < 0)) {
PRMSG(1,"ISCOpenServer: failed to open %s\n", DEV_SPX, 0,0 );
return -1;
}
-
+
if( (connect_spipe(fds, fd) < 0) ||
(named_spipe(fds, server_path) < 0)) {
PRMSG(1,"ISCOpenServer: failed connect pipes\n", 0,0,0 );
@@ -1049,22 +1065,22 @@ TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port)
close(fds);
return -1;
}
-
+
#if !defined(UNIXCONN)
/*
* If the UNIX Domain socket transport is not being used, then link this
* device to the path /tmp/.X11-unix/X path.
*/
#define X_UNIX_DIR "/tmp/.X11-unix"
-
+
if (trans_mkdir(X_UNIX_DIR, mode) == -1) {
PRMSG (1, "ISCOpenServer: mkdir(%s) failed, errno = %d\n",
X_UNIX_DIR, errno, 0);
return(-1);
}
-
+
unlink(server_unix_path);
-
+
#ifdef SVR4
/* we prefer symbolic links because hard links can't cross file systems */
if( symlink(server_path, server_unix_path) < 0 )
@@ -1091,11 +1107,11 @@ TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port)
*/
#endif /* SVR4 */
#endif /* !UNIXCONN */
-
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
+
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
PRMSG(1,"ISCOpenServer: failed to fill in addr info\n",
@@ -1114,9 +1130,9 @@ TRANS(ISCAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
{
struct strrecvfd str;
-
+
PRMSG(2,"ISCAccept(%d)\n", ciptr->fd, 0,0 );
-
+
while (ioctl(ciptr->fd, I_RECVFD, &str) < 0) {
if (errno != EAGAIN) {
PRMSG(1,"ISCAccept: Can't read fildes", 0,0,0 );
@@ -1124,11 +1140,11 @@ TRANS(ISCAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
return(-1);
}
}
-
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
+
newciptr->addrlen=ciptr->addrlen;
if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) {
PRMSG(1,
@@ -1138,9 +1154,9 @@ TRANS(ISCAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
*status = TRANS_ACCEPT_BAD_MALLOC;
return -1;
}
-
+
memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen);
-
+
newciptr->peeraddrlen=newciptr->addrlen;
if( (newciptr->peeraddr=(char *)xalloc(newciptr->peeraddrlen)) == NULL ) {
PRMSG(1,
@@ -1151,27 +1167,35 @@ TRANS(ISCAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
*status = TRANS_ACCEPT_BAD_MALLOC;
return -1;
}
-
+
memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen);
-
+
*status = 0;
return(str.fd);
}
#endif /* TRANS_SERVER */
-
+#endif /* !SCO325 */
-
/* SCO */
+/*
+ * 2002-11-09 (jkj@sco.com)
+ *
+ * This code has been modified to match what is in the actual SCO X server.
+ * This greatly helps inter-operability between X11R6 and X11R5 (the native
+ * SCO server). Mainly, it relies on streams nodes existing in /dev, not
+ * creating them or unlinking them, which breaks the native X server.
+ */
+
#ifdef TRANS_CLIENT
static int
TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
-
{
+#ifdef SCORNODENAME
int fd, server, fl, ret;
char server_path[64];
struct strbuf ctlbuf;
@@ -1179,60 +1203,62 @@ TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
void (*savef)();
long temp;
extern int getmsg(), putmsg();
-
+#endif
+
PRMSG(2,"SCOOpenClient(%s)\n", port, 0,0 );
-
+
#if !defined(SCORNODENAME)
PRMSG(1,"SCOOpenClient: Protocol is not supported by a SCO connection\n", 0,0,0);
return -1;
#else
(void) sprintf(server_path, SCORNODENAME, port);
-
+
if ((server = open(server_path, O_RDWR)) < 0) {
PRMSG(1,"SCOOpenClient: failed to open %s\n", server_path, 0,0 );
return -1;
}
-
+
if ((fd = open(DEV_SPX, O_RDWR)) < 0) {
PRMSG(1,"SCOOpenClient: failed to open %s\n", DEV_SPX, 0,0 );
close(server);
return -1;
}
-
+
(void) write(server, &server, 1);
ctlbuf.len = 0;
ctlbuf.maxlen = sizeof(long);
ctlbuf.buf = (caddr_t)&temp;
fl = 0;
-
+
savef = signal(SIGALRM, _dummy);
alarm_time = alarm(10);
-
+
ret = getmsg(server, &ctlbuf, 0, &fl);
-
+
(void) alarm(alarm_time);
(void) signal(SIGALRM, savef);
-
+
if (ret < 0) {
PRMSG(1,"SCOOpenClient: error from getmsg\n", 0,0,0 );
close(fd);
close(server);
return -1;
}
-
+
/* The msg we got via getmsg is the result of an
* I_FDINSERT, so if we do a putmsg with whatever
* we recieved, we're doing another I_FDINSERT ...
*/
(void) putmsg(fd, &ctlbuf, 0, 0);
(void) fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0)|O_NDELAY);
-
+
(void) close(server);
-
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
+
+ ciptr->flags |= TRANS_NOUNLINK;
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
PRMSG(1,"SCOOpenClient: failed to fill addr info\n",
@@ -1240,7 +1266,7 @@ TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
close(fd);
return -1;
}
-
+
return(fd);
#endif /* !SCORNODENAME */
@@ -1253,55 +1279,82 @@ TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
static int
TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
-
{
+#ifdef SCORNODENAME
char serverR_path[64];
char serverS_path[64];
- int fdr = -1;
- int fds = -1;
-
+ struct flock mylock;
+ int fdr = -1;
+ int fds = -1;
+ long temp;
+ struct strfdinsert sbuf;
+#endif
+
PRMSG(2,"SCOOpenServer(%s)\n", port, 0,0 );
-
+
#if !defined(SCORNODENAME)
PRMSG(1,"SCOOpenServer: Protocol is not supported by a SCO connection\n", 0,0,0);
return -1;
#else
(void) sprintf(serverR_path, SCORNODENAME, port);
(void) sprintf(serverS_path, SCOSNODENAME, port);
-
- unlink(serverR_path);
- unlink(serverS_path);
-
- if ((fds = open(DEV_SPX, O_RDWR)) < 0 ||
- (fdr = open(DEV_SPX, O_RDWR)) < 0 ) {
- PRMSG(2,"SCOOpenServer: failed to open %s\n", DEV_SPX, 0,0 );
+
+ fds = open (serverS_path, O_RDWR | O_NDELAY);
+ if (fds < 0) {
+ PRMSG(1,"SCOOpenServer: failed to open %s", serverS_path, 0, 0);
return -1;
}
-
- if (connect_spipe(fds, fdr) != -1 &&
- named_spipe(fds, serverS_path) != -1 &&
- named_spipe(fdr, serverR_path) != -1) {
- PRMSG(2,"SCOOpenServer: connect pipes\n", 0,0,0 );
- } else {
- PRMSG(2,"SCOOpenServer: failed to connect pipes\n", 0,0,0 );
- close(fds);
- close(fdr);
+
+ /*
+ * Lock the connection device for the duration of the server.
+ * This resolves multiple server starts especially on SMP machines.
+ */
+ mylock.l_type = F_WRLCK;
+ mylock.l_whence = 0;
+ mylock.l_start = 0;
+ mylock.l_len = 0;
+ if (fcntl (fds, F_SETLK, &mylock) < 0) {
+ PRMSG(1,"SCOOpenServer: failed to lock %s", serverS_path, 0, 0);
+ close (fds);
+ return -1;
+ }
+
+ fdr = open (serverR_path, O_RDWR | O_NDELAY);
+ if (fds < 0) {
+ PRMSG(1,"SCOOpenServer: failed to open %s", serverR_path, 0, 0);
+ close (fds);
return -1;
}
-
+
+ sbuf.databuf.maxlen = 0;
+ sbuf.databuf.len = -1;
+ sbuf.databuf.buf = NULL;
+ sbuf.ctlbuf.maxlen = sizeof(long);
+ sbuf.ctlbuf.len = sizeof(long);
+ sbuf.ctlbuf.buf = (caddr_t)&temp;
+ sbuf.offset = 0;
+ sbuf.flags = 0;
+ sbuf.fildes = fdr;
+
+ if (ioctl(fds, I_FDINSERT, &sbuf) < 0) {
+ PRMSG(1,"SCOOpenServer: ioctl(I_FDINSERT) failed on %s", serverS_path, 0, 0);
+ close (fdr);
+ close (fds);
+ return -1;
+ }
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
- if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0)
- {
- PRMSG(1,"SCOOpenServer: failed to fill in addr info\n",
- 0,0,0);
+
+ ciptr->flags |= TRANS_NOUNLINK;
+ if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) {
+ PRMSG(1,"SCOOpenServer: failed to fill in addr info\n", 0,0,0);
close(fds);
close(fdr);
return -1;
}
-
+
return(fds);
#endif /* !SCORNODENAME */
@@ -1309,36 +1362,47 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
static int
TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
-
{
- char c;
- int fd;
-
+ char c;
+ int fd;
+ long temp;
+ struct strfdinsert sbuf;
+
PRMSG(2,"SCOAccept(%d)\n", ciptr->fd, 0,0 );
-
+
if (read(ciptr->fd, &c, 1) < 0) {
PRMSG(1,"SCOAccept: can't read from client",0,0,0);
*status = TRANS_ACCEPT_MISC_ERROR;
return(-1);
}
-
+
if( (fd = open(DEV_SPX, O_RDWR)) < 0 ) {
PRMSG(1,"SCOAccept: can't open \"%s\"",DEV_SPX, 0,0 );
*status = TRANS_ACCEPT_MISC_ERROR;
return(-1);
}
-
- if (connect_spipe(ciptr->fd, fd) < 0) {
- PRMSG(1,"SCOAccept: can't connect pipes", 0,0,0 );
- (void) close(fd);
+
+ sbuf.databuf.maxlen = 0;
+ sbuf.databuf.len = -1;
+ sbuf.databuf.buf = NULL;
+ sbuf.ctlbuf.maxlen = sizeof(long);
+ sbuf.ctlbuf.len = sizeof(long);
+ sbuf.ctlbuf.buf = (caddr_t)&temp;
+ sbuf.offset = 0;
+ sbuf.flags = 0;
+ sbuf.fildes = fd;
+
+ if (ioctl(ciptr->fd, I_FDINSERT, &sbuf) < 0) {
+ PRMSG(1,"SCOAccept: ioctl(I_FDINSERT) failed", 0, 0, 0);
+ close (fd);
*status = TRANS_ACCEPT_MISC_ERROR;
- return(-1);
+ return -1;
}
-
+
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
-
+
newciptr->addrlen=ciptr->addrlen;
if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) {
PRMSG(1,
@@ -1348,9 +1412,10 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
*status = TRANS_ACCEPT_BAD_MALLOC;
return -1;
}
-
+
memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen);
-
+ newciptr->flags |= TRANS_NOUNLINK;
+
newciptr->peeraddrlen=newciptr->addrlen;
if( (newciptr->peeraddr=(char *)xalloc(newciptr->peeraddrlen)) == NULL ) {
PRMSG(1,
@@ -1361,9 +1426,9 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
*status = TRANS_ACCEPT_BAD_MALLOC;
return -1;
}
-
+
memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen);
-
+
*status = 0;
return(fd);
@@ -1375,12 +1440,15 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
#ifdef TRANS_REOPEN
+#ifndef sun
static int
TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
{
+#ifdef PTSNODENAME
char server_path[64];
+#endif
PRMSG(2,"PTSReopenServer(%d,%s)\n", fd, port, 0 );
@@ -1395,7 +1463,7 @@ TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
(void) sprintf(server_path, "%s%s", PTSNODENAME, port);
}
} else {
- (void) sprintf(server_path, "%s%d", PTSNODENAME, getpid());
+ (void) sprintf(server_path, "%s%ld", PTSNODENAME, (long)getpid());
}
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
@@ -1410,11 +1478,15 @@ TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
#endif /* !PTSNODENAME */
}
+#endif /* !sun */
+
static int
TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd, char *port)
{
+#ifdef NAMEDNODENAME
char server_path[64];
+#endif
PRMSG(2,"NAMEDReopenServer(%s)\n", port, 0,0 );
@@ -1429,7 +1501,7 @@ TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd, char *port)
(void) sprintf(server_path, "%s%s", NAMEDNODENAME, port);
}
} else {
- (void) sprintf(server_path, "%s%d", NAMEDNODENAME, getpid());
+ (void) sprintf(server_path, "%s%ld", NAMEDNODENAME, (long)getpid());
}
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
@@ -1444,14 +1516,18 @@ TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd, char *port)
#endif /* !NAMEDNODENAME */
}
+#ifndef sun
+#ifndef SCO325
static int
TRANS(ISCReopenServer)(XtransConnInfo ciptr, int fd, char *port)
{
- char server_path[64],server_unix_path[64];
-
+#ifdef ISCDEVNODENAME
+ char server_path[64], server_unix_path[64];
+#endif
+
PRMSG(2,"ISCReopenServer(%s)\n", port, 0,0 );
-
+
#if !defined(ISCDEVNODENAME)
PRMSG(1,"ISCReopenServer: Protocol is not supported by a ISC connection\n", 0,0,0);
return 0;
@@ -1461,45 +1537,47 @@ TRANS(ISCReopenServer)(XtransConnInfo ciptr, int fd, char *port)
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
- PRMSG(1,"ISCReopenServer: failed to fill in addr info\n",
- 0,0,0);
+ PRMSG(1, "ISCReopenServer: failed to fill in addr info\n", 0,0,0);
return 0;
}
-
+
return 1;
#endif /* !ISCDEVNODENAME */
}
-
+#endif /* !SCO325 */
static int
TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, char *port)
{
- char serverR_path[64];
- char serverS_path[64];
-
+#ifdef SCORNODENAME
+ char serverR_path[64], serverS_path[64];
+#endif
+
PRMSG(2,"SCOReopenServer(%s)\n", port, 0,0 );
-
+
#if !defined(SCORNODENAME)
PRMSG(1,"SCOReopenServer: Protocol is not supported by a SCO connection\n", 0,0,0);
return 0;
#else
(void) sprintf(serverR_path, SCORNODENAME, port);
(void) sprintf(serverS_path, SCOSNODENAME, port);
-
+
+ ciptr->flags |= TRANS_NOUNLINK;
if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0)
{
- PRMSG(1,"SCOReopenServer: failed to fill in addr info\n",
- 0,0,0);
+ PRMSG(1, "SCOReopenServer: failed to fill in addr info\n", 0,0,0);
return 0;
}
-
+
return 1;
#endif /* SCORNODENAME */
}
+#endif /* !sun */
+
#endif /* TRANS_REOPEN */
@@ -1708,6 +1786,7 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
#endif /* SVR4 */
#ifndef sun
+#ifndef SCO325
{"isc",
#ifdef TRANS_CLIENT
TRANS(ISCOpenClient),
@@ -1729,6 +1808,7 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
TRANS(ISCAccept)
#endif /* TRANS_SERVER */
},
+#endif /* !SCO325 */
{"sco",
#ifdef TRANS_CLIENT
@@ -1755,13 +1835,13 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
};
#define NUMTRANSPORTS (sizeof(LOCALtrans2devtab)/sizeof(LOCALtrans2dev))
-
+
static char *XLOCAL=NULL;
static char *workingXLOCAL=NULL;
static char *freeXLOCAL=NULL;
-#ifdef sco
-#define DEF_XLOCAL "UNIX:SCO:PTS:NAMED:ISC"
+#ifdef SCO325
+#define DEF_XLOCAL "SCO:UNIX:PTS"
#else
#define DEF_XLOCAL "UNIX:PTS:NAMED:ISC:SCO"
#endif
@@ -1771,7 +1851,7 @@ TRANS(LocalInitTransports)(char *protocol)
{
PRMSG(3,"LocalInitTransports(%s)\n", protocol, 0,0 );
-
+
if( strcmp(protocol,"local") && strcmp(protocol,"LOCAL") )
{
workingXLOCAL=freeXLOCAL=(char *)xalloc (strlen (protocol) + 1);
@@ -1796,26 +1876,29 @@ TRANS(LocalEndTransports)(void)
xfree(freeXLOCAL);
}
+#define TYPEBUFSIZE 32
+
+#ifdef TRANS_CLIENT
+
static LOCALtrans2dev *
TRANS(LocalGetNextTransport)(void)
{
int i,j;
char *typetocheck;
-#define TYPEBUFSIZE 32
char typebuf[TYPEBUFSIZE];
PRMSG(3,"LocalGetNextTransport()\n", 0,0,0 );
-
+
while(1)
{
if( workingXLOCAL == NULL || *workingXLOCAL == '\0' )
return NULL;
-
+
typetocheck=workingXLOCAL;
workingXLOCAL=strchr(workingXLOCAL,':');
if(workingXLOCAL && *workingXLOCAL)
*workingXLOCAL++='\0';
-
+
for(i=0;i<NUMTRANSPORTS;i++)
{
/*
@@ -1826,7 +1909,7 @@ TRANS(LocalGetNextTransport)(void)
for(j=0;j<TYPEBUFSIZE;j++)
if (isupper(typebuf[j]))
typebuf[j]=tolower(typebuf[j]);
-
+
/* Now, see if they match */
if(!strcmp(LOCALtrans2devtab[i].transname,typebuf))
return &LOCALtrans2devtab[i];
@@ -1838,8 +1921,6 @@ TRANS(LocalGetNextTransport)(void)
#endif
}
-#ifdef TRANS_CLIENT
-
#ifdef NEED_UTSNAME
#include <sys/utsname.h>
#endif
@@ -1882,13 +1963,12 @@ static XtransConnInfo
TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
{
- int fd = -1;
LOCALtrans2dev *transptr;
XtransConnInfo ciptr;
int index;
PRMSG(3,"LocalOpenClient()\n", 0,0,0 );
-
+
/*
* Make sure 'host' is really local. If not, we return failure.
* The reason we make this check is because a process may advertise
@@ -1917,18 +1997,18 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
* we don't have to do anything special.
*/
#endif /* X11_t */
-
+
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1,"LocalOpenClient: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
return NULL;
}
-
+
ciptr->fd = -1;
-
+
TRANS(LocalInitTransports)(protocol);
-
+
index = 0;
for(transptr=TRANS(LocalGetNextTransport)();
transptr!=NULL;transptr=TRANS(LocalGetNextTransport)(), index++)
@@ -1955,18 +2035,18 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
if( ciptr->fd >= 0 )
break;
}
-
+
TRANS(LocalEndTransports)();
-
+
if( ciptr->fd < 0 )
{
xfree(ciptr);
return NULL;
}
-
+
ciptr->priv=(char *)transptr;
ciptr->index = index;
-
+
return ciptr;
}
@@ -1979,11 +2059,11 @@ static XtransConnInfo
TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
{
- int i,fd = -1;
+ int i;
XtransConnInfo ciptr;
-
+
PRMSG(2,"LocalOpenServer(%d,%s,%s)\n", type, protocol, port);
-
+
#if defined(X11_t)
/*
* For X11, the port will be in the format xserverN where N is the
@@ -1992,14 +2072,14 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
* the port. This just truncates port to the display portion.
*/
#endif /* X11_t */
-
+
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1,"LocalOpenServer: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
return NULL;
}
-
+
for(i=1;i<NUMTRANSPORTS;i++)
{
if( strcmp(protocol,LOCALtrans2devtab[i].transname) != 0 )
@@ -2025,11 +2105,11 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
if( ciptr->fd >= 0 ) {
ciptr->priv=(char *)&LOCALtrans2devtab[i];
ciptr->index=i;
- ciptr->flags=1;
+ ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS);
return ciptr;
}
}
-
+
xfree(ciptr);
return NULL;
}
@@ -2044,17 +2124,17 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
{
XtransConnInfo ciptr;
- int stat;
-
+ int stat = 0;
+
PRMSG(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd);
-
+
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1,"LocalReopenServer: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
return NULL;
}
-
+
ciptr->fd = fd;
switch( type )
@@ -2073,10 +2153,10 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
if( stat > 0 ) {
ciptr->priv=(char *)&LOCALtrans2devtab[index];
ciptr->index=index;
- ciptr->flags=1;
+ ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS);
return ciptr;
}
-
+
xfree(ciptr);
return NULL;
}
@@ -2097,7 +2177,7 @@ TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol,
{
PRMSG(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port);
-
+
return TRANS(LocalOpenClient)(XTRANS_OPEN_COTS_CLIENT, protocol, host, port);
}
@@ -2135,7 +2215,7 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
typetocheck = workingXLOCAL;
}
TRANS(LocalEndTransports)();
-
+
if (!found) {
PRMSG(3,"LocalOpenCOTSServer: disabling %s\n",thistrans->TransName,0,0);
thistrans->flags |= TRANS_DISABLED;
@@ -2156,7 +2236,7 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
{
PRMSG(2,"LocalOpenCLTSClient(%s,%s,%s)\n",protocol,host,port);
-
+
return TRANS(LocalOpenClient)(XTRANS_OPEN_CLTS_CLIENT, protocol, host, port);
}
@@ -2171,7 +2251,7 @@ TRANS(LocalOpenCLTSServer)(Xtransport *thistrans, char *protocol,
{
PRMSG(2,"LocalOpenCLTSServer(%s,%s,%s)\n",protocol,host,port);
-
+
return TRANS(LocalOpenServer)(XTRANS_OPEN_CLTS_SERVER, protocol, host, port);
}
@@ -2187,14 +2267,14 @@ TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
int index;
PRMSG(2,"LocalReopenCOTSServer(%d,%s)\n", fd, port, 0);
-
+
for(index=1;index<NUMTRANSPORTS;index++)
{
if( strcmp(thistrans->TransName,
LOCALtrans2devtab[index].transname) == 0 )
break;
}
-
+
if (index >= NUMTRANSPORTS)
{
return (NULL);
@@ -2211,14 +2291,14 @@ TRANS(LocalReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
int index;
PRMSG(2,"LocalReopenCLTSServer(%d,%s)\n", fd, port, 0);
-
+
for(index=1;index<NUMTRANSPORTS;index++)
{
if( strcmp(thistrans->TransName,
LOCALtrans2devtab[index].transname) == 0 )
break;
}
-
+
if (index >= NUMTRANSPORTS)
{
return (NULL);
@@ -2232,24 +2312,24 @@ TRANS(LocalReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
-static
+static int
TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg)
{
PRMSG(2,"LocalSetOption(%d,%d,%d)\n",ciptr->fd,option,arg);
-
+
return -1;
}
#ifdef TRANS_SERVER
-static
-TRANS(LocalCreateListener)(XtransConnInfo ciptr, char *port)
+static int
+TRANS(LocalCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags)
{
PRMSG(2,"LocalCreateListener(%x->%d,%s)\n",ciptr,ciptr->fd,port);
-
+
return 0;
}
@@ -2259,11 +2339,11 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status)
{
XtransConnInfo newciptr;
LOCALtrans2dev *transptr;
-
+
PRMSG(2,"LocalAccept(%x->%d)\n", ciptr, ciptr->fd,0);
-
+
transptr=(LOCALtrans2dev *)ciptr->priv;
-
+
if( (newciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo)))==NULL )
{
PRMSG(1,"LocalAccept: calloc(1,%d) failed\n",
@@ -2271,18 +2351,18 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
-
+
newciptr->fd=transptr->devaccept(ciptr,newciptr,status);
-
+
if( newciptr->fd < 0 )
{
xfree(newciptr);
return NULL;
}
-
+
newciptr->priv=(char *)transptr;
newciptr->index = ciptr->index;
-
+
*status = 0;
return newciptr;
@@ -2293,12 +2373,12 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status)
#ifdef TRANS_CLIENT
-static
+static int
TRANS(LocalConnect)(XtransConnInfo ciptr, char *host, char *port)
{
PRMSG(2,"LocalConnect(%x->%d,%s)\n", ciptr, ciptr->fd, port);
-
+
return 0;
}
@@ -2323,7 +2403,7 @@ TRANS(LocalRead)(XtransConnInfo ciptr, char *buf, int size)
{
PRMSG(2,"LocalRead(%d,%x,%d)\n", ciptr->fd, buf, size );
-
+
return read(ciptr->fd,buf,size);
}
@@ -2332,7 +2412,7 @@ TRANS(LocalWrite)(XtransConnInfo ciptr, char *buf, int size)
{
PRMSG(2,"LocalWrite(%d,%x,%d)\n", ciptr->fd, buf, size );
-
+
return write(ciptr->fd,buf,size);
}
@@ -2341,7 +2421,7 @@ TRANS(LocalReadv)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
PRMSG(2,"LocalReadv(%d,%x,%d)\n", ciptr->fd, buf, size );
-
+
return READV(ciptr,buf,size);
}
@@ -2350,7 +2430,7 @@ TRANS(LocalWritev)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
PRMSG(2,"LocalWritev(%d,%x,%d)\n", ciptr->fd, buf, size );
-
+
return WRITEV(ciptr,buf,size);
}
@@ -2359,7 +2439,7 @@ TRANS(LocalDisconnect)(XtransConnInfo ciptr)
{
PRMSG(2,"LocalDisconnect(%x->%d)\n", ciptr, ciptr->fd, 0);
-
+
return 0;
}
@@ -2370,11 +2450,11 @@ TRANS(LocalClose)(XtransConnInfo ciptr)
struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr;
char path[200]; /* > sizeof sun_path +1 */
int ret;
-
+
PRMSG(2,"LocalClose(%x->%d)\n", ciptr, ciptr->fd ,0);
-
+
ret=close(ciptr->fd);
-
+
if(ciptr->flags
&& sockname
&& sockname->sun_family == AF_UNIX
@@ -2382,9 +2462,10 @@ TRANS(LocalClose)(XtransConnInfo ciptr)
{
strncpy(path,sockname->sun_path,
ciptr->addrlen-sizeof(sockname->sun_family));
- unlink(path);
+ if (!(ciptr->flags & TRANS_NOUNLINK))
+ unlink(path);
}
-
+
return ret;
}
@@ -2395,11 +2476,11 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
int ret;
PRMSG(2,"LocalCloseForCloning(%x->%d)\n", ciptr, ciptr->fd ,0);
-
+
/* Don't unlink path */
ret=close(ciptr->fd);
-
+
return ret;
}
@@ -2414,6 +2495,21 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
* call to SelectTransport() in Xtrans.c.
*/
+#ifdef TRANS_SERVER
+static char * local_aliases[] = {
+# ifndef sun
+ "pts",
+# endif
+ "named",
+# ifndef sun
+# ifndef SCO325
+ "isc",
+# endif
+ "sco",
+# endif
+ NULL };
+#endif
+
Xtransport TRANS(LocalFuncs) = {
/* Local Interface */
"local",
@@ -2422,6 +2518,7 @@ Xtransport TRANS(LocalFuncs) = {
TRANS(LocalOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ local_aliases,
TRANS(LocalOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -2463,6 +2560,7 @@ Xtransport TRANS(PTSFuncs) = {
TRANS(LocalOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ NULL,
TRANS(LocalOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -2504,6 +2602,7 @@ Xtransport TRANS(NAMEDFuncs) = {
TRANS(LocalOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ NULL,
TRANS(LocalOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -2536,7 +2635,7 @@ Xtransport TRANS(NAMEDFuncs) = {
};
#ifndef sun
-
+#ifndef SCO325
Xtransport TRANS(ISCFuncs) = {
/* Local Interface */
"isc",
@@ -2545,6 +2644,7 @@ Xtransport TRANS(ISCFuncs) = {
TRANS(LocalOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ NULL,
TRANS(LocalOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -2575,6 +2675,7 @@ Xtransport TRANS(ISCFuncs) = {
TRANS(LocalClose),
TRANS(LocalCloseForCloning),
};
+#endif /* !SCO325 */
Xtransport TRANS(SCOFuncs) = {
/* Local Interface */
"sco",
@@ -2583,6 +2684,7 @@ Xtransport TRANS(SCOFuncs) = {
TRANS(LocalOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ NULL,
TRANS(LocalOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
diff --git a/xc/lib/xtrans/Xtranssock.c b/xc/lib/xtrans/Xtranssock.c
index 4b61c9437..775080a93 100644
--- a/xc/lib/xtrans/Xtranssock.c
+++ b/xc/lib/xtrans/Xtranssock.c
@@ -1,9 +1,14 @@
-/* $TOG: Xtranssock.c /main/61 1998/02/06 15:54:53 kaleb $ */
+/* $Xorg: Xtranssock.c,v 1.11 2001/02/09 02:04:06 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
+Copyright 2002 Sun Microsystems, Inc. All rights reserved.
-All Rights Reserved.
+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.
@@ -16,13 +21,13 @@ 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
+Except as contained in this notice, the name of the copyright holders 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.
+from the copyright holders.
*/
-/* $XFree86: xc/lib/xtrans/Xtranssock.c,v 3.43 1999/07/04 13:39:53 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/Xtranssock.c,v 3.62 2003/08/24 17:35:13 tsi Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -51,15 +56,15 @@ from The Open Group.
#ifdef XTHREADS
#include <X11/Xthreads.h>
#endif
+
#ifndef WIN32
#if defined(TCPCONN) || defined(UNIXCONN)
+#include <sys/socket.h>
#include <netinet/in.h>
-#else
-#ifdef ESIX
-#include <lan/in.h>
-#endif
+#include <arpa/inet.h>
#endif
+
#if defined(TCPCONN) || defined(UNIXCONN)
#define X_INCLUDE_NETDB_H
#define XOS_USE_NO_LOCKING
@@ -77,35 +82,33 @@ from The Open Group.
#include <sys/stat.h>
#endif
-#if defined(hpux) || defined(__EMX__)
+#if defined(hpux) || defined(__UNIXOS2__) || (defined(MOTOROLA) && defined(SYSV))
#define NO_TCP_H
-#endif /* hpux */
-#ifdef MOTOROLA
-#ifdef SYSV
-#define NO_TCP_H
-#endif /* SYSV */
-#endif /* MOTOROLA */
+#endif
+
#ifndef NO_TCP_H
-#ifdef __osf__
+#if defined(__osf__) || defined(linux)
#include <sys/param.h>
#endif /* osf */
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+#include <sys/param.h>
#include <machine/endian.h>
#endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ */
#include <netinet/tcp.h>
#endif /* !NO_TCP_H */
+
#include <sys/ioctl.h>
-#if defined(SVR4) && !defined(SCO325) && !defined(DGUX)
+#if defined(SVR4) && !defined(SCO325) && !defined(DGUX) && !defined(_SEQUENT_)
#include <sys/filio.h>
#endif
-#if (defined(i386) && defined(SYSV)) || defined(_SEQUENT_)
-#if !defined(_SEQUENT_) && !defined(ESIX) && !defined(sco)
+
+#if (defined(i386) && defined(SYSV)) && !defined(sco) && !defined(sun)
#include <net/errno.h>
-#endif /* _SEQUENT_ || ESIX || SCO */
-#if !defined(ISC) || !defined(I_NREAD) || defined(SCO325)
+#endif
+
+#if (defined(i386) && defined(SYSV)) && (!defined(ISC) || !defined(I_NREAD) || defined(SCO325)) || defined(_SEQUENT_)
#include <sys/stropts.h>
-#endif
-#endif /* i386 && SYSV || _SEQUENT_ */
+#endif
#else /* !WIN32 */
@@ -129,7 +132,7 @@ from The Open Group.
#undef SO_DONTLINGER
#endif
-#if defined(__EMX__)
+#if defined(__UNIXOS2__)
#if defined(NOT_EMX09A)
static int IBMsockInit = 0;
#define SocketInitOnce()\
@@ -185,7 +188,13 @@ typedef struct _Sockettrans2dev {
static Sockettrans2dev Sockettrans2devtab[] = {
#ifdef TCPCONN
{"inet",AF_INET,SOCK_STREAM,SOCK_DGRAM,0},
+#if !defined(IPv6) || !defined(AF_INET6)
{"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0},
+#else /* IPv6 */
+ {"tcp",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0},
+ {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, /* fallback */
+ {"inet6",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0},
+#endif
#endif /* TCPCONN */
#ifdef UNIXCONN
{"unix",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0},
@@ -267,20 +276,20 @@ static Sockettrans2dev Sockettrans2devtab[] = {
*/
static int
-TRANS(SocketSelectFamily) (char *family)
+TRANS(SocketSelectFamily) (int first, char *family)
{
int i;
PRMSG (3,"SocketSelectFamily(%s)\n", family, 0, 0);
- for (i = 0; i < NUMSOCKETFAMILIES;i++)
+ for (i = first + 1; i < NUMSOCKETFAMILIES;i++)
{
if (!strcmp (family, Sockettrans2devtab[i].transname))
return i;
}
- return -1;
+ return (first == -1 ? -2 : -1);
}
@@ -293,16 +302,21 @@ static int
TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
{
+#if defined(IPv6) && defined(AF_INET6)
+ struct sockaddr_storage sockname;
+#else
struct sockaddr_in sockname;
+#endif
#if defined(SVR4) || defined(SCO325)
size_t namelen = sizeof sockname;
#else
int namelen = sizeof sockname;
#endif
- PRMSG (3,"SocketINETGetAddr(%x)\n", ciptr, 0, 0);
+ PRMSG (3,"SocketINETGetAddr(%p)\n", ciptr, 0, 0);
- if (getsockname (ciptr->fd,(struct sockaddr *) &sockname, &namelen) < 0)
+ if (getsockname (ciptr->fd,(struct sockaddr *) &sockname,
+ (void *)&namelen) < 0)
{
PRMSG (1,"SocketINETGetAddr: getsockname() failed: %d\n",
EGET(),0, 0);
@@ -321,7 +335,11 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
return -1;
}
+#if defined(IPv6) && defined(AF_INET6)
+ ciptr->family = ((struct sockaddr *)&sockname)->sa_family;
+#else
ciptr->family = sockname.sin_family;
+#endif
ciptr->addrlen = namelen;
memcpy (ciptr->addr, &sockname, ciptr->addrlen);
@@ -338,16 +356,21 @@ static int
TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
{
+#if defined(IPv6) && defined(AF_INET6)
+ struct sockaddr_storage sockname;
+#else
struct sockaddr_in sockname;
+#endif
#if defined(SVR4) || defined(SCO325)
size_t namelen = sizeof sockname;
#else
int namelen = sizeof sockname;
#endif
- PRMSG (3,"SocketINETGetPeerAddr(%x)\n", ciptr, 0, 0);
+ PRMSG (3,"SocketINETGetPeerAddr(%p)\n", ciptr, 0, 0);
- if (getpeername (ciptr->fd, (struct sockaddr *) &sockname, &namelen) < 0)
+ if (getpeername (ciptr->fd, (struct sockaddr *) &sockname,
+ (void *)&namelen) < 0)
{
PRMSG (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n",
EGET(), 0, 0);
@@ -396,7 +419,7 @@ TRANS(SocketOpen) (int i, int type)
#endif
#endif
) {
- PRMSG (1, "SocketOpen: socket() failed for %s\n",
+ PRMSG (2, "SocketOpen: socket() failed for %s\n",
Sockettrans2devtab[i].transname, 0, 0);
xfree ((char *) ciptr);
@@ -404,7 +427,11 @@ TRANS(SocketOpen) (int i, int type)
}
#ifdef TCP_NODELAY
- if (Sockettrans2devtab[i].family == AF_INET)
+ if (Sockettrans2devtab[i].family == AF_INET
+#if defined(IPv6) && defined(AF_INET6)
+ || Sockettrans2devtab[i].family == AF_INET6
+#endif
+ )
{
/*
* turn off TCP coalescence for INET sockets
@@ -457,26 +484,25 @@ TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol,
{
XtransConnInfo ciptr;
- int i;
+ int i = -1;
PRMSG (2, "SocketOpenCOTSClient(%s,%s,%s)\n",
protocol, host, port);
SocketInitOnce();
- if ((i = TRANS(SocketSelectFamily) (thistrans->TransName)) < 0)
- {
- PRMSG (1,
- "SocketOpenCOTSClient: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
- return NULL;
+ while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) {
+ if ((ciptr = TRANS(SocketOpen) (
+ i, Sockettrans2devtab[i].devcotsname)) != NULL)
+ break;
}
-
- if ((ciptr = TRANS(SocketOpen) (
- i, Sockettrans2devtab[i].devcotsname)) == NULL)
- {
- PRMSG (1,"SocketOpenCOTSClient: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
+ if (i < 0) {
+ if (i == -1)
+ PRMSG (1,"SocketOpenCOTSClient: Unable to open socket for %s\n",
+ thistrans->TransName, 0, 0);
+ else
+ PRMSG (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n",
+ thistrans->TransName, 0, 0);
return NULL;
}
@@ -498,25 +524,24 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
{
XtransConnInfo ciptr;
- int i;
+ int i = -1;
PRMSG (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
- if ((i = TRANS(SocketSelectFamily) (thistrans->TransName)) < 0)
- {
- PRMSG (1,
- "SocketOpenCOTSServer: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
- return NULL;
+ while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) {
+ if ((ciptr = TRANS(SocketOpen) (
+ i, Sockettrans2devtab[i].devcotsname)) != NULL)
+ break;
}
-
- if ((ciptr = TRANS(SocketOpen) (
- i, Sockettrans2devtab[i].devcotsname)) == NULL)
- {
- PRMSG (1,"SocketOpenCOTSServer: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
+ if (i < 0) {
+ if (i == -1)
+ PRMSG (1,"SocketOpenCOTSServer: Unable to open socket for %s\n",
+ thistrans->TransName, 0, 0);
+ else
+ PRMSG (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n",
+ thistrans->TransName, 0, 0);
return NULL;
}
@@ -527,17 +552,27 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
#ifdef SO_REUSEADDR
/*
- * SO_REUSEADDR only applied to AF_INET
+ * SO_REUSEADDR only applied to AF_INET && AF_INET6
*/
- if (Sockettrans2devtab[i].family == AF_INET)
+ if (Sockettrans2devtab[i].family == AF_INET
+#if defined(IPv6) && defined(AF_INET6)
+ || Sockettrans2devtab[i].family == AF_INET6
+#endif
+ )
{
int one = 1;
setsockopt (ciptr->fd, SOL_SOCKET, SO_REUSEADDR,
(char *) &one, sizeof (int));
}
#endif
-
+#ifdef IPV6_V6ONLY
+ if (Sockettrans2devtab[i].family == AF_INET6)
+ {
+ int one = 1;
+ setsockopt(ciptr->fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(int));
+ }
+#endif
/* Save the index for later use */
ciptr->index = i;
@@ -556,25 +591,24 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
{
XtransConnInfo ciptr;
- int i;
+ int i = -1;
PRMSG (2,"SocketOpenCLTSClient(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
- if ((i = TRANS(SocketSelectFamily) (thistrans->TransName)) < 0)
- {
- PRMSG (1,
- "SocketOpenCLTSClient: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
- return NULL;
+ while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) {
+ if ((ciptr = TRANS(SocketOpen) (
+ i, Sockettrans2devtab[i].devcotsname)) != NULL)
+ break;
}
-
- if ((ciptr = TRANS(SocketOpen) (
- i, Sockettrans2devtab[i].devcotsname)) == NULL)
- {
- PRMSG (1,"SocketOpenCLTSClient: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
+ if (i < 0) {
+ if (i == -1)
+ PRMSG (1,"SocketOpenCLTSClient: Unable to open socket for %s\n",
+ thistrans->TransName, 0, 0);
+ else
+ PRMSG (1,"SocketOpenCLTSClient: Unable to determine socket type for %s\n",
+ thistrans->TransName, 0, 0);
return NULL;
}
@@ -596,28 +630,34 @@ TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
{
XtransConnInfo ciptr;
- int i;
+ int i = -1;
PRMSG (2,"SocketOpenCLTSServer(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
- if ((i = TRANS(SocketSelectFamily) (thistrans->TransName)) < 0)
- {
- PRMSG (1,
- "SocketOpenCLTSServer: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
+ while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) {
+ if ((ciptr = TRANS(SocketOpen) (
+ i, Sockettrans2devtab[i].devcotsname)) != NULL)
+ break;
+ }
+ if (i < 0) {
+ if (i == -1)
+ PRMSG (1,"SocketOpenCLTSServer: Unable to open socket for %s\n",
+ thistrans->TransName, 0, 0);
+ else
+ PRMSG (1,"SocketOpenCLTSServer: Unable to determine socket type for %s\n",
+ thistrans->TransName, 0, 0);
return NULL;
}
- if ((ciptr = TRANS(SocketOpen) (
- i, Sockettrans2devtab[i].devcotsname)) == NULL)
+#ifdef IPV6_V6ONLY
+ if (Sockettrans2devtab[i].family == AF_INET6)
{
- PRMSG (1,"SocketOpenCLTSServer: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
- return NULL;
+ int one = 1;
+ setsockopt(ciptr->fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(int));
}
-
+#endif
/* Save the index for later use */
ciptr->index = i;
@@ -635,27 +675,25 @@ TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
{
XtransConnInfo ciptr;
- int i;
+ int i = -1;
PRMSG (2,
"SocketReopenCOTSServer(%d, %s)\n", fd, port, 0);
SocketInitOnce();
- if ((i = TRANS(SocketSelectFamily) (thistrans->TransName)) < 0)
- {
- PRMSG (1,
- "SocketReopenCOTSServer: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
- return NULL;
+ while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) {
+ if ((ciptr = TRANS(SocketReopen) (
+ i, Sockettrans2devtab[i].devcotsname, fd, port)) != NULL)
+ break;
}
-
- if ((ciptr = TRANS(SocketReopen) (
- i, Sockettrans2devtab[i].devcotsname, fd, port)) == NULL)
- {
- PRMSG (1,
- "SocketReopenCOTSServer: Unable to reopen socket for %s\n",
- thistrans->TransName, 0, 0);
+ if (i < 0) {
+ if (i == -1)
+ PRMSG (1,"SocketReopenCOTSServer: Unable to open socket for %s\n",
+ thistrans->TransName, 0, 0);
+ else
+ PRMSG (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n",
+ thistrans->TransName, 0, 0);
return NULL;
}
@@ -671,27 +709,25 @@ TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
{
XtransConnInfo ciptr;
- int i;
+ int i = -1;
PRMSG (2,
"SocketReopenCLTSServer(%d, %s)\n", fd, port, 0);
SocketInitOnce();
- if ((i = TRANS(SocketSelectFamily) (thistrans->TransName)) < 0)
- {
- PRMSG (1,
- "SocketReopenCLTSServer: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
- return NULL;
+ while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) {
+ if ((ciptr = TRANS(SocketReopen) (
+ i, Sockettrans2devtab[i].devcotsname, fd, port)) != NULL)
+ break;
}
-
- if ((ciptr = TRANS(SocketReopen) (
- i, Sockettrans2devtab[i].devcotsname, fd, port)) == NULL)
- {
- PRMSG (1,
- "SocketReopenCLTSServer: Unable to reopen socket for %s\n",
- thistrans->TransName, 0, 0);
+ if (i < 0) {
+ if (i == -1)
+ PRMSG (1,"SocketReopenCLTSServer: Unable to open socket for %s\n",
+ thistrans->TransName, 0, 0);
+ else
+ PRMSG (1,"SocketReopenCLTSServer: Unable to determine socket type for %s\n",
+ thistrans->TransName, 0, 0);
return NULL;
}
@@ -714,7 +750,7 @@ TRANS(SocketSetOption) (XtransConnInfo ciptr, int option, int arg)
return -1;
}
-
+#ifdef UNIXCONN
static int
set_sun_path(const char *port, const char *upath, char *path)
{
@@ -735,28 +771,37 @@ set_sun_path(const char *port, const char *upath, char *path)
}
return 0;
}
+#endif
#ifdef TRANS_SERVER
static int
TRANS(SocketCreateListener) (XtransConnInfo ciptr,
- struct sockaddr *sockname, int socknamelen)
+ struct sockaddr *sockname,
+ int socknamelen, unsigned int flags)
{
int namelen = socknamelen;
int fd = ciptr->fd;
int retry;
- PRMSG (3, "SocketCreateListener(%x,%d)\n", ciptr, fd, 0);
+ PRMSG (3, "SocketCreateListener(%x,%p)\n", ciptr, fd, 0);
- if (Sockettrans2devtab[ciptr->index].family == AF_INET)
+ if (Sockettrans2devtab[ciptr->index].family == AF_INET
+#if defined(IPv6) && defined(AF_INET6)
+ || Sockettrans2devtab[ciptr->index].family == AF_INET6
+#endif
+ )
retry = 20;
else
retry = 0;
while (bind (fd, (struct sockaddr *) sockname, namelen) < 0)
{
- if (errno == EADDRINUSE)
+ if (errno == EADDRINUSE) {
+ if (flags & ADDR_IN_USE_ALLOWED)
+ break;
+ } else
return TRANS_ADDR_IN_USE;
if (retry-- == 0) {
@@ -772,7 +817,11 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
#endif /* SO_REUSEDADDR */
}
- if (Sockettrans2devtab[ciptr->index].family == AF_INET) {
+ if (Sockettrans2devtab[ciptr->index].family == AF_INET
+#if defined(IPv6) && defined(AF_INET6)
+ || Sockettrans2devtab[ciptr->index].family == AF_INET6
+#endif
+ ) {
#ifdef SO_DONTLINGER
setsockopt (fd, SOL_SOCKET, SO_DONTLINGER, (char *) NULL, 0);
#else
@@ -795,21 +844,26 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
/* Set a flag to indicate that this connection is a listener */
- ciptr->flags = 1;
+ ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS);
return 0;
}
#ifdef TCPCONN
static int
-TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port)
+TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
{
- struct sockaddr_in sockname;
+#if defined(IPv6) && defined(AF_INET6)
+ struct sockaddr_storage sockname;
+#else
+ struct sockaddr_in sockname;
+#endif
+ unsigned short sport;
int namelen = sizeof(sockname);
int status;
long tmpport;
-#ifdef XTHREADS
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgetservbynameparams sparams;
#endif
struct servent *servp;
@@ -853,7 +907,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port)
return TRANS_CREATE_LISTENER_FAILED;
}
/* we trust getservbyname to return a valid number */
- sockname.sin_port = htons (servp->s_port);
+ sport = servp->s_port;
}
else
{
@@ -867,20 +921,42 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port)
if (tmpport < 1024 || tmpport > USHRT_MAX)
return TRANS_CREATE_LISTENER_FAILED;
- sockname.sin_port = htons (((unsigned short) tmpport));
+ sport = (unsigned short) tmpport;
}
}
else
- sockname.sin_port = htons (0);
+ sport = 0;
+ bzero(&sockname, sizeof(sockname));
+#if defined(IPv6) && defined(AF_INET6)
+ if (Sockettrans2devtab[ciptr->index].family == AF_INET) {
+ namelen = sizeof (struct sockaddr_in);
+#ifdef BSD44SOCKETS
+ ((struct sockaddr_in *)&sockname)->sin_len = namelen;
+#endif
+ ((struct sockaddr_in *)&sockname)->sin_family = AF_INET;
+ ((struct sockaddr_in *)&sockname)->sin_port = htons(sport);
+ ((struct sockaddr_in *)&sockname)->sin_addr.s_addr = htonl(INADDR_ANY);
+ } else {
+ namelen = sizeof (struct sockaddr_in6);
+#ifdef SIN6_LEN
+ ((struct sockaddr_in6 *)&sockname)->sin6_len = sizeof(sockname);
+#endif
+ ((struct sockaddr_in6 *)&sockname)->sin6_family = AF_INET6;
+ ((struct sockaddr_in6 *)&sockname)->sin6_port = htons(sport);
+ ((struct sockaddr_in6 *)&sockname)->sin6_addr = in6addr_any;
+ }
+#else
#ifdef BSD44SOCKETS
sockname.sin_len = sizeof (sockname);
#endif
sockname.sin_family = AF_INET;
+ sockname.sin_port = htons (sport);
sockname.sin_addr.s_addr = htonl (INADDR_ANY);
+#endif
if ((status = TRANS(SocketCreateListener) (ciptr,
- (struct sockaddr *) &sockname, namelen)) < 0)
+ (struct sockaddr *) &sockname, namelen, flags)) < 0)
{
PRMSG (1,
"SocketINETCreateListener: ...SocketCreateListener() failed\n",
@@ -905,7 +981,8 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port)
#ifdef UNIXCONN
static int
-TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port)
+TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
+ unsigned int flags)
{
struct sockaddr_un sockname;
@@ -943,7 +1020,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port)
return TRANS_CREATE_LISTENER_FAILED;
}
} else {
- sprintf (sockname.sun_path, "%s%d", UNIX_PATH, getpid());
+ sprintf (sockname.sun_path, "%s%ld", UNIX_PATH, (long)getpid());
}
#if defined(BSD44SOCKETS) && !defined(Lynx)
@@ -956,7 +1033,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port)
unlink (sockname.sun_path);
if ((status = TRANS(SocketCreateListener) (ciptr,
- (struct sockaddr *) &sockname, namelen)) < 0)
+ (struct sockaddr *) &sockname, namelen, flags)) < 0)
{
PRMSG (1,
"SocketUNIXCreateListener: ...SocketCreateListener() failed\n",
@@ -1006,7 +1083,7 @@ TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr)
int status = TRANS_RESET_NOOP;
unsigned int mode;
- PRMSG (3, "SocketUNIXResetListener(%x,%d)\n", ciptr, ciptr->fd, 0);
+ PRMSG (3, "SocketUNIXResetListener(%p,%d)\n", ciptr, ciptr->fd, 0);
if (stat (unsock->sun_path, &statb) == -1 ||
((statb.st_mode & S_IFMT) !=
@@ -1078,7 +1155,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
struct sockaddr_in sockname;
int namelen = sizeof(sockname);
- PRMSG (2, "SocketINETAccept(%x,%d)\n", ciptr, ciptr->fd, 0);
+ PRMSG (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd, 0);
if ((newciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
@@ -1089,7 +1166,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
}
if ((newciptr->fd = accept (ciptr->fd,
- (struct sockaddr *) &sockname, &namelen)) < 0)
+ (struct sockaddr *) &sockname, (void *)&namelen)) < 0)
{
PRMSG (1, "SocketINETAccept: accept() failed\n", 0, 0, 0);
xfree (newciptr);
@@ -1158,7 +1235,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
int namelen = sizeof sockname;
#endif
- PRMSG (2, "SocketUNIXAccept(%x,%d)\n", ciptr, ciptr->fd, 0);
+ PRMSG (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd, 0);
if ((newciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
@@ -1169,7 +1246,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
}
if ((newciptr->fd = accept (ciptr->fd,
- (struct sockaddr *) &sockname, &namelen)) < 0)
+ (struct sockaddr *) &sockname, (void *)&namelen)) < 0)
{
PRMSG (1, "SocketUNIXAccept: accept() failed\n", 0, 0, 0);
xfree (newciptr);
@@ -1227,29 +1304,47 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
#ifdef TRANS_CLIENT
#ifdef TCPCONN
+
+#if defined(IPv6) && defined(AF_INET6)
+struct addrlist {
+ struct addrinfo * addr;
+ struct addrinfo * firstaddr;
+ char port[PORTBUFSIZE];
+ char host[MAXHOSTNAMELEN];
+};
+static struct addrlist *addrlist = NULL;
+#endif
+
+
static int
TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
{
- struct sockaddr_in sockname;
-#if defined(SVR4) || defined(SCO325)
- size_t namelen = sizeof sockname;
+ struct sockaddr * socketaddr = NULL;
+ int socketaddrlen = 0;
+ int res;
+#if defined(IPv6) && defined(AF_INET6)
+ struct addrinfo hints;
+ char ntopbuf[INET6_ADDRSTRLEN];
+ struct sockaddr_in6 tmpsin6;
+ int resetonce = 0;
#else
- int namelen = sizeof sockname;
-#endif
-#ifdef XTHREADS
+ struct sockaddr_in sockname;
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
_Xgetservbynameparams sparams;
#endif
struct hostent *hostp;
struct servent *servp;
-
+ unsigned long tmpaddr;
+#endif
#ifdef X11_t
char portbuf[PORTBUFSIZE];
#endif
+#if defined(X11_t) || !defined(IPv6) || !defined(AF_INET6)
long tmpport;
- unsigned long tmpaddr;
+#endif
char hostnamebuf[256]; /* tmp space */
PRMSG (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port);
@@ -1279,6 +1374,116 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
}
#endif
+#if defined(IPv6) && defined(AF_INET6)
+ if (addrlist != NULL) {
+ if (strcmp(host,addrlist->host) || strcmp(port,addrlist->port)) {
+ if (addrlist->firstaddr)
+ freeaddrinfo(addrlist->firstaddr);
+ addrlist->firstaddr = NULL;
+ }
+ } else {
+ addrlist = malloc(sizeof(struct addrlist));
+ addrlist->firstaddr = NULL;
+ }
+
+ if (addrlist->firstaddr == NULL) {
+ strncpy(addrlist->port, port, sizeof(addrlist->port));
+ addrlist->port[sizeof(addrlist->port) - 1] = '\0';
+ strncpy(addrlist->host, host, sizeof(addrlist->host));
+ addrlist->host[sizeof(addrlist->host) - 1] = '\0';
+
+ bzero(&hints,sizeof(hints));
+ hints.ai_socktype = Sockettrans2devtab[ciptr->index].devcotsname;
+
+ res = getaddrinfo(host,port,&hints,&addrlist->firstaddr);
+ if (res != 0) {
+ PRMSG (1,
+ "TRANS(SocketINETConnect) () can't get address for %s:%s: %s\n",
+ host, port, gai_strerror(res));
+ ESET(EINVAL);
+ return TRANS_CONNECT_FAILED;
+ }
+ for (res = 0, addrlist->addr = addrlist->firstaddr; addrlist->addr ; res++) {
+ addrlist->addr = addrlist->addr->ai_next;
+ }
+ PRMSG(4,"Got New Address list with %d addresses\n", res, 0, 0);
+ res = 0;
+ addrlist->addr = NULL;
+ }
+
+ while ( socketaddr == NULL ) {
+ if (addrlist->addr == NULL) {
+ if (resetonce) {
+ /* Already checked entire list - no usable addresses */
+ PRMSG (1,
+ "TRANS(SocketINETConnect) () no usable address for %s:%s\n",
+ host, port, 0);
+ return TRANS_CONNECT_FAILED;
+ } else {
+ /* Go back to beginning of list */
+ resetonce = 1;
+ addrlist->addr = addrlist->firstaddr;
+ }
+ }
+
+
+ socketaddr = addrlist->addr->ai_addr;
+ socketaddrlen = addrlist->addr->ai_addrlen;
+
+ if (addrlist->addr->ai_family == AF_INET) {
+ struct sockaddr_in *sin = (struct sockaddr_in *) socketaddr;
+
+ PRMSG (4,"TRANS(SocketINETConnect) sockname.sin_addr = %s\n",
+ inet_ntop(addrlist->addr->ai_family,&sin->sin_addr,
+ ntopbuf,sizeof(ntopbuf)), 0, 0);
+
+ PRMSG (4,"TRANS(SocketINETConnect) sockname.sin_port = %d\n",
+ ntohs(sin->sin_port), 0, 0);
+
+ if (Sockettrans2devtab[ciptr->index].family == AF_INET6) {
+ /* We have IPv6 socket, need to map IPv4 address to IPv6 */
+ char *v4addr = (char *) &sin->sin_addr.s_addr;
+ bzero(&tmpsin6, sizeof(tmpsin6));
+#ifdef SIN6_LEN
+ tmpsin6.sin6_len = sizeof(tmpsin6);
+#endif
+ tmpsin6.sin6_family = AF_INET6;
+ tmpsin6.sin6_port = sin->sin_port;
+ tmpsin6.sin6_addr.s6_addr[10] = 0xff;
+ tmpsin6.sin6_addr.s6_addr[11] = 0xff;
+ tmpsin6.sin6_addr.s6_addr[12] = v4addr[0];
+ tmpsin6.sin6_addr.s6_addr[13] = v4addr[1];
+ tmpsin6.sin6_addr.s6_addr[14] = v4addr[2];
+ tmpsin6.sin6_addr.s6_addr[15] = v4addr[3];
+
+ socketaddr = (struct sockaddr *) &tmpsin6;
+ socketaddrlen = sizeof(tmpsin6);
+ PRMSG (4,"TRANS(SocketINETConnect) sockname.sin6_addr = %s\n",
+ inet_ntop(AF_INET6, &tmpsin6.sin6_addr, ntopbuf,
+ sizeof(ntopbuf)), 0, 0);
+ }
+ } else if (addrlist->addr->ai_family == AF_INET6) {
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr;
+
+ PRMSG (4,"TRANS(SocketINETConnect) sockname.sin6_addr = %s\n",
+ inet_ntop(addrlist->addr->ai_family, &sin6->sin6_addr,ntopbuf,sizeof(ntopbuf)),
+ 0, 0);
+ PRMSG (4,"TRANS(SocketINETConnect) sockname.sin6_port = %d\n",
+ ntohs(sin6->sin6_port), 0, 0);
+
+ if (Sockettrans2devtab[ciptr->index].family == AF_INET) {
+ PRMSG (4,"TRANS(SocketINETConnect) Skipping IPv6 address\n",
+ 0,0,0);
+ socketaddr = NULL;
+ }
+ } else {
+ socketaddr = NULL; /* Unsupported address type */
+ }
+ if (socketaddr == NULL) {
+ addrlist->addr = addrlist->addr->ai_next;
+ }
+ }
+#else
/*
* Build the socket name.
*/
@@ -1303,7 +1508,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
PRMSG (4,"SocketINETConnect: inet_addr(%s) = %x\n",
host, tmpaddr, 0);
- if (tmpaddr == -1)
+ if ((long)tmpaddr == -1L)
{
if ((hostp = _XGethostbyname(host,hparams)) == NULL)
{
@@ -1369,12 +1574,32 @@ else
PRMSG (4,"SocketINETConnect: sockname.sin_port = %d\n",
ntohs(sockname.sin_port), 0, 0);
+ socketaddr = (struct sockaddr *) &sockname;
+ socketaddrlen = sizeof(sockname);
+#endif /* IPv6 */
+
+ /*
+ * Turn on socket keepalive so the client process will eventually
+ * be notified with a SIGPIPE signal if the display server fails
+ * to respond to a periodic transmission of messages
+ * on the connected socket.
+ * This is useful to avoid hung application processes when the
+ * processes are not spawned from the xdm session and
+ * the display server terminates abnormally.
+ * (Someone turned off the power switch.)
+ */
+
+ {
+ int tmp = 1;
+ setsockopt (ciptr->fd, SOL_SOCKET, SO_KEEPALIVE,
+ (char *) &tmp, sizeof (int));
+ }
/*
* Do the connect()
*/
- if (connect (ciptr->fd, (struct sockaddr *) &sockname, namelen) < 0)
+ if (connect (ciptr->fd, socketaddr, socketaddrlen ) < 0)
{
#ifdef WIN32
int olderrno = WSAGetLastError();
@@ -1382,45 +1607,74 @@ else
int olderrno = errno;
#endif
- PRMSG (1,"SocketINETConnect: Can't connect: errno = %d\n",
- EGET(),0, 0);
-
/*
* If the error was ECONNREFUSED, the server may be overloaded
* and we should try again.
*
+ * If the error was EWOULDBLOCK or EINPROGRESS then the socket
+ * was non-blocking and we should poll using select
+ *
* If the error was EINTR, the connect was interrupted and we
* should try again.
+ *
+ * If multiple addresses are found for a host then we should
+ * try to connect again with a different address for a larger
+ * 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.
*/
- if (olderrno == ECONNREFUSED || olderrno == EINTR)
- return TRANS_TRY_CONNECT_AGAIN;
+ if (olderrno == ECONNREFUSED || olderrno == EINTR
+#if defined(IPv6) && defined(AF_INET6)
+ || ( ((addrlist->addr->ai_next != NULL) ||
+ (addrlist->addr != addrlist->firstaddr)) &&
+ (olderrno == ENETUNREACH || olderrno == EAFNOSUPPORT ||
+ olderrno == EADDRNOTAVAIL || olderrno == ETIMEDOUT))
+#endif
+ )
+ res = TRANS_TRY_CONNECT_AGAIN;
+ else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS)
+ res = TRANS_IN_PROGRESS;
else
- return TRANS_CONNECT_FAILED;
- }
+ {
+ PRMSG (2,"SocketINETConnect: Can't connect: errno = %d\n",
+ olderrno,0, 0);
+
+ res = TRANS_CONNECT_FAILED;
+ }
+ } else {
+ res = 0;
- /*
- * Sync up the address fields of ciptr.
- */
+ /*
+ * Sync up the address fields of ciptr.
+ */
- if (TRANS(SocketINETGetAddr) (ciptr) < 0)
- {
- PRMSG (1,
- "SocketINETConnect: ...SocketINETGetAddr() failed:\n",
- 0, 0, 0);
- return TRANS_CONNECT_FAILED;
- }
+ if (TRANS(SocketINETGetAddr) (ciptr) < 0)
+ {
+ PRMSG (1,
+ "SocketINETConnect: ...SocketINETGetAddr() failed:\n",
+ 0, 0, 0);
+ res = TRANS_CONNECT_FAILED;
+ }
- if (TRANS(SocketINETGetPeerAddr) (ciptr) < 0)
- {
- PRMSG (1,
- "SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n",
+ else if (TRANS(SocketINETGetPeerAddr) (ciptr) < 0)
+ {
+ PRMSG (1,
+ "SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n",
0, 0, 0);
- return TRANS_CONNECT_FAILED;
+ res = TRANS_CONNECT_FAILED;
+ }
}
- return 0;
+#if defined(IPv6) && defined(AF_INET6)
+ if (res != 0) {
+ addrlist->addr = addrlist->addr->ai_next;
+ }
+#endif
+
+ return res;
}
#endif /* TCPCONN */
@@ -1447,6 +1701,53 @@ UnixHostReallyLocal (char *host)
}
else
{
+#if defined(IPv6) && defined(AF_INET6)
+ struct addrinfo *localhostaddr;
+ struct addrinfo *otherhostaddr;
+ struct addrinfo *i, *j;
+ int equiv = 0;
+
+ if (getaddrinfo(hostnamebuf, NULL, NULL, &localhostaddr) != 0)
+ return 0;
+ if (getaddrinfo(host, NULL, NULL, &otherhostaddr) != 0) {
+ freeaddrinfo(localhostaddr);
+ return 0;
+ }
+
+ for (i = localhostaddr; i != NULL && equiv == 0; i = i->ai_next) {
+ 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 *) i->ai_addr;
+ struct sockaddr_in *sinB
+ = (struct sockaddr_in *) j->ai_addr;
+ struct in_addr *A = &sinA->sin_addr;
+ struct in_addr *B = &sinB->sin_addr;
+
+ if (memcmp(A,B,sizeof(struct in_addr)) == 0) {
+ equiv = 1;
+ }
+ } else if (i->ai_family == AF_INET6) {
+ struct sockaddr_in6 *sinA
+ = (struct sockaddr_in6 *) i->ai_addr;
+ struct sockaddr_in6 *sinB
+ = (struct sockaddr_in6 *) j->ai_addr;
+ struct in6_addr *A = &sinA->sin6_addr;
+ struct in6_addr *B = &sinB->sin6_addr;
+
+ if (memcmp(A,B,sizeof(struct in6_addr)) == 0) {
+ equiv = 1;
+ }
+ }
+ }
+ }
+ }
+
+ freeaddrinfo(localhostaddr);
+ freeaddrinfo(otherhostaddr);
+ return equiv;
+#else
/*
* A host may have more than one network address. If any of the
* network addresses of 'host' (specified to the connect call)
@@ -1456,7 +1757,7 @@ UnixHostReallyLocal (char *host)
*/
char specified_local_addr_list[10][4];
int scount, equiv, i, j;
-#ifdef XTHREADS
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
#endif
struct hostent *hostp;
@@ -1516,6 +1817,7 @@ UnixHostReallyLocal (char *host)
}
return (equiv);
+#endif
}
}
@@ -1620,13 +1922,28 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
{
errno = olderrno;
- PRMSG (1,"SocketUNIXConnect: Can't connect: errno = %d\n",
- EGET(),0, 0);
+ /*
+ * If the error was ENOENT, the server may be starting up
+ * and we should try again.
+ *
+ * If the error was EWOULDBLOCK or EINPROGRESS then the socket
+ * was non-blocking and we should poll using select
+ *
+ * If the error was EINTR, the connect was interrupted and we
+ * should try again.
+ */
if (olderrno == ENOENT || olderrno == EINTR)
return TRANS_TRY_CONNECT_AGAIN;
+ else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS)
+ return TRANS_IN_PROGRESS;
else
+ {
+ PRMSG (2,"SocketUNIXConnect: Can't connect: errno = %d\n",
+ EGET(),0, 0);
+
return TRANS_CONNECT_FAILED;
+ }
}
}
@@ -1662,21 +1979,23 @@ static int
TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend)
{
- PRMSG (2,"SocketBytesReadable(%x,%d,%x)\n",
+ PRMSG (2,"SocketBytesReadable(%p,%d,%p)\n",
ciptr, ciptr->fd, pend);
-
+#if defined(QNX4)
+ *pend = 0L; /* FIONREAD only returns a short. Zero out upper bits */
+#endif
#ifdef WIN32
return ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend);
#else
-#if (defined(i386) && defined(SYSV)) || defined(_SEQUENT_)
+#if (defined(i386) && defined(SYSV) && !defined(sco)) || (defined(_SEQUENT_) && _SOCKET_VERSION == 1)
return ioctl (ciptr->fd, I_NREAD, (char *) pend);
#else
-#if defined(__EMX__)
+#if defined(__UNIXOS2__)
return ioctl (ciptr->fd, FIONREAD, (char*) pend, sizeof(int));
#else
return ioctl (ciptr->fd, FIONREAD, (char *) pend);
-#endif /* __EMX__ */
-#endif /* i386 && SYSV && !SCO || _SEQUENT_ */
+#endif /* __UNIXOS2__ */
+#endif /* i386 && SYSV || _SEQUENT_ && _SOCKET_VERSION == 1 */
#endif /* WIN32 */
}
@@ -1685,9 +2004,9 @@ static int
TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size)
{
- PRMSG (2,"SocketRead(%d,%x,%d)\n", ciptr->fd, buf, size);
+ PRMSG (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size);
-#if defined(WIN32) || defined(__EMX__)
+#if defined(WIN32) || defined(__UNIXOS2__)
return recv ((SOCKET)ciptr->fd, buf, size, 0);
#else
return read (ciptr->fd, buf, size);
@@ -1699,9 +2018,9 @@ static int
TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size)
{
- PRMSG (2,"SocketWrite(%d,%x,%d)\n", ciptr->fd, buf, size);
+ PRMSG (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size);
-#if defined(WIN32) || defined(__EMX__)
+#if defined(WIN32) || defined(__UNIXOS2__)
return send ((SOCKET)ciptr->fd, buf, size, 0);
#else
return write (ciptr->fd, buf, size);
@@ -1713,7 +2032,7 @@ static int
TRANS(SocketReadv) (XtransConnInfo ciptr, struct iovec *buf, int size)
{
- PRMSG (2,"SocketReadv(%d,%x,%d)\n", ciptr->fd, buf, size);
+ PRMSG (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, buf, size);
return READV (ciptr, buf, size);
}
@@ -1723,7 +2042,7 @@ static int
TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size)
{
- PRMSG (2,"SocketWritev(%d,%x,%d)\n", ciptr->fd, buf, size);
+ PRMSG (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, buf, size);
return WRITEV (ciptr, buf, size);
}
@@ -1733,7 +2052,7 @@ static int
TRANS(SocketDisconnect) (XtransConnInfo ciptr)
{
- PRMSG (2,"SocketDisconnect(%x,%d)\n", ciptr, ciptr->fd, 0);
+ PRMSG (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd, 0);
return shutdown (ciptr->fd, 2); /* disallow further sends and receives */
}
@@ -1744,7 +2063,7 @@ static int
TRANS(SocketINETClose) (XtransConnInfo ciptr)
{
- PRMSG (2,"SocketINETClose(%x,%d)\n", ciptr, ciptr->fd, 0);
+ PRMSG (2,"SocketINETClose(%p,%d)\n", ciptr, ciptr->fd, 0);
return close (ciptr->fd);
}
@@ -1766,7 +2085,7 @@ TRANS(SocketUNIXClose) (XtransConnInfo ciptr)
char path[200]; /* > sizeof sun_path +1 */
int ret;
- PRMSG (2,"SocketUNIXClose(%x,%d)\n", ciptr, ciptr->fd, 0);
+ PRMSG (2,"SocketUNIXClose(%p,%d)\n", ciptr, ciptr->fd, 0);
ret = close(ciptr->fd);
@@ -1777,7 +2096,8 @@ TRANS(SocketUNIXClose) (XtransConnInfo ciptr)
{
strncpy (path, sockname->sun_path,
ciptr->addrlen - sizeof (sockname->sun_family));
- unlink (path);
+ if (!(ciptr->flags & TRANS_NOUNLINK))
+ unlink (path);
}
return ret;
@@ -1793,7 +2113,7 @@ TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr)
int ret;
- PRMSG (2,"SocketUNIXCloseForCloning(%x,%d)\n",
+ PRMSG (2,"SocketUNIXCloseForCloning(%p,%d)\n",
ciptr, ciptr->fd, 0);
ret = close(ciptr->fd);
@@ -1805,14 +2125,19 @@ TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr)
#ifdef TCPCONN
+# ifdef TRANS_SERVER
+static char* tcp_nolisten[] = { "inet", "inet6", NULL };
+# endif
+
Xtransport TRANS(SocketTCPFuncs) = {
/* Socket Interface */
"tcp",
- 0,
+ TRANS_ALIAS,
#ifdef TRANS_CLIENT
TRANS(SocketOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ tcp_nolisten,
TRANS(SocketOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -1847,11 +2172,12 @@ Xtransport TRANS(SocketTCPFuncs) = {
Xtransport TRANS(SocketINETFuncs) = {
/* Socket Interface */
"inet",
- TRANS_ALIAS,
+ 0,
#ifdef TRANS_CLIENT
TRANS(SocketOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ NULL,
TRANS(SocketOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -1883,6 +2209,47 @@ Xtransport TRANS(SocketINETFuncs) = {
TRANS(SocketINETClose),
};
+#if defined(IPv6) && defined(AF_INET6)
+Xtransport TRANS(SocketINET6Funcs) = {
+ /* Socket Interface */
+ "inet6",
+ 0,
+#ifdef TRANS_CLIENT
+ TRANS(SocketOpenCOTSClient),
+#endif /* TRANS_CLIENT */
+#ifdef TRANS_SERVER
+ NULL,
+ TRANS(SocketOpenCOTSServer),
+#endif /* TRANS_SERVER */
+#ifdef TRANS_CLIENT
+ TRANS(SocketOpenCLTSClient),
+#endif /* TRANS_CLIENT */
+#ifdef TRANS_SERVER
+ TRANS(SocketOpenCLTSServer),
+#endif /* TRANS_SERVER */
+#ifdef TRANS_REOPEN
+ TRANS(SocketReopenCOTSServer),
+ TRANS(SocketReopenCLTSServer),
+#endif
+ TRANS(SocketSetOption),
+#ifdef TRANS_SERVER
+ TRANS(SocketINETCreateListener),
+ NULL, /* ResetListener */
+ TRANS(SocketINETAccept),
+#endif /* TRANS_SERVER */
+#ifdef TRANS_CLIENT
+ TRANS(SocketINETConnect),
+#endif /* TRANS_CLIENT */
+ TRANS(SocketBytesReadable),
+ TRANS(SocketRead),
+ TRANS(SocketWrite),
+ TRANS(SocketReadv),
+ TRANS(SocketWritev),
+ TRANS(SocketDisconnect),
+ TRANS(SocketINETClose),
+ TRANS(SocketINETClose),
+ };
+#endif /* IPv6 */
#endif /* TCPCONN */
#ifdef UNIXCONN
@@ -1895,6 +2262,7 @@ Xtransport TRANS(SocketLocalFuncs) = {
TRANS(SocketOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ NULL,
TRANS(SocketOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -1926,7 +2294,12 @@ Xtransport TRANS(SocketLocalFuncs) = {
TRANS(SocketUNIXCloseForCloning),
};
#endif /* !LOCALCONN */
-
+# ifdef TRANS_SERVER
+# if !defined(LOCALCONN)
+static char* unix_nolisten[] = { "local" , NULL };
+# endif
+# endif
+
Xtransport TRANS(SocketUNIXFuncs) = {
/* Socket Interface */
"unix",
@@ -1939,6 +2312,11 @@ Xtransport TRANS(SocketUNIXFuncs) = {
TRANS(SocketOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+#if !defined(LOCALCONN)
+ unix_nolisten,
+#else
+ NULL,
+#endif
TRANS(SocketOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
diff --git a/xc/lib/xtrans/Xtranstli.c b/xc/lib/xtrans/Xtranstli.c
index 17edadd2c..9f686c4fb 100644
--- a/xc/lib/xtrans/Xtranstli.c
+++ b/xc/lib/xtrans/Xtranstli.c
@@ -1,9 +1,13 @@
-/* $TOG: Xtranstli.c /main/29 1998/04/22 16:31:16 barstow $ */
+/* $Xorg: Xtranstli.c,v 1.4 2001/02/09 02:04:07 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/xtrans/Xtranstli.c,v 3.8 1999/06/20 08:41:23 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/Xtranstli.c,v 3.13 2003/08/26 15:38:39 tsi Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -127,7 +131,7 @@ TRANS(TLISelectFamily)(char *family)
for(i=0;i<NUMTLIFAMILIES;i++)
{
- if( !strcmp(family,TLItrans2devtab[i].transname) )
+ if( !strcmp(family,TLItrans2devtab[i].transname) )
return i;
}
return -1;
@@ -171,9 +175,9 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr)
if( (ciptr->addr=(char *)xalloc(netbuf.len)) == NULL )
{
- PRMSG(1, "TLIGetAddr: Can't allocate space for the addr\n",
+ PRMSG(1, "TLIGetAddr: Can't allocate space for the addr\n",
0,0,0);
- return -1;
+ return -1;
}
ciptr->family=((struct sockaddr *) &sockname)->sa_family;
@@ -221,10 +225,10 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr)
if( (ciptr->peeraddr=(char *)xalloc(netbuf.len)) == NULL )
{
- PRMSG(1,
+ PRMSG(1,
"TLIGetPeerAddr: Can't allocate space for the addr\n",
0,0,0);
- return -1;
+ return -1;
}
ciptr->peeraddrlen=netbuf.len;
@@ -747,7 +751,7 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
static int
-TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port)
+TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags)
{
char portbuf[PORTBUFSIZE];
@@ -809,7 +813,7 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port)
static int
-TRANS(TLITLICreateListener)(XtransConnInfo ciptr, char *port)
+TRANS(TLITLICreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags)
{
struct t_bind *req;
@@ -925,6 +929,23 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
extern int t_errno;
PRMSG(1, "TLIAccept() t_accept() failed\n", 0,0,0 );
PRMSG(1, "TLIAccept: %s\n", t_errlist[t_errno], 0,0 );
+ if( t_errno == TLOOK )
+ {
+ int evtype = t_look(ciptr->fd);
+ PRMSG(1, "TLIAccept() t_look() returned %d\n", evtype,0,0 );
+ switch( evtype )
+ {
+ case T_DISCONNECT:
+ if( t_rcvdis(ciptr->fd, NULL) < 0 )
+ {
+ PRMSG(1, "TLIAccept() t_rcvdis() failed\n", 0,0,0 );
+ PRMSG(1, "TLIAccept: %s\n", t_errlist[t_errno], 0,0 );
+ }
+ break;
+ default:
+ break;
+ }
+ }
t_free((char *)call,T_CALL);
t_close(newciptr->fd);
free(newciptr);
@@ -1280,11 +1301,12 @@ TRANS(TLICloseForCloning)(XtransConnInfo ciptr)
Xtransport TRANS(TLITCPFuncs) = {
/* TLI Interface */
"tcp",
- 0,
+ 0,
#ifdef TRANS_CLIENT
TRANS(TLIOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ NULL,
TRANS(TLIOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -1316,6 +1338,9 @@ Xtransport TRANS(TLITCPFuncs) = {
TRANS(TLICloseForCloning),
};
+#ifdef TRANS_SERVER
+static char * inet_aliases[] = { "tcp", NULL };
+#endif
Xtransport TRANS(TLIINETFuncs) = {
/* TLI Interface */
"inet",
@@ -1324,6 +1349,7 @@ Xtransport TRANS(TLIINETFuncs) = {
TRANS(TLIOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ inet_aliases,
TRANS(TLIOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
@@ -1363,6 +1389,7 @@ Xtransport TRANS(TLITLIFuncs) = {
TRANS(TLIOpenCOTSClient),
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
+ NULL,
TRANS(TLIOpenCOTSServer),
#endif /* TRANS_SERVER */
#ifdef TRANS_CLIENT
diff --git a/xc/lib/xtrans/Xtransutil.c b/xc/lib/xtrans/Xtransutil.c
index f5dd3959f..c3757ca3b 100644
--- a/xc/lib/xtrans/Xtransutil.c
+++ b/xc/lib/xtrans/Xtransutil.c
@@ -1,9 +1,13 @@
-/* $TOG: Xtransutil.c /main/33 1998/02/06 15:55:10 kaleb $ */
+/* $Xorg: Xtransutil.c,v 1.4 2001/02/09 02:04:07 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/xtrans/Xtransutil.c,v 3.14 1999/06/20 08:41:24 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/Xtransutil.c,v 3.27 2003/07/18 15:53:24 tsi Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -65,9 +69,10 @@ from The Open Group.
* of these values are also defined by the ChangeHost protocol message.
*/
-#define FamilyInternet 0
+#define FamilyInternet 0 /* IPv4 */
#define FamilyDECnet 1
#define FamilyChaos 2
+#define FamilyInternet6 6
#define FamilyAmoeba 33
#define FamilyLocalHost 252
#define FamilyKrb5Principal 253
@@ -78,7 +83,7 @@ from The Open Group.
/*
* TRANS(ConvertAddress) converts a sockaddr based address to an
* X authorization based address. Some of this is defined as part of
- * the ChangeHost protocol. The rest is just doen in a consistent manner.
+ * the ChangeHost protocol. The rest is just done in a consistent manner.
*/
int
@@ -90,7 +95,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
switch( *familyp )
{
-#if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN)
case AF_INET:
{
/*
@@ -126,7 +131,43 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
}
break;
}
-#endif /* defined(TCPCONN) || defined(STREAMSCONN) || MNX_TCPCONN */
+
+#if defined(IPv6) && defined(AF_INET6)
+ case AF_INET6:
+ {
+ struct sockaddr_in6 saddr6;
+
+ memcpy (&saddr6, *addrp, sizeof (struct sockaddr_in6));
+
+ if (IN6_IS_ADDR_LOOPBACK(&saddr6.sin6_addr))
+ {
+ *familyp=FamilyLocal;
+ }
+ else if (IN6_IS_ADDR_V4MAPPED(&(saddr6.sin6_addr))) {
+ char *cp = (char *) &saddr6.sin6_addr.s6_addr[12];
+
+ if ((cp[0] == 127) && (cp[1] == 0) &&
+ (cp[2] == 0) && (cp[3] == 1))
+ {
+ *familyp=FamilyLocal;
+ }
+ else
+ {
+ *familyp=FamilyInternet;
+ *addrlenp = sizeof (struct in_addr);
+ memcpy(*addrp,cp,*addrlenp);
+ }
+ }
+ else
+ {
+ *familyp=FamilyInternet6;
+ *addrlenp=sizeof(saddr6.sin6_addr);
+ memcpy(*addrp,&saddr6.sin6_addr,sizeof(saddr6.sin6_addr));
+ }
+ break;
+ }
+#endif /* IPv6 */
+#endif /* defined(TCPCONN) || defined(STREAMSCONN) */
#if defined(DNETCONN)
case AF_DECnet:
@@ -149,22 +190,8 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
*familyp=FamilyLocal;
break;
}
-#endif /* defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)*/
+#endif /* defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN*/
-#if defined(AMRPCCONN)
- case AF_AMOEBA:
- {
- *familyp=FamilyAmoeba;
- break;
- }
-#endif
-#if defined(AMTCPCONN) && !(defined(TCPCONN) || defined(STREAMSCONN))
- case AF_INET:
- {
- *familyp=FamilyInternet;
- break;
- }
-#endif
default:
PRMSG(1,"ConvertAddress: Unknown family type %d\n",
@@ -243,22 +270,36 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
hostnamebuf, saddr->sun_path);
break;
}
-#endif /* defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
-*/
+#endif /* defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) || defined(OS2PIPECONN) */
-#if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN)
case AF_INET:
+#if defined(IPv6) && defined(AF_INET6)
+ case AF_INET6:
+#endif
{
struct sockaddr_in *saddr = (struct sockaddr_in *) addr;
+#if defined(IPv6) && defined(AF_INET6)
+ struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) addr;
+#endif
+ int portnum;
char portnumbuf[10];
- sprintf (portnumbuf, "%d", ntohs (saddr->sin_port));
+
+#if defined(IPv6) && defined(AF_INET6)
+ if (family == AF_INET6)
+ portnum = ntohs (saddr6->sin6_port);
+ else
+#endif
+ portnum = ntohs (saddr->sin_port);
+
+ sprintf (portnumbuf, "%d", portnum);
networkId = (char *) xalloc (3 + strlen (transName) +
strlen (hostnamebuf) + strlen (portnumbuf));
sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf);
break;
}
-#endif /* defined(TCPCONN) || defined(STREAMSCONN) || MNX_TCPCONN */
+#endif /* defined(TCPCONN) || defined(STREAMSCONN) */
#if defined(DNETCONN)
case AF_DECnet:
@@ -284,7 +325,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
static jmp_buf env;
#ifdef SIGALRM
-static int nameserver_timedout = 0;
+static volatile int nameserver_timedout = 0;
static
#ifdef SIGNALRETURNSINT
@@ -312,7 +353,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
char *peer_addr = ciptr->peeraddr;
char *hostname;
char addrbuf[256];
- char *addr = NULL;
+ const char *addr = NULL;
switch (family)
{
@@ -324,17 +365,37 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
addr = addrbuf;
break;
}
-#endif /* defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
-*/
+#endif /* defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) || defined(OS2PIPECONN) */
-#if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN)
case AF_INET:
+#if defined(IPv6) && defined(AF_INET6)
+ case AF_INET6:
+#endif
{
struct sockaddr_in *saddr = (struct sockaddr_in *) peer_addr;
-#ifdef XTHREADS
+#if defined(IPv6) && defined(AF_INET6)
+ struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) peer_addr;
+#endif
+ char *address;
+ int addresslen;
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
#endif
- struct hostent * hostp = NULL;
+ struct hostent * volatile hostp = NULL;
+
+#if defined(IPv6) && defined(AF_INET6)
+ if (family == AF_INET6)
+ {
+ address = (char *) &saddr6->sin6_addr;
+ addresslen = sizeof (saddr6->sin6_addr);
+ }
+ else
+#endif
+ {
+ address = (char *) &saddr->sin_addr;
+ addresslen = sizeof (saddr->sin_addr);
+ }
#ifdef SIGALRM
/*
@@ -350,8 +411,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
alarm (4);
if (setjmp(env) == 0) {
#endif
- hostp = _XGethostbyaddr ((char *) &saddr->sin_addr,
- sizeof (saddr->sin_addr), AF_INET, hparams);
+ hostp = _XGethostbyaddr (address, addresslen, family, hparams);
#ifdef SIGALRM
}
alarm (0);
@@ -359,11 +419,15 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
if (hostp != NULL)
addr = hostp->h_name;
else
+#if defined(IPv6) && defined(AF_INET6)
+ addr = inet_ntop (family, address, addrbuf, sizeof (addrbuf));
+#else
addr = inet_ntoa (saddr->sin_addr);
+#endif
break;
}
-#endif /* defined(TCPCONN) || defined(STREAMSCONN) || MNX_TCPCONN */
+#endif /* defined(TCPCONN) || defined(STREAMSCONN) */
#if defined(DNETCONN)
case AF_DECnet:
@@ -382,25 +446,6 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
}
#endif /* defined(DNETCONN) */
-#if defined(AMRPCCONN)
- case AF_AMOEBA:
- {
- addr = "Amoeba"; /* not really used */
- break;
- }
-#endif
-#if defined(AMTCPCONN) && !(defined(TCPCONN) || defined(STREAMSCONN))
- case AF_INET:
- {
- if (gethostname (addrbuf, sizeof (addrbuf)) == 0) {
- addr = addrbuf;
- } else {
- addr = "";
- }
- break;
- }
-#endif
-
default:
return (NULL);
}
@@ -528,12 +573,16 @@ trans_mkdir(char *path, int mode)
if (updateOwner && !updatedOwner) {
PRMSG(1, "mkdir: Owner of %s should be set to root\n",
path, 0, 0);
+#if !defined(__CYGWIN__) && !defined(__DARWIN__)
sleep(5);
+#endif
}
if (updateMode && !updatedMode) {
PRMSG(1, "mkdir: Mode of %s should be set to %04o\n",
path, mode, 0);
+#if !defined(__CYGWIN__) && !defined(__DARWIN__)
sleep(5);
+#endif
}
return 0;
}
diff --git a/xc/lib/xtrans/transport.c b/xc/lib/xtrans/transport.c
index 7aeadfc0f..e00a82a32 100644
--- a/xc/lib/xtrans/transport.c
+++ b/xc/lib/xtrans/transport.c
@@ -1,9 +1,13 @@
-/* $TOG: transport.c /main/7 1998/02/06 15:54:19 kaleb $ */
+/* $Xorg: transport.c,v 1.4 2001/02/09 02:04:07 xorgcvs Exp $ */
/*
Copyright 1993, 1994, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/xtrans/transport.c,v 3.4 1998/10/03 09:07:37 dawes Exp $ */
+/* $XFree86: xc/lib/xtrans/transport.c,v 3.10 2003/03/25 04:18:15 dawes Exp $ */
/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
*
@@ -47,12 +51,14 @@ from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef __UNIXOS2__
+#define I_NEED_OS2_H
+#endif
+
#ifdef XSERV_t
#include "os.h"
#else
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#define xalloc(_size) malloc(_size)
#define xcalloc(_num,_size) calloc(_num,_size)
#define xrealloc(_ptr,_size) realloc(_ptr,_size)
@@ -76,11 +82,5 @@ from The Open Group.
#ifdef STREAMSCONN
#include "Xtranstli.c"
#endif
-#if defined(AMRPCCONN) || defined(AMTCPCONN)
-#include "Xtransam.c"
-#endif
-#if defined(MNX_TCPCONN)
-#include "Xtransmnx.c"
-#endif
#include "Xtrans.c"
#include "Xtransutil.c"
diff --git a/xc/lib/zlib/Imakefile b/xc/lib/zlib/Imakefile
index 8846d459d..42a088c11 100644
--- a/xc/lib/zlib/Imakefile
+++ b/xc/lib/zlib/Imakefile
@@ -1,19 +1,28 @@
-XCOMM $TOG: Imakefile /main/4 1998/02/04 14:32:56 kaleb $
+XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:46 cpqbld Exp $
-XCOMM $XFree86: xc/lib/zlib/Imakefile,v 1.6 1999/04/17 09:08:13 dawes Exp $
+XCOMM $XFree86: xc/lib/zlib/Imakefile,v 1.9 2003/06/01 21:05:49 herrb Exp $
+#ifndef cygwinArchitecture
#define DoNormalLib YES
#define DoSharedLib NO
+#else
+#define DoNormalLib NO
+#define DoSharedLib YES
+#endif
#define DoExtraLib NO
#define DoDebugLib NO
#define DoProfileLib NO
#define HasSharedData NO
#define LibName z
#define SoRev SOZLIBREV
+
+ ZLIBDIR = $(TOP)/extras/zlib
+INCLUDES = -I$(ZLIBDIR)
+
#if OsNeedZlibHeaders
#define LibHeaders YES
HEADERS = zconf.h zlib.h
@@ -31,4 +40,22 @@ OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o \
#include <Library.tmpl>
+LinkSourceFile(adler32.c,$(ZLIBDIR))
+LinkSourceFile(compress.c,$(ZLIBDIR))
+LinkSourceFile(crc32.c,$(ZLIBDIR))
+LinkSourceFile(gzio.c,$(ZLIBDIR))
+LinkSourceFile(uncompr.c,$(ZLIBDIR))
+LinkSourceFile(deflate.c,$(ZLIBDIR))
+LinkSourceFile(trees.c,$(ZLIBDIR))
+LinkSourceFile(zutil.c,$(ZLIBDIR))
+LinkSourceFile(inflate.c,$(ZLIBDIR))
+LinkSourceFile(infblock.c,$(ZLIBDIR))
+LinkSourceFile(inftrees.c,$(ZLIBDIR))
+LinkSourceFile(infcodes.c,$(ZLIBDIR))
+LinkSourceFile(infutil.c,$(ZLIBDIR))
+LinkSourceFile(inffast.c,$(ZLIBDIR))
+
+LinkSourceFile(zconf.h,$(ZLIBDIR))
+LinkSourceFile(zlib.h,$(ZLIBDIR))
+
DependTarget()
diff --git a/xc/programs/Imakefile b/xc/programs/Imakefile
index aa943acfe..61b9fb811 100644
--- a/xc/programs/Imakefile
+++ b/xc/programs/Imakefile
@@ -2,7 +2,7 @@ XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:47:01 cpqbld Exp $
-XCOMM $XFree86: xc/programs/Imakefile,v 3.53 2002/11/20 04:43:50 dawes Exp $
+XCOMM $XFree86: xc/programs/Imakefile,v 3.56 2003/06/20 15:49:50 eich Exp $
#define IHaveSubdirs
#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
@@ -68,10 +68,6 @@ XFINDPROXYSRCDIR = xfindproxy
MKFONTSCALEDIR = mkfontscale
#endif
-#if BuildXIElib
- XIECLIENTDIRS = xieperf
-#endif
-
#if BuildXInputLib
XINPUTCLIENTDIRS = xsetmode xsetpointer
#endif
@@ -108,13 +104,20 @@ XTRAPCLIENTDIRS = xtrap
XCURSORGENDIR = xcursorgen
#endif
+#if BuildFontconfigLibrary
+ FCDIRS = fc-cache fc-list
+#endif
+#if 0
+ FCLANGDIR = fc-lang
+#endif
+
#if BuildServersOnly || !BuildClients
SUBDIRS = $(XSSRCDIR)
#else
SUBDIRS = \
- appres bdftopcf bitmap \
- $(SCREENSAVESRCDIR) editres fslsfonts fstobdf iceauth \
- ico listres luit \
+ appres bdftopcf fonttosfnt bitmap \
+ $(SCREENSAVESRCDIR) editres $(FCDIRS) $(FCLANGDIR) fslsfonts fstobdf \
+ iceauth ico listres luit \
$(MAKEPSRESDIR) $(DPSCLIENTDIRS) \
$(MKCFMSRCDIR) \
mkfontdir $(MKFONTSCALEDIR) oclock $(PROXYMGRSRCDIR) \
@@ -124,15 +127,14 @@ SUBDIRS = \
xcmsdb $(XCONSOLESRCDIR) xditview $(XDMSRCDIR) xdpyinfo \
$(XF86DGASRCDIR) xedit xev xeyes xfd xfontsel $(XFSSRCDIR) xfsinfo \
$(XFINDPROXYSRCDIR) $(XFWPSRCDIR) $(XGAMMASRCDIR) xgc $(XHOSTSRCDIR) \
- $(XIECLIENTDIRS) $(XINITSRCDIR) $(XKBSRCDIRS) xkill $(XLOADDIR) xlogo \
- xlsatoms \
+ $(XINITSRCDIR) $(XKBSRCDIRS) xkill $(XLOADDIR) xlogo xlsatoms \
xlsclients xlsfonts xmag xman xmessage xmh xmodmap xprop xrdb \
xrefresh $(XRXSRCDIR) xset \
xsetroot $(XSMSRCDIR) xstdcmap $(XINPUTCLIENTDIRS) \
$(XTERMSRCDIR) $(XTRAPCLIENTDIRS) $(XVIDTUNESRCDIR) xwd xwininfo xwud \
$(XPMCLIENTDIRS) $(XVINFOSRCDIR) \
$(XSSRCDIR) $(XASSRCDIR) $(LBXPROXYSRCDIR) $(SCRIPTSDIR) \
- $(GLXCLIENTDIRS) $(XRANDRDIR) $(XCURSORGENDIR)
+ $(GLXCLIENTDIRS) $(XRANDRDIR) $(XCURSORGENDIR)
#endif
MakeSubdirs($(SUBDIRS))
diff --git a/xc/programs/Xserver/afb/afb.h b/xc/programs/Xserver/afb/afb.h
index ef96c3231..91b876a0a 100644
--- a/xc/programs/Xserver/afb/afb.h
+++ b/xc/programs/Xserver/afb/afb.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/afb/afb.h,v 3.5 1999/06/27 16:17:29 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/afb/afb.h,v 3.9 2003/07/16 01:38:35 dawes Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -56,14 +56,15 @@ SOFTWARE.
#include "region.h"
#include "gc.h"
#include "colormap.h"
-#include "miscstruct.h"
+#include "regionstr.h"
#include "mibstore.h"
+#include "mfb.h"
extern int afbInverseAlu[];
extern int afbScreenPrivateIndex;
/* warning: PixelType definition duplicated in maskbits.h */
#ifndef PixelType
-#define PixelType unsigned long
+#define PixelType CARD32
#endif /* PixelType */
#define AFB_MAX_DEPTH 8
@@ -282,7 +283,20 @@ extern RegionPtr afbPixmapToRegion(
/* afbcmap.c */
-extern Bool afbInitializeColormap(
+extern int afbListInstalledColormaps(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ Colormap * /*pmaps*/
+#endif
+);
+
+extern void afbInstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/
+#endif
+);
+
+extern void afbUninstallColormap(
#if NeedFunctionPrototypes
ColormapPtr /*pmap*/
#endif
@@ -297,6 +311,27 @@ extern void afbResolveColor(
#endif
);
+extern Bool afbInitializeColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/
+#endif
+);
+
+extern int afbExpandDirectColors(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/,
+ int /*ndefs*/,
+ xColorItem * /*indefs*/,
+ xColorItem * /*outdefs*/
+#endif
+);
+
+extern Bool afbCreateDefColormap(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/
+#endif
+);
+
extern Bool afbSetVisualTypes(
#if NeedFunctionPrototypes
int /*depth*/,
@@ -305,10 +340,18 @@ extern Bool afbSetVisualTypes(
#endif
);
-extern int afbListInstalledColormaps(ScreenPtr, Colormap *);
-extern void afbInstallColormap(ColormapPtr);
-extern void afbUninstallColormap(ColormapPtr);
-extern Bool afbCreateDefColormap(ScreenPtr);
+extern Bool afbInitVisuals(
+#if NeedFunctionPrototypes
+ VisualPtr * /*visualp*/,
+ DepthPtr * /*depthp*/,
+ int * /*nvisualp*/,
+ int * /*ndepthp*/,
+ int * /*rootDepthp*/,
+ VisualID * /*defaultVisp*/,
+ unsigned long /*sizes*/,
+ int /*bitsPerRGB*/
+#endif
+);
/* afbfillarc.c */
@@ -500,7 +543,7 @@ extern void afbGetSpans(
);
/* afbhrzvert.c */
-extern int afbHorzS(
+extern void afbHorzS(
#if NeedFunctionPrototypes
PixelType * /*addrl*/,
int /*nlwidth*/,
@@ -513,7 +556,7 @@ extern int afbHorzS(
#endif
);
-extern int afbVertS(
+extern void afbVertS(
#if NeedFunctionPrototypes
PixelType * /*addrl*/,
int /*nlwidth*/,
@@ -792,7 +835,7 @@ extern void afbSegmentSD(
);
/* afbsetsp.c */
-extern int afbSetScanline(
+extern void afbSetScanline(
#if NeedFunctionPrototypes
int /*y*/,
int /*xOrigin*/,
@@ -1215,6 +1258,7 @@ typedef struct _afbpos{
case GXandInverted: \
result = fnANDINVERTED (src, dst); \
break; \
+ default: \
case GXnoop: \
result = fnNOOP (src, dst); \
break; \
diff --git a/xc/programs/Xserver/afb/afbbitblt.c b/xc/programs/Xserver/afb/afbbitblt.c
index c88800b4b..36a684008 100644
--- a/xc/programs/Xserver/afb/afbbitblt.c
+++ b/xc/programs/Xserver/afb/afbbitblt.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/afb/afbbitblt.c,v 3.2 1998/03/20 21:04:53 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/afb/afbbitblt.c,v 3.4 2003/07/16 01:38:35 dawes Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -52,7 +52,6 @@ SOFTWARE.
#include "X.h"
#include "Xprotostr.h"
-#include "miscstruct.h"
#include "regionstr.h"
#include "gcstruct.h"
#include "windowstr.h"
@@ -171,7 +170,7 @@ afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height,
void (*doBitBlt)();
unsigned long planemask;
{
- RegionPtr prgnSrcClip; /* may be a new region, or just a copy */
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
Bool freeSrcClip = FALSE;
RegionPtr prgnExposed;
@@ -188,7 +187,6 @@ afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height,
BoxRec fastBox;
int fastClip = 0; /* for fast clipping with pixmap source */
int fastExpose = 0; /* for fast exposures with pixmap source */
- void (*localDoBitBlt)();
origSource.x = srcx;
origSource.y = srcy;
@@ -374,7 +372,6 @@ unsigned long plane;
int alu;
RegionPtr prgnExposed = NULL;
unsigned long old_planemask;
- PixmapPtr pPixmap = NULL;
if (pDstDrawable->depth == 1) {
old_planemask = pGC->planemask;
@@ -405,7 +402,7 @@ unsigned long plane;
int free_pixmap = FALSE;
PixmapPtr pBitmap = (PixmapPtr)pSrcDrawable;
ScreenPtr pScreen = pSrcDrawable->pScreen;
- GCPtr pGC1;
+ GCPtr pGC1 = NULL;
if (pSrcDrawable == pDstDrawable ||
pSrcDrawable->type == DRAWABLE_WINDOW || pSrcDrawable->depth != 1) {
diff --git a/xc/programs/Xserver/afb/afbclip.c b/xc/programs/Xserver/afb/afbclip.c
index 4074f819f..07eb3b816 100644
--- a/xc/programs/Xserver/afb/afbclip.c
+++ b/xc/programs/Xserver/afb/afbclip.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/afb/afbclip.c,v 3.1 1999/06/13 13:47:37 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/afb/afbclip.c,v 3.3 2003/07/16 01:38:35 dawes Exp $ */
/***********************************************************
Copyright (c) 1987 X Consortium
@@ -49,10 +49,9 @@ SOFTWARE.
/* $XConsortium: afbclip.c,v 5.6 94/04/17 20:28:19 dpw Exp $ */
#include "X.h"
-#include "miscstruct.h"
+#include "regionstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
-#include "regionstr.h"
#include "gc.h"
#include "maskbits.h"
#include "mi.h"
@@ -94,18 +93,18 @@ RegionPtr
afbPixmapToRegion(pPix)
PixmapPtr pPix;
{
- register RegionPtr pReg;
- register PixelType *pw, w;
+ register RegionPtr pReg;
+ register PixelType *pw, w;
register int ib;
- int width, h, base, rx1, crects;
- PixelType *pwLineEnd;
- int irectPrevStart, irectLineStart;
+ int width, h, base, rx1 = 0, crects;
+ PixelType *pwLineEnd;
+ int irectPrevStart, irectLineStart;
register BoxPtr prectO, prectN;
- BoxPtr FirstRect, rects, prectLineStart;
- Bool fInBox, fSame;
- register PixelType mask0 = mask[0];
- PixelType *pwLine;
- int nWidth;
+ BoxPtr FirstRect, rects, prectLineStart;
+ Bool fInBox, fSame;
+ register PixelType mask0 = mask[0];
+ PixelType *pwLine;
+ int nWidth;
pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1);
if(!pReg)
diff --git a/xc/programs/Xserver/afb/afbfillarc.c b/xc/programs/Xserver/afb/afbfillarc.c
index a05c32228..1db48b07c 100644
--- a/xc/programs/Xserver/afb/afbfillarc.c
+++ b/xc/programs/Xserver/afb/afbfillarc.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/afb/afbfillarc.c,v 3.1 1998/03/20 21:04:54 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/afb/afbfillarc.c,v 3.2 2003/07/16 01:38:35 dawes Exp $ */
/************************************************************
Copyright (c) 1989 X Consortium
@@ -30,7 +30,7 @@ in this Software without prior written authorization from the X Consortium.
#include "X.h"
#include "Xprotostr.h"
-#include "miscstruct.h"
+#include "regionstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
diff --git a/xc/programs/Xserver/afb/afbfillrct.c b/xc/programs/Xserver/afb/afbfillrct.c
index 4d93c2634..a65b608e6 100644
--- a/xc/programs/Xserver/afb/afbfillrct.c
+++ b/xc/programs/Xserver/afb/afbfillrct.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/afb/afbfillrct.c,v 3.1 1998/03/20 21:04:54 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/afb/afbfillrct.c,v 3.2 2003/07/16 01:38:35 dawes Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -54,7 +54,6 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "windowstr.h"
-#include "miscstruct.h"
#include "regionstr.h"
#include "scrnintstr.h"
diff --git a/xc/programs/Xserver/afb/afbpolypnt.c b/xc/programs/Xserver/afb/afbpolypnt.c
index da9f13d82..b09f3b037 100644
--- a/xc/programs/Xserver/afb/afbpolypnt.c
+++ b/xc/programs/Xserver/afb/afbpolypnt.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/afb/afbpolypnt.c,v 3.1 1998/03/20 21:04:56 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/afb/afbpolypnt.c,v 3.2 2003/07/16 01:38:35 dawes Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -54,7 +54,6 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "windowstr.h"
-#include "miscstruct.h"
#include "regionstr.h"
#include "scrnintstr.h"
diff --git a/xc/programs/Xserver/afb/afbpushpxl.c b/xc/programs/Xserver/afb/afbpushpxl.c
index 688aec973..d556acd8c 100644
--- a/xc/programs/Xserver/afb/afbpushpxl.c
+++ b/xc/programs/Xserver/afb/afbpushpxl.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/afb/afbpushpxl.c,v 3.1 1998/03/20 21:04:56 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/afb/afbpushpxl.c,v 3.2 2003/07/16 01:38:35 dawes Exp $ */
/***********************************************************
Copyright (c) 1987 X Consortium
@@ -52,9 +52,8 @@ SOFTWARE.
#include "gcstruct.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
-#include "miscstruct.h"
-#include "maskbits.h"
#include "regionstr.h"
+#include "maskbits.h"
#include "afb.h"
/* afbSolidPP is courtesy of xhacks@csri.toronto.edu
diff --git a/xc/programs/Xserver/afb/afbzerarc.c b/xc/programs/Xserver/afb/afbzerarc.c
index a12891363..db1bd2bfd 100644
--- a/xc/programs/Xserver/afb/afbzerarc.c
+++ b/xc/programs/Xserver/afb/afbzerarc.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/afb/afbzerarc.c,v 3.1 1998/03/20 21:04:58 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/afb/afbzerarc.c,v 3.3 2003/07/16 01:38:36 dawes Exp $ */
/************************************************************
Copyright (c) 1989 X Consortium
@@ -36,7 +36,7 @@ in this Software without prior written authorization from the X Consortium.
#include "X.h"
#include "Xprotostr.h"
-#include "miscstruct.h"
+#include "regionstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
@@ -91,7 +91,6 @@ afbZeroArcSS(pDraw, pGC, arc)
register int k1, k3, dx, dy;
PixelType *addrl;
PixelType *yorgl, *yorgol;
- PixelType pixel;
int nlwidth, yoffset, dyoffset;
int sizeDst, depthDst;
PixelType pmask;
diff --git a/xc/programs/Xserver/cfb/cfb.h b/xc/programs/Xserver/cfb/cfb.h
index 3d84eb295..b7d027905 100644
--- a/xc/programs/Xserver/cfb/cfb.h
+++ b/xc/programs/Xserver/cfb/cfb.h
@@ -1,4 +1,4 @@
-/* $TOG: cfb.h /main/53 1998/02/09 14:08:27 kaleb $ */
+/* $Xorg: cfb.h,v 1.3 2000/08/17 19:48:12 cpqbld Exp $ */
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
@@ -27,11 +27,12 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86: xc/programs/Xserver/cfb/cfb.h,v 3.19 1999/08/21 13:48:13 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfb.h,v 3.30 2003/07/19 13:22:27 tsi Exp $ */
#if !defined(__CFB_H__) || defined(CFB_PROTOTYPES_ONLY)
#include "X.h"
+#include "globals.h"
#include "pixmap.h"
#include "region.h"
#include "gc.h"
@@ -44,6 +45,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "cfbmap.h"
+#ifndef CfbBits
+#define CfbBits CARD32
+#endif
+
#ifndef CFB_PROTOTYPES_ONLY
#define __CFB_H__
/*
@@ -62,7 +67,7 @@ typedef struct {
unsigned char ropOpStip; /* rop for opaque stipple */
/* this value is ropFillArea in mfb, usurped for cfb */
unsigned char oneRect; /* drawable has one clip rect */
- unsigned long xor, and; /* reduced rop values */
+ CfbBits xor, and; /* reduced rop values */
} cfbPrivGC;
typedef cfbPrivGC *cfbPrivGCPtr;
@@ -75,7 +80,7 @@ typedef cfbPrivGC *cfbPrivGCPtr;
/* way to carry RROP info around */
typedef struct {
unsigned char rop;
- unsigned long xor, and;
+ CfbBits xor, and;
} cfbRRopRec, *cfbRRopPtr;
/* private field of window */
@@ -95,24 +100,19 @@ typedef struct {
/* cfb8bit.c */
extern int cfbSetStipple(
-#if NeedFunctionPrototypes
int /*alu*/,
- unsigned long /*fg*/,
- unsigned long /*planemask*/
-#endif
+ CfbBits /*fg*/,
+ CfbBits /*planemask*/
);
extern int cfbSetOpaqueStipple(
-#if NeedFunctionPrototypes
int /*alu*/,
- unsigned long /*fg*/,
- unsigned long /*bg*/,
- unsigned long /*planemask*/
-#endif
+ CfbBits /*fg*/,
+ CfbBits /*bg*/,
+ CfbBits /*planemask*/
);
extern int cfbComputeClipMasks32(
-#if NeedFunctionPrototypes
BoxPtr /*pBox*/,
int /*numRects*/,
int /*x*/,
@@ -120,25 +120,21 @@ extern int cfbComputeClipMasks32(
int /*w*/,
int /*h*/,
CARD32 * /*clips*/
-#endif
);
#endif /* !CFB_PROTOTYPES_ONLY */
/* cfb8cppl.c */
extern void cfbCopyImagePlane(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
#ifndef CFB_PROTOTYPES_ONLY
extern void cfbCopyPlane8to1(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
@@ -146,11 +142,9 @@ extern void cfbCopyPlane8to1(
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/,
unsigned long /*bitPlane*/
-#endif
);
extern void cfbCopyPlane16to1(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
@@ -158,11 +152,9 @@ extern void cfbCopyPlane16to1(
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/,
unsigned long /*bitPlane*/
-#endif
);
extern void cfbCopyPlane24to1(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
@@ -170,11 +162,9 @@ extern void cfbCopyPlane24to1(
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/,
unsigned long /*bitPlane*/
-#endif
);
extern void cfbCopyPlane32to1(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
@@ -182,14 +172,12 @@ extern void cfbCopyPlane32to1(
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/,
unsigned long /*bitPlane*/
-#endif
);
#endif
/* cfb8lineCO.c */
extern int cfb8LineSS1RectCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
@@ -200,21 +188,17 @@ extern int cfb8LineSS1RectCopy(
int * /*y1p*/,
int * /*x2p*/,
int * /*y2p*/
-#endif
);
extern void cfb8LineSS1Rect(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pptInit*/
-#endif
);
extern void cfb8ClippedLineCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x1*/,
@@ -223,12 +207,10 @@ extern void cfb8ClippedLineCopy(
int /*y2*/,
BoxPtr /*boxp*/,
Bool /*shorten*/
-#endif
);
/* cfb8lineCP.c */
extern int cfb8LineSS1RectPreviousCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
@@ -239,13 +221,10 @@ extern int cfb8LineSS1RectPreviousCopy(
int * /*y1p*/,
int * /*x2p*/,
int * /*y2p*/
-
-#endif
);
/* cfb8lineG.c */
extern int cfb8LineSS1RectGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
@@ -256,11 +235,9 @@ extern int cfb8LineSS1RectGeneral(
int * /*y1p*/,
int * /*x2p*/,
int * /*y2p*/
-#endif
);
extern void cfb8ClippedLineGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x1*/,
@@ -269,12 +246,10 @@ extern void cfb8ClippedLineGeneral(
int /*y2*/,
BoxPtr /*boxp*/,
Bool /*shorten*/
-#endif
);
/* cfb8lineX.c */
extern int cfb8LineSS1RectXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
@@ -285,11 +260,9 @@ extern int cfb8LineSS1RectXor(
int * /*y1p*/,
int * /*x2p*/,
int * /*y2p*/
-#endif
);
extern void cfb8ClippedLineXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x1*/,
@@ -298,70 +271,56 @@ extern void cfb8ClippedLineXor(
int /*y2*/,
BoxPtr /*boxp*/,
Bool /*shorten*/
-#endif
);
/* cfb8segC.c */
extern int cfb8SegmentSS1RectCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
/* cfb8segCS.c */
extern int cfb8SegmentSS1RectShiftCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
extern void cfb8SegmentSS1Rect(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
/* cfb8segG.c */
extern int cfb8SegmentSS1RectGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
/* cfbsegX.c */
extern int cfb8SegmentSS1RectXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
/* cfballpriv.c */
extern Bool cfbAllocatePrivates(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
int * /*window_index*/,
int * /*gc_index*/
-#endif
);
/* cfbbitblt.c */
extern RegionPtr cfbBitBlt(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr/*pGC*/,
@@ -372,33 +331,50 @@ extern RegionPtr cfbBitBlt(
int /*dstx*/,
int /*dsty*/,
void (* /*doBitBlt*/)(
-#if NeedNestedPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+ ),
+ unsigned long /*bitPlane*/
+);
+
+#define cfbCopyPlaneExpand cfbBitBlt
+
+extern RegionPtr cfbCopyPlaneReduce(
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr /*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/,
+ void (* /*doCopyPlane*/)(
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/,
- unsigned long /*bitPlane*/
-#endif
+ unsigned long /*bitPlane*/ /* We must know which plane to reduce! */
),
unsigned long /*bitPlane*/
-#endif
);
extern void cfbDoBitblt(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
extern RegionPtr cfbCopyArea(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr/*pGC*/,
@@ -408,25 +384,20 @@ extern RegionPtr cfbCopyArea(
int /*height*/,
int /*dstx*/,
int /*dsty*/
-#endif
);
#ifndef CFB_PROTOTYPES_ONLY
extern void cfbCopyPlane1to8(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/,
- unsigned long /*bitPlane*/
-#endif
+ unsigned long /*planemask*/
);
#endif
extern RegionPtr cfbCopyPlane(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
@@ -437,64 +408,54 @@ extern RegionPtr cfbCopyPlane(
int /*dstx*/,
int /*dsty*/,
unsigned long /*bitPlane*/
-#endif
);
/* cfbbltC.c */
extern void cfbDoBitbltCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
/* cfbbltG.c */
extern void cfbDoBitbltGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
/* cfbbltO.c */
extern void cfbDoBitbltOr(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
/* cfbbltX.c */
extern void cfbDoBitbltXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
/* cfbbres.c */
extern void cfbBresS(
-#if NeedFunctionPrototypes
int /*rop*/,
- unsigned long /*and*/,
- unsigned long /*xor*/,
- unsigned long * /*addrl*/,
+ CfbBits /*and*/,
+ CfbBits /*xor*/,
+ CfbBits * /*addrl*/,
int /*nlwidth*/,
int /*signdx*/,
int /*signdy*/,
@@ -505,19 +466,17 @@ extern void cfbBresS(
int /*e1*/,
int /*e2*/,
int /*len*/
-#endif
);
/* cfbbresd.c */
extern void cfbBresD(
-#if NeedFunctionPrototypes
cfbRRopPtr /*rrops*/,
int * /*pdashIndex*/,
unsigned char * /*pDash*/,
int /*numInDashList*/,
int * /*pdashOffset*/,
int /*isDoubleDash*/,
- unsigned long * /*addrl*/,
+ CfbBits * /*addrl*/,
int /*nlwidth*/,
int /*signdx*/,
int /*signdy*/,
@@ -528,93 +487,71 @@ extern void cfbBresD(
int /*e1*/,
int /*e2*/,
int /*len*/
-#endif
);
/* cfbbstore.c */
extern void cfbSaveAreas(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/,
RegionPtr /*prgnSave*/,
int /*xorg*/,
int /*yorg*/,
WindowPtr /*pWin*/
-#endif
);
extern void cfbRestoreAreas(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/,
RegionPtr /*prgnRestore*/,
int /*xorg*/,
int /*yorg*/,
WindowPtr /*pWin*/
-#endif
);
/* cfbcmap.c */
#ifndef CFB_PROTOTYPES_ONLY
extern int cfbListInstalledColormaps(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
Colormap * /*pmaps*/
-#endif
);
extern void cfbInstallColormap(
-#if NeedFunctionPrototypes
ColormapPtr /*pmap*/
-#endif
);
extern void cfbUninstallColormap(
-#if NeedFunctionPrototypes
ColormapPtr /*pmap*/
-#endif
);
extern void cfbResolveColor(
-#if NeedFunctionPrototypes
unsigned short * /*pred*/,
unsigned short * /*pgreen*/,
unsigned short * /*pblue*/,
VisualPtr /*pVisual*/
-#endif
);
extern Bool cfbInitializeColormap(
-#if NeedFunctionPrototypes
ColormapPtr /*pmap*/
-#endif
);
extern int cfbExpandDirectColors(
-#if NeedFunctionPrototypes
ColormapPtr /*pmap*/,
int /*ndef*/,
xColorItem * /*indefs*/,
xColorItem * /*outdefs*/
-#endif
);
extern Bool cfbCreateDefColormap(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/
-#endif
);
extern Bool cfbSetVisualTypes(
-#if NeedFunctionPrototypes
int /*depth*/,
int /*visuals*/,
int /*bitsPerRGB*/
-#endif
);
extern void cfbClearVisualTypes(void);
extern Bool cfbInitVisuals(
-#if NeedFunctionPrototypes
VisualPtr * /*visualp*/,
DepthPtr * /*depthp*/,
int * /*nvisualp*/,
@@ -623,145 +560,117 @@ extern Bool cfbInitVisuals(
VisualID * /*defaultVisp*/,
unsigned long /*sizes*/,
int /*bitsPerRGB*/
-#endif
);
#endif
/* cfbfillarcC.c */
extern void cfbPolyFillArcSolidCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* cfbfillarcG.c */
extern void cfbPolyFillArcSolidGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* cfbfillrct.c */
extern void cfbFillBoxTileOdd(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
BoxPtr /*rects*/,
PixmapPtr /*tile*/,
int /*xrot*/,
int /*yrot*/
-#endif
);
extern void cfbFillRectTileOdd(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbPolyFillRect(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nrectFill*/,
xRectangle * /*prectInit*/
-#endif
);
/* cfbfillsp.c */
extern void cfbUnnaturalTileFS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr/*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
extern void cfbUnnaturalStippleFS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr/*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
#ifndef CFB_PROTOTYPES_ONLY
extern void cfb8Stipple32FS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
extern void cfb8OpaqueStipple32FS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
#endif
/* cfbgc.c */
extern GCOpsPtr cfbMatchCommon(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
cfbPrivGCPtr /*devPriv*/
-#endif
);
extern Bool cfbCreateGC(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/
-#endif
);
extern void cfbValidateGC(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
unsigned long /*changes*/,
DrawablePtr /*pDrawable*/
-#endif
);
/* cfbgetsp.c */
extern void cfbGetSpans(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*wMax*/,
DDXPointPtr /*ppt*/,
int * /*pwidth*/,
int /*nspans*/,
char * /*pdstStart*/
-#endif
);
/* cfbglblt8.c */
extern void cfbPolyGlyphBlt8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -769,12 +678,10 @@ extern void cfbPolyGlyphBlt8(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* cfbglrop8.c */
extern void cfbPolyGlyphRop8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -782,39 +689,33 @@ extern void cfbPolyGlyphRop8(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* cfbhrzvert.c */
-extern int cfbHorzS(
-#if NeedFunctionPrototypes
+extern void cfbHorzS(
int /*rop*/,
- unsigned long /*and*/,
- unsigned long /*xor*/,
- unsigned long * /*addrl*/,
+ CfbBits /*and*/,
+ CfbBits /*xor*/,
+ CfbBits * /*addrl*/,
int /*nlwidth*/,
int /*x1*/,
int /*y1*/,
int /*len*/
-#endif
);
extern void cfbVertS(
-#if NeedFunctionPrototypes
int /*rop*/,
- unsigned long /*and*/,
- unsigned long /*xor*/,
- unsigned long * /*addrl*/,
+ CfbBits /*and*/,
+ CfbBits /*xor*/,
+ CfbBits * /*addrl*/,
int /*nlwidth*/,
int /*x1*/,
int /*y1*/,
int /*len*/
-#endif
);
/* cfbigblt8.c */
extern void cfbImageGlyphBlt8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -822,12 +723,10 @@ extern void cfbImageGlyphBlt8(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* cfbimage.c */
extern void cfbPutImage(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*depth*/,
@@ -838,11 +737,9 @@ extern void cfbPutImage(
int /*leftPad*/,
int /*format*/,
char * /*pImage*/
-#endif
);
extern void cfbGetImage(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*sx*/,
int /*sy*/,
@@ -851,148 +748,116 @@ extern void cfbGetImage(
unsigned int /*format*/,
unsigned long /*planeMask*/,
char * /*pdstLine*/
-#endif
);
/* cfbline.c */
extern void cfbLineSS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pptInit*/
-#endif
);
extern void cfbLineSD(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pptInit*/
-#endif
);
/* cfbmskbits.c */
/* cfbpixmap.c */
extern PixmapPtr cfbCreatePixmap(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
int /*width*/,
int /*height*/,
int /*depth*/
-#endif
);
extern Bool cfbDestroyPixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/
-#endif
);
extern PixmapPtr cfbCopyPixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pSrc*/
-#endif
);
extern void cfbPadPixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/
-#endif
);
extern void cfbXRotatePixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPix*/,
int /*rw*/
-#endif
);
extern void cfbYRotatePixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPix*/,
int /*rh*/
-#endif
);
extern void cfbCopyRotatePixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*psrcPix*/,
PixmapPtr * /*ppdstPix*/,
int /*xrot*/,
int /*yrot*/
-#endif
);
/* cfbply1rctC.c */
extern void cfbFillPoly1RectCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*shape*/,
int /*mode*/,
int /*count*/,
DDXPointPtr /*ptsIn*/
-#endif
);
/* cfbply1rctG.c */
extern void cfbFillPoly1RectGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*shape*/,
int /*mode*/,
int /*count*/,
DDXPointPtr /*ptsIn*/
-#endif
);
/* cfbpntwin.c */
extern void cfbPaintWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
RegionPtr /*pRegion*/,
int /*what*/
-#endif
);
extern void cfbFillBoxSolid(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
unsigned long /*pixel*/
-#endif
);
extern void cfbFillBoxTile32(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
PixmapPtr /*tile*/
-#endif
);
/* cfbpolypnt.c */
extern void cfbPolyPoint(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
xPoint * /*pptInit*/
-#endif
);
/* cfbpush8.c */
#ifndef CFB_PROTOTYPES_ONLY
extern void cfbPushPixels8(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
PixmapPtr /*pBitmap*/,
DrawablePtr /*pDrawable*/,
@@ -1000,59 +865,47 @@ extern void cfbPushPixels8(
int /*dy*/,
int /*xOrg*/,
int /*yOrg*/
-#endif
);
/* cfbrctstp8.c */
extern void cfb8FillRectOpaqueStippled32(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfb8FillRectTransparentStippled32(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfb8FillRectStippledUnnatural(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
#endif
/* cfbrrop.c */
extern int cfbReduceRasterOp(
-#if NeedFunctionPrototypes
int /*rop*/,
- unsigned long /*fg*/,
- unsigned long /*pm*/,
- unsigned long * /*andp*/,
- unsigned long * /*xorp*/
-#endif
+ CfbBits /*fg*/,
+ CfbBits /*pm*/,
+ CfbBits * /*andp*/,
+ CfbBits * /*xorp*/
);
/* cfbscrinit.c */
extern Bool cfbCloseScreen(
-#if NeedFunctionPrototypes
int /*index*/,
ScreenPtr /*pScreen*/
-#endif
);
extern Bool cfbSetupScreen(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
int /*xsize*/,
@@ -1060,11 +913,9 @@ extern Bool cfbSetupScreen(
int /*dpix*/,
int /*dpiy*/,
int /*width*/
-#endif
);
extern Bool cfbFinishScreenInit(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
int /*xsize*/,
@@ -1072,11 +923,9 @@ extern Bool cfbFinishScreenInit(
int /*dpix*/,
int /*dpiy*/,
int /*width*/
-#endif
);
extern Bool cfbScreenInit(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
int /*xsize*/,
@@ -1084,44 +933,34 @@ extern Bool cfbScreenInit(
int /*dpix*/,
int /*dpiy*/,
int /*width*/
-#endif
);
extern PixmapPtr cfbGetScreenPixmap(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/
-#endif
);
extern void cfbSetScreenPixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPix*/
-#endif
);
/* cfbseg.c */
extern void cfbSegmentSS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSeg*/
-#endif
);
extern void cfbSegmentSD(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSeg*/
-#endif
);
/* cfbsetsp.c */
-extern int cfbSetScanline(
-#if NeedFunctionPrototypes
+extern void cfbSetScanline(
int /*y*/,
int /*xOrigin*/,
int /*xStart*/,
@@ -1131,11 +970,9 @@ extern int cfbSetScanline(
int * /*pdstBase*/,
int /*widthDst*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbSetSpans(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
char * /*psrc*/,
@@ -1143,76 +980,62 @@ extern void cfbSetSpans(
int * /*pwidth*/,
int /*nspans*/,
int /*fSorted*/
-#endif
);
/* cfbsolidC.c */
extern void cfbFillRectSolidCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbSolidSpansCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbsolidG.c */
extern void cfbFillRectSolidGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbSolidSpansGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbsolidX.c */
extern void cfbFillRectSolidXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbSolidSpansXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbteblt8.c */
#ifndef CFB_PROTOTYPES_ONLY
extern void cfbTEGlyphBlt8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr/*pGC*/,
int /*xInit*/,
@@ -1220,13 +1043,11 @@ extern void cfbTEGlyphBlt8(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
#endif
/* cfbtegblt.c */
extern void cfbTEGlyphBlt(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr/*pGC*/,
int /*x*/,
@@ -1234,54 +1055,44 @@ extern void cfbTEGlyphBlt(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* cfbtile32C.c */
extern void cfbFillRectTile32Copy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbTile32FSCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbtile32G.c */
extern void cfbFillRectTile32General(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbTile32FSGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbtileoddC.c */
extern void cfbFillBoxTileOddCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
@@ -1290,11 +1101,9 @@ extern void cfbFillBoxTileOddCopy(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillSpanTileOddCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
DDXPointPtr /*ppt*/,
@@ -1304,11 +1113,9 @@ extern void cfbFillSpanTileOddCopy(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillBoxTile32sCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
@@ -1317,11 +1124,9 @@ extern void cfbFillBoxTile32sCopy(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillSpanTile32sCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
DDXPointPtr /*ppt*/,
@@ -1331,12 +1136,10 @@ extern void cfbFillSpanTile32sCopy(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
/* cfbtileoddG.c */
extern void cfbFillBoxTileOddGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
@@ -1345,11 +1148,9 @@ extern void cfbFillBoxTileOddGeneral(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillSpanTileOddGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
DDXPointPtr /*ppt*/,
@@ -1359,11 +1160,9 @@ extern void cfbFillSpanTileOddGeneral(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillBoxTile32sGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
@@ -1372,11 +1171,9 @@ extern void cfbFillBoxTile32sGeneral(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillSpanTile32sGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
DDXPointPtr /*ppt*/,
@@ -1386,88 +1183,67 @@ extern void cfbFillSpanTile32sGeneral(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
/* cfbwindow.c */
extern Bool cfbCreateWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern Bool cfbDestroyWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern Bool cfbMapWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWindow*/
-#endif
);
extern Bool cfbPositionWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/
-#endif
);
extern Bool cfbUnmapWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWindow*/
-#endif
);
extern void cfbCopyWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
DDXPointRec /*ptOldOrg*/,
RegionPtr /*prgnSrc*/
-#endif
);
extern Bool cfbChangeWindowAttributes(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
unsigned long /*mask*/
-#endif
);
/* cfbzerarcC.c */
extern void cfbZeroPolyArcSS8Copy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* cfbzerarcG.c */
extern void cfbZeroPolyArcSS8General(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* cfbzerarcX.c */
extern void cfbZeroPolyArcSS8Xor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
-#if !defined(SINGLEDEPTH) && PSZ != 8 || defined(FORCE_SEPARATE_PRIVATE)
+#if (!defined(SINGLEDEPTH) && PSZ != 8) || defined(FORCE_SEPARATE_PRIVATE)
#define CFB_NEED_SCREEN_PRIVATE
@@ -1490,7 +1266,7 @@ extern int cfbScreenPrivateIndex;
#define cfbGetPixelWidth(pDrawable) cfbGetTypedWidth(pDrawable, PixelType)
-#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned long)
+#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, CfbBits)
#define cfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
PixmapPtr _pPix; \
@@ -1506,7 +1282,7 @@ extern int cfbScreenPrivateIndex;
cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
#define cfbGetLongWidthAndPointer(pDrawable, width, pointer) \
- cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned long, unsigned long)
+ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, CfbBits, CfbBits)
#define cfbGetPixelWidthAndPointer(pDrawable, width, pointer) \
cfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
@@ -1518,7 +1294,7 @@ extern int cfbScreenPrivateIndex;
}
#define cfbGetWindowLongWidthAndPointer(pWin, width, pointer) \
- cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned long, unsigned long)
+ cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, CfbBits, CfbBits)
#define cfbGetWindowByteWidthAndPointer(pWin, width, pointer) \
cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned char, unsigned char)
@@ -1526,34 +1302,20 @@ extern int cfbScreenPrivateIndex;
#define cfbGetWindowPixelWidthAndPointer(pDrawable, width, pointer) \
cfbGetWindowTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
-/* Macros which handle a coordinate in a single register */
-
-/* Most compilers will convert divide by 65536 into a shift, if signed
- * shifts exist. If your machine does arithmetic shifts and your compiler
- * can't get it right, add to this line.
+/*
+ * XFree86 empties the root BorderClip when the VT is inactive,
+ * here's a macro which uses that to disable GetImage and GetSpans
*/
+#define cfbWindowEnabled(pWin) \
+ REGION_NOTEMPTY((pWin)->drawable.pScreen, \
+ &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip)
-/* mips compiler - what a joke - it CSEs the 65536 constant into a reg
- * forcing as to use div instead of shift. Let's be explicit.
- */
+#define cfbDrawableEnabled(pDrawable) \
+ ((pDrawable)->type == DRAWABLE_PIXMAP ? \
+ TRUE : cfbWindowEnabled((WindowPtr) pDrawable))
-#if defined(mips) || defined(sparc) || defined(__alpha) || defined(__alpha__) || defined(__i386__) || defined(i386)
-#define GetHighWord(x) (((int) (x)) >> 16)
-#else
-#define GetHighWord(x) (((int) (x)) / 65536)
-#endif
+#include "micoord.h"
-#if IMAGE_BYTE_ORDER == MSBFirst
-#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
-#define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff))
-#define intToX(i) (GetHighWord(i))
-#define intToY(i) ((int) ((short) i))
-#else
-#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
-#define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff))
-#define intToX(i) ((int) ((short) (i)))
-#define intToY(i) (GetHighWord(i))
-#endif
/*
* if CFB is built as a module, it shouldn't call libc functions.
*/
diff --git a/xc/programs/Xserver/cfb/cfbbitblt.c b/xc/programs/Xserver/cfb/cfbbitblt.c
index 648a749b2..98e427ce7 100644
--- a/xc/programs/Xserver/cfb/cfbbitblt.c
+++ b/xc/programs/Xserver/cfb/cfbbitblt.c
@@ -2,13 +2,17 @@
* cfb copy area
*/
-/* $XFree86: xc/programs/Xserver/cfb/cfbbitblt.c,v 1.6 1999/08/21 13:48:14 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbbitblt.c,v 1.17 2003/07/19 13:22:27 tsi Exp $ */
/*
Copyright 1989, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -27,7 +31,7 @@ in this Software without prior written authorization from The Open Group.
Author: Keith Packard
*/
-/* $TOG: cfbbitblt.c /main/73 1998/05/14 14:41:31 msr $ */
+/* $Xorg: cfbbitblt.c,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $ */
#include "X.h"
#include "Xmd.h"
@@ -49,7 +53,7 @@ Author: Keith Packard
#define cfbCopyPlane1toN cfbCopyPlane1to8
#define cfbCopyPlaneNto1 cfbCopyPlane8to1
#else
-unsigned int FgPixel, BgPixel;
+static unsigned int FgPixel, BgPixel;
# if PSZ == 16
#define cfbCopyPlane1toN cfbCopyPlane1to16
#define cfbCopyPlaneNto1 cfbCopyPlane16to1
@@ -64,19 +68,25 @@ unsigned int FgPixel, BgPixel;
# endif
#endif
+/* cfbBitBltcfb == cfbCopyPlaneExpand */
RegionPtr
-cfbBitBlt (pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane)
- register DrawablePtr pSrcDrawable;
- register DrawablePtr pDstDrawable;
- GC *pGC;
- int srcx, srcy;
- int width, height;
- int dstx, dsty;
- void (*doBitBlt)();
- unsigned long bitPlane;
+cfbBitBlt (
+ register DrawablePtr pSrcDrawable,
+ register DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ void (*doBitBlt)(
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/),
+ unsigned long bitPlane)
{
- RegionPtr prgnSrcClip; /* may be a new region, or just a copy */
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
Bool freeSrcClip = FALSE;
RegionPtr prgnExposed;
@@ -128,7 +138,13 @@ cfbBitBlt (pSrcDrawable, pDstDrawable,
{
if (pGC->subWindowMode == IncludeInferiors)
{
- if (!((WindowPtr) pSrcDrawable)->parent)
+ /*
+ * XFree86 DDX empties the border clip when the
+ * VT is inactive
+ */
+ if (!((WindowPtr) pSrcDrawable)->parent &&
+ REGION_NOTEMPTY (pSrcDrawable->pScreen,
+ &((WindowPtr) pSrcDrawable)->borderClip))
{
/*
* special case bitblt from root window in
@@ -292,15 +308,276 @@ cfbBitBlt (pSrcDrawable, pDstDrawable,
ppt->y = pbox->y1 + dy;
}
- (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane);
+ (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask);
DEALLOCATE_LOCAL(pptSrc);
}
prgnExposed = NULL;
if (pGC->fExpose)
{
- extern RegionPtr miHandleExposures();
+ /* Pixmap sources generate a NoExposed (we return NULL to do this) */
+ if (!fastExpose)
+ prgnExposed =
+ miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ origSource.x, origSource.y,
+ (int)origSource.width,
+ (int)origSource.height,
+ origDest.x, origDest.y, bitPlane);
+ }
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return prgnExposed;
+}
+
+
+RegionPtr
+cfbCopyPlaneReduce (
+ register DrawablePtr pSrcDrawable,
+ register DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ void (*doCopyPlane)(
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/),
+ unsigned long bitPlane)
+{
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
+ Bool freeSrcClip = FALSE;
+
+ RegionPtr prgnExposed;
+ RegionRec rgnDst;
+ DDXPointPtr pptSrc;
+ register DDXPointPtr ppt;
+ register BoxPtr pbox;
+ int i;
+ register int dx;
+ register int dy;
+ xRectangle origSource;
+ DDXPointRec origDest;
+ int numRects;
+ BoxRec fastBox;
+ int fastClip = 0; /* for fast clipping with pixmap source */
+ int fastExpose = 0; /* for fast exposures with pixmap source */
+
+ origSource.x = srcx;
+ origSource.y = srcy;
+ origSource.width = width;
+ origSource.height = height;
+ origDest.x = dstx;
+ origDest.y = dsty;
+
+ if ((pSrcDrawable != pDstDrawable) &&
+ pSrcDrawable->pScreen->SourceValidate)
+ {
+ (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
+ }
+
+ srcx += pSrcDrawable->x;
+ srcy += pSrcDrawable->y;
+ /* clip the source */
+
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP)
+ {
+ if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE))
+ {
+ prgnSrcClip = cfbGetCompositeClip(pGC);
+ }
+ else
+ {
+ fastClip = 1;
+ }
+ }
+ else
+ {
+ if (pGC->subWindowMode == IncludeInferiors)
+ {
+ /*
+ * XFree86 DDX empties the border clip when the
+ * VT is inactive
+ */
+ if (!((WindowPtr) pSrcDrawable)->parent &&
+ REGION_NOTEMPTY (pSrcDrawable->pScreen,
+ &((WindowPtr) pSrcDrawable)->borderClip))
+ {
+ /*
+ * special case bitblt from root window in
+ * IncludeInferiors mode; just like from a pixmap
+ */
+ fastClip = 1;
+ }
+ else if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE))
+ {
+ prgnSrcClip = cfbGetCompositeClip(pGC);
+ }
+ else
+ {
+ prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
+ freeSrcClip = TRUE;
+ }
+ }
+ else
+ {
+ prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
+ }
+ }
+
+ fastBox.x1 = srcx;
+ fastBox.y1 = srcy;
+ fastBox.x2 = srcx + width;
+ fastBox.y2 = srcy + height;
+
+ /* Don't create a source region if we are doing a fast clip */
+ if (fastClip)
+ {
+ fastExpose = 1;
+ /*
+ * clip the source; if regions extend beyond the source size,
+ * make sure exposure events get sent
+ */
+ if (fastBox.x1 < pSrcDrawable->x)
+ {
+ fastBox.x1 = pSrcDrawable->x;
+ fastExpose = 0;
+ }
+ if (fastBox.y1 < pSrcDrawable->y)
+ {
+ fastBox.y1 = pSrcDrawable->y;
+ fastExpose = 0;
+ }
+ if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
+ {
+ fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ fastExpose = 0;
+ }
+ if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
+ {
+ fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ fastExpose = 0;
+ }
+ }
+ else
+ {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
+ }
+
+ dstx += pDstDrawable->x;
+ dsty += pDstDrawable->y;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW)
+ {
+ if (!((WindowPtr)pDstDrawable)->realized)
+ {
+ if (!fastClip)
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ }
+
+ dx = srcx - dstx;
+ dy = srcy - dsty;
+
+ /* Translate and clip the dst to the destination composite clip */
+ if (fastClip)
+ {
+ RegionPtr cclip;
+
+ /* Translate the region directly */
+ fastBox.x1 -= dx;
+ fastBox.x2 -= dx;
+ fastBox.y1 -= dy;
+ fastBox.y2 -= dy;
+
+ /* If the destination composite clip is one rectangle we can
+ do the clip directly. Otherwise we have to create a full
+ blown region and call intersect */
+
+ /* XXX because CopyPlane uses this routine for 8-to-1 bit
+ * copies, this next line *must* also correctly fetch the
+ * composite clip from an mfb gc
+ */
+
+ cclip = cfbGetCompositeClip(pGC);
+ if (REGION_NUM_RECTS(cclip) == 1)
+ {
+ BoxPtr pBox = REGION_RECTS(cclip);
+
+ if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
+ if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
+ if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
+ if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
+
+ /* Check to see if the region is empty */
+ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
+ {
+ REGION_INIT(pGC->pScreen, &rgnDst, NullBox, 0);
+ }
+ else
+ {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ }
+ }
+ else
+ {
+ /* We must turn off fastClip now, since we must create
+ a full blown region. It is intersected with the
+ composite clip below. */
+ fastClip = 0;
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1);
+ }
+ }
+ else
+ {
+ REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
+ }
+
+ if (!fastClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, &rgnDst,
+ &rgnDst,
+ cfbGetCompositeClip(pGC));
+ }
+
+ /* Do bit blitting */
+ numRects = REGION_NUM_RECTS(&rgnDst);
+ if (numRects && width && height)
+ {
+ if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+ sizeof(DDXPointRec))))
+ {
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ pbox = REGION_RECTS(&rgnDst);
+ ppt = pptSrc;
+ for (i = numRects; --i >= 0; pbox++, ppt++)
+ {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ (*doCopyPlane) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane);
+ DEALLOCATE_LOCAL(pptSrc);
+ }
+
+ prgnExposed = NULL;
+ if (pGC->fExpose)
+ {
/* Pixmap sources generate a NoExposed (we return NULL to do this) */
if (!fastExpose)
prgnExposed =
@@ -325,21 +602,29 @@ cfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc, planemask)
DDXPointPtr pptSrc;
unsigned long planemask;
{
- void (*blt)() = cfbDoBitbltGeneral;
+ void (*doBitBlt)(
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/)
+ = cfbDoBitbltGeneral;
+
if ((planemask & PMSK) == PMSK) {
switch (alu) {
case GXcopy:
- blt = cfbDoBitbltCopy;
+ doBitBlt = cfbDoBitbltCopy;
break;
case GXxor:
- blt = cfbDoBitbltXor;
+ doBitBlt = cfbDoBitbltXor;
break;
case GXor:
- blt = cfbDoBitbltOr;
+ doBitBlt = cfbDoBitbltOr;
break;
}
}
- (*blt) (pSrc, pDst, alu, prgnDst, pptSrc, planemask);
+ (*doBitBlt) (pSrc, pDst, alu, prgnDst, pptSrc, planemask);
}
RegionPtr
@@ -352,7 +637,13 @@ cfbCopyArea(pSrcDrawable, pDstDrawable,
int width, height;
int dstx, dsty;
{
- void (*doBitBlt) ();
+ void (*doBitBlt) (
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/);
doBitBlt = cfbDoBitbltCopy;
if (pGC->alu != GXcopy || (pGC->planemask & PMSK) != PMSK)
@@ -376,40 +667,39 @@ cfbCopyArea(pSrcDrawable, pDstDrawable,
#if PSZ == 8
void
-cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane)
+cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask)
DrawablePtr pSrcDrawable; /* must be a bitmap */
DrawablePtr pDstDrawable; /* must be depth 8 drawable */
int rop; /* not used; caller must call cfb8CheckOpaqueStipple
* beforehand to get cfb8StippleRRop set correctly */
- unsigned long planemask; /* to apply to destination writes */
RegionPtr prgnDst; /* region in destination to draw to;
* screen relative coords. if dest is a window;
* drawable relative if dest is a pixmap */
DDXPointPtr pptSrc; /* drawable relative src coords to copy from;
* must be one point for each box in prgnDst */
- unsigned long bitPlane; /* not used; assumed always to be 1 */
+ unsigned long planemask; /* to apply to destination writes */
{
int srcx, srcy; /* upper left corner of box being copied in source */
int dstx, dsty; /* upper left corner of box being copied in dest */
int width, height; /* in pixels, unpadded, of box being copied */
int xoffSrc; /* bit # in leftmost word of row from which copying starts */
int xoffDst; /* byte # in leftmost word of row from which copying starts */
- unsigned long *psrcBase, *pdstBase; /* start of drawable's pixel data */
+ CfbBits *psrcBase, *pdstBase; /* start of drawable's pixel data */
int widthSrc; /* # of groups of 32 pixels (1 bit/pixel) in src bitmap*/
int widthDst; /* # of groups of 4 pixels (8 bits/pixel) in dst */
- unsigned long *psrcLine, *pdstLine; /* steps a row at a time thru src/dst;
+ CfbBits *psrcLine, *pdstLine; /* steps a row at a time thru src/dst;
* may point into middle of row */
- register unsigned long *psrc, *pdst; /* steps within the row */
- register unsigned long bits, tmp; /* bits from source */
+ register CfbBits *psrc, *pdst; /* steps within the row */
+ register CfbBits bits, tmp; /* bits from source */
register int leftShift;
register int rightShift;
- unsigned long startmask; /* left edge pixel mask */
- unsigned long endmask; /* right edge pixel mask */
+ CfbBits startmask; /* left edge pixel mask */
+ CfbBits endmask; /* right edge pixel mask */
register int nlMiddle; /* number of words in middle of the row to draw */
register int nl;
- int firstoff;
- int secondoff;
- unsigned long src;
+ int firstoff = 0;
+ int secondoff = 0;
+ CfbBits src;
int nbox; /* number of boxes in region to copy */
BoxPtr pbox; /* steps thru boxes in region */
int pixelsRemainingOnRightEdge; /* # pixels to be drawn on a row after
@@ -547,11 +837,11 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
# define FirstStep(c) c = BitLeft (c, 8);
#else
/* 0x3c is 0xf << 2 (4 bits, long word) */
-# define StoreBits(o,c) StorePixels(pdst,o,*((unsigned long *)\
+# define StoreBits(o,c) StorePixels(pdst,o,*((CfbBits *)\
(((char *) cfb8Pixels) + (c & 0x3c))))
# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \
- *((unsigned long *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \
- *((unsigned long *) (((char *) cfb8StippleXor) + (c & 0x3c))))
+ *((CfbBits *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \
+ *((CfbBits *) (((char *) cfb8StippleXor) + (c & 0x3c))))
# define FirstStep(c) c = BitLeft (c, 2);
#endif /* PGSZ */
#endif /* BITMAP_BIT_ORDER */
@@ -708,31 +998,28 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
/******************************************************************/
-void
+static void
#if PSZ == 16
-cfbCopyPlane1to16 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
- planemask, bitPlane)
+cfbCopyPlane1to16
#endif
#if PSZ == 24
-cfbCopyPlane1to24 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
- planemask, bitPlane)
+cfbCopyPlane1to24
#endif
#if PSZ == 32
-cfbCopyPlane1to32 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
- planemask, bitPlane)
+cfbCopyPlane1to32
#endif
- DrawablePtr pSrcDrawable;
- DrawablePtr pDstDrawable;
- int rop;
- unsigned long planemask;
- RegionPtr prgnDst;
- DDXPointPtr pptSrc;
- unsigned long bitPlane;
+(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planemask)
{
int srcx, srcy, dstx, dsty;
int width, height;
int xoffSrc;
- unsigned long *psrcBase, *pdstBase;
+ CfbBits *psrcBase, *pdstBase;
int widthSrc, widthDst;
unsigned int *psrcLine;
register unsigned int *psrc;
@@ -751,7 +1038,9 @@ cfbCopyPlane1to32 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
register unsigned int bits, tmp;
register unsigned int fgpixel, bgpixel;
register unsigned int src;
+#if PSZ == 24
register unsigned int dst;
+#endif
register int leftShift, rightShift;
register int i, nl;
int nbox;
@@ -787,8 +1076,8 @@ cfbCopyPlane1to32 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
/* must explicitly ask for "int" widths, as code below expects it */
/* on some machines (Alpha), "long" and "int" are not the same size */
- cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, unsigned long)
- cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, unsigned long)
+ cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, CfbBits)
+ cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, CfbBits)
#if PSZ == 16
widthDst <<= 1;
@@ -852,7 +1141,7 @@ cfbCopyPlane1to32 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
* I've thrown in some optimization to at least write
* some aligned 32-bit words instead of 16-bit shorts.
*/
- if ((unsigned int)psrc & 2) {
+ if ((unsigned long)psrc & 2) {
/* Write unaligned 16-bit word at left edge. */
if (tmp & 0x01)
*pdst = fgpixel;
@@ -1063,14 +1352,22 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
unsigned long bitPlane;
{
RegionPtr ret;
- extern RegionPtr miHandleExposures();
- void (*doBitBlt)();
+
+#if IMAGE_BYTE_ORDER == LSBFirst
+
+ void (*doCopyPlaneExpand)(
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/);
if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == PSZ)
{
if (bitPlane == 1)
{
- doBitBlt = cfbCopyPlane1toN;
+ doCopyPlaneExpand = cfbCopyPlane1toN;
#if PSZ == 8
cfb8CheckOpaqueStipple (pGC->alu,
pGC->fgPixel, pGC->bgPixel,
@@ -1079,8 +1376,8 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
FgPixel = pGC->fgPixel;
BgPixel = pGC->bgPixel;
#endif
- ret = cfbBitBlt (pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane);
+ ret = cfbCopyPlaneExpand (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, doCopyPlaneExpand, bitPlane);
}
else
ret = miHandleExposures (pSrcDrawable, pDstDrawable,
@@ -1088,7 +1385,6 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
}
else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == 1)
{
- extern int InverseAlu[16];
int oldalu;
oldalu = pGC->alu;
@@ -1096,7 +1392,7 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
pGC->alu = InverseAlu[pGC->alu];
else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1))
pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel);
- ret = cfbBitBlt (pSrcDrawable, pDstDrawable,
+ ret = cfbCopyPlaneReduce(pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty,
cfbCopyPlaneNto1, bitPlane);
pGC->alu = oldalu;
@@ -1123,7 +1419,7 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
*/
ValidateGC ((DrawablePtr) pBitmap, pGC1);
/* no exposures here, scratch GC's don't get graphics expose */
- (void) cfbBitBlt (pSrcDrawable, (DrawablePtr) pBitmap,
+ cfbCopyPlaneReduce(pSrcDrawable, (DrawablePtr) pBitmap,
pGC1, srcx, srcy, width, height, 0, 0,
cfbCopyPlaneNto1, bitPlane);
#if PSZ == 8
@@ -1135,7 +1431,7 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
BgPixel = pGC->bgPixel;
#endif
/* no exposures here, copy bits from inside a pixmap */
- (void) cfbBitBlt ((DrawablePtr) pBitmap, pDstDrawable, pGC,
+ cfbCopyPlaneExpand((DrawablePtr) pBitmap, pDstDrawable, pGC,
0, 0, width, height, dstx, dsty, cfbCopyPlane1toN, 1);
FreeScratchGC (pGC1);
(*pScreen->DestroyPixmap) (pBitmap);
@@ -1145,6 +1441,7 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
dstx, dsty, bitPlane);
}
else
+#endif
ret = miCopyPlane (pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
return ret;
diff --git a/xc/programs/Xserver/cfb/cfbblt.c b/xc/programs/Xserver/cfb/cfbblt.c
index 3f5bb22be..cb8d4a8cd 100644
--- a/xc/programs/Xserver/cfb/cfbblt.c
+++ b/xc/programs/Xserver/cfb/cfbblt.c
@@ -1,13 +1,17 @@
/*
* cfb copy area
*/
-/* $XFree86: xc/programs/Xserver/cfb/cfbblt.c,v 3.7 1999/01/26 10:40:03 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbblt.c,v 3.13 2003/07/16 01:38:36 dawes Exp $ */
/*
Copyright 1989, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -26,7 +30,7 @@ in this Software without prior written authorization from The Open Group.
Author: Keith Packard
*/
-/* $TOG: cfbblt.c /main/14 1998/02/09 14:04:41 kaleb $ */
+/* $Xorg: cfbblt.c,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $ */
/* 24-bit bug fixes: Peter Wainwright, 1998/11/28 */
@@ -114,14 +118,15 @@ Author: Keith Packard
#endif
void
-MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
- DrawablePtr pSrc, pDst;
- int alu;
- RegionPtr prgnDst;
- DDXPointPtr pptSrc;
- unsigned long planemask;
+MROP_NAME(cfbDoBitblt)(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int alu,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planemask)
{
- unsigned long *psrcBase, *pdstBase;
+ CfbBits *psrcBase, *pdstBase;
/* start of src and dst bitmaps */
int widthSrc, widthDst; /* add to get to same position in next line */
@@ -137,29 +142,26 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
int xdir; /* 1 = left right, -1 = right left/ */
int ydir; /* 1 = top down, -1 = bottom up */
- unsigned long *psrcLine, *pdstLine;
+ CfbBits *psrcLine, *pdstLine;
/* pointers to line with current src and dst */
- register unsigned long *psrc;/* pointer to current src longword */
- register unsigned long *pdst;/* pointer to current dst longword */
+ register CfbBits *psrc;/* pointer to current src longword */
+ register CfbBits *pdst;/* pointer to current dst longword */
MROP_DECLARE_REG()
/* following used for looping through a line */
- unsigned long startmask, endmask; /* masks for writing ends of dst */
+ CfbBits startmask, endmask; /* masks for writing ends of dst */
int nlMiddle; /* whole longwords in dst */
- int xoffSrc, xoffDst, xoffEnd;
- register int leftShift, rightShift;
- register unsigned long bits;
- register unsigned long bits1;
+ int xoffSrc, xoffDst;
register int nl; /* temp copy of nlMiddle */
-
- /* place to store full source word */
- int nstart; /* number of ragged bits at start of dst */
- int nend; /* number of ragged bits at end of dst */
- int srcStartOver; /* pulling nstart bits from src
- overflows into the next word? */
int careful;
- int tmpSrc;
+
+#if (PSZ != 24) || (MROP != 0)
+ register int leftShift, rightShift;
+ register CfbBits bits;
+ register CfbBits bits1;
+#endif
+
#if PSZ == 24
#ifdef DO_MEMCPY
int w2;
@@ -373,7 +375,7 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
xoffDst = ( - pbox->x1) & PAM;
#if 1
if((int)xoffSrc != (int)xoffDst /* Alignments must be same. */
- || (widthDstBytes & PAM != widthSrcBytes & PAM && h > 1))
+ || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1))
#else
if(1)
#endif
@@ -416,7 +418,7 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
#endif
#ifdef DO_UNALIGNED_BITBLT
nl = xoffSrc - xoffDst;
- psrcLine = (unsigned long *)
+ psrcLine = (CfbBits *)
(((unsigned char *) psrcLine) + nl);
#else
#if PSZ == 24 && MROP == 0
@@ -655,7 +657,7 @@ pdst++;
xoffDst = (-pbox->x2) & PAM;
#if 1
if(xoffSrc != xoffDst /* Alignments must be same. */
- || (widthDstBytes & PAM != widthSrcBytes & PAM && h > 1))
+ || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1))
#else
if(1)
#endif
@@ -702,7 +704,7 @@ pdst++;
#else
nl = xoffSrc - xoffDst;
#endif
- psrcLine = (unsigned long *)
+ psrcLine = (CfbBits *)
(((unsigned char *) psrcLine) + nl);
#else
#if PSZ == 24 && MROP == 0
diff --git a/xc/programs/Xserver/cfb/cfbcppl.c b/xc/programs/Xserver/cfb/cfbcppl.c
index 56abbe2aa..ee4c18fdc 100644
--- a/xc/programs/Xserver/cfb/cfbcppl.c
+++ b/xc/programs/Xserver/cfb/cfbcppl.c
@@ -3,7 +3,11 @@
*
Copyright 1990, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -21,7 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
-/* $XFree86: xc/programs/Xserver/cfb/cfbcppl.c,v 1.1 1999/08/21 13:48:14 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbcppl.c,v 1.7 2003/07/16 01:38:37 dawes Exp $ */
#include "X.h"
#include "Xmd.h"
@@ -35,19 +39,24 @@ in this Software without prior written authorization from The Open Group.
#undef PSZ /* for maskbits.h */
#include "maskbits.h"
#define PSZ 8
-#endif
#include "mergerop.h"
+#else /* PSZ==8 */
+#include "cfbtab.h" /* provides starttab, endttab, partmasks */
+#endif /* PSZ==8 */
void
-cfbCopyImagePlane (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask)
- DrawablePtr pSrcDrawable;
- DrawablePtr pDstDrawable;
- int rop;
- RegionPtr prgnDst;
- DDXPointPtr pptSrc;
- unsigned long planemask;
+cfbCopyImagePlane(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planemask)
{
+ /* note: there must be some sort of trick behind,
+ passing a planemask value with all bits set
+ whilst using the current planemask for the bitPlane value. */
#if PSZ == 8
cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
(unsigned long) ~0L, planemask);
@@ -56,6 +65,10 @@ cfbCopyImagePlane (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask)
cfbCopyPlane16to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
(unsigned long) ~0L, planemask);
#endif
+#if PSZ == 24
+ cfbCopyPlane24to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ (unsigned long) ~0L, planemask);
+#endif
#if PSZ == 32
cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
(unsigned long) ~0L, planemask);
@@ -82,14 +95,14 @@ cfbCopyImagePlane (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask)
}
void
-cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane)
- DrawablePtr pSrcDrawable;
- DrawablePtr pDstDrawable;
- int rop;
- RegionPtr prgnDst;
- DDXPointPtr pptSrc;
- unsigned long planemask;
- unsigned long bitPlane;
+cfbCopyPlane8to1(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planemask,
+ unsigned long bitPlane)
{
int srcx, srcy, dstx, dsty, width, height;
unsigned char *psrcBase;
@@ -101,11 +114,11 @@ cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
register int i;
register int curBit;
register int bitPos;
- register unsigned long bits;
+ register CfbBits bits;
register PixelType *pdst;
PixelType startmask, endmask;
- int niStart, niEnd;
- int bitStart, bitEnd;
+ int niStart = 0, niEnd = 0;
+ int bitStart = 0, bitEnd = 0;
int nl, nlMiddle;
int nbox;
BoxPtr pbox;
@@ -172,7 +185,7 @@ cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
i = niStart;
curBit = bitStart;
GetBits (psrc, i, curBit, bitPos, bits);
- *pdst = *pdst & ~startmask | bits;
+ *pdst = (*pdst & ~startmask) | bits;
pdst++;
}
nl = nlMiddle;
@@ -188,7 +201,7 @@ cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
i = niEnd;
curBit = bitEnd;
GetBits (psrc, i, curBit, bitPos, bits);
- *pdst = *pdst & ~endmask | bits;
+ *pdst = (*pdst & ~endmask) | bits;
}
}
}
@@ -283,28 +296,26 @@ cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
void
#if PSZ == 16
-cfbCopyPlane16to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
- planemask, bitPlane)
+cfbCopyPlane16to1
#endif
#if PSZ == 24
-cfbCopyPlane24to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
- planemask, bitPlane)
+cfbCopyPlane24to1
#endif
#if PSZ == 32
-cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
- planemask, bitPlane)
+cfbCopyPlane32to1
#endif
- DrawablePtr pSrcDrawable;
- DrawablePtr pDstDrawable;
- int rop;
- RegionPtr prgnDst;
- DDXPointPtr pptSrc;
- unsigned long planemask;
- unsigned long bitPlane;
+(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planemask,
+ unsigned long bitPlane)
{
int srcx, srcy, dstx, dsty, width, height;
- unsigned long *psrcBase;
- unsigned long *pdstBase;
+ CfbBits *psrcBase;
+ CfbBits *pdstBase;
int widthSrc, widthDst;
#if PSZ == 16
unsigned short *psrcLine;
@@ -324,25 +335,22 @@ cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
register int curBit;
register int bitPos;
register unsigned int bits;
- unsigned int startmask, endmask;
- int niStart, niEnd;
- int bitStart, bitEnd;
+ unsigned int startmask = 0, endmask = 0;
+ int niStart = 0, niEnd = 0;
+ int bitStart = 0, bitEnd = 0;
int nl, nlMiddle;
int nbox;
BoxPtr pbox;
int result;
- extern int starttab[32], endtab[32];
- extern unsigned int partmasks[32][32];
-
if (!(planemask & 1))
return;
/* must explicitly ask for "int" widths, as code below expects it */
/* on some machines (Alpha), "long" and "int" are not the same size */
- cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, unsigned long)
- cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, unsigned long)
+ cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, CfbBits)
+ cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, CfbBits)
#if PSZ == 16
widthSrc <<= 1;
diff --git a/xc/programs/Xserver/cfb/cfbfillarc.c b/xc/programs/Xserver/cfb/cfbfillarc.c
index d51498681..1586feaf1 100644
--- a/xc/programs/Xserver/cfb/cfbfillarc.c
+++ b/xc/programs/Xserver/cfb/cfbfillarc.c
@@ -1,9 +1,13 @@
-/* $XFree86: xc/programs/Xserver/cfb/cfbfillarc.c,v 3.2 1998/10/04 09:37:39 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbfillarc.c,v 3.6 2003/07/16 01:38:37 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -21,11 +25,11 @@ in this Software without prior written authorization from The Open Group.
********************************************************/
-/* $TOG: cfbfillarc.c /main/18 1998/02/09 14:05:10 kaleb $ */
+/* $Xorg: cfbfillarc.c,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $ */
#include "X.h"
#include "Xprotostr.h"
-#include "miscstruct.h"
+#include "regionstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
@@ -43,10 +47,10 @@ in this Software without prior written authorization from The Open Group.
#endif
static void
-RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+RROP_NAME(cfbFillEllipseSolid)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc)
{
STUPID int x, y, e;
STUPID int yk, xk, ym, xm, dx, dy, xorg, yorg;
@@ -54,15 +58,15 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
#if PSZ == 24
unsigned char *addrlt, *addrlb;
#else
- unsigned long *addrlt, *addrlb;
+ CfbBits *addrlt, *addrlb;
#endif
- register unsigned long *addrl;
+ register CfbBits *addrl;
register int n;
int nlwidth;
RROP_DECLARE
register int xpos;
register int slw;
- unsigned long startmask, endmask;
+ CfbBits startmask, endmask;
int nlmiddle;
#if PSZ == 24
register int pidx;
@@ -93,11 +97,11 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
xpos = xorg - x;
#if PSZ == 24
xpos3 = (xpos * 3) & ~0x03;
- addrl = (unsigned long *)((char *)addrlt + xpos3);
+ addrl = (CfbBits *)((char *)addrlt + xpos3);
if (slw == 1){
RROP_SOLID24(addrl, xpos);
if (miFillArcLower(slw)){
- addrl = (unsigned long *)((char *)addrlb + xpos3);
+ addrl = (CfbBits *)((char *)addrlb + xpos3);
RROP_SOLID24(addrl, xpos);
}
continue;
@@ -122,7 +126,7 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
RROP_SOLID_MASK(addrl, endmask, pidx);
if (!miFillArcLower(slw))
continue;
- addrl = (unsigned long *)((char *)addrlb + xpos3);
+ addrl = (CfbBits *)((char *)addrlb + xpos3);
pidx = xpos;
if (startmask){
RROP_SOLID_MASK(addrl, startmask, pidx-1);
@@ -183,7 +187,7 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
#define FILLSPAN(xl,xr,addr) \
if (xr >= xl){ \
n = xr - xl + 1; \
- addrl = (unsigned long *)((char *)addr + ((xl * 3) & ~0x03)); \
+ addrl = (CfbBits *)((char *)addr + ((xl * 3) & ~0x03)); \
if (n <= 1){ \
if (n) \
RROP_SOLID24(addrl, xl); \
@@ -250,10 +254,10 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
}
static void
-RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+RROP_NAME(cfbFillArcSliceSolid)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc)
{
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
register int x, y, e;
@@ -263,13 +267,13 @@ RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc)
#if PSZ == 24
unsigned char *addrlt, *addrlb;
#else
- unsigned long *addrlt, *addrlb;
+ CfbBits *addrlt, *addrlb;
#endif
- register unsigned long *addrl;
+ register CfbBits *addrl;
register int n;
int nlwidth;
RROP_DECLARE
- unsigned long startmask, endmask;
+ CfbBits startmask, endmask;
#if PSZ == 24
register int pidx;
#endif /* PSZ == 24 */
diff --git a/xc/programs/Xserver/cfb/cfbglblt8.c b/xc/programs/Xserver/cfb/cfbglblt8.c
index 5c0ab74f5..60a012c28 100644
--- a/xc/programs/Xserver/cfb/cfbglblt8.c
+++ b/xc/programs/Xserver/cfb/cfbglblt8.c
@@ -1,9 +1,13 @@
-/* $TOG: cfbglblt8.c /main/33 1998/02/09 14:05:46 kaleb $ */
+/* $Xorg: cfbglblt8.c,v 1.4 2001/02/09 02:04:38 xorgcvs Exp $ */
/*
Copyright 1989, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -19,7 +23,7 @@ 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.
*/
-/* $XFree86: xc/programs/Xserver/cfb/cfbglblt8.c,v 3.2 1998/10/04 09:37:43 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbglblt8.c,v 3.8 2003/08/06 14:04:02 eich Exp $ */
/*
* Poly glyph blt. Accepts an arbitrary font <= 32 bits wide, in Copy mode
@@ -60,7 +64,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef USE_LEFTBITS
typedef unsigned char *glyphPointer;
-extern unsigned long endtab[];
+extern CfbBits endtab[];
#define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \
(dst) &= widthMask; \
@@ -83,7 +87,14 @@ typedef CARD32 *glyphPointer;
#endif
-static void cfbPolyGlyphBlt8Clipped();
+static void cfbPolyGlyphBlt8Clipped(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci, /* array of character info */
+ unsigned char *pglyphBase); /* start of array of glyphs */
#if defined(HAS_STIPPLE_CODE) && !defined(GLYPHROP) && !defined(USE_LEFTBITS)
#define USE_STIPPLE_CODE
@@ -118,31 +129,31 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
CharInfoPtr *ppci; /* array of character info */
pointer pglyphBase; /* start of array of glyphs */
{
- register unsigned long c;
#ifndef GLYPHROP
- register unsigned long pixel;
+ register CfbBits pixel;
+#endif
+#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE)
+ register CfbBits c;
+ register CfbBits *dst;
#endif
- register unsigned long *dst;
register glyphPointer glyphBits;
register int xoff;
FontPtr pfont = pGC->font;
CharInfoPtr pci;
- unsigned long *dstLine;
- unsigned long *pdstBase;
+ CfbBits *dstLine;
+ CfbBits *pdstBase;
int hTmp;
int bwidthDst;
int widthDst;
int h;
- int ew;
BoxRec bbox; /* for clipping */
- int widthDiff;
int w;
RegionPtr clip;
BoxPtr extents;
#ifdef USE_LEFTBITS
int widthGlyph;
- unsigned long widthMask;
+ CfbBits widthMask;
#endif
#ifndef STIPPLE
#ifdef USE_STIPPLE_CODE
@@ -209,7 +220,7 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pixel = cfbGetGCPrivate(pGC)->xor;
#endif
- cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long)
+ cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits)
widthDst = bwidthDst / PGSZB;
while (nglyph--)
@@ -224,7 +235,7 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
(y - pci->metrics.ascent) * widthDst + (xoff >> PWSH);
#endif
x += pci->metrics.characterWidth;
- if (hTmp = pci->metrics.descent + pci->metrics.ascent)
+ if ((hTmp = pci->metrics.descent + pci->metrics.ascent))
{
#if PSZ == 24
xoff &= 0x03;
@@ -244,7 +255,7 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
#endif
do {
dst = dstLine;
- dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
dst += DST_INC;
@@ -263,47 +274,52 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
}
static void
-cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- unsigned int nglyph;
- CharInfoPtr *ppci; /* array of character info */
- unsigned char *pglyphBase; /* start of array of glyphs */
+cfbPolyGlyphBlt8Clipped(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci, /* array of character info */
+ unsigned char *pglyphBase) /* start of array of glyphs */
{
- register unsigned long c;
#ifndef GLYPHROP
- register unsigned long pixel;
+ register CfbBits pixel;
+#endif
+#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE)
+ register CfbBits c;
#endif
- register unsigned long *dst;
register glyphPointer glyphBits;
- register int xoff;
- unsigned long c1;
+ register int xoff;
+#if defined(USE_LEFTBITS) || (!defined(STIPPLE) && !defined(USE_STIPPLE_CODE))
+ register CfbBits *dst;
+#endif
CharInfoPtr pci;
FontPtr pfont = pGC->font;
- unsigned long *dstLine;
- unsigned long *pdstBase;
- CARD32 *cTmp, *clips;
+ CfbBits *dstLine;
+ CfbBits *pdstBase;
+#ifdef USE_LEFTBITS
+ CARD32 *cTmp;
+#endif
+ CARD32 *clips;
int maxAscent, maxDescent;
int minLeftBearing;
int hTmp;
int widthDst;
int bwidthDst;
- int ew;
int xG, yG;
BoxPtr pBox;
int numRects;
- int widthDiff;
int w;
RegionPtr pRegion;
int yBand;
#ifdef GLYPHROP
- unsigned long bits;
+ CfbBits bits;
#endif
#ifdef USE_LEFTBITS
int widthGlyph;
- unsigned long widthMask;
+ CfbBits widthMask;
#endif
#ifdef GLYPHROP
@@ -312,7 +328,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pixel = cfbGetGCPrivate(pGC)->xor;
#endif
- cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long)
+ cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits)
widthDst = bwidthDst / PGSZB;
maxAscent = FONTMAXBOUNDS(pfont,ascent);
@@ -348,7 +364,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
xG = x + pci->metrics.leftSideBearing;
yG = y - pci->metrics.ascent;
x += pci->metrics.characterWidth;
- if (hTmp = pci->metrics.descent + pci->metrics.ascent)
+ if ((hTmp = pci->metrics.descent + pci->metrics.ascent))
{
#if PSZ == 24
dstLine = pdstBase + yG * widthDst + ((xG>> 2)*3);
@@ -373,7 +389,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
cTmp = clips;
do {
dst = dstLine;
- dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
c &= *cTmp++;
if (c)
@@ -390,7 +406,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
}
} while (--hTmp);
break;
-#else /* !USE_LEFT_BITS */
+#else /* !USE_LEFTBITS */
{
int h;
@@ -403,7 +419,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
}
glyphBits = clips;
/* fall through */
-#endif /* USE_LEFT_BITS */
+#endif /* USE_LEFTBITS */
case rgnIN:
#ifdef STIPPLE
STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
@@ -413,7 +429,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
#else
do {
dst = dstLine;
- dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
if (c)
{
@@ -429,7 +445,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
c = BitLeft(c,PGSZB - xoff);
dst += DST_INC;
#else /* GLYPHROP */
- if (bits = GetBitGroup(BitRight(c,xoff)))
+ if ((bits = GetBitGroup(BitRight(c,xoff))))
WriteBitGroup(dst, pixel, bits);
c = BitLeft(c,PGSZB - xoff);
dst += DST_INC;
diff --git a/xc/programs/Xserver/cfb/cfbmap.h b/xc/programs/Xserver/cfb/cfbmap.h
index dce25c804..42056345a 100644
--- a/xc/programs/Xserver/cfb/cfbmap.h
+++ b/xc/programs/Xserver/cfb/cfbmap.h
@@ -1,9 +1,13 @@
/*
- * $TOG: cfbmap.h /main/12 1998/02/09 14:06:19 kaleb $
+ * $Xorg: cfbmap.h,v 1.4 2001/02/09 02:04:38 xorgcvs Exp $
*
Copyright 1991, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -22,174 +26,300 @@ in this Software without prior written authorization from The Open Group.
* Author: Keith Packard, MIT X Consortium
*/
-/* $XFree86: xc/programs/Xserver/cfb/cfbmap.h,v 3.7 1998/11/28 10:42:51 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbmap.h,v 3.12 2003/07/19 13:22:27 tsi Exp $ */
/*
* Map names around so that multiple depths can be supported simultaneously
*/
-/* a losing vendor cpp dumps core if we define NAME in terms of CATNAME */
+#if 0
+#undef QuartetBitsTable
+#undef QuartetPixelMaskTable
+#undef cfb8ClippedLineCopy
+#undef cfb8ClippedLineGeneral
+#undef cfb8ClippedLineXor
+#undef cfb8LineSS1Rect
+#undef cfb8LineSS1RectCopy
+#undef cfb8LineSS1RectGeneral
+#undef cfb8LineSS1RectPreviousCopy
+#undef cfb8LineSS1RectXor
+#undef cfb8SegmentSS1Rect
+#undef cfb8SegmentSS1RectCopy
+#undef cfb8SegmentSS1RectGeneral
+#undef cfb8SegmentSS1RectShiftCopy
+#undef cfb8SegmentSS1RectXor
+#undef cfbAllocatePrivates
+#undef cfbBSFuncRec
+#undef cfbBitBlt
+#undef cfbBresD
+#undef cfbBresS
+#undef cfbChangeWindowAttributes
+#undef cfbCloseScreen
+#undef cfbCopyArea
+#undef cfbCopyImagePlane
+#undef cfbCopyPixmap
+#undef cfbCopyPlane
+#undef cfbCopyPlaneReduce
+#undef cfbCopyRotatePixmap
+#undef cfbCopyWindow
+#undef cfbCreateGC
+#undef cfbCreatePixmap
+#undef cfbCreateScreenResources
+#undef cfbCreateWindow
+#undef cfbDestroyPixmap
+#undef cfbDestroyWindow
+#undef cfbDoBitblt
+#undef cfbDoBitbltCopy
+#undef cfbDoBitbltGeneral
+#undef cfbDoBitbltOr
+#undef cfbDoBitbltXor
+#undef cfbFillBoxSolid
+#undef cfbFillBoxTile32
+#undef cfbFillBoxTile32sCopy
+#undef cfbFillBoxTile32sGeneral
+#undef cfbFillBoxTileOdd
+#undef cfbFillBoxTileOddCopy
+#undef cfbFillBoxTileOddGeneral
+#undef cfbFillPoly1RectCopy
+#undef cfbFillPoly1RectGeneral
+#undef cfbFillRectSolidCopy
+#undef cfbFillRectSolidGeneral
+#undef cfbFillRectSolidXor
+#undef cfbFillRectTile32Copy
+#undef cfbFillRectTile32General
+#undef cfbFillRectTileOdd
+#undef cfbFillSpanTile32sCopy
+#undef cfbFillSpanTile32sGeneral
+#undef cfbFillSpanTileOddCopy
+#undef cfbFillSpanTileOddGeneral
+#undef cfbFinishScreenInit
+#undef cfbGCFuncs
+#undef cfbGetImage
+#undef cfbGetScreenPixmap
+#undef cfbGetSpans
+#undef cfbHorzS
+#undef cfbImageGlyphBlt8
+#undef cfbLineSD
+#undef cfbLineSS
+#undef cfbMapWindow
+#undef cfbMatchCommon
+#undef cfbNonTEOps
+#undef cfbNonTEOps1Rect
+#undef cfbPadPixmap
+#undef cfbPaintWindow
+#undef cfbPolyFillArcSolidCopy
+#undef cfbPolyFillArcSolidGeneral
+#undef cfbPolyFillRect
+#undef cfbPolyGlyphBlt8
+#undef cfbPolyGlyphRop8
+#undef cfbPolyPoint
+#undef cfbPositionWindow
+#undef cfbPutImage
+#undef cfbReduceRasterOp
+#undef cfbRestoreAreas
+#undef cfbSaveAreas
+#undef cfbScreenInit
+#undef cfbScreenPrivateIndex
+#undef cfbSegmentSD
+#undef cfbSegmentSS
+#undef cfbSetScanline
+#undef cfbSetScreenPixmap
+#undef cfbSetSpans
+#undef cfbSetupScreen
+#undef cfbSolidSpansCopy
+#undef cfbSolidSpansGeneral
+#undef cfbSolidSpansXor
+#undef cfbStippleStack
+#undef cfbStippleStackTE
+#undef cfbTEGlyphBlt
+#undef cfbTEOps
+#undef cfbTEOps1Rect
+#undef cfbTile32FSCopy
+#undef cfbTile32FSGeneral
+#undef cfbUnmapWindow
+#undef cfbUnnaturalStippleFS
+#undef cfbUnnaturalTileFS
+#undef cfbValidateGC
+#undef cfbVertS
+#undef cfbXRotatePixmap
+#undef cfbYRotatePixmap
+#undef cfbZeroPolyArcSS8Copy
+#undef cfbZeroPolyArcSS8General
+#undef cfbZeroPolyArcSS8Xor
+#undef cfbendpartial
+#undef cfbendtab
+#undef cfbmask
+#undef cfbrmask
+#undef cfbstartpartial
+#undef cfbstarttab
+#endif
+
+/* a losing vendor cpp dumps core if we define CFBNAME in terms of CATNAME */
#if PSZ != 8
+
#if PSZ == 32
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) cfb32##subname
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define CFBNAME(subname) cfb32##subname
#else
-#define NAME(subname) cfb32/**/subname
+#define CFBNAME(subname) cfb32/**/subname
#endif
#endif
#if PSZ == 24
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) cfb24##subname
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define CFBNAME(subname) cfb24##subname
#else
-#define NAME(subname) cfb24/**/subname
+#define CFBNAME(subname) cfb24/**/subname
#endif
#endif
#if PSZ == 16
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) cfb16##subname
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define CFBNAME(subname) cfb16##subname
#else
-#define NAME(subname) cfb16/**/subname
+#define CFBNAME(subname) cfb16/**/subname
#endif
#endif
#if PSZ == 4
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) cfb4##subname
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define CFBNAME(subname) cfb4##subname
#else
-#define NAME(subname) cfb4/**/subname
+#define CFBNAME(subname) cfb4/**/subname
#endif
#endif
-#ifndef NAME
+#ifndef CFBNAME
cfb can not hack PSZ yet
#endif
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#undef CATNAME
+
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define CATNAME(prefix,subname) prefix##subname
#else
#define CATNAME(prefix,subname) prefix/**/subname
#endif
-#define cfbScreenPrivateIndex NAME(ScreenPrivateIndex)
-#define QuartetBitsTable NAME(QuartetBitsTable)
-#define QuartetPixelMaskTable NAME(QuartetPixelMaskTable)
-#define cfbAllocatePrivates NAME(AllocatePrivates)
-#define cfbBSFuncRec NAME(BSFuncRec)
-#define cfbBitBlt NAME(BitBlt)
-#define cfbBresD NAME(BresD)
-#define cfbBresS NAME(BresS)
-#define cfbChangeWindowAttributes NAME(ChangeWindowAttributes)
-#define cfbCloseScreen NAME(CloseScreen)
-#define cfbCopyArea NAME(CopyArea)
-#define cfbCopyImagePlane NAME(CopyImagePlane)
-#define cfbCopyPixmap NAME(CopyPixmap)
-#define cfbCopyPlane NAME(CopyPlane)
-#define cfbCopyRotatePixmap NAME(CopyRotatePixmap)
-#define cfbCopyWindow NAME(CopyWindow)
-#define cfbCreateGC NAME(CreateGC)
-#define cfbCreatePixmap NAME(CreatePixmap)
-#define cfbCreateWindow NAME(CreateWindow)
-#define cfbCreateScreenResources NAME(CreateScreenResources)
-#define cfbDestroyPixmap NAME(DestroyPixmap)
-#define cfbDestroyWindow NAME(DestroyWindow)
-#define cfbDoBitblt NAME(DoBitblt)
-#define cfbDoBitbltCopy NAME(DoBitbltCopy)
-#define cfbDoBitbltGeneral NAME(DoBitbltGeneral)
-#define cfbDoBitbltOr NAME(DoBitbltOr)
-#define cfbDoBitbltXor NAME(DoBitbltXor)
-#define cfbFillBoxSolid NAME(FillBoxSolid)
-#define cfbFillBoxTile32 NAME(FillBoxTile32)
-#define cfbFillBoxTile32sCopy NAME(FillBoxTile32sCopy)
-#define cfbFillBoxTile32sGeneral NAME(FillBoxTile32sGeneral)
-#define cfbFillBoxTileOdd NAME(FillBoxTileOdd)
-#define cfbFillBoxTileOddCopy NAME(FillBoxTileOddCopy)
-#define cfbFillBoxTileOddGeneral NAME(FillBoxTileOddGeneral)
-#define cfbFillPoly1RectCopy NAME(FillPoly1RectCopy)
-#define cfbFillPoly1RectGeneral NAME(FillPoly1RectGeneral)
-#define cfbFillRectSolidCopy NAME(FillRectSolidCopy)
-#define cfbFillRectSolidGeneral NAME(FillRectSolidGeneral)
-#define cfbFillRectSolidXor NAME(FillRectSolidXor)
-#define cfbFillRectTile32Copy NAME(FillRectTile32Copy)
-#define cfbFillRectTile32General NAME(FillRectTile32General)
-#define cfbFillRectTileOdd NAME(FillRectTileOdd)
-#define cfbFillSpanTile32sCopy NAME(FillSpanTile32sCopy)
-#define cfbFillSpanTile32sGeneral NAME(FillSpanTile32sGeneral)
-#define cfbFillSpanTileOddCopy NAME(FillSpanTileOddCopy)
-#define cfbFillSpanTileOddGeneral NAME(FillSpanTileOddGeneral)
-#define cfbFinishScreenInit NAME(FinishScreenInit)
-#define cfbGCFuncs NAME(GCFuncs)
-#define cfbGetImage NAME(GetImage)
-#define cfbGetScreenPixmap NAME(GetScreenPixmap)
-#define cfbGetSpans NAME(GetSpans)
-#define cfbHorzS NAME(HorzS)
-#define cfbImageGlyphBlt8 NAME(ImageGlyphBlt8)
-#define cfbLineSD NAME(LineSD)
-#define cfbLineSS NAME(LineSS)
-#define cfbMapWindow NAME(MapWindow)
-#define cfbMatchCommon NAME(MatchCommon)
-#define cfbNonTEOps NAME(NonTEOps)
-#define cfbNonTEOps1Rect NAME(NonTEOps1Rect)
-#define cfbPadPixmap NAME(PadPixmap)
-#define cfbPaintWindow NAME(PaintWindow)
-#define cfbPolyGlyphBlt8 NAME(PolyGlyphBlt8)
-#define cfbPolyGlyphRop8 NAME(PolyGlyphRop8)
-#define cfbPolyFillArcSolidCopy NAME(PolyFillArcSolidCopy)
-#define cfbPolyFillArcSolidGeneral NAME(PolyFillArcSolidGeneral)
-#define cfbPolyFillRect NAME(PolyFillRect)
-#define cfbPolyPoint NAME(PolyPoint)
-#define cfbPositionWindow NAME(PositionWindow)
-#define cfbPutImage NAME(PutImage)
-#define cfbReduceRasterOp NAME(ReduceRasterOp)
-#define cfbRestoreAreas NAME(RestoreAreas)
-#define cfbSaveAreas NAME(SaveAreas)
-#define cfbScreenInit NAME(ScreenInit)
-#define cfbSegmentSD NAME(SegmentSD)
-#define cfbSegmentSS NAME(SegmentSS)
-#define cfbSetScanline NAME(SetScanline)
-#define cfbSetScreenPixmap NAME(SetScreenPixmap)
-#define cfbSetSpans NAME(SetSpans)
-#define cfbSetupScreen NAME(SetupScreen)
-#define cfbSolidSpansCopy NAME(SolidSpansCopy)
-#define cfbSolidSpansGeneral NAME(SolidSpansGeneral)
-#define cfbSolidSpansXor NAME(SolidSpansXor)
-#define cfbStippleStack NAME(StippleStack)
-#define cfbStippleStackTE NAME(StippleStackTE)
-#define cfbTEGlyphBlt NAME(TEGlyphBlt)
-#define cfbTEOps NAME(TEOps)
-#define cfbTEOps1Rect NAME(TEOps1Rect)
-#define cfbTile32FSCopy NAME(Tile32FSCopy)
-#define cfbTile32FSGeneral NAME(Tile32FSGeneral)
-#define cfbUnmapWindow NAME(UnmapWindow)
-#define cfbUnnaturalStippleFS NAME(UnnaturalStippleFS)
-#define cfbUnnaturalTileFS NAME(UnnaturalTileFS)
-#define cfbValidateGC NAME(ValidateGC)
-#define cfbVertS NAME(VertS)
-#define cfbXRotatePixmap NAME(XRotatePixmap)
-#define cfbYRotatePixmap NAME(YRotatePixmap)
-#define cfbendpartial NAME(endpartial)
-#define cfbendtab NAME(endtab)
-#define cfbmask NAME(mask)
-#define cfbrmask NAME(rmask)
-#define cfbstartpartial NAME(startpartial)
-#define cfbstarttab NAME(starttab)
-#define cfb8LineSS1Rect NAME(LineSS1Rect)
-#define cfb8SegmentSS1Rect NAME(SegmentSS1Rect)
-#define cfb8ClippedLineCopy NAME(ClippedLineCopy)
-#define cfb8ClippedLineXor NAME(ClippedLineXor)
-#define cfb8ClippedLineGeneral NAME(ClippedLineGeneral )
-#define cfb8SegmentSS1RectCopy NAME(SegmentSS1RectCopy)
-#define cfb8SegmentSS1RectXor NAME(SegmentSS1RectXor)
-#define cfb8SegmentSS1RectGeneral NAME(SegmentSS1RectGeneral )
-#define cfb8SegmentSS1RectShiftCopy NAME(SegmentSS1RectShiftCopy)
-#define cfb8LineSS1RectCopy NAME(LineSS1RectCopy)
-#define cfb8LineSS1RectXor NAME(LineSS1RectXor)
-#define cfb8LineSS1RectGeneral NAME(LineSS1RectGeneral )
-#define cfb8LineSS1RectPreviousCopy NAME(LineSS1RectPreviousCopy)
-#define cfbZeroPolyArcSS8Copy NAME(ZeroPolyArcSSCopy)
-#define cfbZeroPolyArcSS8Xor NAME(ZeroPolyArcSSXor)
-#define cfbZeroPolyArcSS8General NAME(ZeroPolyArcSSGeneral)
+#define QuartetBitsTable CFBNAME(QuartetBitsTable)
+#define QuartetPixelMaskTable CFBNAME(QuartetPixelMaskTable)
+#define cfb8ClippedLineCopy CFBNAME(ClippedLineCopy)
+#define cfb8ClippedLineGeneral CFBNAME(ClippedLineGeneral )
+#define cfb8ClippedLineXor CFBNAME(ClippedLineXor)
+#define cfb8LineSS1Rect CFBNAME(LineSS1Rect)
+#define cfb8LineSS1RectCopy CFBNAME(LineSS1RectCopy)
+#define cfb8LineSS1RectGeneral CFBNAME(LineSS1RectGeneral )
+#define cfb8LineSS1RectPreviousCopy CFBNAME(LineSS1RectPreviousCopy)
+#define cfb8LineSS1RectXor CFBNAME(LineSS1RectXor)
+#define cfb8SegmentSS1Rect CFBNAME(SegmentSS1Rect)
+#define cfb8SegmentSS1RectCopy CFBNAME(SegmentSS1RectCopy)
+#define cfb8SegmentSS1RectGeneral CFBNAME(SegmentSS1RectGeneral )
+#define cfb8SegmentSS1RectShiftCopy CFBNAME(SegmentSS1RectShiftCopy)
+#define cfb8SegmentSS1RectXor CFBNAME(SegmentSS1RectXor)
+#define cfbAllocatePrivates CFBNAME(AllocatePrivates)
+#define cfbBSFuncRec CFBNAME(BSFuncRec)
+#define cfbBitBlt CFBNAME(BitBlt)
+#define cfbBresD CFBNAME(BresD)
+#define cfbBresS CFBNAME(BresS)
+#define cfbChangeWindowAttributes CFBNAME(ChangeWindowAttributes)
+#define cfbCloseScreen CFBNAME(CloseScreen)
+#define cfbCopyArea CFBNAME(CopyArea)
+#define cfbCopyImagePlane CFBNAME(CopyImagePlane)
+#define cfbCopyPixmap CFBNAME(CopyPixmap)
+#define cfbCopyPlane CFBNAME(CopyPlane)
+#define cfbCopyPlaneReduce CFBNAME(CopyPlaneReduce)
+#define cfbCopyRotatePixmap CFBNAME(CopyRotatePixmap)
+#define cfbCopyWindow CFBNAME(CopyWindow)
+#define cfbCreateGC CFBNAME(CreateGC)
+#define cfbCreatePixmap CFBNAME(CreatePixmap)
+#define cfbCreateScreenResources CFBNAME(CreateScreenResources)
+#define cfbCreateWindow CFBNAME(CreateWindow)
+#define cfbDestroyPixmap CFBNAME(DestroyPixmap)
+#define cfbDestroyWindow CFBNAME(DestroyWindow)
+#define cfbDoBitblt CFBNAME(DoBitblt)
+#define cfbDoBitbltCopy CFBNAME(DoBitbltCopy)
+#define cfbDoBitbltGeneral CFBNAME(DoBitbltGeneral)
+#define cfbDoBitbltOr CFBNAME(DoBitbltOr)
+#define cfbDoBitbltXor CFBNAME(DoBitbltXor)
+#define cfbFillBoxSolid CFBNAME(FillBoxSolid)
+#define cfbFillBoxTile32 CFBNAME(FillBoxTile32)
+#define cfbFillBoxTile32sCopy CFBNAME(FillBoxTile32sCopy)
+#define cfbFillBoxTile32sGeneral CFBNAME(FillBoxTile32sGeneral)
+#define cfbFillBoxTileOdd CFBNAME(FillBoxTileOdd)
+#define cfbFillBoxTileOddCopy CFBNAME(FillBoxTileOddCopy)
+#define cfbFillBoxTileOddGeneral CFBNAME(FillBoxTileOddGeneral)
+#define cfbFillPoly1RectCopy CFBNAME(FillPoly1RectCopy)
+#define cfbFillPoly1RectGeneral CFBNAME(FillPoly1RectGeneral)
+#define cfbFillRectSolidCopy CFBNAME(FillRectSolidCopy)
+#define cfbFillRectSolidGeneral CFBNAME(FillRectSolidGeneral)
+#define cfbFillRectSolidXor CFBNAME(FillRectSolidXor)
+#define cfbFillRectTile32Copy CFBNAME(FillRectTile32Copy)
+#define cfbFillRectTile32General CFBNAME(FillRectTile32General)
+#define cfbFillRectTileOdd CFBNAME(FillRectTileOdd)
+#define cfbFillSpanTile32sCopy CFBNAME(FillSpanTile32sCopy)
+#define cfbFillSpanTile32sGeneral CFBNAME(FillSpanTile32sGeneral)
+#define cfbFillSpanTileOddCopy CFBNAME(FillSpanTileOddCopy)
+#define cfbFillSpanTileOddGeneral CFBNAME(FillSpanTileOddGeneral)
+#define cfbFinishScreenInit CFBNAME(FinishScreenInit)
+#define cfbGCFuncs CFBNAME(GCFuncs)
+#define cfbGetImage CFBNAME(GetImage)
+#define cfbGetScreenPixmap CFBNAME(GetScreenPixmap)
+#define cfbGetSpans CFBNAME(GetSpans)
+#define cfbHorzS CFBNAME(HorzS)
+#define cfbImageGlyphBlt8 CFBNAME(ImageGlyphBlt8)
+#define cfbLineSD CFBNAME(LineSD)
+#define cfbLineSS CFBNAME(LineSS)
+#define cfbMapWindow CFBNAME(MapWindow)
+#define cfbMatchCommon CFBNAME(MatchCommon)
+#define cfbNonTEOps CFBNAME(NonTEOps)
+#define cfbNonTEOps1Rect CFBNAME(NonTEOps1Rect)
+#define cfbPadPixmap CFBNAME(PadPixmap)
+#define cfbPaintWindow CFBNAME(PaintWindow)
+#define cfbPolyFillArcSolidCopy CFBNAME(PolyFillArcSolidCopy)
+#define cfbPolyFillArcSolidGeneral CFBNAME(PolyFillArcSolidGeneral)
+#define cfbPolyFillRect CFBNAME(PolyFillRect)
+#define cfbPolyGlyphBlt8 CFBNAME(PolyGlyphBlt8)
+#define cfbPolyGlyphRop8 CFBNAME(PolyGlyphRop8)
+#define cfbPolyPoint CFBNAME(PolyPoint)
+#define cfbPositionWindow CFBNAME(PositionWindow)
+#define cfbPutImage CFBNAME(PutImage)
+#define cfbReduceRasterOp CFBNAME(ReduceRasterOp)
+#define cfbRestoreAreas CFBNAME(RestoreAreas)
+#define cfbSaveAreas CFBNAME(SaveAreas)
+#define cfbScreenInit CFBNAME(ScreenInit)
+#define cfbScreenPrivateIndex CFBNAME(ScreenPrivateIndex)
+#define cfbSegmentSD CFBNAME(SegmentSD)
+#define cfbSegmentSS CFBNAME(SegmentSS)
+#define cfbSetScanline CFBNAME(SetScanline)
+#define cfbSetScreenPixmap CFBNAME(SetScreenPixmap)
+#define cfbSetSpans CFBNAME(SetSpans)
+#define cfbSetupScreen CFBNAME(SetupScreen)
+#define cfbSolidSpansCopy CFBNAME(SolidSpansCopy)
+#define cfbSolidSpansGeneral CFBNAME(SolidSpansGeneral)
+#define cfbSolidSpansXor CFBNAME(SolidSpansXor)
+#define cfbStippleStack CFBNAME(StippleStack)
+#define cfbStippleStackTE CFBNAME(StippleStackTE)
+#define cfbTEGlyphBlt CFBNAME(TEGlyphBlt)
+#define cfbTEOps CFBNAME(TEOps)
+#define cfbTEOps1Rect CFBNAME(TEOps1Rect)
+#define cfbTile32FSCopy CFBNAME(Tile32FSCopy)
+#define cfbTile32FSGeneral CFBNAME(Tile32FSGeneral)
+#define cfbUnmapWindow CFBNAME(UnmapWindow)
+#define cfbUnnaturalStippleFS CFBNAME(UnnaturalStippleFS)
+#define cfbUnnaturalTileFS CFBNAME(UnnaturalTileFS)
+#define cfbValidateGC CFBNAME(ValidateGC)
+#define cfbVertS CFBNAME(VertS)
+#define cfbXRotatePixmap CFBNAME(XRotatePixmap)
+#define cfbYRotatePixmap CFBNAME(YRotatePixmap)
+#define cfbZeroPolyArcSS8Copy CFBNAME(ZeroPolyArcSSCopy)
+#define cfbZeroPolyArcSS8General CFBNAME(ZeroPolyArcSSGeneral)
+#define cfbZeroPolyArcSS8Xor CFBNAME(ZeroPolyArcSSXor)
+#define cfbendpartial CFBNAME(endpartial)
+#define cfbendtab CFBNAME(endtab)
+#define cfbmask CFBNAME(mask)
+#define cfbrmask CFBNAME(rmask)
+#define cfbstartpartial CFBNAME(startpartial)
+#define cfbstarttab CFBNAME(starttab)
#endif /* PSZ != 8 */
diff --git a/xc/programs/Xserver/cfb/cfbscrinit.c b/xc/programs/Xserver/cfb/cfbscrinit.c
index 5579608b7..7e0d15dd4 100644
--- a/xc/programs/Xserver/cfb/cfbscrinit.c
+++ b/xc/programs/Xserver/cfb/cfbscrinit.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/cfb/cfbscrinit.c,v 1.17 1998/12/20 11:57:29 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbscrinit.c,v 1.20 2003/07/16 01:38:37 dawes Exp $ */
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
@@ -27,7 +27,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $TOG: cfbscrinit.c /main/60 1998/02/09 14:07:30 kaleb $ */
+/* $Xorg: cfbscrinit.c,v 1.3 2000/08/17 19:48:15 cpqbld Exp $ */
#include "X.h"
#include "Xmd.h"
@@ -72,6 +72,20 @@ cfbCloseScreen (index, pScreen)
return TRUE;
}
+static void DestroyColormapNoop(
+ ColormapPtr pColormap)
+{
+ /* NOOP */
+}
+
+static void StoreColorsNoop(
+ ColormapPtr pColormap,
+ int ndef,
+ xColorItem * pdef)
+{
+ /* NOOP */
+}
+
Bool
cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
register ScreenPtr pScreen;
@@ -80,8 +94,6 @@ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
int dpix, dpiy; /* dots per inch */
int width; /* pixel width of frame buffer */
{
- int i;
-
if (!cfbAllocatePrivates(pScreen, (int *) 0, (int *) 0))
return FALSE;
pScreen->defColormap = FakeClientID(0);
@@ -106,11 +118,11 @@ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
pScreen->UnrealizeFont = mfbUnrealizeFont;
pScreen->CreateGC = cfbCreateGC;
pScreen->CreateColormap = cfbInitializeColormap;
- pScreen->DestroyColormap = (void (*)())NoopDDA;
+ pScreen->DestroyColormap = DestroyColormapNoop;
pScreen->InstallColormap = cfbInstallColormap;
pScreen->UninstallColormap = cfbUninstallColormap;
pScreen->ListInstalledColormaps = cfbListInstalledColormaps;
- pScreen->StoreColors = (void (*)())NoopDDA;
+ pScreen->StoreColors = StoreColorsNoop;
pScreen->ResolveColor = cfbResolveColor;
pScreen->BitmapToRegion = mfbPixmapToRegion;
@@ -142,7 +154,6 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
int dpix, dpiy; /* dots per inch */
int width; /* pixel width of frame buffer */
{
- int i, j;
#ifdef CFB_NEED_SCREEN_PRIVATE
pointer oldDevPrivate;
#endif
diff --git a/xc/programs/Xserver/cfb/cfbunmap.h b/xc/programs/Xserver/cfb/cfbunmap.h
index 5235c2239..af1754c40 100644
--- a/xc/programs/Xserver/cfb/cfbunmap.h
+++ b/xc/programs/Xserver/cfb/cfbunmap.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/cfb/cfbunmap.h,v 1.4 1998/11/28 10:42:52 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbunmap.h,v 1.6 2003/07/19 13:22:28 tsi Exp $ */
/*
* Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
*
@@ -29,12 +29,24 @@
* Unmap names
*/
-#undef NAME
+#undef CFBNAME
#undef CATNAME
-#undef cfbScreenPrivateIndex
#undef QuartetBitsTable
#undef QuartetPixelMaskTable
+#undef cfb8ClippedLineCopy
+#undef cfb8ClippedLineGeneral
+#undef cfb8ClippedLineXor
+#undef cfb8LineSS1Rect
+#undef cfb8LineSS1RectCopy
+#undef cfb8LineSS1RectGeneral
+#undef cfb8LineSS1RectPreviousCopy
+#undef cfb8LineSS1RectXor
+#undef cfb8SegmentSS1Rect
+#undef cfb8SegmentSS1RectCopy
+#undef cfb8SegmentSS1RectGeneral
+#undef cfb8SegmentSS1RectShiftCopy
+#undef cfb8SegmentSS1RectXor
#undef cfbAllocatePrivates
#undef cfbBSFuncRec
#undef cfbBitBlt
@@ -46,12 +58,13 @@
#undef cfbCopyImagePlane
#undef cfbCopyPixmap
#undef cfbCopyPlane
+#undef cfbCopyPlaneReduce
#undef cfbCopyRotatePixmap
#undef cfbCopyWindow
#undef cfbCreateGC
#undef cfbCreatePixmap
-#undef cfbCreateWindow
#undef cfbCreateScreenResources
+#undef cfbCreateWindow
#undef cfbDestroyPixmap
#undef cfbDestroyWindow
#undef cfbDoBitblt
@@ -93,11 +106,11 @@
#undef cfbNonTEOps1Rect
#undef cfbPadPixmap
#undef cfbPaintWindow
-#undef cfbPolyGlyphBlt8
-#undef cfbPolyGlyphRop8
#undef cfbPolyFillArcSolidCopy
#undef cfbPolyFillArcSolidGeneral
#undef cfbPolyFillRect
+#undef cfbPolyGlyphBlt8
+#undef cfbPolyGlyphRop8
#undef cfbPolyPoint
#undef cfbPositionWindow
#undef cfbPutImage
@@ -105,6 +118,7 @@
#undef cfbRestoreAreas
#undef cfbSaveAreas
#undef cfbScreenInit
+#undef cfbScreenPrivateIndex
#undef cfbSegmentSD
#undef cfbSegmentSS
#undef cfbSetScanline
@@ -128,26 +142,12 @@
#undef cfbVertS
#undef cfbXRotatePixmap
#undef cfbYRotatePixmap
+#undef cfbZeroPolyArcSS8Copy
+#undef cfbZeroPolyArcSS8General
+#undef cfbZeroPolyArcSS8Xor
#undef cfbendpartial
#undef cfbendtab
#undef cfbmask
#undef cfbrmask
#undef cfbstartpartial
#undef cfbstarttab
-#undef cfb8LineSS1Rect
-#undef cfb8SegmentSS1Rect
-#undef cfb8ClippedLineCopy
-#undef cfb8ClippedLineXor
-#undef cfb8ClippedLineGeneral
-#undef cfb8SegmentSS1RectCopy
-#undef cfb8SegmentSS1RectXor
-#undef cfb8SegmentSS1RectGeneral
-#undef cfb8SegmentSS1RectShiftCopy
-#undef cfb8LineSS1RectCopy
-#undef cfb8LineSS1RectXor
-#undef cfb8LineSS1RectGeneral
-#undef cfb8LineSS1RectPreviousCopy
-#undef cfbZeroPolyArcSS8Copy
-#undef cfbZeroPolyArcSS8Xor
-#undef cfbZeroPolyArcSS8General
-
diff --git a/xc/programs/Xserver/cfb/cfbzerarc.c b/xc/programs/Xserver/cfb/cfbzerarc.c
index 4b408b363..d5edd78e4 100644
--- a/xc/programs/Xserver/cfb/cfbzerarc.c
+++ b/xc/programs/Xserver/cfb/cfbzerarc.c
@@ -1,9 +1,13 @@
-/* $XFree86: xc/programs/Xserver/cfb/cfbzerarc.c,v 3.1 1998/10/04 09:37:53 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbzerarc.c,v 3.4 2003/07/16 01:38:37 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -21,7 +25,7 @@ in this Software without prior written authorization from The Open Group.
********************************************************/
-/* $TOG: cfbzerarc.c /main/25 1998/02/09 14:08:20 kaleb $ */
+/* $Xorg: cfbzerarc.c,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $ */
/* Derived from:
* "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
@@ -31,7 +35,7 @@ in this Software without prior written authorization from The Open Group.
#include "X.h"
#include "Xprotostr.h"
-#include "miscstruct.h"
+#include "regionstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
@@ -44,10 +48,10 @@ in this Software without prior written authorization from The Open Group.
#ifdef PIXEL_ADDR
static void
-RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+RROP_NAME(cfbZeroArcSS8)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc)
{
miZeroArcRec info;
Bool do360;
diff --git a/xc/programs/Xserver/cfb/module/Imakefile b/xc/programs/Xserver/cfb/module/Imakefile
index 79dda8413..954edc80b 100644
--- a/xc/programs/Xserver/cfb/module/Imakefile
+++ b/xc/programs/Xserver/cfb/module/Imakefile
@@ -1,8 +1,11 @@
-XCOMM $XFree86: xc/programs/Xserver/cfb/module/Imakefile,v 1.1 2002/05/31 15:12:56 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/cfb/module/Imakefile,v 1.2 2003/03/25 04:18:16 dawes Exp $
#define IHaveModules
#define PixelSize 8
#define LinkDirectory ..
+#ifdef OS2Architecture
+CFBCMAP = cfbcmap.o
+#endif
#include "../Imakefile.inc"
diff --git a/xc/programs/Xserver/dix/Imakefile b/xc/programs/Xserver/dix/Imakefile
index dd9e54c80..b7e125080 100644
--- a/xc/programs/Xserver/dix/Imakefile
+++ b/xc/programs/Xserver/dix/Imakefile
@@ -1,5 +1,10 @@
-XCOMM $XConsortium: Imakefile /main/52 1996/12/02 10:20:03 lehors $
-XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.9 1999/04/17 09:08:28 dawes Exp $
+XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:48:16 cpqbld Exp $
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.17 2003/04/15 18:30:43 alanh Exp $
+
#include <Server.tmpl>
#if PrintOnlyServer
@@ -21,7 +26,8 @@ OBJS = atom.o colormap.o cursor.o devices.o dispatch.o dixutils.o events.o \
main.o property.o resource.o swaprep.o swapreq.o \
tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o $(FFS_OBJ)
- INCLUDES = -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC)
+ INCLUDES = -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC) \
+ -I$(SERVERSRC)/Xext -I$(SERVERSRC)/lbx
LINTLIBS = ../os/llib-los.ln
/*
@@ -58,16 +64,22 @@ VENDORSTRING = XVendorString
#ifdef XVendorRelease
VENDORRELEASE = XVendorRelease
- VENDOR_RELEASE = -DVENDOR_RELEASE=$(VENDORRELEASE)
+ VENDOR_RELEASE = -DVENDOR_RELEASE="$(VENDORRELEASE)"
#endif
#if HasKrb5
K5DEFS = Krb5Defines
#endif
+#ifdef DarwinArchitecture
+#if DarwinQuartzSupport
+ QUARTZ_DEFINES = -DDARWIN_WITH_QUARTZ
+#endif
+#endif
+
SITE_DEFINES = $(SITE_FONT_PATH) $(SITE_RGB_DB) $(SITE_DISPLAY_CLASS)
-VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE)
+VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) $(QUARTZ_DEFINES)
NormalLibraryObjectRule()
NormalLibraryTarget(dix,$(OBJS))
diff --git a/xc/programs/Xserver/dix/dispatch.c b/xc/programs/Xserver/dix/dispatch.c
index 78d592fa7..f917267e5 100644
--- a/xc/programs/Xserver/dix/dispatch.c
+++ b/xc/programs/Xserver/dix/dispatch.c
@@ -1,9 +1,13 @@
-/* $TOG: dispatch.c /main/196 1998/02/09 14:18:32 kaleb $ */
+/* $Xorg: dispatch.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
/************************************************************
Copyright 1987, 1989, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -64,7 +68,7 @@ SOFTWARE.
* *
*****************************************************************/
-/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.14 1999/03/14 03:21:32 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.30 2003/07/04 16:24:24 eich Exp $ */
#ifdef PANORAMIX_DEBUG
#include <stdio.h>
@@ -87,7 +91,6 @@ int ProcInitialConnection();
#include "dispatch.h"
#include "swaprep.h"
#include "swapreq.h"
-#include "dixevents.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@@ -104,25 +107,20 @@ int ProcInitialConnection();
#include "inputstr.h"
#include "XKBsrv.h"
#endif
+#ifdef LBX
+#include "lbxserve.h"
+#endif
#define mskcnt ((MAXCLIENTS + 31) / 32)
-#define BITMASK(i) (1 << ((i) & 31))
+#define BITMASK(i) (1U << ((i) & 31))
#define MASKIDX(i) ((i) >> 5)
#define MASKWORD(buf, i) buf[MASKIDX(i)]
#define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i)
#define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i)
#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
-extern WindowPtr *WindowTable;
extern xConnSetupPrefix connSetupPrefix;
extern char *ConnectionInfo;
-extern void ReleaseActiveGrabs();
-extern void NotImplemented();
-extern void SwapConnClientPrefix(
-#if NeedFunctionPrototypes
- xConnClientPrefix *
-#endif
-);
Selection *CurrentSelections;
int NumCurrentSelections;
@@ -137,9 +135,6 @@ CallbackListPtr ServerGrabCallback = NULL;
HWEventQueuePtr checkForInput[2];
extern int connBlockScreenStart;
-extern void Swap32Write(), SLHostsExtend(), SQColorsExtend(), WriteSConnectionInfo();
-extern void WriteSConnSetupPrefix();
-
static void KillAllClients(
#if NeedFunctionPrototypes
void
@@ -152,10 +147,6 @@ static void DeleteClientFromAnySelections(
#endif
);
-#ifdef LBX
-extern unsigned long StandardRequestLength();
-#endif
-
static int nextFreeClientID; /* always MIN free client ID */
static int nClients; /* number of authorized clients */
@@ -251,17 +242,123 @@ FlushClientCaches(id)
}
}
}
+#ifdef SMART_SCHEDULE
+
+#undef SMART_DEBUG
+
+#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
+#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
+
+Bool SmartScheduleDisable;
+long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
+long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
+long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
+long SmartScheduleTime;
+ClientPtr SmartLastClient;
+int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1];
+int SmartScheduleClient(int *clientReady, int nready);
+
+#ifdef SMART_DEBUG
+long SmartLastPrint;
+#endif
+
+void Dispatch(void);
+void InitProcVectors(void);
+
+int
+SmartScheduleClient (int *clientReady, int nready)
+{
+ ClientPtr pClient;
+ int i;
+ int client;
+ int bestPrio, best = 0;
+ int bestRobin, robin;
+ long now = SmartScheduleTime;
+ long idle;
+
+ bestPrio = -0x7fffffff;
+ bestRobin = 0;
+ idle = 2 * SmartScheduleSlice;
+ for (i = 0; i < nready; i++)
+ {
+ client = clientReady[i];
+ pClient = clients[client];
+ /* Praise clients which are idle */
+ if ((now - pClient->smart_check_tick) >= idle)
+ {
+ if (pClient->smart_priority < 0)
+ pClient->smart_priority++;
+ }
+ pClient->smart_check_tick = now;
+
+ /* check priority to select best client */
+ robin = (pClient->index - SmartLastIndex[pClient->smart_priority-SMART_MIN_PRIORITY]) & 0xff;
+ if (pClient->smart_priority > bestPrio ||
+ (pClient->smart_priority == bestPrio && robin > bestRobin))
+ {
+ bestPrio = pClient->smart_priority;
+ bestRobin = robin;
+ best = client;
+ }
+#ifdef SMART_DEBUG
+ if ((now - SmartLastPrint) >= 5000)
+ fprintf (stderr, " %2d: %3d", client, pClient->smart_priority);
+#endif
+ }
+#ifdef SMART_DEBUG
+ if ((now - SmartLastPrint) >= 5000)
+ {
+ fprintf (stderr, " use %2d\n", best);
+ SmartLastPrint = now;
+ }
+#endif
+ pClient = clients[best];
+ SmartLastIndex[bestPrio-SMART_MIN_PRIORITY] = pClient->index;
+ /*
+ * Set current client pointer
+ */
+ if (SmartLastClient != pClient)
+ {
+ pClient->smart_start_tick = now;
+ SmartLastClient = pClient;
+ }
+ /*
+ * Adjust slice
+ */
+ if (nready == 1)
+ {
+ /*
+ * If it's been a long time since another client
+ * has run, bump the slice up to get maximal
+ * performance from a single client
+ */
+ if ((now - pClient->smart_start_tick) > 1000 &&
+ SmartScheduleSlice < SmartScheduleMaxSlice)
+ {
+ SmartScheduleSlice += SmartScheduleInterval;
+ }
+ }
+ else
+ {
+ SmartScheduleSlice = SmartScheduleInterval;
+ }
+ return best;
+}
+#endif
#define MAJOROP ((xReq *)client->requestBuffer)->reqType
void
-Dispatch()
+Dispatch(void)
{
register int *clientReady; /* array of request ready clients */
register int result;
register ClientPtr client;
register int nready;
register HWEventQueuePtr* icheck = checkForInput;
+#ifdef SMART_SCHEDULE
+ int start_tick;
+#endif
nextFreeClientID = 1;
InitSelections();
@@ -281,6 +378,13 @@ Dispatch()
nready = WaitForSomething(clientReady);
+#ifdef SMART_SCHEDULE
+ if (nready && !SmartScheduleDisable)
+ {
+ clientReady[0] = SmartScheduleClient (clientReady, nready);
+ nready = 1;
+ }
+#endif
/*****************
* Handle events in round robin fashion, doing input between
* each round
@@ -303,6 +407,9 @@ Dispatch()
isItTimeToYield = FALSE;
requestingClient = client;
+#ifdef SMART_SCHEDULE
+ start_tick = SmartScheduleTime;
+#endif
while (!isItTimeToYield)
{
if (*icheck[0] != *icheck[1])
@@ -310,7 +417,16 @@ Dispatch()
ProcessInputEvents();
FlushIfCriticalOutputPending();
}
-
+#ifdef SMART_SCHEDULE
+ if (!SmartScheduleDisable &&
+ (SmartScheduleTime - start_tick) >= SmartScheduleSlice)
+ {
+ /* Penalize clients which consume ticks */
+ if (client->smart_priority > SMART_MIN_PRIORITY)
+ client->smart_priority--;
+ break;
+ }
+#endif
/* now, finally, deal with client requests */
result = ReadRequestFromClient(client);
@@ -328,7 +444,7 @@ Dispatch()
client->requestLog[client->requestLogIndex] = MAJOROP;
client->requestLogIndex++;
#endif
- if (result > (MAX_BIG_REQUEST_SIZE << 2))
+ if (result > (maxBigRequestSize << 2))
result = BadLength;
else
result = (* client->requestVector[MAJOROP])(client);
@@ -345,7 +461,11 @@ Dispatch()
}
}
FlushAllOutput();
-
+#ifdef SMART_SCHEDULE
+ client = clients[clientReady[nready]];
+ if (client)
+ client->smart_stop_tick = SmartScheduleTime;
+#endif
requestingClient = NULL;
}
dispatchException &= ~DE_PRIORITYCHANGE;
@@ -729,15 +849,10 @@ int
ProcQueryTree(client)
register ClientPtr client;
{
-
xQueryTreeReply reply;
int numChildren = 0;
register WindowPtr pChild, pWin, pHead;
Window *childIDs = (Window *)NULL;
-#ifdef PANORAMIX
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- int j, thisScreen;
-#endif
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -752,55 +867,6 @@ ProcQueryTree(client)
reply.parent = pWin->parent->drawable.id;
else
reply.parent = (Window)None;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ) {
- thisScreen = 0;
- for (j = 0; j <= PanoramiXNumScreens - 1; j++) {
- if ( pWin->winSize.extents.x1 < (panoramiXdataPtr[j].x + panoramiXdataPtr[j].width)) {
- thisScreen = j;
- break;
- }
- }
- }
- if ( !noPanoramiXExtension && thisScreen ) {
- PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- pWin = (WindowPtr)SecurityLookupWindow(pPanoramiXWin->info[thisScreen].id, client,
- SecurityReadAccess);
- if (!pWin)
- return(BadWindow);
- pHead = RealChildHead(pWin);
- for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
- numChildren++;
- if (numChildren)
- {
- int curChild = 0;
- childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window));
- if (!childIDs)
- return BadAlloc;
- for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, pChild->drawable.id, thisScreen);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- childIDs[curChild++] = pPanoramiXWin->info[0].id;
- }
- } /* numChildren */
- }else { /* otherwise its screen 0, and nothing changes */
- pHead = RealChildHead(pWin);
- for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
- numChildren++;
- if (numChildren)
- {
- int curChild = 0;
-
- childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window));
- if (!childIDs)
- return BadAlloc;
- for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
- childIDs[curChild++] = pChild->drawable.id;
- }
- }
-#else
pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
numChildren++;
@@ -814,7 +880,6 @@ ProcQueryTree(client)
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
childIDs[curChild++] = pChild->drawable.id;
}
-#endif
reply.nChildren = numChildren;
reply.length = (numChildren * sizeof(Window)) >> 2;
@@ -1894,6 +1959,7 @@ ProcPolyFillRectangle(client)
if (things & 4)
return(BadLength);
things >>= 3;
+
if (things)
(*pGC->ops->PolyFillRect) (pDraw, pGC, things,
(xRectangle *) &stuff[1]);
@@ -1920,6 +1986,49 @@ ProcPolyFillArc(client)
return (client->noClientException);
}
+#ifdef MATCH_CLIENT_ENDIAN
+
+int
+ServerOrder (void)
+{
+ int whichbyte = 1;
+
+ if (*((char *) &whichbyte))
+ return LSBFirst;
+ return MSBFirst;
+}
+
+#define ClientOrder(client) ((client)->swapped ? !ServerOrder() : ServerOrder())
+
+void
+ReformatImage (char *base, int nbytes, int bpp, int order)
+{
+ switch (bpp) {
+ case 1: /* yuck */
+ if (BITMAP_BIT_ORDER != order)
+ BitOrderInvert ((unsigned char *) base, nbytes);
+#if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8
+ ReformatImage (base, nbytes, BITMAP_SCANLINE_UNIT, order);
+#endif
+ break;
+ case 4:
+ break; /* yuck */
+ case 8:
+ break;
+ case 16:
+ if (IMAGE_BYTE_ORDER != order)
+ TwoByteSwap ((unsigned char *) base, nbytes);
+ break;
+ case 32:
+ if (IMAGE_BYTE_ORDER != order)
+ FourByteSwap ((unsigned char *) base, nbytes);
+ break;
+ }
+}
+#else
+#define ReformatImage(b,n,bpp,o)
+#endif
+
/* 64-bit server notes: the protocol restricts padding of images to
* 8-, 16-, or 32-bits. We would like to have 64-bits for the server
* to use internally. Removes need for internal alignment checking.
@@ -1950,9 +2059,6 @@ ProcPutImage(client)
(stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
return BadMatch;
length = BitmapBytePad(stuff->width + stuff->leftPad);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);
-#endif
}
else if (stuff->format == XYPixmap)
{
@@ -1961,19 +2067,12 @@ ProcPutImage(client)
return BadMatch;
length = BitmapBytePad(stuff->width + stuff->leftPad);
length *= stuff->depth;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);
- lengthProto *= stuff->depth;
-#endif
}
else if (stuff->format == ZPixmap)
{
if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))
return BadMatch;
length = PixmapBytePad(stuff->width, stuff->depth);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->width, stuff->depth);
-#endif
}
else
{
@@ -1981,65 +2080,21 @@ ProcPutImage(client)
return BadValue;
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* handle 64 bit case where protocol may pad to 32 and we want 64 */
- if ( length != lengthProto ) {
- register int i;
- char * stuffptr, /* pointer into protocol data */
- * tmpptr; /* new location to copy to */
-
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))
- return (BadAlloc);
-
- bzero(tmpImage,length*stuff->height);
-
- if ( stuff->format == XYPixmap ) {
- int lineBytes = BitmapBytePad(stuff->width + stuff->leftPad);
- int lineBytesProto =
- BitmapBytePadProto(stuff->width + stuff->leftPad);
- int depth = stuff->depth;
-
- stuffptr = (char *)&stuff[1];
- tmpptr = tmpImage;
- for ( i = 0; i < stuff->height*stuff->depth;
- stuffptr += lineBytesProto,tmpptr += lineBytes, i++)
- memmove(tmpptr,stuffptr,lineBytesProto);
- }
- else {
- for ( i = 0,stuffptr = (char *)&stuff[1],tmpptr=tmpImage;
- i < stuff->height;
- stuffptr += lengthProto,tmpptr += length, i++)
- memmove(tmpptr,stuffptr,lengthProto);
- }
- }
-
- /* handle 64-bit case where stuff is not 64-bit aligned */
- else if ((unsigned long)&stuff[1] & (sizeof(long)-1)) {
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))
- return (BadAlloc);
- memmove(tmpImage,(char *)&stuff[1],length*stuff->height);
- }
- else
- tmpImage = (char *)&stuff[1];
-#else
tmpImage = (char *)&stuff[1];
lengthProto = length;
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
if (((((lengthProto * stuff->height) + (unsigned)3) >> 2) +
(sizeof(xPutImageReq) >> 2)) != client->req_len)
return BadLength;
+ ReformatImage (tmpImage, lengthProto * stuff->height,
+ stuff->format == ZPixmap ? BitsPerPixel (stuff->depth) : 1,
+ ClientOrder(client));
+
(*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,
stuff->width, stuff->height,
stuff->leftPad, stuff->format, tmpImage);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* free up our temporary space if used */
- if (tmpImage != (char *)&stuff[1])
- DEALLOCATE_LOCAL(tmpImage);
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
-
return (client->noClientException);
}
@@ -2057,10 +2112,7 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
int nlines, linesPerBuf;
register int linesDone;
long widthBytesLine, length;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long widthBytesLineProto, lengthProto;
-#endif
- Mask plane;
+ Mask plane = 0;
char *pBuf;
xGetImageReply xgi;
RegionPtr pVisibleRegion = NULL;
@@ -2110,10 +2162,6 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
widthBytesLine = PixmapBytePad(width, pDraw->depth);
length = widthBytesLine * height;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = PixmapBytePadProto(width, pDraw->depth);
- lengthProto = widthBytesLineProto * height;
-#endif
}
else
{
@@ -2123,18 +2171,9 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
length = widthBytesLine * height *
Ones(planemask & (plane | (plane - 1)));
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = BitmapBytePadProto(width);
- lengthProto = widthBytesLineProto * height *
- Ones(planemask & (plane | (plane - 1)));
-#endif
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- xgi.length = lengthProto;
-#else
xgi.length = length;
-#endif
if (im_return) {
pBuf = (char *)xalloc(sz_xGetImageReply + length);
@@ -2164,12 +2203,12 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
{
/* we have to make sure intermediate buffers don't need padding */
while ((linesPerBuf > 1) &&
- (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)))
+ (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1)))
{
linesPerBuf--;
length -= widthBytesLine;
}
- while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))
+ while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1))
{
linesPerBuf++;
length += widthBytesLine;
@@ -2217,35 +2256,19 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
nlines, format, pBuf);
#endif
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* for 64-bit server, convert image to pad to 32 bits */
- if ( widthBytesLine != widthBytesLineProto ) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- for (i = 1,
- bufPtr = pBuf + widthBytesLine,
- protoPtr = pBuf + widthBytesLineProto;
- i < nlines;
- bufPtr += widthBytesLine,
- protoPtr += widthBytesLineProto,
- i++)
- memmove(protoPtr, bufPtr, widthBytesLineProto);
- }
-#endif
/* Note that this is NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
if (!im_return)
+ {
+ ReformatImage (pBuf, (int)(nlines * widthBytesLine),
+ BitsPerPixel (pDraw->depth),
+ ClientOrder(client));
+
/* Don't split me, gcc pukes when you do */
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto),
- pBuf);
-#else
(void)WriteToClient(client,
(int)(nlines * widthBytesLine),
pBuf);
-#endif
+ }
linesDone += nlines;
}
}
@@ -2275,41 +2298,21 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
nlines, format, pBuf);
#endif
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* for 64-bit server, convert image to pad to 32 bits */
- if ( widthBytesLine != widthBytesLineProto ) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- for (i = 1,
- bufPtr = pBuf + widthBytesLine,
- protoPtr = pBuf + widthBytesLineProto;
- i < nlines;
- bufPtr += widthBytesLine,
- protoPtr += widthBytesLineProto,
- i++)
- memmove(protoPtr, bufPtr, widthBytesLineProto);
- }
-#endif
/* Note: NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
if (im_return) {
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- pBuf += nlines * widthBytesLineProto;
-#else
pBuf += nlines * widthBytesLine;
-#endif
- } else
+ } else {
+ ReformatImage (pBuf,
+ (int)(nlines * widthBytesLine),
+ 1,
+ ClientOrder (client));
+
/* Don't split me, gcc pukes when you do */
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto),
- pBuf);
-#else
(void)WriteToClient(client,
(int)(nlines * widthBytesLine),
pBuf);
-#endif
+ }
linesDone += nlines;
}
}
@@ -2648,7 +2651,7 @@ ProcAllocColor(client)
return (retval);
}
#ifdef PANORAMIX
- if (noPanoramiXExtension)
+ if (noPanoramiXExtension || !pmap->pScreen->myNum)
#endif
WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
return (client->noClientException);
@@ -2707,7 +2710,7 @@ ProcAllocNamedColor (client)
return(retval);
}
#ifdef PANORAMIX
- if (noPanoramiXExtension)
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
WriteReplyToClient(client, sizeof (xAllocNamedColorReply), &ancr);
return (client->noClientException);
@@ -2777,7 +2780,7 @@ ProcAllocColorCells (client)
return(retval);
}
#ifdef PANORAMIX
- if (noPanoramiXExtension)
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
{
accr.type = X_Reply;
@@ -2855,9 +2858,14 @@ ProcAllocColorPlanes(client)
return(retval);
}
acpr.length = length >> 2;
- WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+#endif
+ {
+ WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
DEALLOCATE_LOCAL(ppixels);
return (client->noClientException);
}
@@ -3339,11 +3347,10 @@ int
ProcListHosts(client)
register ClientPtr client;
{
-extern int GetHosts();
xListHostsReply reply;
int len, nHosts, result;
pointer pdata;
- REQUEST(xListHostsReq);
+ /* REQUEST(xListHostsReq); */
REQUEST_SIZE_MATCH(xListHostsReq);
#ifdef XCSECURITY
@@ -3468,7 +3475,7 @@ ProcGetFontPath(client)
xGetFontPathReply reply;
int stringLens, numpaths;
unsigned char *bufferStart;
- REQUEST (xReq);
+ /* REQUEST (xReq); */
REQUEST_SIZE_MATCH(xReq);
bufferStart = GetFontPath(&numpaths, &stringLens);
@@ -3532,7 +3539,7 @@ int ProcNoOperation(client)
}
void
-InitProcVectors()
+InitProcVectors(void)
{
int i;
for (i = 0; i<256; i++)
@@ -3569,16 +3576,6 @@ void
CloseDownClient(client)
register ClientPtr client;
{
-#ifdef PANORAMIX
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-#endif
Bool really_close_down = client->clientGone ||
client->closeDownMode == DestroyAll;
@@ -3652,12 +3649,12 @@ CloseDownClient(client)
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
}
FreeClientResources(client);
-#ifdef PANORAMIX
- PANORAMIX_FREE(client);
-#endif
if (client->index < nextFreeClientID)
nextFreeClientID = client->index;
clients[client->index] = NullClient;
+#ifdef SMART_SCHEDULE
+ SmartLastClient = NullClient;
+#endif
xfree(client);
while (!clients[currentMaxClients-1])
@@ -3670,8 +3667,11 @@ KillAllClients()
{
int i;
for (i=1; i<currentMaxClients; i++)
- if (clients[i])
+ if (clients[i]) {
+ /* Make sure Retained clients are released. */
+ clients[i]->closeDownMode = DestroyAll;
CloseDownClient(clients[i]);
+ }
}
/*********************
@@ -3751,6 +3751,12 @@ void InitClient(client, i, ospriv)
client->appgroup = NULL;
#endif
client->fontResFunc = NULL;
+#ifdef SMART_SCHEDULE
+ client->smart_priority = 0;
+ client->smart_start_tick = SmartScheduleTime;
+ client->smart_stop_tick = SmartScheduleTime;
+ client->smart_check_tick = SmartScheduleTime;
+#endif
}
extern int clientPrivateLen;
@@ -3807,16 +3813,6 @@ NextAvailableClient(ospriv)
register int i;
register ClientPtr client;
xReq data;
-#ifdef PANORAMIX
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-#endif
i = nextFreeClientID;
if (i == MAXCLIENTS)
@@ -3836,9 +3832,6 @@ NextAvailableClient(ospriv)
if (!InsertFakeRequest(client, (char *)&data, sz_xReq))
{
FreeClientResources(client);
-#ifdef PANORAMIX
- PANORAMIX_FREE(client);
-#endif
xfree(client);
return (ClientPtr)NULL;
}
@@ -3908,7 +3901,6 @@ SendConnSetup(client, reason)
if (reason)
{
xConnSetupPrefix csp;
- char pad[3];
csp.success = xFalse;
csp.lengthReason = strlen(reason);
@@ -3941,6 +3933,10 @@ SendConnSetup(client, reason)
#endif
((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
+#ifdef MATCH_CLIENT_ENDIAN
+ ((xConnSetup *)lConnectionInfo)->imageByteOrder = ClientOrder (client);
+ ((xConnSetup *)lConnectionInfo)->bitmapBitOrder = ClientOrder (client);
+#endif
/* fill in the "currentInputMask" */
root = (xWindowRoot *)(lConnectionInfo + connBlockScreenStart);
#ifdef PANORAMIX
diff --git a/xc/programs/Xserver/dix/events.c b/xc/programs/Xserver/dix/events.c
index 501159bc4..11f70e767 100644
--- a/xc/programs/Xserver/dix/events.c
+++ b/xc/programs/Xserver/dix/events.c
@@ -1,9 +1,13 @@
-/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.20 1999/05/30 14:04:11 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.48 2003/04/16 19:18:44 mvojkovi Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -64,9 +68,7 @@ SOFTWARE.
* *
*****************************************************************/
-
-
-/* $TOG: events.c /main/188 1998/02/09 14:19:04 kaleb $ */
+/* $Xorg: events.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#include "X.h"
#include "misc.h"
@@ -108,10 +110,6 @@ extern Bool XkbFilterEvents();
#include "dixgrabs.h"
#include "dispatch.h"
-extern WindowPtr *WindowTable;
-
-extern void (* EventSwapVector[128]) ();
-
#define EXTENSION_EVENT_BASE 64
#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
@@ -144,6 +142,9 @@ extern void (* EventSwapVector[128]) ();
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
+#define XE_KBPTR (xE->u.keyButtonPointer)
+
+
#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
CallbackListPtr EventCallback;
@@ -186,13 +187,20 @@ static struct {
CursorPtr current;
BoxRec hotLimits; /* logical constraints of hot spot */
Bool confined; /* confined to screen */
-#ifdef SHAPE
+#if defined(SHAPE) || defined(PANORAMIX)
RegionPtr hotShape; /* additional logical shape constraint */
#endif
BoxRec physLimits; /* physical constraints of hot spot */
WindowPtr win; /* window of logical position */
HotSpot hot; /* logical pointer position */
HotSpot hotPhys; /* physical pointer position */
+#ifdef PANORAMIX
+ ScreenPtr screen; /* all others are in Screen 0 coordinates */
+ RegionRec Reg1; /* Region 1 for confining motion */
+ RegionRec Reg2; /* Region 2 for confining virtual motion */
+ WindowPtr windows[MAXSCREENS];
+ WindowPtr confineWin; /* confine window */
+#endif
} sprite; /* info about the cursor sprite */
static void DoEnterLeaveEvents(
@@ -210,26 +218,14 @@ static WindowPtr XYToWindow(
#endif
);
-void DeliverFocusedEvent();
-int DeliverDeviceEvents();
-void DoFocusEvents();
-Mask EventMaskForClient();
-Bool CheckDeviceGrabs();
-void EnqueueEvent();
+extern int lastEvent;
-extern Bool GrabMatchesSecond();
-extern Bool DeletePassiveGrabFromList();
-extern int AddPassiveGrabToList();
+static Mask lastEventMask;
-extern Bool permitOldBugs;
-extern Bool Must_have_memory;
-extern int lastEvent;
#ifdef XINPUT
-extern int DeviceMotionNotify, DeviceButtonPress, DeviceKeyPress;
+extern int DeviceMotionNotify;
#endif
-static Mask lastEventMask;
-
#define CantBeFiltered NoEventMask
static Mask filters[128] =
{
@@ -272,16 +268,331 @@ static Mask filters[128] =
static CARD8 criticalEvents[32] =
{
- 0x3c /* key and button events */
+ 0x7c /* key and button events */
};
-Mask
-GetNextEventMask()
+#ifdef PANORAMIX
+
+static void ConfineToShape(RegionPtr shape, int *px, int *py);
+static void SyntheticMotion(int x, int y);
+static void PostNewCursor(void);
+
+static Bool
+XineramaSetCursorPosition(
+ int x,
+ int y,
+ Bool generateEvent
+){
+ ScreenPtr pScreen;
+ BoxRec box;
+ int i;
+
+ /* x,y are in Screen 0 coordinates. We need to decide what Screen
+ to send the message too and what the coordinates relative to
+ that screen are. */
+
+ pScreen = sprite.screen;
+ x += panoramiXdataPtr[0].x;
+ y += panoramiXdataPtr[0].y;
+
+ if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
+ x, y, &box))
+ {
+ FOR_NSCREENS(i)
+ {
+ if(i == pScreen->myNum)
+ continue;
+ if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], x, y, &box))
+ {
+ pScreen = screenInfo.screens[i];
+ break;
+ }
+ }
+ }
+
+ sprite.screen = pScreen;
+ sprite.hotPhys.x = x - panoramiXdataPtr[0].x;
+ sprite.hotPhys.y = y - panoramiXdataPtr[0].y;
+ x -= panoramiXdataPtr[pScreen->myNum].x;
+ y -= panoramiXdataPtr[pScreen->myNum].y;
+
+ return (*pScreen->SetCursorPosition)(pScreen, x, y, generateEvent);
+}
+
+
+static void
+XineramaConstrainCursor(void)
+{
+ ScreenPtr pScreen = sprite.screen;
+ BoxRec newBox = sprite.physLimits;
+
+ /* Translate the constraining box to the screen
+ the sprite is actually on */
+ newBox.x1 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x;
+ newBox.x2 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x;
+ newBox.y1 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y;
+ newBox.y2 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y;
+
+ (* pScreen->ConstrainCursor)(pScreen, &newBox);
+}
+
+static void
+XineramaCheckPhysLimits(
+ CursorPtr cursor,
+ Bool generateEvents
+){
+ HotSpot new;
+
+ if (!cursor)
+ return;
+
+ new = sprite.hotPhys;
+
+ /* I don't care what the DDX has to say about it */
+ sprite.physLimits = sprite.hotLimits;
+
+ /* constrain the pointer to those limits */
+ if (new.x < sprite.physLimits.x1)
+ new.x = sprite.physLimits.x1;
+ else
+ if (new.x >= sprite.physLimits.x2)
+ new.x = sprite.physLimits.x2 - 1;
+ if (new.y < sprite.physLimits.y1)
+ new.y = sprite.physLimits.y1;
+ else
+ if (new.y >= sprite.physLimits.y2)
+ new.y = sprite.physLimits.y2 - 1;
+
+ if (sprite.hotShape) /* more work if the shape is a mess */
+ ConfineToShape(sprite.hotShape, &new.x, &new.y);
+
+ if((new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y))
+ {
+ XineramaSetCursorPosition (new.x, new.y, generateEvents);
+ if (!generateEvents)
+ SyntheticMotion(new.x, new.y);
+ }
+
+ /* Tell DDX what the limits are */
+ XineramaConstrainCursor();
+}
+
+
+static Bool
+XineramaSetWindowPntrs(WindowPtr pWin)
+{
+ if(pWin == WindowTable[0]) {
+ memcpy(sprite.windows, WindowTable,
+ PanoramiXNumScreens*sizeof(WindowPtr));
+ } else {
+ PanoramiXRes *win;
+ int i;
+
+ win = (PanoramiXRes*)LookupIDByType(pWin->drawable.id, XRT_WINDOW);
+
+ if(!win)
+ return FALSE;
+
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ sprite.windows[i] = LookupIDByType(win->info[i].id, RT_WINDOW);
+ if(!sprite.windows[i]) /* window is being unmapped */
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static void
+XineramaCheckVirtualMotion(
+ QdEventPtr qe,
+ WindowPtr pWin
+){
+
+ if (qe)
+ {
+ sprite.hot.pScreen = qe->pScreen; /* should always be Screen 0 */
+ sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
+ sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
+ pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
+ NullWindow;
+ }
+ if (pWin)
+ {
+ int x, y, off_x, off_y, i;
+ BoxRec lims;
+
+ if(!XineramaSetWindowPntrs(pWin))
+ return;
+
+ i = PanoramiXNumScreens - 1;
+
+ REGION_COPY(sprite.screen, &sprite.Reg2,
+ &sprite.windows[i]->borderSize);
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+
+ while(i--) {
+ x = off_x - panoramiXdataPtr[i].x;
+ y = off_y - panoramiXdataPtr[i].y;
+
+ if(x || y)
+ REGION_TRANSLATE(sprite.screen, &sprite.Reg2, x, y);
+
+ REGION_UNION(sprite.screen, &sprite.Reg2, &sprite.Reg2,
+ &sprite.windows[i]->borderSize);
+
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+ }
+
+ lims = *REGION_EXTENTS(sprite.screen, &sprite.Reg2);
+
+ if (sprite.hot.x < lims.x1)
+ sprite.hot.x = lims.x1;
+ else if (sprite.hot.x >= lims.x2)
+ sprite.hot.x = lims.x2 - 1;
+ if (sprite.hot.y < lims.y1)
+ sprite.hot.y = lims.y1;
+ else if (sprite.hot.y >= lims.y2)
+ sprite.hot.y = lims.y2 - 1;
+
+ if (REGION_NUM_RECTS(&sprite.Reg2) > 1)
+ ConfineToShape(&sprite.Reg2, &sprite.hot.x, &sprite.hot.y);
+
+ if (qe)
+ {
+ qe->pScreen = sprite.hot.pScreen;
+ qe->event->u.keyButtonPointer.rootX = sprite.hot.x;
+ qe->event->u.keyButtonPointer.rootY = sprite.hot.y;
+ }
+ }
+}
+
+
+static Bool
+XineramaCheckMotion(xEvent *xE)
{
- lastEventMask <<= 1;
- return lastEventMask;
+ WindowPtr prevSpriteWin = sprite.win;
+
+ if (xE && !syncEvents.playingEvents)
+ {
+ /* Motion events entering DIX get translated to Screen 0
+ coordinates. Replayed events have already been
+ translated since they've entered DIX before */
+ XE_KBPTR.rootX += panoramiXdataPtr[sprite.screen->myNum].x -
+ panoramiXdataPtr[0].x;
+ XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y -
+ panoramiXdataPtr[0].y;
+
+ sprite.hot.x = XE_KBPTR.rootX;
+ sprite.hot.y = XE_KBPTR.rootY;
+ if (sprite.hot.x < sprite.physLimits.x1)
+ sprite.hot.x = sprite.physLimits.x1;
+ else if (sprite.hot.x >= sprite.physLimits.x2)
+ sprite.hot.x = sprite.physLimits.x2 - 1;
+ if (sprite.hot.y < sprite.physLimits.y1)
+ sprite.hot.y = sprite.physLimits.y1;
+ else if (sprite.hot.y >= sprite.physLimits.y2)
+ sprite.hot.y = sprite.physLimits.y2 - 1;
+
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
+
+ sprite.hotPhys = sprite.hot;
+ if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
+ (sprite.hotPhys.y != XE_KBPTR.rootY))
+ {
+ XineramaSetCursorPosition(
+ sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
+ }
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
+ }
+
+ sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
+
+ if (sprite.win != prevSpriteWin)
+ {
+ if (prevSpriteWin != NullWindow) {
+ if (!xE)
+ UpdateCurrentTimeIf();
+ DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal);
+ }
+ PostNewCursor();
+ return FALSE;
+ }
+ return TRUE;
}
+
+static void
+XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents)
+{
+
+ if (syncEvents.playingEvents)
+ {
+ XineramaCheckVirtualMotion((QdEventPtr)NULL, pWin);
+ SyntheticMotion(sprite.hot.x, sprite.hot.y);
+ }
+ else
+ {
+ int x, y, off_x, off_y, i;
+
+ if(!XineramaSetWindowPntrs(pWin))
+ return;
+
+ i = PanoramiXNumScreens - 1;
+
+ REGION_COPY(sprite.screen, &sprite.Reg1,
+ &sprite.windows[i]->borderSize);
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+
+ while(i--) {
+ x = off_x - panoramiXdataPtr[i].x;
+ y = off_y - panoramiXdataPtr[i].y;
+
+ if(x || y)
+ REGION_TRANSLATE(sprite.screen, &sprite.Reg1, x, y);
+
+ REGION_UNION(sprite.screen, &sprite.Reg1, &sprite.Reg1,
+ &sprite.windows[i]->borderSize);
+
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+ }
+
+ sprite.hotLimits = *REGION_EXTENTS(sprite.screen, &sprite.Reg1);
+
+ if(REGION_NUM_RECTS(&sprite.Reg1) > 1)
+ sprite.hotShape = &sprite.Reg1;
+ else
+ sprite.hotShape = NullRegion;
+
+ sprite.confined = FALSE;
+ sprite.confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin;
+
+ XineramaCheckPhysLimits(sprite.current, generateEvents);
+ }
+}
+
+
+static void
+XineramaChangeToCursor(CursorPtr cursor)
+{
+ if (cursor != sprite.current)
+ {
+ if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
+ (sprite.current->bits->yhot != cursor->bits->yhot))
+ XineramaCheckPhysLimits(cursor, FALSE);
+ (*sprite.screen->DisplayCursor)(sprite.screen, cursor);
+ sprite.current = cursor;
+ }
+}
+
+
+#endif /* PANORAMIX */
+
void
SetMaskForEvent(mask, event)
Mask mask;
@@ -311,6 +622,15 @@ SyntheticMotion(x, y)
{
xEvent xE;
+#ifdef PANORAMIX
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer */
+ if(!noPanoramiXExtension) {
+ x += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x;
+ y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y;
+ }
+#endif
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
if (syncEvents.playingEvents)
@@ -405,7 +725,7 @@ CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
new.y = sprite.physLimits.y2 - 1;
#ifdef SHAPE
if (sprite.hotShape)
- ConfineToShape(sprite.hotShape, &new.x, &new.y);
+ ConfineToShape(sprite.hotShape, &new.x, &new.y);
#endif
if ((pScreen != sprite.hotPhys.pScreen) ||
(new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y))
@@ -429,7 +749,12 @@ CheckVirtualMotion(qe, pWin)
register WindowPtr pWin;
#endif
{
-
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaCheckVirtualMotion(qe, pWin);
+ return;
+ }
+#endif
if (qe)
{
sprite.hot.pScreen = qe->pScreen;
@@ -470,14 +795,18 @@ CheckVirtualMotion(qe, pWin)
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
-void
-ConfineCursorToWindow(pWin, generateEvents, confineToScreen)
- WindowPtr pWin;
- Bool generateEvents;
- Bool confineToScreen;
+static void
+ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaConfineCursorToWindow(pWin, generateEvents);
+ return;
+ }
+#endif
+
if (syncEvents.playingEvents)
{
CheckVirtualMotion((QdEventPtr)NULL, pWin);
@@ -509,11 +838,18 @@ ChangeToCursor(cursor)
CursorPtr cursor;
#endif
{
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaChangeToCursor(cursor);
+ return;
+ }
+#endif
+
if (cursor != sprite.current)
{
if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
(sprite.current->bits->yhot != cursor->bits->yhot))
- CheckPhysLimits(cursor, FALSE, PointerConfinedToScreen(),
+ CheckPhysLimits(cursor, FALSE, sprite.confined,
(ScreenPtr)NULL);
(*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen,
cursor);
@@ -591,6 +927,18 @@ GetSpritePosition(px, py)
*py = sprite.hotPhys.y;
}
+#ifdef PANORAMIX
+int
+XineramaGetCursorScreen()
+{
+ if(!noPanoramiXExtension) {
+ return sprite.screen->myNum;
+ } else {
+ return 0;
+ }
+}
+#endif /* PANORAMIX */
+
#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
static void
@@ -605,10 +953,10 @@ MonthChangedOrBadTime(xE)
* different sources in sorted order, then it's possible for time to go
* backwards when it should not. Here we ensure a decent time.
*/
- if ((currentTime.milliseconds - xE->u.keyButtonPointer.time) > TIMESLOP)
+ if ((currentTime.milliseconds - XE_KBPTR.time) > TIMESLOP)
currentTime.months++;
else
- xE->u.keyButtonPointer.time = currentTime.milliseconds;
+ XE_KBPTR.time = currentTime.milliseconds;
}
#define NoticeTime(xE) { \
@@ -640,6 +988,13 @@ EnqueueEvent(xE, device, count)
xEvent *qxE;
NoticeTime(xE);
+
+#ifdef XKB
+ /* Fix for key repeating bug. */
+ if (xE->u.u.type == KeyRelease)
+ AccessXCancelRepeatKey(device->key->xkbInfo, xE->u.u.detail);
+#endif
+
if (DeviceEventCallback)
{
DeviceEventInfoRec eventinfo;
@@ -653,7 +1008,7 @@ EnqueueEvent(xE, device, count)
* updated yet.
*/
if (xE->u.u.type == MotionNotify)
- xE->u.keyButtonPointer.root =
+ XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id;
eventinfo.events = xE;
eventinfo.count = count;
@@ -661,8 +1016,16 @@ EnqueueEvent(xE, device, count)
}
if (xE->u.u.type == MotionNotify)
{
- sprite.hotPhys.x = xE->u.keyButtonPointer.rootX;
- sprite.hotPhys.y = xE->u.keyButtonPointer.rootY;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XE_KBPTR.rootX += panoramiXdataPtr[sprite.screen->myNum].x -
+ panoramiXdataPtr[0].x;
+ XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y -
+ panoramiXdataPtr[0].y;
+ }
+#endif
+ sprite.hotPhys.x = XE_KBPTR.rootX;
+ sprite.hotPhys.y = XE_KBPTR.rootY;
/* do motion compression */
if (tail &&
(tail->event->u.u.type == MotionNotify) &&
@@ -670,7 +1033,7 @@ EnqueueEvent(xE, device, count)
{
tail->event->u.keyButtonPointer.rootX = sprite.hotPhys.x;
tail->event->u.keyButtonPointer.rootY = sprite.hotPhys.y;
- tail->event->u.keyButtonPointer.time = xE->u.keyButtonPointer.time;
+ tail->event->u.keyButtonPointer.time = XE_KBPTR.time;
tail->months = currentTime.months;
return;
}
@@ -713,6 +1076,19 @@ PlayReleasedEvents()
CheckVirtualMotion(qe, NullWindow);
syncEvents.time.months = qe->months;
syncEvents.time.milliseconds = qe->event->u.keyButtonPointer.time;
+#ifdef PANORAMIX
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer */
+ if(!noPanoramiXExtension) {
+ qe->event->u.keyButtonPointer.rootX +=
+ panoramiXdataPtr[0].x -
+ panoramiXdataPtr[sprite.screen->myNum].x;
+ qe->event->u.keyButtonPointer.rootY +=
+ panoramiXdataPtr[0].y -
+ panoramiXdataPtr[sprite.screen->myNum].y;
+ }
+#endif
(*qe->device->public.processInputProc)(qe->event, qe->device,
qe->evcount);
xfree(qe);
@@ -763,68 +1139,25 @@ ComputeFreezes()
syncEvents.playingEvents = TRUE;
if (replayDev)
{
-#ifdef PANORAMIX
- int j;
- WindowPtr tempw;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
xE = replayDev->sync.event;
count = replayDev->sync.evcount;
syncEvents.replayDev = (DeviceIntPtr)NULL;
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- for (j = PanoramiXNumScreens - 1; j>=0; j--)
- if (XE_PTR.rootX >= panoramiXdataPtr[j].x
- && XE_PTR.rootX < (panoramiXdataPtr[j].x + panoramiXdataPtr[j].width)
- && XE_PTR.rootY >= panoramiXdataPtr[j].y
- && XE_PTR.rootY < (panoramiXdataPtr[j].y +panoramiXdataPtr[j].height))
- break;
- XE_PTR.rootX -= panoramiXdataPtr[j].x;
- XE_PTR.rootY -= panoramiXdataPtr[j].y;
- XE_PTR.eventX -= panoramiXdataPtr[j].x;
- XE_PTR.eventY -= panoramiXdataPtr[j].y;
- w = XYToWindow(XE_PTR.rootX, XE_PTR.rootY);
- }else
-#endif
- w = XYToWindow(
- xE->u.keyButtonPointer.rootX, xE->u.keyButtonPointer.rootY);
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- for (i = 0; i < spriteTraceGood; i++) {
- tempw = spriteTrace[i];
- j = (tempw->drawable.pScreen)->myNum;
- PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, tempw->drawable.id, j);
- j = ((syncEvents.replayWin)->drawable.pScreen)->myNum;
- if (pPanoramiXWin)
- tempw = (WindowPtr)
- LookupIDByType(pPanoramiXWin->info[0].id, RT_WINDOW);
-
- if (syncEvents.replayWin == tempw) {
- if (!CheckDeviceGrabs(replayDev, xE, i+1, count))
- if (replayDev->focus)
- DeliverFocusedEvent(replayDev, xE, w, count);
- else
- DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
- replayDev, count);
- goto playmore;
- }
- } /* for */
- } else { /* if !noPanoramiXExtension */
-#endif
- for (i = 0; i < spriteTraceGood; i++)
- if (syncEvents.replayWin == spriteTrace[i])
- {
- if (!CheckDeviceGrabs(replayDev, xE, i+1, count))
- if (replayDev->focus)
- DeliverFocusedEvent(replayDev, xE, w, count);
- else
- DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
+
+ w = XYToWindow( XE_KBPTR.rootX, XE_KBPTR.rootY);
+ for (i = 0; i < spriteTraceGood; i++)
+ {
+ if (syncEvents.replayWin == spriteTrace[i])
+ {
+ if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) {
+ if (replayDev->focus)
+ DeliverFocusedEvent(replayDev, xE, w, count);
+ else
+ DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
replayDev, count);
- goto playmore;
- }
-#ifdef PANORAMIX
- }
-#endif
+ }
+ goto playmore;
+ }
+ }
/* must not still be in the same stack */
if (replayDev->focus)
DeliverFocusedEvent(replayDev, xE, w, count);
@@ -854,6 +1187,24 @@ playmore:
PostNewCursor();
}
+#ifdef RANDR
+void
+ScreenRestructured (ScreenPtr pScreen)
+{
+ GrabPtr grab;
+
+ if ((grab = inputInfo.pointer->grab) && grab->confineTo)
+ {
+ if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen)
+ sprite.hotPhys.x = sprite.hotPhys.y = 0;
+ ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
+ }
+ else
+ ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum],
+ TRUE, FALSE);
+}
+#endif
+
void
CheckGrabForSyncs(thisDev, thisMode, otherMode)
register DeviceIntPtr thisDev;
@@ -904,14 +1255,6 @@ ActivatePointerGrab(mouse, grab, time, autoGrab)
{
if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen)
sprite.hotPhys.x = sprite.hotPhys.y = 0;
-#ifdef PANORAMIX
- if ((!noPanoramiXExtension) &&
- ( grab->confineTo->drawable.x + grab->confineTo->drawable.width >
- (grab->confineTo->drawable.pScreen)->width ||
- grab->confineTo->drawable.x < 0) )
- ConfineCursorToWindow(grab->confineTo, FALSE, FALSE);
- else
-#endif
ConfineCursorToWindow(grab->confineTo, FALSE, TRUE);
}
DoEnterLeaveEvents(oldWin, grab->window, NotifyGrab);
@@ -926,8 +1269,7 @@ ActivatePointerGrab(mouse, grab, time, autoGrab)
mouse->grab = &mouse->activeGrab;
mouse->fromPassiveGrab = autoGrab;
PostNewCursor();
- CheckGrabForSyncs(mouse,
- (Bool)grab->pointerMode, (Bool)grab->keyboardMode);
+ CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
}
void
@@ -982,8 +1324,7 @@ ActivateKeyboardGrab(keybd, grab, time, passive)
keybd->activeGrab = *grab;
keybd->grab = &keybd->activeGrab;
keybd->fromPassiveGrab = passive;
- CheckGrabForSyncs(keybd,
- (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
+ CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
}
void
@@ -1254,7 +1595,13 @@ TryClientEvents (client, pEvents, count, mask, filter, grab)
}
if (BitIsOn(criticalEvents, type))
+ {
+#ifdef SMART_SCHEDULE
+ if (client->smart_priority < SMART_MAX_PRIORITY)
+ client->smart_priority++;
+#endif
SetCriticalOutputPending();
+ }
WriteEventsToClient(client, count, pEvents);
#ifdef DEBUG
@@ -1284,7 +1631,7 @@ DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
int attempt;
register InputClients *other;
ClientPtr client = NullClient;
- Mask deliveryMask; /* If a grab occurs due to a button press, then
+ Mask deliveryMask = 0; /* If a grab occurs due to a button press, then
this mask is the mask of the grab. */
int type = pEvents->u.u.type;
@@ -1374,6 +1721,24 @@ DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
Only works for core events.
*/
+#ifdef PANORAMIX
+static int
+XineramaTryClientEventsResult(
+ ClientPtr client,
+ GrabPtr grab,
+ Mask mask,
+ Mask filter
+){
+ if ((client) && (client != serverClient) && (!client->clientGone) &&
+ ((filter == CantBeFiltered) || (mask & filter)))
+ {
+ if (grab && !SameClient(grab, client)) return -1;
+ else return 1;
+ }
+ return 0;
+}
+#endif
+
int
MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
register WindowPtr pWin;
@@ -1384,10 +1749,16 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
{
register OtherClients *other;
+
if (pWin->eventMask & filter)
{
if (wClient(pWin) == dontClient)
return 0;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return XineramaTryClientEventsResult(
+ wClient(pWin), NullGrab, pWin->eventMask, filter);
+#endif
return TryClientEvents(wClient(pWin), pEvents, count,
pWin->eventMask, filter, NullGrab);
}
@@ -1397,6 +1768,11 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
{
if (SameClient(other, dontClient))
return 0;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return XineramaTryClientEventsResult(
+ rClient(other), NullGrab, other->mask, filter);
+#endif
return TryClientEvents(rClient(other), pEvents, count,
other->mask, filter, NullGrab);
}
@@ -1419,23 +1795,9 @@ FixUpEventFromWindow(xE, pWin, child, calcChild)
Bool calcChild;
#endif
{
-#ifdef PANORAMIX
- int j;
- int k = (pWin->drawable.pScreen)->myNum;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
-
if (calcChild)
{
WindowPtr w=spriteTrace[spriteTraceGood-1];
-#ifdef PANORAMIX
- if (!noPanoramiXExtension){
- j = (w->drawable.pScreen)->myNum;
- PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, w->drawable.id, j);
- if (pPanoramiXWin)
- w = (WindowPtr)LookupIDByType(pPanoramiXWin->info[k].id, RT_WINDOW);
- }
-#endif
/* If the search ends up past the root should the child field be
set to none or should the value in the argument be passed
through. It probably doesn't matter since everyone calls
@@ -1460,48 +1822,24 @@ FixUpEventFromWindow(xE, pWin, child, calcChild)
w = w->parent;
}
}
- xE->u.keyButtonPointer.root = ROOT->drawable.id;
-#ifdef PANORAMIX
- if (!noPanoramiXExtension){
- pPanoramiXWin=PanoramiXWinRoot;
- PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, pWin->drawable.id, k);
- if (pPanoramiXWin)
- pWin = (WindowPtr)LookupIDByType(pPanoramiXWin->info[0].id, RT_WINDOW);
- if (pWin) {
- xE->u.keyButtonPointer.event = pWin->drawable.id;
- xE->u.keyButtonPointer.eventX = xE->u.keyButtonPointer.rootX -
- pWin->drawable.x +
- panoramiXdataPtr[sprite.hot.pScreen->myNum].x;
- xE->u.keyButtonPointer.eventY = xE->u.keyButtonPointer.rootY -
- pWin->drawable.y +
- panoramiXdataPtr[sprite.hot.pScreen->myNum].y;
- }else if (pPanoramiXWin)
- xE->u.keyButtonPointer.event = pPanoramiXWin->info[0].id;
- xE->u.keyButtonPointer.sameScreen = xTrue;
- xE->u.keyButtonPointer.child = child;
- }
- else {
-#endif
- xE->u.keyButtonPointer.event = pWin->drawable.id;
- if (sprite.hot.pScreen == pWin->drawable.pScreen)
- {
- xE->u.keyButtonPointer.sameScreen = xTrue;
- xE->u.keyButtonPointer.child = child;
- xE->u.keyButtonPointer.eventX =
- xE->u.keyButtonPointer.rootX - pWin->drawable.x;
- xE->u.keyButtonPointer.eventY =
- xE->u.keyButtonPointer.rootY - pWin->drawable.y;
- }
- else
- {
- xE->u.keyButtonPointer.sameScreen = xFalse;
- xE->u.keyButtonPointer.child = None;
- xE->u.keyButtonPointer.eventX = 0;
- xE->u.keyButtonPointer.eventY = 0;
- }
-#ifdef PANORAMIX
- }
-#endif
+ XE_KBPTR.root = ROOT->drawable.id;
+ XE_KBPTR.event = pWin->drawable.id;
+ if (sprite.hot.pScreen == pWin->drawable.pScreen)
+ {
+ XE_KBPTR.sameScreen = xTrue;
+ XE_KBPTR.child = child;
+ XE_KBPTR.eventX =
+ XE_KBPTR.rootX - pWin->drawable.x;
+ XE_KBPTR.eventY =
+ XE_KBPTR.rootY - pWin->drawable.y;
+ }
+ else
+ {
+ XE_KBPTR.sameScreen = xFalse;
+ XE_KBPTR.child = None;
+ XE_KBPTR.eventX = 0;
+ XE_KBPTR.eventY = 0;
+ }
}
int
@@ -1581,6 +1919,11 @@ DeliverEvents(pWin, xE, count, otherParent)
Mask filter;
int deliveries;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return count;
+#endif
+
if (!count)
return 0;
filter = filters[xE->u.u.type];
@@ -1607,6 +1950,32 @@ DeliverEvents(pWin, xE, count, otherParent)
return deliveries;
}
+
+static Bool
+PointInBorderSize(WindowPtr pWin, int x, int y)
+{
+ BoxRec box;
+
+ if(POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderSize, x, y, &box))
+ return TRUE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && XineramaSetWindowPntrs(pWin)) {
+ int i;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ if(POINT_IN_REGION(sprite.screen,
+ &sprite.windows[i]->borderSize,
+ x + panoramiXdataPtr[0].x - panoramiXdataPtr[i].x,
+ y + panoramiXdataPtr[0].y - panoramiXdataPtr[i].y,
+ &box))
+ return TRUE;
+ }
+ }
+#endif
+ return FALSE;
+}
+
static WindowPtr
#if NeedFunctionPrototypes
XYToWindow(int x, int y)
@@ -1616,9 +1985,6 @@ XYToWindow(x, y)
#endif
{
register WindowPtr pWin;
-#ifdef SHAPE
- BoxRec box;
-#endif
spriteTraceGood = 1; /* root window still there */
pWin = ROOT->firstChild;
@@ -1636,9 +2002,7 @@ XYToWindow(x, y)
* is made to see if the point is inside
* borderSize
*/
- && (!wBoundingShape(pWin) ||
- POINT_IN_REGION(pWin->drawable.pScreen,
- &pWin->borderSize, x, y, &box))
+ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
#endif
)
{
@@ -1669,6 +2033,11 @@ CheckMotion(xE)
{
WindowPtr prevSpriteWin = sprite.win;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ return XineramaCheckMotion(xE);
+#endif
+
if (xE && !syncEvents.playingEvents)
{
if (sprite.hot.pScreen != sprite.hotPhys.pScreen)
@@ -1676,8 +2045,8 @@ CheckMotion(xE)
sprite.hot.pScreen = sprite.hotPhys.pScreen;
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
- sprite.hot.x = xE->u.keyButtonPointer.rootX;
- sprite.hot.y = xE->u.keyButtonPointer.rootY;
+ sprite.hot.x = XE_KBPTR.rootX;
+ sprite.hot.y = XE_KBPTR.rootY;
if (sprite.hot.x < sprite.physLimits.x1)
sprite.hot.x = sprite.physLimits.x1;
else if (sprite.hot.x >= sprite.physLimits.x2)
@@ -1691,13 +2060,15 @@ CheckMotion(xE)
ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
#endif
sprite.hotPhys = sprite.hot;
- if ((sprite.hotPhys.x != xE->u.keyButtonPointer.rootX) ||
- (sprite.hotPhys.y != xE->u.keyButtonPointer.rootY))
+ if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
+ (sprite.hotPhys.y != XE_KBPTR.rootY))
+ {
(*sprite.hotPhys.pScreen->SetCursorPosition)(
sprite.hotPhys.pScreen,
sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ }
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
}
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
@@ -1750,6 +2121,24 @@ DefineInitialRootWindow(win)
(*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits);
(*pScreen->SetCursorPosition) (pScreen, sprite.hot.x, sprite.hot.y, FALSE);
(*pScreen->DisplayCursor) (pScreen, sprite.current);
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ sprite.hotLimits.x1 = -panoramiXdataPtr[0].x;
+ sprite.hotLimits.y1 = -panoramiXdataPtr[0].y;
+ sprite.hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x;
+ sprite.hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y;
+ sprite.physLimits = sprite.hotLimits;
+ sprite.confineWin = NullWindow;
+#ifdef SHAPE
+ sprite.hotShape = NullRegion;
+#endif
+ sprite.screen = pScreen;
+ /* gotta UNINIT these someplace */
+ REGION_INIT(pScreen, &sprite.Reg1, NullBox, 1);
+ REGION_INIT(pScreen, &sprite.Reg2, NullBox, 1);
+ }
+#endif
}
/*
@@ -1774,10 +2163,144 @@ NewCurrentScreen(newScreen, x, y)
{
sprite.hotPhys.x = x;
sprite.hotPhys.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ sprite.hotPhys.x += panoramiXdataPtr[newScreen->myNum].x -
+ panoramiXdataPtr[0].x;
+ sprite.hotPhys.y += panoramiXdataPtr[newScreen->myNum].y -
+ panoramiXdataPtr[0].y;
+ if (newScreen != sprite.screen) {
+ sprite.screen = newScreen;
+ /* Make sure we tell the DDX to update its copy of the screen */
+ if(sprite.confineWin)
+ XineramaConfineCursorToWindow(sprite.confineWin, TRUE);
+ else
+ XineramaConfineCursorToWindow(WindowTable[0], TRUE);
+ /* if the pointer wasn't confined, the DDX won't get
+ told of the pointer warp so we reposition it here */
+ if(!syncEvents.playingEvents)
+ (*sprite.screen->SetCursorPosition)(sprite.screen,
+ sprite.hotPhys.x + panoramiXdataPtr[0].x -
+ panoramiXdataPtr[sprite.screen->myNum].x,
+ sprite.hotPhys.y + panoramiXdataPtr[0].y -
+ panoramiXdataPtr[sprite.screen->myNum].y, FALSE);
+ }
+ } else
+#endif
if (newScreen != sprite.hotPhys.pScreen)
ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE);
}
+#ifdef PANORAMIX
+
+static Bool
+XineramaPointInWindowIsVisible(
+ WindowPtr pWin,
+ int x,
+ int y
+)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ BoxRec box;
+ int i, xoff, yoff;
+
+ if (!pWin->realized) return FALSE;
+
+ if (POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box))
+ return TRUE;
+
+ if(!XineramaSetWindowPntrs(pWin)) return FALSE;
+
+ xoff = x + panoramiXdataPtr[0].x;
+ yoff = y + panoramiXdataPtr[0].y;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ pWin = sprite.windows[i];
+ pScreen = pWin->drawable.pScreen;
+ x = xoff - panoramiXdataPtr[i].x;
+ y = yoff - panoramiXdataPtr[i].y;
+
+ if(POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box))
+ return TRUE;
+
+ }
+
+ return FALSE;
+}
+
+static int
+XineramaWarpPointer(ClientPtr client)
+{
+ WindowPtr dest = NULL;
+ int x, y;
+
+ REQUEST(xWarpPointerReq);
+
+
+ if (stuff->dstWid != None)
+ {
+ dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
+ if (!dest)
+ return BadWindow;
+ }
+ x = sprite.hotPhys.x;
+ y = sprite.hotPhys.y;
+
+ if (stuff->srcWid != None)
+ {
+ int winX, winY;
+ XID winID = stuff->srcWid;
+ WindowPtr source;
+
+ source = SecurityLookupWindow(winID, client, SecurityReadAccess);
+ if (!source) return BadWindow;
+
+ winX = source->drawable.x;
+ winY = source->drawable.y;
+ if(source == WindowTable[0]) {
+ winX -= panoramiXdataPtr[0].x;
+ winY -= panoramiXdataPtr[0].y;
+ }
+ if (x < winX + stuff->srcX ||
+ y < winY + stuff->srcY ||
+ (stuff->srcWidth != 0 &&
+ winX + stuff->srcX + (int)stuff->srcWidth < x) ||
+ (stuff->srcHeight != 0 &&
+ winY + stuff->srcY + (int)stuff->srcHeight < y) ||
+ !XineramaPointInWindowIsVisible(source, x, y))
+ return Success;
+ }
+ if (dest) {
+ x = dest->drawable.x;
+ y = dest->drawable.y;
+ if(dest == WindowTable[0]) {
+ x -= panoramiXdataPtr[0].x;
+ y -= panoramiXdataPtr[0].y;
+ }
+ }
+
+ x += stuff->dstX;
+ y += stuff->dstY;
+
+ if (x < sprite.physLimits.x1)
+ x = sprite.physLimits.x1;
+ else if (x >= sprite.physLimits.x2)
+ x = sprite.physLimits.x2 - 1;
+ if (y < sprite.physLimits.y1)
+ y = sprite.physLimits.y1;
+ else if (y >= sprite.physLimits.y2)
+ y = sprite.physLimits.y2 - 1;
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &x, &y);
+
+ XineramaSetCursorPosition(x, y, TRUE);
+
+ return Success;
+}
+
+#endif
+
+
int
ProcWarpPointer(client)
ClientPtr client;
@@ -1785,16 +2308,16 @@ ProcWarpPointer(client)
WindowPtr dest = NULL;
int x, y;
ScreenPtr newScreen;
-#ifdef PANORAMIX
- int i, softx, softy;
- WindowPtr sWin = NULL;
- ScreenPtr sftScreen;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
REQUEST(xWarpPointerReq);
REQUEST_SIZE_MATCH(xWarpPointerReq);
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ return XineramaWarpPointer(client);
+#endif
+
if (stuff->dstWid != None)
{
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
@@ -1803,13 +2326,16 @@ ProcWarpPointer(client)
}
x = sprite.hotPhys.x;
y = sprite.hotPhys.y;
+
if (stuff->srcWid != None)
{
int winX, winY;
- WindowPtr source = SecurityLookupWindow(stuff->srcWid, client,
- SecurityReadAccess);
- if (!source)
- return BadWindow;
+ XID winID = stuff->srcWid;
+ WindowPtr source;
+
+ source = SecurityLookupWindow(winID, client, SecurityReadAccess);
+ if (!source) return BadWindow;
+
winX = source->drawable.x;
winY = source->drawable.y;
if (source->drawable.pScreen != sprite.hotPhys.pScreen ||
@@ -1822,55 +2348,17 @@ ProcWarpPointer(client)
!PointInWindowIsVisible(source, x, y))
return Success;
}
- if (dest)
+ if (dest)
{
x = dest->drawable.x;
y = dest->drawable.y;
newScreen = dest->drawable.pScreen;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->dstWid);
-#endif
- }
- else
+ } else
newScreen = sprite.hotPhys.pScreen;
+
x += stuff->dstX;
y += stuff->dstY;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ) {
- if (pPanoramiXWin) {
- for ( i = 0 ; i < PanoramiXNumScreens; i++) {
- sWin = SecurityLookupWindow(pPanoramiXWin->info[i].id, client,
- SecurityReadAccess);
- sftScreen = sWin->drawable.pScreen;
- softx = sftScreen->width + panoramiXdataPtr[i].x;
- softy = sftScreen->height + panoramiXdataPtr[i].y;
- /* Figure out which screen the cursor is on. The destination (x,y)
- values are coming from the client, so it believes we have a screen
- size of (sizeofScreen * NumberOfScreens )*/
- if (x < 0)
- x = 0;
- if (y < 0)
- y = 0;
- if ((x > softx) || (y > softy))
- continue;
- else
- break;
- }
- newScreen = sftScreen;
- }
- if (x < 0)
- x = 0;
- else if (x >= newScreen->width + panoramiXdataPtr[newScreen->myNum].x )
- x = newScreen->width + panoramiXdataPtr[newScreen->myNum].x - 1;
- if (y < 0)
- y = 0;
- else if (y >= newScreen->height + panoramiXdataPtr[newScreen->myNum].y )
- y = newScreen->height + panoramiXdataPtr[newScreen->myNum].y - 1;
- x -= panoramiXdataPtr[newScreen->myNum].x;
- y -= panoramiXdataPtr[newScreen->myNum].y;
- }else {
-#endif
+
if (x < 0)
x = 0;
else if (x >= newScreen->width)
@@ -1879,9 +2367,7 @@ ProcWarpPointer(client)
y = 0;
else if (y >= newScreen->height)
y = newScreen->height - 1;
-#if PANORAMIX
- }
-#endif
+
if (newScreen == sprite.hotPhys.pScreen)
{
if (x < sprite.physLimits.x1)
@@ -1892,7 +2378,7 @@ ProcWarpPointer(client)
y = sprite.physLimits.y1;
else if (y >= sprite.physLimits.y2)
y = sprite.physLimits.y2 - 1;
-#ifdef SHAPE
+#if defined(SHAPE)
if (sprite.hotShape)
ConfineToShape(sprite.hotShape, &x, &y);
#endif
@@ -1905,6 +2391,25 @@ ProcWarpPointer(client)
return Success;
}
+static Bool
+BorderSizeNotEmpty(WindowPtr pWin)
+{
+ if(REGION_NOTEMPTY(sprite.hotPhys.pScreen, &pWin->borderSize))
+ return TRUE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && XineramaSetWindowPntrs(pWin)) {
+ int i;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ if(REGION_NOTEMPTY(sprite.screen, &sprite.windows[i]->borderSize))
+ return TRUE;
+ }
+ }
+#endif
+ return FALSE;
+}
+
/* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
passive grab set on the window to be activated. */
@@ -1966,9 +2471,8 @@ CheckPassiveGrabsOnWindow(pWin, device, xE, count)
#endif
if (GrabMatchesSecond(&tempGrab, grab) &&
(!grab->confineTo ||
- (grab->confineTo->realized &&
- REGION_NOTEMPTY( grab->confineTo->drawable.pScreen,
- &grab->confineTo->borderSize))))
+ (grab->confineTo->realized &&
+ BorderSizeNotEmpty(grab->confineTo))))
{
#ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(wClient(pWin), device, FALSE))
@@ -1976,8 +2480,8 @@ CheckPassiveGrabsOnWindow(pWin, device, xE, count)
#endif
#ifdef XKB
if (!noXkbExtension) {
- xE->u.keyButtonPointer.state &= 0x1f00;
- xE->u.keyButtonPointer.state |=
+ XE_KBPTR.state &= 0x1f00;
+ XE_KBPTR.state |=
tempGrab.modifiersDetail.exact&(~0x1f00);
}
#endif
@@ -2031,11 +2535,7 @@ CheckDeviceGrabs(device, xE, checkFirst, count)
int count;
{
register int i;
-#ifdef PANORAMIX
- register int j,k;
- PanoramiXWindow *pPanoramiXWin = NULL;
-#endif
- register WindowPtr pWin;
+ register WindowPtr pWin = NULL;
register FocusClassPtr focus = device->focus;
if ((xE->u.u.type == ButtonPress
@@ -2049,24 +2549,6 @@ CheckDeviceGrabs(device, xE, checkFirst, count)
if (focus)
{
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- k = (ROOT->drawable.pScreen)->myNum;
- for (; i < focus->traceGood; i++)
- {
- pWin = focus->trace[i];
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
- if (pPanoramiXWin) {
- pWin = (WindowPtr)
- LookupIDByType(pPanoramiXWin->info[k].id, RT_WINDOW);
- }
- if ( pWin && pWin->optional &&
- CheckPassiveGrabsOnWindow(pWin, device, xE, count))
- return TRUE;
- }
- }else {
-#endif
for (; i < focus->traceGood; i++)
{
pWin = focus->trace[i];
@@ -2074,35 +2556,13 @@ CheckDeviceGrabs(device, xE, checkFirst, count)
CheckPassiveGrabsOnWindow(pWin, device, xE, count))
return TRUE;
}
-#ifdef PANORAMIX
- }
-#endif
if ((focus->win == NoneWin) ||
(i >= spriteTraceGood) ||
((i > checkFirst) && (pWin != spriteTrace[i-1])))
return FALSE;
}
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- k = (ROOT->drawable.pScreen)->myNum;;
- for (; i < spriteTraceGood; i++) {
- pWin = spriteTrace[i];
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, pWin->drawable.id, k);
- if (pPanoramiXWin) {
- for ( j= PanoramiXNumScreens - 1; j>=0; j--) {
- pWin = (WindowPtr)
- LookupIDByType(pPanoramiXWin->info[j].id, RT_WINDOW);
- if ( pWin && pWin->optional &&
- CheckPassiveGrabsOnWindow(pWin, device, xE, count))
- return TRUE;
- }
- }
- }
- return FALSE;
- }else {
-#endif
+
for (; i < spriteTraceGood; i++)
{
pWin = spriteTrace[i];
@@ -2112,9 +2572,6 @@ CheckDeviceGrabs(device, xE, checkFirst, count)
}
return FALSE;
-#ifdef PANORAMIX
- }
-#endif
}
void
@@ -2126,11 +2583,6 @@ DeliverFocusedEvent(keybd, xE, window, count)
{
WindowPtr focus = keybd->focus->win;
int mskidx = 0;
-#ifdef PANORAMIX
- register int k;
- WindowPtr orig_focus;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
if (focus == FollowKeyboardWin)
focus = inputInfo.keyboard->focus->win;
@@ -2141,27 +2593,12 @@ DeliverFocusedEvent(keybd, xE, window, count)
DeliverDeviceEvents(window, xE, NullGrab, NullWindow, keybd, count);
return;
}
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- k = (ROOT->drawable.pScreen)->myNum;
- orig_focus = focus;
- PANORAMIXFIND_ID(pPanoramiXWin, focus->drawable.id);
- if (pPanoramiXWin) {
- focus = (WindowPtr) LookupIDByType(pPanoramiXWin->info[k].id, RT_WINDOW);
- }
- }
-#endif
if ((focus == window) || IsParent(focus, window))
{
if (DeliverDeviceEvents(window, xE, NullGrab, focus, keybd, count))
return;
}
/* just deliver it to the focus window */
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- focus = orig_focus;
- }
-#endif
FixUpEventFromWindow(xE, focus, None, FALSE);
if (xE->u.u.type & EXTENSION_EVENT_BASE)
mskidx = keybd->id;
@@ -2284,10 +2721,9 @@ ProcessKeyboardEvent (xE, keybd, count)
CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
}
}
- xE->u.keyButtonPointer.state = (keyc->state |
- inputInfo.pointer->button->state);
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ XE_KBPTR.state = (keyc->state | inputInfo.pointer->button->state);
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
key = xE->u.u.detail;
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
@@ -2364,6 +2800,44 @@ ProcessKeyboardEvent (xE, keybd, count)
(*keybd->DeactivateGrab)(keybd);
}
+#ifdef XKB
+/* This function is used to set the key pressed or key released state -
+ this is only used when the pressing of keys does not cause
+ CoreProcessKeyEvent to be called, as in for example Mouse Keys.
+*/
+void
+FixKeyState (xE, keybd)
+ register xEvent *xE;
+ register DeviceIntPtr keybd;
+{
+ int key, bit;
+ register BYTE *kptr;
+ register KeyClassPtr keyc = keybd->key;
+
+ key = xE->u.u.detail;
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+#ifdef DEBUG
+ if ((xkbDebugFlags&0x4)&&
+ ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
+ ErrorF("FixKeyState: Key %d %s\n",key,
+ (xE->u.u.type==KeyPress?"down":"up"));
+ }
+#endif
+ switch (xE->u.u.type)
+ {
+ case KeyPress:
+ *kptr |= bit;
+ break;
+ case KeyRelease:
+ *kptr &= ~bit;
+ break;
+ default:
+ FatalError("Impossible keyboard event");
+ }
+}
+#endif
+
void
#ifdef XKB
CoreProcessPointerEvent (xE, mouse, count)
@@ -2383,7 +2857,7 @@ ProcessPointerEvent (xE, mouse, count)
if (!syncEvents.playingEvents)
NoticeTime(xE)
- xE->u.keyButtonPointer.state = (butc->state | (
+ XE_KBPTR.state = (butc->state | (
#ifdef XKB
(noXkbExtension ?
inputInfo.keyboard->key->state :
@@ -2399,7 +2873,7 @@ ProcessPointerEvent (xE, mouse, count)
DeviceEventInfoRec eventinfo;
/* see comment in EnqueueEvents regarding the next three lines */
if (xE->u.u.type == MotionNotify)
- xE->u.keyButtonPointer.root =
+ XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id;
eventinfo.events = xE;
eventinfo.count = count;
@@ -2411,53 +2885,10 @@ ProcessPointerEvent (xE, mouse, count)
register int key;
register BYTE *kptr;
int bit;
-#ifdef PANORAMIX
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- int x_off = 0, y_off = 0;
-#endif
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ) {
- for (j = PanoramiXNumScreens - 1; j; j--) {
- if (xE->u.keyButtonPointer.root == PanoramiXWinRoot->info[j].id)
- break;
- }
- if (j) {
- xE->u.keyButtonPointer.root = PanoramiXWinRoot->info[0].id;
- xE->u.keyButtonPointer.sameScreen = xTrue;
- }
-
- PANORAMIXFIND_ID(pPanoramiXWin, xE->u.keyButtonPointer.event);
- if (pPanoramiXWin) {
- for (j = PanoramiXNumScreens - 1; j; j--) {
- if (pPanoramiXWin->info[j].id == xE->u.keyButtonPointer.event)
- break;
- }
- }
- if (j && pPanoramiXWin) {
- xE->u.keyButtonPointer.event = pPanoramiXWin->info[0].id;
- }
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, xE->u.keyButtonPointer.child);
- if (pPanoramiXWin) {
- for (j = PanoramiXNumScreens - 1; j; j--) {
- if (pPanoramiXWin->info[j].id == xE->u.keyButtonPointer.child)
- break;
- }
- }
- if (j && pPanoramiXWin)
- xE->u.keyButtonPointer.child = pPanoramiXWin->info[0].id;
-
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
- }else {
-#endif
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
-#ifdef PANORAMIX
- }
-#endif
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
+
key = xE->u.u.detail;
kptr = &butc->down[key >> 3];
bit = 1 << (key & 7);
@@ -2465,7 +2896,8 @@ ProcessPointerEvent (xE, mouse, count)
{
case ButtonPress:
mouse->valuator->motionHintWindow = NullWindow;
- butc->buttonsDown++;
+ if (!(*kptr & bit))
+ butc->buttonsDown++;
butc->motionMask = ButtonMotionMask;
*kptr |= bit;
#if !defined(XFree86Server) || !defined(XINPUT)
@@ -2482,7 +2914,9 @@ ProcessPointerEvent (xE, mouse, count)
break;
case ButtonRelease:
mouse->valuator->motionHintWindow = NullWindow;
- if (!--butc->buttonsDown)
+ if (*kptr & bit)
+ --butc->buttonsDown;
+ if (!butc->buttonsDown)
butc->motionMask = 0;
*kptr &= ~bit;
#if !defined(XFree86Server) || !defined(XINPUT)
@@ -3036,16 +3470,11 @@ DoFocusEvents(dev, fromWin, toWin, mode)
/* Notify all the roots */
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
- FocusEvent(dev, FocusOut, mode, out,
- WindowTable[sprite.hotPhys.pScreen->myNum]);
- else {
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[0]);
+ else
+#endif
for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
- }
-#else
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
-#endif
}
else
{
@@ -3060,16 +3489,11 @@ DoFocusEvents(dev, fromWin, toWin, mode)
/* Notify all the roots */
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
- FocusEvent(dev, FocusIn, mode, in,
- WindowTable[sprite.hotPhys.pScreen->myNum]);
- else {
+ FocusEvent(dev, FocusIn, mode, in, WindowTable[0]);
+ else
+#endif
for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
- }
-#else
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
-#endif
if (toWin == PointerRootWin)
(void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode,
NotifyPointer, TRUE);
@@ -3083,16 +3507,11 @@ DoFocusEvents(dev, fromWin, toWin, mode)
TRUE);
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
- FocusEvent(dev, FocusOut, mode, out,
- WindowTable[sprite.hotPhys.pScreen->myNum]);
- else {
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[0]);
+ else
+#endif
for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
- }
-#else
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
-#endif
if (toWin->parent != NullWindow)
(void)FocusInEvents(dev, ROOT, toWin, toWin, mode,
NotifyNonlinearVirtual, TRUE);
@@ -3242,24 +3661,6 @@ SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
return Success;
}
-#ifdef PANORAMIX
-int PanoramiXSetInputFocus(ClientPtr client)
-{
- REQUEST(xSetInputFocusReq);
- int j, result;
- Window winID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- REQUEST_SIZE_MATCH(xSetInputFocusReq);
- j = (sprite.hotPhys.pScreen)->myNum;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->focus);
- winID = pPanoramiXWin ? pPanoramiXWin->info[j].id : stuff->focus;
- result = SetInputFocus(client, inputInfo.keyboard, winID, stuff->revertTo,
- stuff->time, FALSE);
- return(result);
-}
-#endif
-
int
ProcSetInputFocus(client)
ClientPtr client;
@@ -3267,10 +3668,6 @@ ProcSetInputFocus(client)
REQUEST(xSetInputFocusReq);
REQUEST_SIZE_MATCH(xSetInputFocusReq);
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return PanoramiXSetInputFocus(client);
-#endif
#ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
return Success;
@@ -3279,49 +3676,15 @@ ProcSetInputFocus(client)
stuff->revertTo, stuff->time, FALSE);
}
-#ifdef PANORAMIX
-int PanoramiXGetInputFocus(ClientPtr client)
-{
- xGetInputFocusReply rep;
- REQUEST(xReq);
- int j;
- FocusClassPtr focus = inputInfo.keyboard->focus;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- REQUEST_SIZE_MATCH(xReq);
- j = (sprite.hotPhys.pScreen)->myNum;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- if (focus->win == NoneWin)
- rep.focus = None;
- else if (focus->win == PointerRootWin)
- rep.focus = PointerRoot;
- else{
- rep.focus = focus->win->drawable.id;
- PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, focus->win->drawable.id, j);
- if (pPanoramiXWin)
- rep.focus = pPanoramiXWin->info[0].id;
- }
- rep.revertTo = focus->revert;
- WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep);
- return Success;
-}
-#endif
-
int
ProcGetInputFocus(client)
ClientPtr client;
{
xGetInputFocusReply rep;
- REQUEST(xReq);
+ /* REQUEST(xReq); */
FocusClassPtr focus = inputInfo.keyboard->focus;
REQUEST_SIZE_MATCH(xReq);
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return PanoramiXGetInputFocus(client);
-#endif
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@@ -3346,20 +3709,9 @@ ProcGrabPointer(client)
CursorPtr cursor, oldCursor;
REQUEST(xGrabPointerReq);
TimeStamp time;
-#ifdef PANORAMIX
- int j,i, PanoramiXNum;
- Bool NotViewable, NotRealized;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
REQUEST_SIZE_MATCH(xGrabPointerReq);
UpdateCurrentTime();
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ) {
- PanoramiXNum = (sprite.hotPhys.pScreen)->myNum;
- NotViewable = FALSE;
- }
-#endif
if ((stuff->pointerMode != GrabModeSync) &&
(stuff->pointerMode != GrabModeAsync))
{
@@ -3385,45 +3737,10 @@ ProcGrabPointer(client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
- if (pPanoramiXWin) {
- pWin = SecurityLookupWindow(pPanoramiXWin->info[PanoramiXNum].id, client,
- SecurityReadAccess);
- if (!pWin)
- return BadWindow;
- }
- if (stuff->confineTo == PanoramiXWinRoot->info[0].id)
- stuff->confineTo = None;
- }
-#endif
if (stuff->confineTo == None)
confineTo = NullWindow;
-#ifdef PANORAMIX
- else if ( !noPanoramiXExtension ) {
- if (stuff->confineTo) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->confineTo);
- if (pPanoramiXWin) {
- stuff->confineTo = pPanoramiXWin->info[sprite.hotPhys.pScreen->
-myNum].id;
- confineTo = SecurityLookupWindow(stuff->confineTo, client,
- SecurityReadAccess);
- if (!confineTo)
- return BadWindow;
- }
- if ((confineTo && !(confineTo->realized &&
- REGION_NOTEMPTY(confineTo->drawable.pScreen, &confineTo->
-borderSize))))
- NotViewable = TRUE;
- }
- } else {
-#else
else
{
-#endif
confineTo = SecurityLookupWindow(stuff->confineTo, client,
SecurityReadAccess);
if (!confineTo)
@@ -3449,22 +3766,9 @@ borderSize))))
grab = device->grab;
if ((grab) && !SameClient(grab, client))
rep.status = AlreadyGrabbed;
-#ifdef PANORAMIX
- else if ((!noPanoramiXExtension ) &&
- (!(pWin->realized) || NotViewable))
- rep.status = GrabNotViewable;
- else if ((noPanoramiXExtension) && (!pWin->realized) ||
- (confineTo &&
- !(confineTo->realized &&
- REGION_NOTEMPTY( confineTo->drawable.pScreen,
- &confineTo->borderSize))))
-#else
else if ((!pWin->realized) ||
(confineTo &&
- !(confineTo->realized &&
- REGION_NOTEMPTY( confineTo->drawable.pScreen,
- &confineTo->borderSize))))
-#endif
+ !(confineTo->realized && BorderSizeNotEmpty(confineTo))))
rep.status = GrabNotViewable;
else if (device->sync.frozen &&
device->sync.other && !SameClient(device->sync.other, client))
@@ -3640,11 +3944,6 @@ ProcGrabKeyboard(client)
xGrabKeyboardReply rep;
REQUEST(xGrabKeyboardReq);
int result;
-#ifdef PANORAMIX
- int PanoramiXNum;
- Window winID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
#ifdef XCSECURITY
@@ -3655,14 +3954,6 @@ ProcGrabKeyboard(client)
}
else
#endif
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- PanoramiXNum = (sprite.hotPhys.pScreen)->myNum;
- winID = stuff->grabWindow;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
- stuff->grabWindow = pPanoramiXWin ? pPanoramiXWin->info[PanoramiXNum].id : winID;
- }
-#endif
result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode,
stuff->pointerMode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
@@ -3704,66 +3995,21 @@ ProcQueryPointer(client)
WindowPtr pWin, t;
REQUEST(xResourceReq);
DeviceIntPtr mouse = inputInfo.pointer;
-#ifdef PANORAMIX
- int PanoramiXNum;
- Window winID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
REQUEST_SIZE_MATCH(xResourceReq);
pWin = SecurityLookupWindow(stuff->id, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ){
- t = sprite.win;
- PanoramiXNum = (sprite.hotPhys.pScreen)->myNum;
- if (t == pWin) {
- /* we probably want pWin of some Fake Window */
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- winID = pPanoramiXWin ? pPanoramiXWin->info[PanoramiXNum].id : stuff->id;
- pWin = SecurityLookupWindow(winID, client, SecurityReadAccess);
- }
- }
-#endif
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.mask = mouse->button->state | inputInfo.keyboard->key->state;
rep.length = 0;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ){
- rep.root = PanoramiXWinRoot->info[0].id;
- rep.rootX = sprite.hot.x + panoramiXdataPtr[PanoramiXNum].x;
- rep.rootY = sprite.hot.y + panoramiXdataPtr[PanoramiXNum].y;
- } else {
-#endif
- rep.root = (ROOT)->drawable.id;
- rep.rootX = sprite.hot.x;
- rep.rootY = sprite.hot.y;
-#ifdef PANORAMIX
- }
-#endif
+ rep.root = (ROOT)->drawable.id;
+ rep.rootX = sprite.hot.x;
+ rep.rootY = sprite.hot.y;
rep.child = None;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ){
- rep.sameScreen = xTrue;
- rep.winX = sprite.hot.x - pWin->drawable.x + panoramiXdataPtr[PanoramiXNum].x;
- rep.winY = sprite.hot.y - pWin->drawable.y + panoramiXdataPtr[PanoramiXNum].y;
- for (; pPanoramiXWin &&
- ((unsigned long)LookupIDByType(pPanoramiXWin->info[PanoramiXNum].id,
- RT_WINDOW) != (unsigned long) t); pPanoramiXWin = pPanoramiXWin->next);
- if (pPanoramiXWin)
- t = (WindowPtr)LookupIDByType(pPanoramiXWin->info[0].id, RT_WINDOW);
- for (; t; t = t->parent) {
- if (t->parent == pWin) {
- rep.child = t->drawable.id;
- break;
- }
- }
- } else {
-#endif
if (sprite.hot.pScreen == pWin->drawable.pScreen)
{
rep.sameScreen = xTrue;
@@ -3782,7 +4028,15 @@ ProcQueryPointer(client)
rep.winX = 0;
rep.winY = 0;
}
+
#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ rep.rootX += panoramiXdataPtr[0].x;
+ rep.rootY += panoramiXdataPtr[0].y;
+ if(stuff->id == rep.root) {
+ rep.winX += panoramiXdataPtr[0].x;
+ rep.winY += panoramiXdataPtr[0].y;
+ }
}
#endif
@@ -3841,6 +4095,14 @@ InitEvents()
}
}
+void
+CloseDownEvents(void)
+{
+ xfree(spriteTrace);
+ spriteTrace = NULL;
+ spriteTraceSize = 0;
+}
+
int
ProcSendEvent(client)
ClientPtr client;
@@ -3912,9 +4174,6 @@ ProcSendEvent(client)
stuff->event.u.u.type |= 0x80;
if (stuff->propagate)
{
-#ifdef PANORAMIX
- if (noPanoramiXExtension){
-#endif
for (;pWin; pWin = pWin->parent)
{
if (DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask,
@@ -3926,14 +4185,8 @@ ProcSendEvent(client)
if (!stuff->eventMask)
break;
}
-#ifdef PANORAMIX
- }
-#endif
}
else
-#ifdef PANORAMIX
- if (noPanoramiXExtension)
-#endif
(void)DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask,
NullGrab, 0);
return Success;
@@ -3947,13 +4200,6 @@ ProcUngrabKey(client)
WindowPtr pWin;
GrabRec tempGrab;
DeviceIntPtr keybd = inputInfo.keyboard;
-#ifdef PANORAMIX
- int i;
- Bool result, anyTrue;
- Window GrabWinID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register GrabPtr grab;
-#endif
REQUEST_SIZE_MATCH(xUngrabKeyReq);
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
@@ -3983,31 +4229,9 @@ ProcUngrabKey(client)
tempGrab.detail.exact = stuff->key;
tempGrab.detail.pMask = NULL;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ){
- anyTrue = FALSE;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, i) {
- GrabWinID = pPanoramiXWin ?
- pPanoramiXWin->info[i].id : stuff->grabWindow;
- pWin = SecurityLookupWindow(GrabWinID, client, SecurityReadAccess);
- tempGrab.window = pWin;
- result = DeletePassiveGrabFromList(&tempGrab);
- if (result == TRUE)
- anyTrue = result;
- }
- if (anyTrue)
- return(Success);
- else
- return(BadAlloc);
- }else {
-#endif
if (!DeletePassiveGrabFromList(&tempGrab))
return(BadAlloc);
return(Success);
-#ifdef PANORAMIX
- }
-#endif
}
int
@@ -4018,11 +4242,6 @@ ProcGrabKey(client)
REQUEST(xGrabKeyReq);
GrabPtr grab;
DeviceIntPtr keybd = inputInfo.keyboard;
-#ifdef PANORAMIX
- int i, result, anySuccess;
- Window GrabWinID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
REQUEST_SIZE_MATCH(xGrabKeyReq);
if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse))
@@ -4058,40 +4277,15 @@ ProcGrabKey(client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ){
- anySuccess = BadAccess;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, i) {
- GrabWinID = pPanoramiXWin ?
- pPanoramiXWin->info[i].id : stuff->grabWindow;
- pWin = SecurityLookupWindow(GrabWinID, client, SecurityReadAccess);
- grab = CreateGrab(client->index, keybd, pWin,
- (Mask)(KeyPressMask | KeyReleaseMask),
- (Bool)stuff->ownerEvents,
- (Bool)stuff->keyboardMode,
- (Bool)stuff->pointerMode,
- keybd, stuff->modifiers, KeyPress,
- stuff->key, NullWindow, NullCursor);
- if (!grab)
- return BadAlloc;
- result = AddPassiveGrabToList(grab);
- if (result == Success)
- anySuccess = result;
- }
- return (anySuccess);
- }else {
-#endif
+
grab = CreateGrab(client->index, keybd, pWin,
(Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents,
(Bool)stuff->keyboardMode, (Bool)stuff->pointerMode,
- keybd, stuff->modifiers, KeyPress, stuff->key, NullWindow, NullCursor);
+ keybd, stuff->modifiers, KeyPress, stuff->key,
+ NullWindow, NullCursor);
if (!grab)
return BadAlloc;
return AddPassiveGrabToList(grab);
-#ifdef PANORAMIX
- }
-#endif
}
@@ -4103,19 +4297,8 @@ ProcGrabButton(client)
REQUEST(xGrabButtonReq);
CursorPtr cursor;
GrabPtr grab;
-#ifdef PANORAMIX
- int i, result, anySuccess;
- Bool NotViewable, NotRealized;
- Window GrabWinID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-#endif
REQUEST_SIZE_MATCH(xGrabButtonReq);
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ) {
- NotViewable = FALSE;
- }
-#endif
if ((stuff->pointerMode != GrabModeSync) &&
(stuff->pointerMode != GrabModeAsync))
{
@@ -4147,44 +4330,9 @@ ProcGrabButton(client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension ){
- if (stuff->confineTo == PanoramiXWinRoot->info[0].id)
- stuff->confineTo = None;
- }
-#endif
if (stuff->confineTo == None)
confineTo = NullWindow;
-#ifdef PANORAMIX
- else if ( !noPanoramiXExtension ) {
- if (stuff->confineTo) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->confineTo);
- if (pPanoramiXWin) {
- for ( i = PanoramiXNumScreens - 1; i >=0 ; i--) {
- stuff->confineTo = pPanoramiXWin->info[i].id;
- confineTo = SecurityLookupWindow(stuff->confineTo, client,
- SecurityReadAccess);
- if (!confineTo)
- return BadWindow;
- /* find where confined windows top-left corner lies
- and based on its coordinates choose the window
- which is truly seen. Then check realized/empty
- and pass this window to activate grab. */
- if ((confineTo->drawable.x >= 0) &&
- (confineTo->drawable.x <= panoramiXdataPtr[i].x))
- break;
- }
- } else
- confineTo = SecurityLookupWindow(stuff->confineTo, client,
- SecurityReadAccess);
- if (!confineTo)
- return BadWindow;
- }
- } else {
-#else
else {
-#endif
confineTo = SecurityLookupWindow(stuff->confineTo, client,
SecurityReadAccess);
if (!confineTo)
@@ -4203,45 +4351,17 @@ ProcGrabButton(client)
}
}
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- anySuccess = BadAccess;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, i) {
- GrabWinID = pPanoramiXWin ?
- pPanoramiXWin->info[i].id : stuff->grabWindow;
- pWin = SecurityLookupWindow(GrabWinID, client, SecurityReadAccess);
- grab = CreateGrab(client->index, inputInfo.pointer, pWin,
- permitOldBugs ? (Mask)(stuff->eventMask |
- ButtonPressMask | ButtonReleaseMask) :
- (Mask)stuff->eventMask,
- (Bool)stuff->ownerEvents,
- (Bool) stuff->keyboardMode,
- (Bool)stuff->pointerMode,
- inputInfo.keyboard, stuff->modifiers,
- ButtonPress, stuff->button, confineTo, cursor);
- if (!grab)
- return BadAlloc;
- result = AddPassiveGrabToList(grab);
- if (result == Success)
- anySuccess = result;
- }
- return (anySuccess);
- }else {
-#endif
- grab = CreateGrab(client->index, inputInfo.pointer, pWin,
- permitOldBugs ? (Mask)(stuff->eventMask |
+
+ grab = CreateGrab(client->index, inputInfo.pointer, pWin,
+ permitOldBugs ? (Mask)(stuff->eventMask |
ButtonPressMask | ButtonReleaseMask) :
(Mask)stuff->eventMask,
(Bool)stuff->ownerEvents, (Bool) stuff->keyboardMode,
(Bool)stuff->pointerMode, inputInfo.keyboard, stuff->modifiers,
ButtonPress, stuff->button, confineTo, cursor);
- if (!grab)
+ if (!grab)
return BadAlloc;
- return AddPassiveGrabToList(grab);
-#ifdef PANORAMIX
- }
-#endif
+ return AddPassiveGrabToList(grab);
}
int
@@ -4251,13 +4371,6 @@ ProcUngrabButton(client)
REQUEST(xUngrabButtonReq);
WindowPtr pWin;
GrabRec tempGrab;
-#ifdef PANORAMIX
- int i;
- Bool result, anyTrue;
- Window GrabWinID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register GrabPtr grab;
-#endif
REQUEST_SIZE_MATCH(xUngrabButtonReq);
if ((stuff->modifiers != AnyModifier) &&
@@ -4279,31 +4392,9 @@ ProcUngrabButton(client)
tempGrab.detail.exact = stuff->button;
tempGrab.detail.pMask = NULL;
-#ifdef PANORAMIX
- anyTrue = FALSE;
- if ( !noPanoramiXExtension ){
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, i) {
- GrabWinID = pPanoramiXWin ?
- pPanoramiXWin->info[i].id : stuff->grabWindow;
- pWin = SecurityLookupWindow(GrabWinID, client, SecurityReadAccess);
- tempGrab.window = pWin;
- result = DeletePassiveGrabFromList(&tempGrab);
- if (result == TRUE)
- anyTrue = result;
- }
- if (anyTrue)
- return (Success);
- else
- return (BadAlloc);
- }else {
-#endif
- if (!DeletePassiveGrabFromList(&tempGrab))
+ if (!DeletePassiveGrabFromList(&tempGrab))
return(BadAlloc);
- return(Success);
-#ifdef PANORAMIX
- }
-#endif
+ return(Success);
}
void
@@ -4406,10 +4497,13 @@ CheckCursorConfinement(pWin)
GrabPtr grab = inputInfo.pointer->grab;
WindowPtr confineTo;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return;
+#endif
+
if (grab && (confineTo = grab->confineTo))
{
- if (!REGION_NOTEMPTY( confineTo->drawable.pScreen,
- &confineTo->borderSize))
+ if (!BorderSizeNotEmpty(confineTo))
(*inputInfo.pointer->DeactivateGrab)(inputInfo.pointer);
else if ((pWin == confineTo) || IsParent(pWin, confineTo))
ConfineCursorToWindow(confineTo, TRUE, TRUE);
@@ -4440,6 +4534,7 @@ ProcRecolorCursor(client)
CursorPtr pCursor;
int nscr;
ScreenPtr pscr;
+ Bool displayed;
REQUEST(xRecolorCursorReq);
REQUEST_SIZE_MATCH(xRecolorCursorReq);
@@ -4462,9 +4557,14 @@ ProcRecolorCursor(client)
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
{
pscr = screenInfo.screens[nscr];
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ displayed = (pscr == sprite.screen);
+ else
+#endif
+ displayed = (pscr == sprite.hotPhys.pScreen);
( *pscr->RecolorCursor)(pscr, pCursor,
- (pCursor == sprite.current) &&
- (pscr == sprite.hotPhys.pScreen));
+ (pCursor == sprite.current) && displayed);
}
return (Success);
}
@@ -4475,172 +4575,51 @@ WriteEventsToClient(pClient, count, events)
int count;
xEvent *events;
{
- xEvent eventTo, *eventFrom;
- int i;
#ifdef PANORAMIX
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- int x_off = 0, y_off = 0;
- int j,NewId,OrigId;
-#endif
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- switch (events->u.u.type) {
- case ButtonPress : case ButtonRelease :
- case MotionNotify : case KeyPress :
- FORCE_ROOT(events->u.keyButtonPointer, j);
- events->u.keyButtonPointer.sameScreen = xTrue;
- for (i = 0; i < count; i++) {
- FORCE_WIN(events[i].u.keyButtonPointer.event, j);
- if (events[i].u.keyButtonPointer.child) {
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events[i].u.keyButtonPointer.child, j);
- }
- }
- break;
- case EnterNotify : case LeaveNotify :
- FORCE_ROOT(events->u.enterLeave, j);
- for (i = 0; i < count; i++) {
- FORCE_WIN(events[i].u.enterLeave.event, j);
- if (events[i].u.enterLeave.child) {
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events[i].u.enterLeave.child, j);
- }
- }
- break;
- case Expose :
- /* Need to do this count time, ensure no fake
- window ideas are send to client */
- for (i = 0; i < count; i++)
- FORCE_WIN(events[i].u.expose.window, j);
- break;
- case FocusOut :
- FORCE_WIN(events->u.focus.window, j);
- break;
- case FocusIn :
- FORCE_WIN(events->u.focus.window, j);
- break;
- case VisibilityNotify :
- FORCE_WIN(events->u.visibility.window, j);
- break;
- case GraphicsExpose :
- FORCE_WIN(events->u.graphicsExposure.drawable, j);
- break;
- case NoExpose :
- SKIP_FAKE_WINDOW(events->u.noExposure.drawable, j);
- break;
- case CreateNotify :
- FORCE_WIN(events->u.createNotify.parent, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.createNotify.window, j);
- break;
- case ColormapNotify :
- FORCE_WIN(events->u.colormap.window, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.colormap.colormap, j);
- break;
- case MapNotify :
- SKIP_FAKE_WINDOW(events->u.mapNotify.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.mapNotify.window, j);
- break;
- case UnmapNotify :
- SKIP_FAKE_WINDOW(events->u.unmapNotify.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.unmapNotify.window, j);
- break;
- case DestroyNotify :
- SKIP_FAKE_WINDOW(events->u.destroyNotify.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.destroyNotify.window, j);
- break;
- case GravityNotify :
- FORCE_WIN(events->u.gravity.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.gravity.window, j);
- break;
- case MapRequest :
- SKIP_FAKE_WINDOW(events->u.mapRequest.parent, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.mapRequest.window, j);
- break;
- case ConfigureNotify :
- FORCE_WIN(events->u.configureNotify.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.configureNotify.window, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.configureNotify.aboveSibling, j);
- break;
- case ConfigureRequest :
- SKIP_FAKE_WINDOW(events->u.configureRequest.parent, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.configureRequest.window, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.configureRequest.sibling, j);
- break;
- case ResizeRequest :
- FORCE_WIN(events->u.resizeRequest.window, j);
- break;
- case CirculateNotify : case CirculateRequest :
- case ReparentNotify :
- FORCE_WIN(events->u.circulate.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.circulate.window, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.circulate.parent, j);
- break;
- case PropertyNotify :
- SKIP_FAKE_WINDOW(events->u.property.window, j);
- break;
- case ClientMessage :
- SKIP_FAKE_WINDOW(events->u.clientMessage.window, j);
- break;
- default :
- switch (events->u.u.type & ~0x80) {
- case VisibilityNotify :
- FORCE_WIN(events->u.visibility.window, j);
- break;
- case MapNotify :
- SKIP_FAKE_WINDOW(events->u.mapNotify.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.mapNotify.window, j);
- break;
- case UnmapNotify :
- SKIP_FAKE_WINDOW(events->u.unmapNotify.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.unmapNotify.window, j);
- case MapRequest :
- SKIP_FAKE_WINDOW(events->u.mapRequest.parent, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.mapRequest.window, j);
- break;
- case ConfigureNotify :
- FORCE_WIN(events->u.configureNotify.event, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.configureNotify.window, j);
- pPanoramiXWin = PanoramiXWinRoot;
- FORCE_WIN(events->u.configureNotify.aboveSibling, j);
- break;
- case ConfigureRequest :
- SKIP_FAKE_WINDOW(events->u.configureRequest.parent, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.configureRequest.window, j);
- pPanoramiXWin = PanoramiXWinRoot;
- SKIP_FAKE_WINDOW(events->u.configureRequest.sibling, j);
- break;
- default :
- break;
- } /* default case */
- break;
- } /* case */
- }
+ xEvent eventCopy;
#endif
+ xEvent eventTo, *eventFrom;
+ int i;
#ifdef XKB
if ((!noXkbExtension)&&(!XkbFilterEvents(pClient, count, events)))
return;
#endif
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension &&
+ (panoramiXdataPtr[0].x || panoramiXdataPtr[0].y))
+ {
+ switch(events->u.u.type) {
+ case MotionNotify:
+ case ButtonPress:
+ case ButtonRelease:
+ case KeyPress:
+ case KeyRelease:
+ case EnterNotify:
+ case LeaveNotify:
+ /*
+ When multiple clients want the same event DeliverEventsToWindow
+ passes the same event structure multiple times so we can't
+ modify the one passed to us
+ */
+ count = 1; /* should always be 1 */
+ memcpy(&eventCopy, events, sizeof(xEvent));
+ eventCopy.u.keyButtonPointer.rootX += panoramiXdataPtr[0].x;
+ eventCopy.u.keyButtonPointer.rootY += panoramiXdataPtr[0].y;
+ if(eventCopy.u.keyButtonPointer.event ==
+ eventCopy.u.keyButtonPointer.root)
+ {
+ eventCopy.u.keyButtonPointer.eventX += panoramiXdataPtr[0].x;
+ eventCopy.u.keyButtonPointer.eventY += panoramiXdataPtr[0].y;
+ }
+ events = &eventCopy;
+ break;
+ default: break;
+ }
+ }
+#endif
+
if (EventCallback)
{
EventInfoRec eventinfo;
diff --git a/xc/programs/Xserver/dix/globals.c b/xc/programs/Xserver/dix/globals.c
index 3051ebbbb..413963f06 100644
--- a/xc/programs/Xserver/dix/globals.c
+++ b/xc/programs/Xserver/dix/globals.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/dix/globals.c,v 1.10 2002/10/08 23:55:18 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/dix/globals.c,v 1.11 2003/07/04 16:24:24 eich Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -79,6 +79,7 @@ PtrCtrl defaultPointerControl = {
ClientPtr *clients;
ClientPtr serverClient;
int currentMaxClients; /* current size of clients array */
+long maxBigRequestSize = MAX_BIG_REQUEST_SIZE;
WindowPtr *WindowTable;
diff --git a/xc/programs/Xserver/dix/property.c b/xc/programs/Xserver/dix/property.c
index 9dbe5bc89..1af6156b5 100644
--- a/xc/programs/Xserver/dix/property.c
+++ b/xc/programs/Xserver/dix/property.c
@@ -1,9 +1,13 @@
-/* $XFree86: xc/programs/Xserver/dix/property.c,v 3.7 1999/01/13 08:30:54 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/dix/property.c,v 3.13 2003/07/16 01:38:37 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
-All Rights Reserved.
+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.
@@ -41,7 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
-/* $TOG: property.c /main/42 1998/02/09 14:20:24 kaleb $ */
+/* $Xorg: property.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#include "X.h"
#define NEED_REPLIES
@@ -56,16 +60,19 @@ SOFTWARE.
#define _SECURITY_SERVER
#include "security.h"
#endif
+#ifdef LBX
+#include "lbxserve.h"
+#include "lbxtags.h"
+#endif
#if defined(LBX) || defined(LBX_COMPAT)
-int fWriteToClient(client, len, buf)
- ClientPtr client;
- int len;
- char *buf;
+#if 0 /* no header in X11 environment, not used in X11 environment */
+int fWriteToClient(ClientPtr client, int len, char *buf)
{
return WriteToClient(client, len, buf);
}
#endif
+#endif
/*****************************************************************
* Property Stuff
@@ -462,11 +469,11 @@ DeleteAllWindowProperties(pWin)
}
static int
-NullPropertyReply(client, propertyType, format, reply)
- ClientPtr client;
- ATOM propertyType;
- int format;
- xGetPropertyReply *reply;
+NullPropertyReply(
+ ClientPtr client,
+ ATOM propertyType,
+ int format,
+ xGetPropertyReply *reply)
{
reply->nItems = 0;
reply->length = 0;
@@ -647,7 +654,7 @@ int
ProcListProperties(client)
ClientPtr client;
{
- Atom *pAtoms, *temppAtoms;
+ Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
int numProps = 0;
WindowPtr pWin;
diff --git a/xc/programs/Xserver/dix/window.c b/xc/programs/Xserver/dix/window.c
index d1a681b98..30c0df032 100644
--- a/xc/programs/Xserver/dix/window.c
+++ b/xc/programs/Xserver/dix/window.c
@@ -100,9 +100,6 @@ SOFTWARE.
#include "security.h"
#endif
-extern Bool permitOldBugs;
-extern Bool blackRoot;
-
#if defined(NEED_SCREEN_REGIONS)
#define REGION_PTR(pScreen,pWin) \
register ScreenPtr pScreen = pWin->drawable.pScreen;
diff --git a/xc/programs/Xserver/fb/fb.h b/xc/programs/Xserver/fb/fb.h
index 5c1fd311b..801939e92 100644
--- a/xc/programs/Xserver/fb/fb.h
+++ b/xc/programs/Xserver/fb/fb.h
@@ -1,5 +1,5 @@
/*
- * $Id: fb.h,v 1.1 2000/01/06 12:56:51 faith Exp $
+ * $XFree86: xc/programs/Xserver/fb/fb.h,v 1.36 2003/06/12 14:12:29 eich Exp $
*
* Copyright © 1998 Keith Packard
*
@@ -21,7 +21,6 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/fb/fb.h,v 1.3 1999/12/30 02:33:58 robin Exp $ */
#ifndef _FB_H_
#define _FB_H_
@@ -39,16 +38,25 @@
#include "mi.h"
#include "migc.h"
#include "mibstore.h"
+#ifdef RENDER
+#include "picturestr.h"
+#else
+#include "picture.h"
+#endif
/*
* This single define controls the basic size of data manipulated
* by this software; it must be log2(sizeof (FbBits) * 8)
*/
-#ifdef VXWORKS
-#define FB_SHIFT 5
-#else
-#define FB_SHIFT 6
+
+#ifndef FB_SHIFT
+#define FB_SHIFT LOG2_BITMAP_PAD
#endif
+
+#if FB_SHIFT < LOG2_BITMAP_PAD
+ error FB_SHIFT must be >= LOG2_BITMAP_PAD
+#endif
+
#define FB_UNIT (1 << FB_SHIFT)
#define FB_HALFUNIT (1 << (FB_SHIFT-1))
#define FB_MASK (FB_UNIT - 1)
@@ -65,13 +73,24 @@
#define FB_24BIT
#endif
+/*
+ * Unless otherwise instructed, fb includes code to advertise 24bpp
+ * windows with 32bpp image format for application compatibility
+ */
+
+#ifdef FB_24BIT
+#ifndef FBNO24_32
+#define FB_24_32BIT
+#endif
+#endif
+
#define FB_STIP_SHIFT LOG2_BITMAP_PAD
#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
#define FB_STIP_MASK (FB_STIP_UNIT - 1)
#define FB_STIP_ALLONES ((FbStip) -1)
#define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0)
-#define FB_STIP_ODDPTR(p) ((((int) (p)) & (FB_MASK >> 3)) != 0)
+#define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0)
#define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT)))
#define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT)))
@@ -79,16 +98,37 @@
#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1))
#if FB_SHIFT == 6
-#ifdef WIN32
+# ifdef WIN32
typedef unsigned __int64 FbBits;
-#else
+# else
+# if defined(__alpha__) || defined(__alpha) || \
+ defined(ia64) || defined(__ia64__) || \
+ defined(__sparc64__) || \
+ defined(__s390x__) || \
+ defined(AMD64) || defined (__AMD64__)
+typedef unsigned long FbBits;
+# else
typedef unsigned long long FbBits;
+# endif
+# endif
#endif
-#endif
+
#if FB_SHIFT == 5
-typedef unsigned long FbBits;
+typedef CARD32 FbBits;
+#endif
+
+#if FB_SHIFT == 4
+typedef CARD16 FbBits;
#endif
-typedef unsigned long FbStip;
+
+#if LOG2_BITMAP_PAD == FB_SHIFT
+typedef FbBits FbStip;
+#else
+# if LOG2_BITMAP_PAD == 5
+typedef CARD32 FbStip;
+# endif
+#endif
+
typedef int FbStride;
@@ -111,27 +151,17 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
/* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */
#define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1))
#define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n)))
+#define FbPatternOffsetBits 0
#else
#define FbScrLeft(x,n) ((x) << (n))
#define FbScrRight(x,n) ((x) >> (n))
/* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */
#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
#define FbStipMoveLsb(x,s,n) (x)
+#define FbPatternOffsetBits (sizeof (FbBits) - 1)
#endif
-#define GetHighWord(x) (((int) (x)) >> 16)
-
-#if IMAGE_BYTE_ORDER == MSBFirst
-#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
-#define coordToInt(x,y) (((x) << 16) | (y))
-#define intToX(i) (GetHighWord(i))
-#define intToY(i) ((int) ((short) i))
-#else
-#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
-#define coordToInt(x,y) (((y) << 16) | (x))
-#define intToX(i) ((int) ((short) (i)))
-#define intToY(i) (GetHighWord(i))
-#endif
+#include "micoord.h"
#define FbStipLeft(x,n) FbScrLeft(x,n)
#define FbStipRight(x,n) FbScrRight(x,n)
@@ -139,11 +169,19 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
#define FbRotLeft(x,n) FbScrLeft(x,n) | (n ? FbScrRight(x,FB_UNIT-n) : 0)
#define FbRotRight(x,n) FbScrRight(x,n) | (n ? FbScrLeft(x,FB_UNIT-n) : 0)
+#define FbRotStipLeft(x,n) FbStipLeft(x,n) | (n ? FbStipRight(x,FB_STIP_UNIT-n) : 0)
+#define FbRotStipRight(x,n) FbStipRight(x,n) | (n ? FbStipLeft(x,FB_STIP_UNIT-n) : 0)
+
#define FbLeftMask(x) ( ((x) & FB_MASK) ? \
FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
#define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
+#define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \
+ FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0)
+#define FbRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \
+ FbScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0)
+
#define FbBitsMask(x,w) (FbScrRight(FB_ALLONES,(x) & FB_MASK) & \
FbScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK))
@@ -166,8 +204,283 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
n >>= FB_SHIFT; \
}
+#ifdef FBNOPIXADDR
+#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) FbMaskBits(x,w,l,n,r)
+#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \
+ *dst = FbDoMaskRRop(*dst,and,xor,l); \
+}
+#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
+ *dst = FbDoMaskRRop(*dst,and,xor,r); \
+}
+#else
+
+#define FbByteMaskInvalid 0x10
+
+#define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1)))
+
+#define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o)))
+#define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3))
+#define FbStorePart(dst,off,t,xor) (*FbPtrOffset(dst,off,t) = \
+ FbSelectPart(xor,off,t))
+#ifndef FbSelectPart
+#define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t)
+#endif
+
+#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \
+ n = (w); \
+ lb = 0; \
+ rb = 0; \
+ r = FbRightMask((x)+n); \
+ if (r) { \
+ /* compute right byte length */ \
+ if ((copy) && (((x) + n) & 7) == 0) { \
+ rb = (((x) + n) & FB_MASK) >> 3; \
+ } else { \
+ rb = FbByteMaskInvalid; \
+ } \
+ } \
+ l = FbLeftMask(x); \
+ if (l) { \
+ /* compute left byte length */ \
+ if ((copy) && ((x) & 7) == 0) { \
+ lb = ((x) & FB_MASK) >> 3; \
+ } else { \
+ lb = FbByteMaskInvalid; \
+ } \
+ /* subtract out the portion painted by leftMask */ \
+ n -= FB_UNIT - ((x) & FB_MASK); \
+ if (n < 0) { \
+ if (lb != FbByteMaskInvalid) { \
+ if (rb == FbByteMaskInvalid) { \
+ lb = FbByteMaskInvalid; \
+ } else if (rb) { \
+ lb |= (rb - lb) << (FB_SHIFT - 3); \
+ rb = 0; \
+ } \
+ } \
+ n = 0; \
+ l &= r; \
+ r = 0; \
+ }\
+ } \
+ n >>= FB_SHIFT; \
+}
+
+#if FB_SHIFT == 6
+#define FbDoLeftMaskByteRRop6Cases(dst,xor) \
+ case (sizeof (FbBits) - 7) | (1 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 7) | (2 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 7) | (3 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ break; \
+ case (sizeof (FbBits) - 7) | (4 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 7) | (5 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
+ break; \
+ case (sizeof (FbBits) - 7) | (6 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 7): \
+ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
+ break; \
+ case (sizeof (FbBits) - 6) | (1 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 6) | (2 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ break; \
+ case (sizeof (FbBits) - 6) | (3 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 6) | (4 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
+ break; \
+ case (sizeof (FbBits) - 6) | (5 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 6): \
+ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
+ break; \
+ case (sizeof (FbBits) - 5) | (1 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 5) | (2 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 5) | (3 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
+ break; \
+ case (sizeof (FbBits) - 5) | (4 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 5): \
+ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
+ break; \
+ case (sizeof (FbBits) - 4) | (1 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 4) | (2 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
+ break; \
+ case (sizeof (FbBits) - 4) | (3 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 4): \
+ FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
+ break;
+
+#define FbDoRightMaskByteRRop6Cases(dst,xor) \
+ case 4: \
+ FbStorePart(dst,0,CARD32,xor); \
+ break; \
+ case 5: \
+ FbStorePart(dst,0,CARD32,xor); \
+ FbStorePart(dst,4,CARD8,xor); \
+ break; \
+ case 6: \
+ FbStorePart(dst,0,CARD32,xor); \
+ FbStorePart(dst,4,CARD16,xor); \
+ break; \
+ case 7: \
+ FbStorePart(dst,0,CARD32,xor); \
+ FbStorePart(dst,4,CARD16,xor); \
+ FbStorePart(dst,6,CARD8,xor); \
+ break;
+#else
+#define FbDoLeftMaskByteRRop6Cases(dst,xor)
+#define FbDoRightMaskByteRRop6Cases(dst,xor)
+#endif
+
+#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \
+ switch (lb) { \
+ FbDoLeftMaskByteRRop6Cases(dst,xor) \
+ case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 3) | (2 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
+ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
+ break; \
+ case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \
+ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
+ break; \
+ case sizeof (FbBits) - 3: \
+ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
+ case sizeof (FbBits) - 2: \
+ FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \
+ break; \
+ case sizeof (FbBits) - 1: \
+ FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \
+ break; \
+ default: \
+ *dst = FbDoMaskRRop(*dst, and, xor, l); \
+ break; \
+ } \
+}
+
+
+#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
+ switch (rb) { \
+ case 1: \
+ FbStorePart(dst,0,CARD8,xor); \
+ break; \
+ case 2: \
+ FbStorePart(dst,0,CARD16,xor); \
+ break; \
+ case 3: \
+ FbStorePart(dst,0,CARD16,xor); \
+ FbStorePart(dst,2,CARD8,xor); \
+ break; \
+ FbDoRightMaskByteRRop6Cases(dst,xor) \
+ default: \
+ *dst = FbDoMaskRRop (*dst, and, xor, r); \
+ } \
+}
+#endif
+
+#define FbMaskStip(x,w,l,n,r) { \
+ n = (w); \
+ r = FbRightStipMask((x)+n); \
+ l = FbLeftStipMask(x); \
+ if (l) { \
+ n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \
+ if (n < 0) { \
+ n = 0; \
+ l &= r; \
+ r = 0; \
+ } \
+ } \
+ n >>= FB_STIP_SHIFT; \
+}
+
+/*
+ * These macros are used to transparently stipple
+ * in copy mode; the expected usage is with 'n' constant
+ * so all of the conditional parts collapse into a minimal
+ * sequence of partial word writes
+ *
+ * 'n' is the bytemask of which bytes to store, 'a' is the address
+ * of the FbBits base unit, 'o' is the offset within that unit
+ *
+ * The term "lane" comes from the hardware term "byte-lane" which
+ */
+
+#define FbLaneCase1(n,a,o) ((n) == 0x01 ? \
+ (*(CARD8 *) ((a)+FbPatternOffset(o,CARD8)) = \
+ fgxor) : 0)
+#define FbLaneCase2(n,a,o) ((n) == 0x03 ? \
+ (*(CARD16 *) ((a)+FbPatternOffset(o,CARD16)) = \
+ fgxor) : \
+ ((void)FbLaneCase1((n)&1,a,o), \
+ FbLaneCase1((n)>>1,a,(o)+1)))
+#define FbLaneCase4(n,a,o) ((n) == 0x0f ? \
+ (*(CARD32 *) ((a)+FbPatternOffset(o,CARD32)) = \
+ fgxor) : \
+ ((void)FbLaneCase2((n)&3,a,o), \
+ FbLaneCase2((n)>>2,a,(o)+2)))
+#define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (*(FbBits *) ((a)+(o)) = fgxor) : \
+ ((void)FbLaneCase4((n)&15,a,o), \
+ FbLaneCase4((n)>>4,a,(o)+4)))
+
+#if FB_SHIFT == 6
+#define FbLaneCase(n,a) FbLaneCase8(n,(CARD8 *) (a),0)
+#endif
+
+#if FB_SHIFT == 5
+#define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0)
+#endif
+
/* Rotate a filled pixel value to the specified alignement */
-#define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b)))
+#define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b)))
+#define FbRot24Stip(p,b) (FbStipRight(p,b) | FbStipLeft(p,24-(b)))
/* step a filled pixel value to the next/previous FB_UNIT alignment */
#define FbNext24Pix(p) (FbRot24(p,(24-FB_UNIT%24)))
@@ -179,10 +492,24 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
#if FB_UNIT == 64
#define FbNext24Rot(r) ((r) == 16 ? 0 : (r) + 8)
#define FbPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8)
+
+#if IMAGE_BYTE_ORDER == MSBFirst
+#define FbFirst24Rot(x) (((x) + 8) % 24)
+#else
+#define FbFirst24Rot(x) ((x) % 24)
#endif
+
+#endif
+
#if FB_UNIT == 32
#define FbNext24Rot(r) ((r) == 0 ? 16 : (r) - 8)
#define FbPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8)
+
+#if IMAGE_BYTE_ORDER == MSBFirst
+#define FbFirst24Rot(x) (((x) + 16) % 24)
+#else
+#define FbFirst24Rot(x) ((x) % 24)
+#endif
#endif
#define FbNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8)
@@ -191,7 +518,53 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
/* Whether 24-bit specific code is needed for this filled pixel value */
#define FbCheck24Pix(p) ((p) == FbNext24Pix(p))
+/* Macros for dealing with dashing */
+
+#define FbDashDeclare \
+ unsigned char *__dash, *__firstDash, *__lastDash
+
+#define FbDashInit(pGC,pPriv,dashOffset,dashlen,even) { \
+ (even) = TRUE; \
+ __firstDash = (pGC)->dash; \
+ __lastDash = __firstDash + (pGC)->numInDashList; \
+ (dashOffset) %= (pPriv)->dashLength; \
+ \
+ __dash = __firstDash; \
+ while ((dashOffset) >= ((dashlen) = *__dash)) \
+ { \
+ (dashOffset) -= (dashlen); \
+ (even) = 1-(even); \
+ if (++__dash == __lastDash) \
+ __dash = __firstDash; \
+ } \
+ (dashlen) -= (dashOffset); \
+}
+
+#define FbDashNext(dashlen) { \
+ if (++__dash == __lastDash) \
+ __dash = __firstDash; \
+ (dashlen) = *__dash; \
+}
+
+/* as numInDashList is always even, this case can skip a test */
+
+#define FbDashNextEven(dashlen) { \
+ (dashlen) = *++__dash; \
+}
+
+#define FbDashNextOdd(dashlen) FbDashNext(dashlen)
+
+#define FbDashStep(dashlen,even) { \
+ if (!--(dashlen)) { \
+ FbDashNext(dashlen); \
+ (even) = 1-(even); \
+ } \
+}
+
extern int fbGCPrivateIndex;
+#ifndef FB_NO_WINDOW_PIXMAPS
+extern int fbWinPrivateIndex;
+#endif
extern const GCOps fbGCOps;
extern const GCFuncs fbGCFuncs;
@@ -200,6 +573,27 @@ extern const GCFuncs fbGCFuncs;
#define FB_OLD_SCREEN
#endif
+#ifdef FB_OLD_SCREEN
+extern WindowPtr *WindowTable;
+#endif
+
+#ifdef FB_24_32BIT
+#define FB_SCREEN_PRIVATE
+#endif
+
+#ifdef FB_SCREEN_PRIVATE
+extern int fbScreenPrivateIndex;
+
+/* private field of a screen */
+typedef struct {
+ unsigned char win32bpp; /* window bpp for 32-bpp images */
+ unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
+} FbScreenPrivRec, *FbScreenPrivPtr;
+
+#define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
+ (pScreen)->devPrivates[fbScreenPrivateIndex].ptr)
+#endif
+
/* private field of GC */
typedef struct {
#ifdef FB_OLD_GC
@@ -215,7 +609,9 @@ typedef struct {
FbBits bgand, bgxor; /* for stipples */
FbBits fg, bg, pm; /* expanded and filled */
unsigned int dashLength; /* total of all dash elements */
- Bool oneRect; /* clip list is single rectangle */
+ unsigned char oneRect; /* clip list is single rectangle */
+ unsigned char evenStipple; /* stipple is even */
+ unsigned char bpp; /* current drawable bpp */
} FbGCPrivRec, *FbGCPrivPtr;
#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
@@ -234,9 +630,22 @@ typedef struct {
#endif
#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
-#define fbGetWindowPixmap(d) fbGetScreenPixmap((d)->pScreen)
+#ifdef FB_NO_WINDOW_PIXMAPS
+#define fbGetWindowPixmap(d) fbGetScreenPixmap(((DrawablePtr) (d))->pScreen)
+#else
+#define fbGetWindowPixmap(pWin) ((PixmapPtr)\
+ ((WindowPtr) (pWin))->devPrivates[fbWinPrivateIndex].ptr)
+#endif
+
+#ifdef __DARWIN__
+#define __fbPixOriginX(pPix) ((pPix)->drawable.x)
+#define __fbPixOriginY(pPix) ((pPix)->drawable.y)
+#else
+#define __fbPixOriginX(pPix) 0
+#define __fbPixOriginY(pPix) 0
+#endif
-#define fbGetDrawable(pDrawable, pointer, stride, bpp) { \
+#define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
PixmapPtr _pPix; \
if ((pDrawable)->type != DRAWABLE_PIXMAP) \
_pPix = fbGetWindowPixmap(pDrawable); \
@@ -245,9 +654,11 @@ typedef struct {
(pointer) = (FbBits *) _pPix->devPrivate.ptr; \
(stride) = ((int) _pPix->devKind) / sizeof (FbBits); \
(bpp) = _pPix->drawable.bitsPerPixel; \
+ (xoff) = __fbPixOriginX(_pPix); \
+ (yoff) = __fbPixOriginY(_pPix); \
}
-#define fbGetStipDrawable(pDrawable, pointer, stride, bpp) { \
+#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
PixmapPtr _pPix; \
if ((pDrawable)->type != DRAWABLE_PIXMAP) \
_pPix = fbGetWindowPixmap(pDrawable); \
@@ -256,8 +667,23 @@ typedef struct {
(pointer) = (FbStip *) _pPix->devPrivate.ptr; \
(stride) = ((int) _pPix->devKind) / sizeof (FbStip); \
(bpp) = _pPix->drawable.bitsPerPixel; \
+ (xoff) = __fbPixOriginX(_pPix); \
+ (yoff) = __fbPixOriginY(_pPix); \
}
+/*
+ * XFree86 empties the root BorderClip when the VT is inactive,
+ * here's a macro which uses that to disable GetImage and GetSpans
+ */
+
+#define fbWindowEnabled(pWin) \
+ REGION_NOTEMPTY((pWin)->drawable.pScreen, \
+ &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip)
+
+#define fbDrawableEnabled(pDrawable) \
+ ((pDrawable)->type == DRAWABLE_PIXMAP ? \
+ TRUE : fbWindowEnabled((WindowPtr) pDrawable))
+
#ifdef FB_OLD_SCREEN
#define BitsPerPixel(d) (\
((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
@@ -276,6 +702,76 @@ typedef struct {
#define FbEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp))
/*
+ * fb24_32.c
+ */
+void
+fb24_32GetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pchardstStart);
+
+void
+fb24_32SetSpans (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted);
+
+void
+fb24_32PutZImage (DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y,
+ int width,
+ int height,
+ CARD8 *src,
+ FbStride srcStride);
+
+void
+fb24_32GetImage (DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w,
+ int h,
+ unsigned int format,
+ unsigned long planeMask,
+ char *d);
+
+void
+fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown,
+ Pixel bitplane,
+ void *closure);
+
+PixmapPtr
+fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
+
+Bool
+fb24_32CreateScreenResources(ScreenPtr pScreen);
+
+Bool
+fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel,
+ int devKind,
+ pointer pPixData);
+
+/*
* fballpriv.c
*/
Bool
@@ -302,8 +798,8 @@ fbBresSolid8(DrawablePtr pDrawable,
int signdx,
int signdy,
int axis,
- int x1,
- int y1,
+ int x,
+ int y,
int e,
int e1,
int e3,
@@ -316,8 +812,8 @@ fbBresDash8 (DrawablePtr pDrawable,
int signdx,
int signdy,
int axis,
- int x1,
- int y1,
+ int x,
+ int y,
int e,
int e1,
int e3,
@@ -330,6 +826,8 @@ fbDots8 (FbBits *dst,
BoxPtr pBox,
xPoint *pts,
int npt,
+ int xoff,
+ int yoff,
FbBits and,
FbBits xor);
@@ -352,6 +850,19 @@ fbGlyph8 (FbBits *dstLine,
int height,
int shift);
+void
+fbPolyline8 (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ptsOrig);
+
+void
+fbPolySegment8 (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pseg);
+
void
fbBresSolid16(DrawablePtr pDrawable,
GCPtr pGC,
@@ -359,8 +870,8 @@ fbBresSolid16(DrawablePtr pDrawable,
int signdx,
int signdy,
int axis,
- int x1,
- int y1,
+ int x,
+ int y,
int e,
int e1,
int e3,
@@ -373,8 +884,8 @@ fbBresDash16(DrawablePtr pDrawable,
int signdx,
int signdy,
int axis,
- int x1,
- int y1,
+ int x,
+ int y,
int e,
int e1,
int e3,
@@ -387,6 +898,8 @@ fbDots16(FbBits *dst,
BoxPtr pBox,
xPoint *pts,
int npt,
+ int xoff,
+ int yoff,
FbBits and,
FbBits xor);
@@ -409,6 +922,93 @@ fbGlyph16(FbBits *dstLine,
int height,
int shift);
+void
+fbPolyline16 (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ptsOrig);
+
+void
+fbPolySegment16 (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pseg);
+
+
+void
+fbBresSolid24(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis,
+ int x,
+ int y,
+ int e,
+ int e1,
+ int e3,
+ int len);
+
+void
+fbBresDash24(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis,
+ int x,
+ int y,
+ int e,
+ int e1,
+ int e3,
+ int len);
+
+void
+fbDots24(FbBits *dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint *pts,
+ int npt,
+ int xoff,
+ int yoff,
+ FbBits and,
+ FbBits xor);
+
+void
+fbArc24(FbBits *dst,
+ FbStride dstStride,
+ int dstBpp,
+ xArc *arc,
+ int dx,
+ int dy,
+ FbBits and,
+ FbBits xor);
+
+void
+fbGlyph24(FbBits *dstLine,
+ FbStride dstStride,
+ int dstBpp,
+ FbStip *stipple,
+ FbBits fg,
+ int height,
+ int shift);
+
+void
+fbPolyline24 (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ptsOrig);
+
+void
+fbPolySegment24 (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pseg);
+
+
void
fbBresSolid32(DrawablePtr pDrawable,
GCPtr pGC,
@@ -416,8 +1016,8 @@ fbBresSolid32(DrawablePtr pDrawable,
int signdx,
int signdy,
int axis,
- int x1,
- int y1,
+ int x,
+ int y,
int e,
int e1,
int e3,
@@ -430,8 +1030,8 @@ fbBresDash32(DrawablePtr pDrawable,
int signdx,
int signdy,
int axis,
- int x1,
- int y1,
+ int x,
+ int y,
int e,
int e1,
int e3,
@@ -444,6 +1044,8 @@ fbDots32(FbBits *dst,
BoxPtr pBox,
xPoint *pts,
int npt,
+ int xoff,
+ int yoff,
FbBits and,
FbBits xor);
@@ -465,6 +1067,19 @@ fbGlyph32(FbBits *dstLine,
FbBits fg,
int height,
int shift);
+void
+fbPolyline32 (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ptsOrig);
+
+void
+fbPolySegment32 (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pseg);
+
/*
* fbblt.c
*/
@@ -626,10 +1241,17 @@ fbExpandDirectColors (ColormapPtr pmap,
Bool
fbCreateDefColormap(ScreenPtr pScreen);
+void
+fbClearVisualTypes(void);
+
Bool
fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);
Bool
+fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
+ Pixel redMask, Pixel greenMask, Pixel blueMask);
+
+Bool
fbInitVisuals (VisualPtr *visualp,
DepthPtr *depthp,
int *nvisualp,
@@ -756,10 +1378,10 @@ fbFill (DrawablePtr pDrawable,
void
fbSolidBoxClipped (DrawablePtr pDrawable,
RegionPtr pClip,
- int x1,
- int y1,
- int x2,
- int y2,
+ int xa,
+ int ya,
+ int xb,
+ int yb,
FbBits and,
FbBits xor);
@@ -774,6 +1396,8 @@ fbPolyFillRect(DrawablePtr pDrawable,
#define fbPolyFillArc miPolyFillArc
+#define fbFillPolygon miFillPolygon
+
/*
* fbfillsp.c
*/
@@ -813,6 +1437,14 @@ fbGetSpans(DrawablePtr pDrawable,
/*
* fbglyph.c
*/
+
+Bool
+fbGlyphIn (RegionPtr pRegion,
+ int x,
+ int y,
+ int width,
+ int height);
+
void
fbPolyGlyphBlt (DrawablePtr pDrawable,
GCPtr pGC,
@@ -831,15 +1463,6 @@ fbImageGlyphBlt (DrawablePtr pDrawable,
CharInfoPtr *ppci,
pointer pglyphBase);
-void
-fbGlyph24 (FbBits *dstBits,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int x,
- int height);
-
/*
* fbimage.c
*/
@@ -900,19 +1523,54 @@ fbGetImage (DrawablePtr pDrawable,
*/
void
+fbZeroLine (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt);
+
+void
+fbZeroSegment (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSegs);
+
+void
fbPolyLine (DrawablePtr pDrawable,
GCPtr pGC,
int mode,
int npt,
DDXPointPtr ppt);
-#define fbPolySegment miPolySegment
+void
+fbFixCoordModePrevious (int npt,
+ DDXPointPtr ppt);
+
+void
+fbPolySegment (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pseg);
+
+#define fbPolyRectangle miPolyRectangle
+
+/*
+ * fbpict.c
+ */
+
+Bool
+fbPictureInit (ScreenPtr pScreen,
+ PictFormatPtr formats,
+ int nformats);
/*
* fbpixmap.c
*/
PixmapPtr
+fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp);
+
+PixmapPtr
fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth);
Bool
@@ -926,6 +1584,18 @@ fbPixmapToRegion(PixmapPtr pPix);
*/
void
+fbDots (FbBits *dstOrig,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint *pts,
+ int npt,
+ int xoff,
+ int yoff,
+ FbBits andOrig,
+ FbBits xorOrig);
+
+void
fbPolyPoint (DrawablePtr pDrawable,
GCPtr pGC,
int mode,
@@ -976,6 +1646,19 @@ fbPush1toN (DrawablePtr pSrcDrawable,
void *closure);
void
+fbPushImage (DrawablePtr pDrawable,
+ GCPtr pGC,
+
+ FbStip *src,
+ FbStride srcStride,
+ int srcX,
+
+ int x,
+ int y,
+ int width,
+ int height);
+
+void
fbPushPixels (GCPtr pGC,
PixmapPtr pBitmap,
DrawablePtr pDrawable,
@@ -990,7 +1673,7 @@ fbPushPixels (GCPtr pGC,
*/
Bool
-fbCloseScreen (int index, ScreenPtr pScreen);
+fbCloseScreen (int indx, ScreenPtr pScreen);
Bool
fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
@@ -998,6 +1681,19 @@ fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
Bool
fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
+void
+fbQueryBestSize (int class,
+ unsigned short *width, unsigned short *height,
+ ScreenPtr pScreen);
+
+#ifndef FB_OLD_SCREEN
+PixmapPtr
+_fbGetWindowPixmap (WindowPtr pWindow);
+
+void
+_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap);
+#endif
+
Bool
fbSetupScreen(ScreenPtr pScreen,
pointer pbits, /* pointer to screen bitmap */
@@ -1034,19 +1730,20 @@ fbInitializeBackingStore (ScreenPtr pScreen);
/*
* fbseg.c
*/
-typedef void (*FbBres) (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len);
-
+typedef void FbBres (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis,
+ int x,
+ int y,
+ int e,
+ int e1,
+ int e3,
+ int len);
+
+FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash;
/*
* fbsetsp.c
*/
@@ -1060,6 +1757,35 @@ fbSetSpans (DrawablePtr pDrawable,
int nspans,
int fSorted);
+FbBres *
+fbSelectBres (DrawablePtr pDrawable,
+ GCPtr pGC);
+
+void
+fbBres (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis,
+ int x,
+ int y,
+ int e,
+ int e1,
+ int e3,
+ int len);
+
+void
+fbSegment (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xa,
+ int ya,
+ int xb,
+ int yb,
+ Bool drawLast,
+ int *dashOffset);
+
+
/*
* fbsolid.c
*/
@@ -1092,6 +1818,13 @@ fbSolid24 (FbBits *dst,
/*
* fbstipple.c
*/
+
+void
+fbTransparentSpan (FbBits *dst,
+ FbBits stip,
+ FbBits fgxor,
+ int n);
+
void
fbEvenStipple (FbBits *dst,
FbStride dstStride,
@@ -1102,6 +1835,7 @@ fbEvenStipple (FbBits *dst,
int height,
FbStip *stip,
+ FbStride stipStride,
int stipHeight,
FbBits fgand,
@@ -1147,6 +1881,7 @@ fbStipple (FbBits *dst,
FbStride stipStride,
int stipWidth,
int stipHeight,
+ Bool even,
FbBits fgand,
FbBits fgxor,
@@ -1222,6 +1957,9 @@ fbTile (FbBits *dst,
FbBits
fbReplicatePixel (Pixel p, int bpp);
+void
+fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
+
/*
* fbwindow.c
*/