Commit 15e5eaf6 authored by Josh Triplett's avatar Josh Triplett
Browse files

Remove support for building without XCB



And there was much rejoicing.
Signed-off-by: Josh Triplett's avatarJosh Triplett <josh@joshtriplett.org>
Reviewed-by: Jamey Sharp's avatarJamey Sharp <jamey@minilop.net>

Consensus on #xorg-devel agrees with removing --without-xcb; in
particular, acks from Adam Jackson, Daniel Stone, Kristian Høgsberg,
Julien Cristau, and Rémi Cardona.
parent fb19eb76
......@@ -8,10 +8,7 @@ SUBDIRS=include $(ORDER) nls man specs
ACLOCAL_AMFLAGS = -I m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = x11.pc
if XCB
pkgconfig_DATA += x11-xcb.pc
endif
pkgconfig_DATA = x11.pc x11-xcb.pc
MAINTAINERCLEANFILES = ChangeLog INSTALL
DISTCLEANFILES = doltcompile doltlibtool
......
......@@ -77,44 +77,14 @@ AC_ARG_WITH(perl,
AC_CHECK_PROGS([PERL], [perl], [no]))
AM_CONDITIONAL(HAVE_PERL, test x$PERL != xno)
# Build with XCB support?
AC_ARG_WITH(xcb,
AC_HELP_STRING([--with-xcb], [use XCB for low-level protocol implementation]),
[ac_cv_use_xcb=$withval], [ac_cv_use_xcb=yes])
AC_CACHE_CHECK([whether to use XCB], [ac_cv_use_xcb], [ac_cv_use_xcb=yes])
AM_CONDITIONAL(XCB, test x$ac_cv_use_xcb != xno)
# Checks for pkg-config packages
# Always required
X11_REQUIRES='xproto >= 7.0.13 xextproto xtrans'
X11_REQUIRES='xproto >= 7.0.13 xextproto xtrans xcb >= 1.1.92'
X11_EXTRA_DEPS="xcb >= 1.1.92"
PKG_PROG_PKG_CONFIG()
case "$ac_cv_use_xcb" in
no)
X11_REQUIRES="${X11_REQUIRES} xau xcmiscproto bigreqsproto"
X11_EXTRA_DEPS="xau"
PKG_CHECK_MODULES(XDMCP, xdmcp,
AC_CHECK_LIB(Xdmcp, XdmcpWrap,
[
AC_CHECK_LIB(Xdmcp, XdmcpWrap, [xdmauth="yes"], [xdmauth="no"], [$XDMCP_LIBS])
X11_EXTRA_DEPS="$X11_EXTRA_DEPS xdmcp"
],
[
XDMCP_CFLAGS=
XDMCP_LIBS=
], [$XDMCP_LIBS]),
[AC_MSG_RESULT(no)])
AC_DEFINE(USE_XCB, 0, [Use XCB for low-level protocol implementation])
;;
*)
X11_REQUIRES="${X11_REQUIRES} xcb >= 1.1.92"
X11_EXTRA_DEPS="xcb >= 1.1.92"
xdmauth="no" # XCB handles all auth
AC_DEFINE(USE_XCB, 1, [Use XCB for low-level protocol implementation])
;;
esac
AC_SUBST(X11_EXTRA_DEPS)
dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
......@@ -338,17 +308,6 @@ fi
AC_SUBST(XTHREADLIB)
AC_SUBST(XTHREAD_CFLAGS)
case x$xdmauth in
xyes)
XDMCP_CFLAGS="$XDMCP_CFLAGS -DHASXDMAUTH"
;;
xno)
XDMCP_LIBS=""
;;
esac
AC_SUBST(XDMCP_CFLAGS)
AC_SUBST(XDMCP_LIBS)
AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
#
......@@ -588,7 +547,6 @@ echo ""
echo "X11 will be built with the following settings:"
echo " Loadable i18n module support: "$XLIB_LOADABLE_I18N
echo " Loadable xcursor library support: "$XLIB_LOADABLE_XCURSOR
echo " Use XCB: "$ac_cv_use_xcb
echo " Threading support: "$xthreads
echo " Use Threads safe API: "$mtsafeapi
echo " Threads stubs in libX11: "$thrstubs
......
......@@ -9,14 +9,11 @@ x11include_HEADERS=\
X11/Xutil.h \
X11/cursorfont.h \
X11/Xregion.h \
X11/ImUtil.h
X11/ImUtil.h \
X11/Xlib-xcb.h
nodist_x11include_HEADERS=\
X11/XlibConf.h
EXTRA_DIST = \
X11/XlibConf.h.in
if XCB
x11include_HEADERS += X11/Xlib-xcb.h
endif
......@@ -11,7 +11,6 @@ AM_CPPFLAGS= \
AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
$(XDMCP_CFLAGS) \
$(MALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
......
......@@ -11,7 +11,6 @@ AM_CPPFLAGS= \
AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
$(XDMCP_CFLAGS) \
$(MALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
......
......@@ -11,7 +11,6 @@ AM_CPPFLAGS= \
AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
$(XDMCP_CFLAGS) \
$(CWARNFLAGS)
if XLIB_LOADABLE_I18N
......
......@@ -11,7 +11,6 @@ AM_CPPFLAGS= \
AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
$(XDMCP_CFLAGS) \
$(CWARNFLAGS)
if XLIB_LOADABLE_I18N
......
......@@ -11,7 +11,6 @@ AM_CPPFLAGS= \
AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
$(XDMCP_CFLAGS) \
$(CWARNFLAGS)
if XLIB_LOADABLE_I18N
......
......@@ -12,7 +12,6 @@ AM_CPPFLAGS= \
AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
$(XDMCP_CFLAGS) \
$(MALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
......
......@@ -30,11 +30,7 @@ from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#if USE_XCB
#include "Xxcbint.h"
#else /* !USE_XCB */
#include <X11/Xtrans/Xtrans.h>
#endif /* USE_XCB */
#include "Xlib.h"
#include "Xlibint.h"
#include "Xintconn.h"
......@@ -72,11 +68,7 @@ XCloseDisplay (
if (dpy->request != dpy->last_request_read)
XSync(dpy, 1);
}
#if USE_XCB
xcb_disconnect(dpy->xcb->connection);
#else /* !USE_XCB */
_XDisconnectDisplay(dpy->trans_conn);
#endif /* USE_XCB */
_XFreeDisplayStructure (dpy);
return 0;
}
This diff is collapsed.
......@@ -3,7 +3,7 @@ XKB_SUBDIRS = xkb
endif
SUBDIRS = util xcms xlibi18n $(XKB_SUBDIRS)
lib_LTLIBRARIES=libX11.la
lib_LTLIBRARIES = libX11.la libX11-xcb.la
BUILT_SOURCES=ks_tables.h
CLEANFILES=ks_tables.h ks_tables_h
......@@ -21,7 +21,6 @@ AM_CPPFLAGS= \
AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
$(XDMCP_CFLAGS) \
$(XMALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
......@@ -312,6 +311,8 @@ libX11_la_SOURCES = \
WMProps.c \
WrBitF.c \
Xatomtype.h \
xcb_disp.c \
xcb_io.c \
Xintatom.h \
Xintconn.h \
XlibAsync.c \
......@@ -320,7 +321,8 @@ libX11_la_SOURCES = \
XomGeneric.h \
Xresinternal.h \
Xrm.c \
XrmI.h
XrmI.h \
Xxcbint.h
#
# ========================= Extra stuff ============================
......@@ -347,21 +349,9 @@ EXTRA_DIST = \
udcInf.c \
UIThrStubs.c
if XCB
libX11_la_SOURCES += \
xcb_disp.c \
xcb_io.c \
Xxcbint.h
lib_LTLIBRARIES += libX11-xcb.la
libX11_xcb_la_SOURCES = x11_xcb.c Xxcbint.h
libX11_xcb_la_LDFLAGS = -version-info 1:0:0 -no-undefined
libX11_xcb_la_LIBADD = libX11.la
else
libX11_la_SOURCES += \
ConnDis.c \
x11_trans.c
endif
#
# Figure out which sub-libraries to link into Xlib
......@@ -385,8 +375,7 @@ libX11_la_LIBADD = \
$(USE_I18N_LIBS) \
$(USE_XCMS_LIBS) \
$(USE_XKB_LIBS) \
$(X11_LIBS) \
$(XDMCP_LIBS)
$(X11_LIBS)
preprocess: $(patsubst %.c,%.ii,$(libX11_la_SOURCES))
.c.ii:
......
......@@ -30,12 +30,7 @@ in this Software without prior written authorization from The Open Group.
#include <config.h>
#endif
#include "Xlibint.h"
#if USE_XCB
#include "Xxcbint.h"
#else /* !USE_XCB */
#include <X11/Xtrans/Xtrans.h>
#include <X11/extensions/bigreqstr.h>
#endif /* USE_XCB */
#include <X11/Xatom.h>
#include <X11/Xresource.h>
#include <stdio.h>
......@@ -45,21 +40,6 @@ in this Software without prior written authorization from The Open Group.
#include "XKBlib.h"
#endif /* XKB */
#if !USE_XCB
#ifdef X_NOT_POSIX
#define Size_t unsigned int
#else
#define Size_t size_t
#endif
#define bignamelen (sizeof(XBigReqExtensionName) - 1)
typedef struct {
unsigned long seq;
int opcode;
} _XBigReqState;
#endif /* !USE_XCB */
#ifdef XTHREADS
#include "locking.h"
int (*_XInitDisplayLock_fn)(Display *dpy) = NULL;
......@@ -76,11 +56,7 @@ static xReq _dummy_request = {
0, 0, 0
};
static void OutOfMemory(Display *dpy, char *setup);
#if !USE_XCB
static Bool _XBigReqHandler(Display *dpy, xReply *rep, char *buf, int len,
XPointer data);
#endif /* !USE_XCB */
static void OutOfMemory(Display *dpy);
/*
* Connects to a server, creates a Display object and returns a pointer to
......@@ -94,14 +70,6 @@ XOpenDisplay (
register int i;
int j, k; /* random iterator indexes */
char *display_name; /* pointer to display name */
#if !USE_XCB
int endian; /* to determine which endian. */
xConnClientPrefix client; /* client information */
int idisplay; /* display number */
int prefixread = 0; /* setup prefix already read? */
char *conn_auth_name, *conn_auth_data;
int conn_auth_namelen, conn_auth_datalen;
#endif /* !USE_XCB */
char *setup = NULL; /* memory allocated at startup */
char *fullname = NULL; /* expanded name of display */
int iscreen; /* screen number */
......@@ -122,11 +90,6 @@ XOpenDisplay (
long int conn_buf_size;
char *xlib_buffer_size;
#if !USE_XCB
bzero((char *) &client, sizeof(client));
bzero((char *) &prefix, sizeof(prefix));
#endif /* !USE_XCB */
/*
* If the display specifier string supplied as an argument to this
* routine is NULL or a pointer to NULL, read the DISPLAY variable.
......@@ -162,7 +125,6 @@ XOpenDisplay (
* will set fullname to point to the expanded name.
*/
#if USE_XCB
if(!_XConnectXCB(dpy, display, &fullname, &iscreen)) {
/* Try falling back on other transports if no transport specified */
const char *slash = strrchr(display_name, '/');
......@@ -183,22 +145,10 @@ XOpenDisplay (
}
dpy->display_name = fullname;
OutOfMemory(dpy, NULL);
OutOfMemory(dpy);
return NULL;
}
fallback_success:
#else /* !USE_XCB */
if ((dpy->trans_conn = _X11TransConnectDisplay (
display_name, &fullname, &idisplay,
&iscreen, &conn_auth_name,
&conn_auth_namelen, &conn_auth_data,
&conn_auth_datalen)) == NULL) {
Xfree ((char *) dpy);
return(NULL);
}
dpy->fd = _X11TransGetConnectionNumber (dpy->trans_conn);
#endif /* USE_XCB */
/* Initialize as much of the display structure as we can.
* Initialize pointers to NULL so that XFreeDisplayStructure will
......@@ -274,12 +224,12 @@ fallback_success:
/* Initialize the display lock */
if (InitDisplayLock(dpy) != 0) {
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
if (!_XPollfdCacheInit(dpy)) {
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
......@@ -305,14 +255,11 @@ fallback_success:
conn_buf_size = XLIBMINBUFSIZE;
if ((dpy->bufptr = dpy->buffer = Xcalloc(1, conn_buf_size)) == NULL) {
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
dpy->bufmax = dpy->buffer + conn_buf_size;
#if USE_XCB
dpy->xcb->real_bufmax = dpy->bufmax;
dpy->xcb->real_bufmax = dpy->buffer + conn_buf_size;
dpy->bufmax = dpy->buffer;
#endif
/* Set up the input event queue and input event queue parameters. */
dpy->head = dpy->tail = NULL;
......@@ -322,68 +269,10 @@ fallback_success:
if ((dpy->free_funcs = (_XFreeFuncRec *)Xcalloc(1,
sizeof(_XFreeFuncRec)))
== NULL) {
OutOfMemory (dpy, setup);
return(NULL);
}
#if !USE_XCB
/*
* The xConnClientPrefix describes the initial connection setup information
* and is followed by the authorization information. Sites that are interested
* in security are strongly encouraged to use an authentication and
* authorization system such as Kerberos.
*/
endian = 1;
if (*(char *) &endian)
client.byteOrder = '\154'; /* 'l' */
else
client.byteOrder = '\102'; /* 'B' */
client.majorVersion = X_PROTOCOL;
client.minorVersion = X_PROTOCOL_REVISION;
client.nbytesAuthProto = conn_auth_namelen;
client.nbytesAuthString = conn_auth_datalen;
prefixread = _XSendClientPrefix(dpy, &client,
conn_auth_name, conn_auth_data,
&prefix);
if (prefixread < 0)
{
_XDisconnectDisplay (dpy->trans_conn);
Xfree ((char *)dpy);
return(NULL);
}
if (conn_auth_name) Xfree(conn_auth_name);
if (conn_auth_data) Xfree(conn_auth_data);
/*
* Now see if connection was accepted...
*/
/* these internal functions expect the display to be locked */
LockDisplay(dpy);
if (prefixread == 0)
_XRead (dpy, (char *)&prefix,(long)SIZEOF(xConnSetupPrefix));
/* an Authenticate reply we weren't expecting? */
if (prefix.success != xTrue && prefix.success != xFalse) {
fprintf (stderr,
"Xlib: unexpected connection setup reply from server, type %d.\r\n",
prefix.success);
_XDisconnectDisplay (dpy->trans_conn);
Xfree ((char *)dpy);
return(NULL);
}
if (prefix.majorVersion != X_PROTOCOL) {
/* XXX - printing messages marks a bad programming interface */
fprintf (stderr,
"Xlib: client uses different protocol version (%d) than server (%d)!\r\n",
X_PROTOCOL, prefix.majorVersion);
_XDisconnectDisplay (dpy->trans_conn);
Xfree ((char *)dpy);
OutOfMemory (dpy);
return(NULL);
}
#endif /* !USE_XCB */
#if USE_XCB
{
const struct xcb_setup_t *xcbsetup = xcb_get_setup(dpy->xcb->connection);
memcpy(&prefix, xcbsetup, sizeof(prefix));
......@@ -392,38 +281,6 @@ fallback_success:
setup += SIZEOF(xConnSetupPrefix);
u.setup = (xConnSetup *) setup;
}
#else /* !USE_XCB */
setuplength = prefix.length << 2;
if ( (u.setup = (xConnSetup *)
(setup = Xmalloc ((unsigned) setuplength))) == NULL) {
_XDisconnectDisplay (dpy->trans_conn);
Xfree ((char *)dpy);
return(NULL);
}
_XRead (dpy, (char *)u.setup, setuplength);
/*
* If the connection was not accepted by the server due to problems,
* give error message to the user....
*/
if (prefix.success != xTrue) {
/* XXX - printing messages marks a bad programming interface */
fprintf (stderr,
"Xlib: connection to \"%s\" refused by server\r\nXlib: ",
fullname);
if (prefix.lengthReason > setuplength) {
fprintf (stderr, "Xlib: Broken initial reply: length of reason > length of packet\r\n");
}else{
(void) fwrite (u.failure, (Size_t)sizeof(char),
(Size_t)prefix.lengthReason, stderr);
(void) fwrite ("\r\n", sizeof(char), 2, stderr);
}
OutOfMemory(dpy, setup);
return (NULL);
}
#endif /* USE_XCB */
/*
* Check if the reply was long enough to get any information out of it.
......@@ -431,7 +288,7 @@ fallback_success:
usedbytes = sz_xConnSetup;
if (setuplength < usedbytes ) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
OutOfMemory(dpy, setup);
OutOfMemory(dpy);
return (NULL);
}
......@@ -460,7 +317,7 @@ fallback_success:
{
fprintf (stderr, "Xlib: connection to \"%s\" invalid setup\n",
fullname);
OutOfMemory(dpy, setup);
OutOfMemory(dpy);
return (NULL);
}
......@@ -475,13 +332,13 @@ fallback_success:
*/
/* Check for a sane vendor string length */
if (u.setup->nbytesVendor > 256) {
OutOfMemory(dpy, setup);
OutOfMemory(dpy);
return (NULL);
}
dpy->vendor = (char *) Xmalloc((unsigned) (u.setup->nbytesVendor + 1));
if (dpy->vendor == NULL) {
OutOfMemory(dpy, setup);
OutOfMemory(dpy);
return (NULL);
}
vendorlen = u.setup->nbytesVendor;
......@@ -492,7 +349,7 @@ fallback_success:
usedbytes += (vendorlen + 3) & ~3;
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
OutOfMemory(dpy, setup);
OutOfMemory(dpy);
return (NULL);
}
......@@ -509,7 +366,7 @@ fallback_success:
(ScreenFormat *)Xmalloc(
(unsigned) (dpy->nformats *sizeof(ScreenFormat)));
if (dpy->pixmap_format == NULL) {
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
/*
......@@ -519,7 +376,7 @@ fallback_success:
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
......@@ -538,7 +395,7 @@ fallback_success:
dpy->screens =
(Screen *)Xmalloc((unsigned) dpy->nscreens*sizeof(Screen));
if (dpy->screens == NULL) {
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
......@@ -552,7 +409,7 @@ fallback_success:
usedbytes += sz_xWindowRoot;
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
......@@ -581,7 +438,7 @@ fallback_success:
sp->depths = (Depth *)Xmalloc(
(unsigned)sp->ndepths*sizeof(Depth));
if (sp->depths == NULL) {
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
/*
......@@ -593,7 +450,7 @@ fallback_success:
usedbytes += sz_xDepth;
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
......@@ -604,7 +461,7 @@ fallback_success:
dp->visuals =
(Visual *)Xmalloc((unsigned)dp->nvisuals*sizeof(Visual));
if (dp->visuals == NULL) {
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
for (k = 0; k < dp->nvisuals; k++) {
......@@ -613,7 +470,7 @@ fallback_success:
usedbytes += sz_xVisualType;
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
OutOfMemory (dpy, setup);
OutOfMemory (dpy);
return(NULL);
}
......@@ -646,7 +503,7 @@ fallback_success:
fprintf(stderr, "Xlib: Did not parse entire setup message: "
"parsed: %ld, message: %ld\n",
usedbytes, setuplength);
OutOfMemory(dpy, setup);
OutOfMemory(dpy);
return(NULL);
}
......@@ -654,30 +511,17 @@ fallback_success:
* Now start talking to the server to setup all other information...
*/
#if !USE_XCB
Xfree (setup); /* all finished with setup information */
#endif /* !USE_XCB */
/*
* Make sure default screen is legal.
*/
if (iscreen >= dpy->nscreens) {
OutOfMemory(dpy, (char *) NULL);
OutOfMemory(dpy);
return(NULL);
}
#if !USE_XCB
/*
* finished calling internal routines, now unlock for external routines
*/
UnlockDisplay(dpy);
#endif /* !USE_XCB */
#if USE_XCB
dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection);
if(dpy->bigreq_size <= dpy->max_request_size)
dpy->bigreq_size = 0;
#endif /* USE_XCB */
/*
* Set up other stuff clients are always going to use.
......@@ -690,7 +534,7 @@ fallback_success:
if ((sp->default_gc = XCreateGC (dpy, sp->root,
GCForeground|GCBackground,
&values)) == NULL) {