summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog28
-rw-r--r--Makefile.am8
-rw-r--r--Xext/security.c35
-rw-r--r--configure.ac38
-rw-r--r--dix/colormap.c103
-rw-r--r--dix/devices.c11
-rw-r--r--dix/dispatch.c55
-rw-r--r--dix/dixfonts.c9
-rw-r--r--dix/extension.c17
-rw-r--r--dix/property.c43
-rw-r--r--dix/swaprep.c12
-rw-r--r--include/dix-config.h.in3
-rw-r--r--include/dix.h4
-rw-r--r--include/dixstruct.h3
-rw-r--r--include/globals.h6
-rw-r--r--include/os.h11
-rw-r--r--include/propertyst.h8
-rw-r--r--include/swaprep.h11
-rw-r--r--lbx/Makefile.am21
-rw-r--r--lbx/lbxcmap.c1156
-rw-r--r--lbx/lbxdata.h48
-rw-r--r--lbx/lbxdix.c869
-rw-r--r--lbx/lbxexts.c275
-rw-r--r--lbx/lbxgfx.c854
-rw-r--r--lbx/lbxmain.c1760
-rw-r--r--lbx/lbxopts.c806
-rw-r--r--lbx/lbxprop.c549
-rw-r--r--lbx/lbxserve.h289
-rw-r--r--lbx/lbxsquish.c158
-rw-r--r--lbx/lbxsrvopts.h67
-rw-r--r--lbx/lbxswap.c828
-rw-r--r--lbx/lbxtables.c39
-rw-r--r--lbx/lbxtags.c237
-rw-r--r--lbx/lbxtags.h86
-rw-r--r--lbx/lbxzerorep.c420
-rw-r--r--mi/miinitext.c21
-rw-r--r--os/Makefile.am5
-rw-r--r--os/access.c6
-rw-r--r--os/connection.c212
-rw-r--r--os/io.c86
-rw-r--r--os/lbxio.c555
-rw-r--r--os/osdep.h26
-rw-r--r--os/utils.c5
43 files changed, 64 insertions, 9719 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e8678da5..9f504c237 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -66,6 +66,34 @@
* xkb/xkbLEDs.c:
Simplify the 'unsupported' list.
+ * configure.ac:
+ * Makefile.am:
+ * Xext/security.c:
+ * dix/colormap.c:
+ * dix/devices.c:
+ * dix/dixfonts.c:
+ * dix/dispatch.c:
+ * dix/extension.c:
+ * dix/property.c:
+ * dix/swaprep.c:
+ * include/dix.h:
+ * include/dix-config.h:
+ * include/dixstruct.h:
+ * include/globals.h:
+ * include/os.h:
+ * include/propertyst.h:
+ * include/swaprep.h:
+ * lbx/*:
+ * mi/miinitext.c:
+ * os/Makefile.am:
+ * os/access.c:
+ * os/connection.c:
+ * os/io.c:
+ * os/lbxio.c:
+ * os/osdep.h:
+ * os/utils.c:
+ Remove LBX. Goodbye.
+
2006-05-30 Matthieu Herrb <matthieu.herrb@laas.fr>
* hw/xfree86/os-support/bsd/Makefile.am:
diff --git a/Makefile.am b/Makefile.am
index 489d0868f..773e7690f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,10 +31,6 @@ XPDDX_DIR=Xprint
XPCONFIG_DIR=XpConfig
endif
-if LBX
-LBX_DIR=lbx
-endif
-
if XINPUT
XINPUT_DIR=Xi
endif
@@ -67,7 +63,6 @@ SUBDIRS = \
$(XTRAP_DIR) \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
- $(LBX_DIR) \
exa \
hw \
$(XPDDX_DIR) \
@@ -108,8 +103,7 @@ DIST_SUBDIRS = \
exa \
hw \
Xprint \
- XpConfig \
- lbx
+ XpConfig
# gross hack
relink: all
diff --git a/Xext/security.c b/Xext/security.c
index d3e9b4ff3..48a45d0a2 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: xserver/xorg/Xext/security.c,v 1.5 2005/07/03 07:01:04 daniels Exp $ */
+/* $XdotOrg: xserver/xorg/Xext/security.c,v 1.6 2006/03/28 01:20:59 ajax Exp $ */
/* $Xorg: security.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
/*
@@ -43,11 +43,6 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/securstr.h>
#include <assert.h>
#include <stdarg.h>
-#ifdef LBX
-#define _XLBX_SERVER_
-#include <X11/extensions/XLbx.h>
-extern unsigned char LbxReqCode;
-#endif
#ifdef XAPPGROUP
#include <X11/extensions/Xagsrv.h>
#endif
@@ -1066,18 +1061,6 @@ SecurityCheckResourceIDAccess(
default:
{
-#ifdef LBX
- /* XXX really need per extension dispatching */
- if (reqtype == LbxReqCode) {
- switch (((xReq *)client->requestBuffer)->data) {
- case X_LbxGetProperty:
- case X_LbxChangeProperty:
- return rval;
- default:
- break;
- }
- }
-#endif
/* others not allowed */
return SecurityAuditResourceIDAccess(client, id);
}
@@ -1178,22 +1161,6 @@ SecurityClientStateCallback(
}
} /* SecurityClientStateCallback */
-#ifdef LBX
-Bool
-SecuritySameLevel(client, authId)
- ClientPtr client;
- XID authId;
-{
- SecurityAuthorizationPtr pAuth;
-
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (pAuth)
- return client->trustLevel == pAuth->trustLevel;
- return client->trustLevel == XSecurityClientTrusted;
-}
-#endif
-
/* SecurityCensorImage
*
* Called after pScreen->GetImage to prevent pieces or trusted windows from
diff --git a/configure.ac b/configure.ac
index 43dbf464c..d65b176fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -411,7 +411,6 @@ AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF8
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: enabled)]), [XF86MISC=$enableval], [XF86MISC=yes])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=yes])
AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
-AC_ARG_ENABLE(lbx, AS_HELP_STRING([--disable-lbx], [Build LBX extension (default: no)]), [LBX=$enableval], [LBX=no])
AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=yes])
AC_ARG_ENABLE(cup, AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: enabled)]), [CUP=$enableval], [CUP=yes])
AC_ARG_ENABLE(evi, AS_HELP_STRING([--disable-evi], [Build Extended-Visual-Information extension (default: enabled)]), [EVI=$enableval], [EVI=yes])
@@ -598,24 +597,6 @@ if test "x$GLX_USE_TLS" = xyes -a "x$AIGLX" = xyes; then
fi
AC_SUBST([GLX_DEFINES])
-PKG_CHECK_MODULES([LBXUTIL_TEST], [lbxutil], [have_lbxutil=yes], [have_lbxutil=no])
-
-if test "x$LBX" = xauto; then
- if test "x$have_lbxutil" = "xyes"; then
- LBX="yes"
- else
- LBX="no"
- fi
-fi
-
-AM_CONDITIONAL(LBX, [test "x$LBX" = xyes])
-if test "x$LBX" = xyes; then
- AC_DEFINE(LBX, 1, [Support LBX extension])
- PKG_CHECK_MODULES([LBXUTIL], [lbxutil])
- LBX_LIB='$(top_builddir)/lbx/liblbx.la'" $LBXUTIL_LIBS"
- LBX_INC='-I$(top_srcdir)/lbx'" $LBXUTIL_CFLAGS"
-fi
-
AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
AC_DEFINE(XF86DRI, 1, [Build DRI extension])
@@ -874,7 +855,7 @@ AC_EGREP_CPP([I_AM_SVR4],[
AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
-XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC $LBX_INC"
+XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
dnl ---------------------------------------------------------------------------
@@ -902,7 +883,7 @@ if test "x$DMX" = xyes; then
modules not found.])
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC"
- XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_DAMAGE_LIB $LBX_LIB $MIEXT_SHADOW_LIB $OS_LIB $CWRAP_LIB"
+ XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $OS_LIB $CWRAP_LIB"
AC_SUBST([XDMX_LIBS])
dnl USB sources in DMX require <linux/input.h>
@@ -941,7 +922,7 @@ AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
if test "x$XVFB" = xyes; then
- XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XVFB_LIBS])
fi
@@ -957,7 +938,7 @@ AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
if test "x$XNEST" = xyes; then
- XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XNEST_LIBS])
fi
@@ -986,7 +967,7 @@ AC_MSG_RESULT([$XGL])
AM_CONDITIONAL(XGL, [test "x$XGL" = xyes])
if test "x$XGL" = xyes; then
- XGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XGL_LIBS])
AC_DEFINE(XGL_MODULAR, 1, [Use loadable XGL modules])
@@ -1007,7 +988,7 @@ AC_MSG_RESULT([$XEGL])
AM_CONDITIONAL(XEGL, [test "x$XEGL" = xyes])
if test "x$XEGL" = xyes; then
- XEGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XEGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XEGL_LIBS])
fi
@@ -1023,7 +1004,7 @@ AC_MSG_RESULT([$XGLX])
AM_CONDITIONAL(XGLX, [test "x$XGLX" = xyes])
if test "x$XGLX" = xyes; then
- XGLX_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XGLX_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XGLX_LIBS])
fi
@@ -1044,7 +1025,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
- XORG_LIBS="$MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
+ XORG_LIBS="$MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
AC_CHECK_LIB([dl], [dlopen], XORG_LIBS="$XORG_LIBS -ldl")
@@ -1297,7 +1278,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
- XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $LBX_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
+ XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
@@ -1636,7 +1617,6 @@ doc/Makefile
fb/Makefile
record/Makefile
XTrap/Makefile
-lbx/Makefile
mfb/Makefile
cfb/Makefile
cfb32/Makefile
diff --git a/dix/colormap.c b/dix/colormap.c
index a448010ea..ba52c251c 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: xserver/xorg/dix/colormap.c,v 1.12 2006/02/15 20:44:12 ajax Exp $ */
+/* $XdotOrg: xserver/xorg/dix/colormap.c,v 1.13 2006/05/22 15:47:56 ajax Exp $ */
/* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.11 2003/11/03 05:10:59 tsi Exp $ */
/***********************************************************
@@ -63,9 +63,6 @@ SOFTWARE.
#include "scrnintstr.h"
#include "resource.h"
#include "windowstr.h"
-#ifdef LBX
-#include "lbxserve.h"
-#endif
extern XID clientErrorValue;
extern int colormapPrivateCount;
@@ -1515,65 +1512,17 @@ FreePixels(register ColormapPtr pmap, register int client)
register Pixel *ppix, *ppixStart;
register int n;
int class;
-#ifdef LBX
- Bool grabbed;
- Bool zeroRefCount;
- Bool anyRefCountReachedZero = 0;
-#endif
class = pmap->class;
ppixStart = pmap->clientPixelsRed[client];
if (class & DynamicClass)
{
n = pmap->numPixelsRed[client];
-#ifdef LBX
- grabbed = LbxCheckCmapGrabbed (pmap);
- if (grabbed)
- {
- /*
- * If the colormap is grabbed by a proxy, the server must
- * notify the proxy of all cells that are freed (the refcount
- * has reached zero on these cells).
- */
-
- LbxBeginFreeCellsEvent (pmap);
- LbxSortPixelList (ppixStart, n);
- }
-#endif
for (ppix = ppixStart; --n >= 0; )
{
FreeCell(pmap, *ppix, REDMAP);
-#ifdef LBX
- /*
- * Only PSEUDO colormaps are grabbed by LBX proxies.
- * Check if the ref count reached zero on this pixel.
- */
-
- zeroRefCount = pmap->red[*ppix].refcnt == 0;
- if (zeroRefCount)
- anyRefCountReachedZero = 1;
-
- if (grabbed && zeroRefCount)
- LbxAddFreeCellToEvent (pmap, *ppix);
-#endif
ppix++;
}
-#ifdef LBX
- if (grabbed)
- LbxEndFreeCellsEvent (pmap);
- else if (anyRefCountReachedZero)
- {
- /*
- * We only send LbxFreeCell events to a proxy that has the colormap
- * grabbed. If the colormap is not grabbed, the proxy that last
- * had the colormap grabbed will not be able to do a smart grab
- * in the future. A smart grab can only occur if the proxy is kept
- * up to date on every alloc/free change in the colormap.
- */
-
- LbxDisableSmartGrab (pmap);
- }
-#endif
}
xfree(ppixStart);
@@ -2323,11 +2272,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
int n, zapped;
int errVal = Success;
int offset, numents;
-#ifdef LBX
- Bool grabbed;
- Bool zeroRefCount;
- Bool anyRefCountReachedZero = 0;
-#endif
if (npixIn == 0)
return (errVal);
@@ -2372,21 +2316,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
break;
}
-#ifdef LBX
- grabbed = LbxCheckCmapGrabbed (pmap);
-
- if (grabbed)
- {
- /*
- * If the colormap is grabbed by a proxy, the server must
- * notify the proxy of all cells that are freed (the refcount
- * has reached zero on these cells).
- */
-
- LbxBeginFreeCellsEvent (pmap);
- LbxSortPixelList (ppixIn, npixIn);
- }
-#endif
/* zap all pixels which match */
while (1)
@@ -2412,19 +2341,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
if (pmap->class & DynamicClass)
{
FreeCell(pmap, pixTest, color);
-#ifdef LBX
- /*
- * Only PSEUDO colormaps are grabbed by LBX proxies.
- * Check if the ref count reached zero on this pixel.
- */
-
- zeroRefCount = pmap->red[pixTest].refcnt == 0;
- if (zeroRefCount)
- anyRefCountReachedZero = 1;
-
- if (grabbed && zeroRefCount)
- LbxAddFreeCellToEvent (pmap, pixTest);
-#endif
}
*cptr = ~((Pixel)0);
zapped++;
@@ -2436,23 +2352,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
GetNextBitsOrBreak(bits, mask, base);
}
-#ifdef LBX
- if (grabbed)
- LbxEndFreeCellsEvent (pmap);
- else if (anyRefCountReachedZero)
- {
- /*
- * We only send LbxFreeCell events to a proxy that has the colormap
- * grabbed. If the colormap is not grabbed, the proxy that last
- * had the colormap grabbed will not be able to do a smart grab
- * in the future. A smart grab can only occur if the proxy is kept
- * up to date on every alloc/free change in the colormap.
- */
-
- LbxDisableSmartGrab (pmap);
- }
-#endif
-
/* delete freed pixels from client pixel list */
if (zapped)
{
diff --git a/dix/devices.c b/dix/devices.c
index 245992e45..ef1bdf354 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -48,7 +48,7 @@ SOFTWARE.
/* $Xorg: devices.c,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $ */
-/* $XdotOrg: xserver/xorg/dix/devices.c,v 1.10 2006/03/28 01:20:59 ajax Exp $ */
+/* $XdotOrg: xserver/xorg/dix/devices.c,v 1.11 2006/06/01 19:22:37 daniels Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -74,9 +74,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
#include "dispatch.h"
#include "swaprep.h"
@@ -962,9 +959,6 @@ ProcSetModifierMapping(ClientPtr client)
return BadAccess;
#endif
-#ifdef LBX
- LbxFlushModifierMapTag();
-#endif
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@@ -1088,9 +1082,6 @@ ProcChangeKeyboardMapping(ClientPtr client)
keysyms.map = (KeySym *)&stuff[1];
if (!SetKeySymsMap(curKeySyms, &keysyms))
return BadAlloc;
-#ifdef LBX
- LbxFlushKeyboardMapTag();
-#endif
SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
client);
return client->noClientException;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index c88398e68..c8ee8d610 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: xserver/xorg/dix/dispatch.c,v 1.13 2005/09/13 01:33:19 daniels Exp $ */
+/* $XdotOrg: xserver/xorg/dix/dispatch.c,v 1.14 2006/02/15 20:44:12 ajax Exp $ */
/* $Xorg: dispatch.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
/************************************************************
@@ -119,9 +119,6 @@ int ProcInitialConnection();
#include "inputstr.h"
#include <X11/extensions/XKBsrv.h>
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
#define mskcnt ((MAXCLIENTS + 31) / 32)
#define BITMASK(i) (1U << ((i) & 31))
@@ -2602,15 +2599,6 @@ ProcAllocColor (register ClientPtr client)
RT_COLORMAP, SecurityWriteAccess);
if (pmap)
{
-#ifdef LBX
- /*
- * If the colormap is grabbed by a proxy, the server will have
- * to regain control over the colormap. This AllocColor request
- * will be handled after the server gets back the colormap control.
- */
- if (LbxCheckColorRequest (client, pmap, (xReq *) stuff))
- return Success;
-#endif
acr.type = X_Reply;
acr.length = 0;
acr.sequenceNumber = client->sequence;
@@ -2655,15 +2643,6 @@ ProcAllocNamedColor (register ClientPtr client)
xAllocNamedColorReply ancr;
-#ifdef LBX
- /*
- * If the colormap is grabbed by a proxy, the server will have
- * to regain control over the colormap. This AllocNamedColor request
- * will be handled after the server gets back the colormap control.
- */
- if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
- return Success;
-#endif
ancr.type = X_Reply;
ancr.length = 0;
ancr.sequenceNumber = client->sequence;
@@ -2717,15 +2696,6 @@ ProcAllocColorCells (register ClientPtr client)
long length;
Pixel *ppixels, *pmasks;
-#ifdef LBX
- /*
- * If the colormap is grabbed by a proxy, the server will have
- * to regain control over the colormap. This AllocColorCells request
- * will be handled after the server gets back the colormap control.
- */
- if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
- return Success;
-#endif
npixels = stuff->colors;
if (!npixels)
{
@@ -2792,15 +2762,6 @@ ProcAllocColorPlanes(register ClientPtr client)
long length;
Pixel *ppixels;
-#ifdef LBX
- /*
- * If the colormap is grabbed by a proxy, the server will have
- * to regain control over the colormap. This AllocColorPlanes request
- * will be handled after the server gets back the colormap control.
- */
- if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
- return Success;
-#endif
npixels = stuff->colors;
if (!npixels)
{
@@ -3570,9 +3531,6 @@ CloseDownClient(register ClientPtr client)
if (ClientIsAsleep(client))
ClientSignal (client);
ProcessWorkQueueZombies();
-#ifdef LBX
- ProcessQTagZombies();
-#endif
CloseDownConnection(client);
/* If the client made it to the Running stage, nClients has
@@ -3690,9 +3648,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
}
#endif
client->replyBytesRemaining = 0;
-#ifdef LBX
- client->readRequest = StandardReadRequestFromClient;
-#endif
#ifdef XCSECURITY
client->trustLevel = XSecurityClientTrusted;
client->CheckAccess = NULL;
@@ -3826,14 +3781,6 @@ ProcInitialConnection(register ClientPtr client)
return (client->noClientException);
}
-#ifdef LBX
-void
-IncrementClientCount()
-{
- nClients++;
-}
-#endif
-
int
SendConnSetup(register ClientPtr client, char *reason)
{
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index a3ccf6c1e..cb0df3c30 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: xserver/xorg/dix/dixfonts.c,v 1.8 2005/07/03 08:53:38 daniels Exp $ */
+/* $XdotOrg: xserver/xorg/dix/dixfonts.c,v 1.9 2006/02/15 20:44:12 ajax Exp $ */
/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.28 2003/11/08 02:02:03 dawes Exp $ */
/************************************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
@@ -76,10 +76,6 @@ Equipment Corporation.
#include "panoramiX.h"
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
-
#ifdef XF86BIGFONT
#define _XF86BIGFONT_SERVER_
#include <X11/extensions/xf86bigfont.h>
@@ -491,9 +487,6 @@ CloseFont(pointer value, XID fid)
}
if (pfont == defaultFont)
defaultFont = NULL;
-#ifdef LBX
- LbxFreeFontTag(pfont);
-#endif
#ifdef XF86BIGFONT
XF86BigfontFreeFontShm(pfont);
#endif
diff --git a/dix/extension.c b/dix/extension.c
index 3e379d7fe..f6f38fcf3 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -65,9 +65,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#endif
#define EXTENSION_BASE 128
#define EXTENSION_EVENT_BASE 64
@@ -154,9 +151,6 @@ AddExtension(char *name, int NumEvents, int NumErrors,
ext->secure = FALSE;
#endif
-#ifdef LBX
- (void) LbxAddExtension(name, ext->base, ext->eventBase, ext->errorBase);
-#endif
return(ext);
}
@@ -176,11 +170,7 @@ _X_EXPORT Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
strcpy(name, alias);
ext->aliases[ext->num_aliases] = name;
ext->num_aliases++;
-#ifdef LBX
- return LbxAddExtensionAlias(ext->index, alias);
-#else
return TRUE;
-#endif
}
static int
@@ -241,9 +231,6 @@ DeclareExtensionSecurity(char *extname, Bool secure)
}
}
#endif
-#ifdef LBX
- LbxDeclareExtensionSecurity(extname, secure);
-#endif
}
_X_EXPORT unsigned short
@@ -271,10 +258,6 @@ CloseDownExtensions()
{
register int i,j;
-#ifdef LBX
- LbxCloseDownExtensions();
-#endif
-
for (i = NumExtensions - 1; i >= 0; i--)
{
(* extensions[i]->CloseDown)(extensions[i]);
diff --git a/dix/property.c b/dix/property.c
index 3dc1afd68..e074c68dd 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -64,19 +64,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
-#ifdef LBX
-#include "lbxserve.h"
-#include "lbxtags.h"
-#endif
-
-#if defined(LBX) || defined(LBX_COMPAT)
-#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
@@ -261,13 +248,8 @@ ProcChangeProperty(ClientPtr client)
}
#endif
-#ifdef LBX
- err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type,
- (int)format, (int)mode, len, TRUE, (pointer)&stuff[1], TRUE, NULL);
-#else
err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format,
(int)mode, len, (pointer)&stuff[1], TRUE);
-#endif
if (err != Success)
return err;
else
@@ -279,11 +261,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, pointer value,
Bool sendevent)
{
-#ifdef LBX
- return LbxChangeWindowProperty(NULL, pWin, property, type,
- format, mode, len, TRUE, value,
- sendevent, NULL);
-#else
PropertyPtr pProp;
xEvent event;
int sizeInBytes;
@@ -390,7 +367,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
}
return(Success);
-#endif
}
int
@@ -420,10 +396,6 @@ DeleteProperty(WindowPtr pWin, Atom propName)
{
prevProp->next = pProp->next;
}
-#ifdef LBX
- if (pProp->tag_id)
- TagDeleteTag(pProp->tag_id);
-#endif
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -445,10 +417,6 @@ DeleteAllWindowProperties(WindowPtr pWin)
pProp = wUserProps (pWin);
while (pProp)
{
-#ifdef LBX
- if (pProp->tag_id)
- TagDeleteTag(pProp->tag_id);
-#endif
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -569,13 +537,6 @@ ProcGetProperty(ClientPtr client)
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
return(Success);
}
-#ifdef LBX
- /* make sure we have the current value */
- if (pProp->tag_id && pProp->owner_pid) {
- LbxStallPropRequest(client, pProp);
- return client->noClientException;
- }
-#endif
/*
* Return type, format, value to client
@@ -626,10 +587,6 @@ ProcGetProperty(ClientPtr client)
if (stuff->delete && (reply.bytesAfter == 0))
{ /* delete the Property */
-#ifdef LBX
- if (pProp->tag_id)
- TagDeleteTag(pProp->tag_id);
-#endif
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
{
if (!(pWin->optional->userProps = pProp->next))
diff --git a/dix/swaprep.c b/dix/swaprep.c
index 5c05d3682..bff404c1c 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -65,11 +65,9 @@ SOFTWARE.
static void SwapFontInfo(xQueryFontReply *pr);
-#ifndef LBX
static void SwapCharInfo(xCharInfo *pInfo);
static void SwapFont(xQueryFontReply *pr, Bool hasGlyphs);
-#endif
/**
* Thanks to Jack Palevich for testing and subsequently rewriting all this
@@ -391,10 +389,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep)
(void)WriteToClient(pClient, size, (char *) pRep);
}
-#ifndef LBX
-static
-#endif
-void
+static void
SwapCharInfo(xCharInfo *pInfo)
{
register char n;
@@ -423,10 +418,7 @@ SwapFontInfo(xQueryFontReply *pr)
swapl(&pr->nCharInfos, n);
}
-#ifndef LBX
-static
-#endif
-void
+static void
SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
{
unsigned i;
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index f33e5827f..4c3a4b7a0 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -374,9 +374,6 @@
/* Support Xv extension */
#undef XV
-/* Build LBX extension */
-#undef LBX
-
/* Build APPGROUP extension */
#undef XAPPGROUP
diff --git a/include/dix.h b/include/dix.h
index 1b8fc4265..1687f751a 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -368,10 +368,6 @@ extern int DoGetImage(
Mask /*planemask*/,
xGetImageReply ** /*im_return*/);
-#ifdef LBX
-extern void IncrementClientCount(void);
-#endif /* LBX */
-
#if defined(DDXBEFORERESET)
extern void ddxBeforeReset (void);
#endif
diff --git a/include/dixstruct.h b/include/dixstruct.h
index d7d810272..f38a64d07 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -129,9 +129,6 @@ typedef struct _Client {
unsigned char requestLog[MAX_REQUEST_LOG];
int requestLogIndex;
#endif
-#ifdef LBX
- int (*readRequest)(ClientPtr /*client*/);
-#endif
unsigned long replyBytesRemaining;
#ifdef XCSECURITY
XID authId;
diff --git a/include/globals.h b/include/globals.h
index a661d8b63..95e11fe70 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -1,4 +1,4 @@
-/* $XdotOrg: xserver/xorg/include/globals.h,v 1.10 2006/01/08 23:43:54 ajax Exp $ */
+/* $XdotOrg: xserver/xorg/include/globals.h,v 1.11 2006/04/05 21:08:45 fredrik Exp $ */
/* $XFree86: xc/programs/Xserver/include/globals.h,v 1.3 1999/09/25 14:38:21 dawes Exp $ */
#ifndef _XSERV_GLOBAL_H_
@@ -84,10 +84,6 @@ extern Bool noFontCacheExtension;
extern Bool noGlxExtension;
#endif
-#ifdef LBX
-extern Bool noLbxExtension;
-#endif
-
#ifdef SCREENSAVER
extern Bool noScreenSaverExtension;
#endif
diff --git a/include/os.h b/include/os.h
index 5a2e6c972..0885bb298 100644
--- a/include/os.h
+++ b/include/os.h
@@ -109,14 +109,7 @@ extern int WaitForSomething(
int* /*pClientsReady*/
);
-#ifdef LBX
-#define ReadRequestFromClient(client) ((client)->readRequest(client))
-extern int StandardReadRequestFromClient(ClientPtr /*client*/);
-
-extern int ClientConnectionNumber(ClientPtr /*client*/);
-#else
extern int ReadRequestFromClient(ClientPtr /*client*/);
-#endif /* LBX */
extern Bool InsertFakeRequest(
ClientPtr /*client*/,
@@ -176,10 +169,6 @@ extern void MakeClientGrabImpervious(ClientPtr /*client*/);
extern void MakeClientGrabPervious(ClientPtr /*client*/);
-#ifdef LBX
-extern void CloseDownFileDescriptor(ClientPtr /* client */);
-#endif
-
extern void AvailableClientInput(ClientPtr /* client */);
extern CARD32 GetTimeInMillis(void);
diff --git a/include/propertyst.h b/include/propertyst.h
index 177fca171..9502a7261 100644
--- a/include/propertyst.h
+++ b/include/propertyst.h
@@ -62,14 +62,6 @@ typedef struct _Property {
short format; /* format of data for swapping - 8,16,32 */
long size; /* size of data in (format/8) bytes */
pointer data; /* private to client */
-#if defined(LBX) || defined(LBX_COMPAT)
- /* If space is at a premium and binary compatibility is not
- * an issue, you may want to put the owner_pid next to format
- * so that the two shorts pack together without padding.
- */
- short owner_pid; /* proxy that has the data */
- XID tag_id;
-#endif
} PropertyRec;
#endif /* PROPERTYSTRUCT_H */
diff --git a/include/swaprep.h b/include/swaprep.h
index 2c026c659..d18b39f0c 100644
--- a/include/swaprep.h
+++ b/include/swaprep.h
@@ -120,17 +120,6 @@ extern void SQueryKeymapReply(
int /* size */,
xQueryKeymapReply * /* pRep */);
-#ifdef LBX
-extern void SwapCharInfo(
- xCharInfo * /* pInfo */);
-#endif
-
-#ifdef LBX
-extern void SwapFont(
- xQueryFontReply * /* pr */,
- Bool /* hasGlyphs */);
-#endif
-
extern void SQueryFontReply(
ClientPtr /* pClient */,
int /* size */,
diff --git a/lbx/Makefile.am b/lbx/Makefile.am
deleted file mode 100644
index a3c249a0a..000000000
--- a/lbx/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-noinst_LTLIBRARIES = liblbx.la
-
-AM_CFLAGS = $(DIX_CFLAGS) @SERVER_DEFINES@ @LOADER_DEFINES@
-
-liblbx_la_SOURCES = \
- lbxcmap.c \
- lbxdata.h \
- lbxdix.c \
- lbxexts.c \
- lbxgfx.c \
- lbxmain.c \
- lbxopts.c \
- lbxprop.c \
- lbxserve.h \
- lbxsquish.c \
- lbxsrvopts.h \
- lbxswap.c \
- lbxtables.c \
- lbxtags.c \
- lbxtags.h \
- lbxzerorep.c
diff --git a/lbx/lbxcmap.c b/lbx/lbxcmap.c
deleted file mode 100644
index 3ae598bc6..000000000
--- a/lbx/lbxcmap.c
+++ /dev/null
@@ -1,1156 +0,0 @@
-/* $Xorg: lbxcmap.c,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */
-
-/*
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-*/
-/* $XFree86: xc/programs/Xserver/lbx/lbxcmap.c,v 1.9 2001/08/23 14:46:57 alanh Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "scrnintstr.h"
-#include "colormapst.h"
-#include "propertyst.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include "lbxserve.h"
-#include <X11/Xfuncproto.h>
-#include <stdio.h>
-
-static int lbxScreenPrivIndex; /* lbx screen private index */
-static int lbxColormapPrivIndex; /* lbx colormap private index */
-
-typedef struct { /* lbx screen private */
- CreateColormapProcPtr CreateColormap;
- DestroyColormapProcPtr DestroyColormap;
- CloseScreenProcPtr CloseScreen;
-} LbxScreenPriv;
-
-typedef struct _LbxStalled {
- XID id;
- struct _LbxStalled *next;
-} LbxStalled;
-
-typedef struct _LbxColormapPriv { /* lbx colormap private */
- char grab_status;
- char smart_grab;
- LbxProxyPtr grabber;
- int last_grabber; /* uid, not pid */
- LbxStalled *stalled_clients;
- ColormapPtr next; /* proxy chain */
-} LbxColormapPriv;
-
-#define CMAP_NOT_GRABBED 0
-#define CMAP_GRABBED 1
-#define CMAP_WAITING_FOR_UNGRAB 2
-
-static int LbxUnstallClient(pointer data, XID id);
-
-static RESTYPE StalledResType;
-
-/*
- * Initialize the fields in the colormap private allocated for LBX.
- */
-
-static LbxColormapPriv *
-LbxColormapPrivInit (ColormapPtr pmap)
-{
- LbxColormapPriv *cmapPriv;
-
- cmapPriv = (LbxColormapPriv *) xalloc (sizeof (LbxColormapPriv));
- if (!cmapPriv)
- return cmapPriv;
-
- pmap->devPrivates[lbxColormapPrivIndex].ptr = (pointer) cmapPriv;
-
- cmapPriv->grab_status = CMAP_NOT_GRABBED;
- cmapPriv->grabber = NULL;
- cmapPriv->last_grabber = 0;
- cmapPriv->smart_grab = FALSE;
- cmapPriv->stalled_clients = NULL;
- cmapPriv->next = NULL;
-
- return cmapPriv;
-}
-
-
-static int
-LbxDefCmapPrivInit (ColormapPtr pmap, int index)
-{
-#if 0
- /* BUG: You can't do that. lbxColormapPrivIndex hasn't
- been initialized yet. */
- pmap->devPrivates[lbxColormapPrivIndex].ptr = NULL;
-#endif
- return 1;
-}
-
-static Bool
-LbxCreateColormap (ColormapPtr pmap)
-{
- ScreenPtr pScreen = pmap->pScreen;
- Bool ret;
-
- pScreen->CreateColormap = ((LbxScreenPriv *) (pScreen->devPrivates[
- lbxScreenPrivIndex].ptr))->CreateColormap;
-
- pmap->devPrivates[lbxColormapPrivIndex].ptr = NULL;
- ret = (*pScreen->CreateColormap) (pmap);
-
- pScreen->CreateColormap = LbxCreateColormap;
-
- return ret;
-}
-
-static void
-LbxDestroyColormap (ColormapPtr pmap)
-{
- ScreenPtr pScreen = pmap->pScreen;
-
- LbxReleaseCmap(pmap, FALSE);
- pScreen->DestroyColormap = ((LbxScreenPriv *) (pScreen->devPrivates[
- lbxScreenPrivIndex].ptr))->DestroyColormap;
- (*pScreen->DestroyColormap) (pmap);
- if (pmap->devPrivates && pmap->devPrivates[lbxColormapPrivIndex].ptr)
- xfree(pmap->devPrivates[lbxColormapPrivIndex].ptr);
- pScreen->DestroyColormap = LbxDestroyColormap;
-}
-
-static Bool
-LbxCloseScreen(int i, ScreenPtr pScreen)
-{
- LbxScreenPriv* pLbxScrPriv = ((LbxScreenPriv *)
- (pScreen->devPrivates[lbxScreenPrivIndex].ptr));
-
- pScreen->CloseScreen = pLbxScrPriv->CloseScreen;
-
- xfree(pScreen->devPrivates[lbxScreenPrivIndex].ptr);
- pScreen->devPrivates[lbxScreenPrivIndex].ptr = NULL;
-
- return pScreen->CloseScreen(i, pScreen);
-}
-
-/*
- * Initialize LBX colormap private.
- */
-
-int
-LbxCmapInit (void)
-
-{
- LbxScreenPriv *pScreenPriv;
- ColormapPtr defMap;
- ScreenPtr pScreen;
- int i;
-
- StalledResType = CreateNewResourceType(LbxUnstallClient);
-
- lbxScreenPrivIndex = AllocateScreenPrivateIndex ();
- if (lbxScreenPrivIndex < 0)
- return 0;
-
- lbxColormapPrivIndex = AllocateColormapPrivateIndex (LbxDefCmapPrivInit);
- if (lbxColormapPrivIndex < 0)
- return 0;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
-
- defMap = (ColormapPtr) LookupIDByType(
- pScreen->defColormap, RT_COLORMAP);
-
- /* now lbxColormapPrivIndex exists */
- defMap->devPrivates[lbxColormapPrivIndex].ptr = NULL;
-
- pScreenPriv = (LbxScreenPriv *) xalloc (sizeof (LbxScreenPriv));
- if (!pScreenPriv)
- return 0;
-
- pScreenPriv->CreateColormap = pScreen->CreateColormap;
- pScreen->CreateColormap = LbxCreateColormap;
- pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
- pScreen->DestroyColormap = LbxDestroyColormap;
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = LbxCloseScreen;
- pScreen->devPrivates[lbxScreenPrivIndex].ptr = (pointer) pScreenPriv;
- }
-
- return 1;
-}
-
-/*
- * Return the number of allocated cells in the PSEUDO colormap.
- */
-
-static int
-NumAllocatedCells (EntryPtr pent,
- int size)
-{
- Pixel pixel;
- int count = 0;
-
- for (pixel = 0; pixel < size; pixel++)
- {
- if (pent[pixel].refcnt != 0 && pent[pixel].refcnt != AllocTemporary)
- count++;
- }
-
- return count;
-}
-
-#define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1)
-#define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1)
-#define NUMBLUE(vis) ((vis->blueMask >> vis->offsetBlue) + 1)
-
-#define PIX_OUT(ptr,is2,val) \
- if (is2) *ptr++ = (val) >> 8; \
- *ptr++ = (val)
-#define RGB_OUT(ptr,is2,shift,val) \
- *ptr++ = (val) >> shift; \
- if (is2) *ptr++ = (val)
-
-/*
- * Return the list of allocated cells in the channel in
- * the format required by LbxGrabCmapReply.
- */
-
-static CARD8 *
-OutputChannel(ColormapPtr pmap,
- EntryPtr chan,
- int size,
- CARD8 *ptr,
- CARD8 flags,
- CARD8 channels)
-{
- Bool px2;
- Bool rgb2;
- int shift;
- int rgb_sz;
- Pixel pixel;
- EntryPtr pent;
- CARD8 *pixel_private_range_ptr = NULL;
- CARD8 *pixel_shared_range_ptr = NULL;
- int allocpriv;
-
- px2 = (flags & LBX_2BYTE_PIXELS) != 0;
- rgb2 = (flags & LBX_RGB_BITS_MASK) > 7;
- if (rgb2)
- shift = 8;
- else
- shift = 15 - (flags & LBX_RGB_BITS_MASK);
- rgb_sz = rgb2 + 1;
- if (channels == (DoRed|DoGreen|DoBlue))
- rgb_sz *= 3;
- /* kinda gross, but ddxen use AllocAll on static maps */
- allocpriv = (pmap->pVisual->class & DynamicClass) ? AllocPrivate : 0;
- for (pixel = 0; pixel < size; pixel++)
- {
- pent = (EntryPtr) &chan[pixel];
-
- if (pent->refcnt == 0 || pent->refcnt == AllocTemporary)
- {
- /*
- * A free pixel. This disrupts all ranges.
- */
-
- pixel_private_range_ptr = pixel_shared_range_ptr = NULL;
-
- continue;
- }
- else if (pent->refcnt == allocpriv)
- {
- /*
- * A private pixel. This disrupts any PIXEL_SHARED_RANGE.
- */
-
- pixel_shared_range_ptr = NULL;
-
- if (!pixel_private_range_ptr)
- {
- pixel_private_range_ptr = ptr;
-
- *ptr++ = LBX_PIXEL_PRIVATE;
- PIX_OUT(ptr, px2, pixel);
- }
- else
- {
- CARD8 *pos = pixel_private_range_ptr + 2 + px2;
- if (*pixel_private_range_ptr == LBX_PIXEL_PRIVATE) {
- *pixel_private_range_ptr = LBX_PIXEL_RANGE_PRIVATE;
- ptr += 1 + px2;
- }
- PIX_OUT(pos, px2, pixel);
- }
- }
- else
- {
- /*
- * A shared pixel. This disrupts any PIXEL_PRIVATE_RANGE.
- */
-
- pixel_private_range_ptr = NULL;
-
- if (!pixel_shared_range_ptr)
- {
- pixel_shared_range_ptr = ptr;
-
- *ptr++ = LBX_PIXEL_SHARED;
- PIX_OUT(ptr, px2, pixel);
- }
- else
- {
- CARD8 *pos = pixel_shared_range_ptr + 2 + px2;
- if (*pixel_shared_range_ptr == LBX_PIXEL_SHARED)
- {
- *pixel_shared_range_ptr = LBX_PIXEL_RANGE_SHARED;
- memmove (pos + 1 + px2, pos, rgb_sz);
- ptr += 1 + px2;
- }
- PIX_OUT(pos, px2, pixel);
- }
-
- if (channels & DoRed) {
- RGB_OUT(ptr, rgb2, shift, pent->co.local.red);
- }
- if (channels & DoGreen) {
- RGB_OUT(ptr, rgb2, shift, pent->co.local.green);
- }
- if (channels & DoBlue) {
- RGB_OUT(ptr, rgb2, shift, pent->co.local.blue);
- }
- }
- }
- return ptr;
-}
-
-static void
-GetAllocatedCells (ColormapPtr pmap,
- CARD8 *flags,
- CARD8 *buf,
- int *bytes)
-{
- CARD8 *ptr;
-
- *flags = pmap->pVisual->bitsPerRGBValue - 1;
- if (pmap->pVisual->ColormapEntries > 256)
- *flags |= LBX_2BYTE_PIXELS;
- if (!(pmap->pVisual->class & DynamicClass))
- *flags |= LBX_AUTO_RELEASE;
- if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
- *flags |= LBX_3CHANNELS;
- ptr = OutputChannel(pmap, pmap->red, NUMRED(pmap->pVisual),
- buf, *flags, DoRed);
- *ptr++ = LBX_NEXT_CHANNEL;
- ptr = OutputChannel(pmap, pmap->green, NUMGREEN(pmap->pVisual),
- ptr, *flags, DoGreen);
- *ptr++ = LBX_NEXT_CHANNEL;
- ptr = OutputChannel(pmap, pmap->blue, NUMBLUE(pmap->pVisual),
- ptr, *flags, DoBlue);
- } else
- ptr = OutputChannel(pmap, pmap->red, pmap->pVisual->ColormapEntries,
- buf, *flags, DoRed|DoGreen|DoBlue);
- *ptr++ = LBX_LIST_END;
- *bytes = ptr - buf;
-}
-
-
-/*
- * Send an LbxReleaseCmapEvent to a proxy.
- */
-
-static void
-SendReleaseCmapEvent (LbxProxyPtr proxy,
- Colormap cmap)
-{
- xLbxReleaseCmapEvent ev;
- ClientPtr client;
- LbxClientPtr lbxcp;
- int n;
-
- lbxcp = proxy->lbxClients[0];
-
- if (lbxcp && (client = lbxcp->client))
- {
- ev.type = LbxEventCode;
- ev.lbxType = LbxReleaseCmapEvent;
- ev.sequenceNumber = client->sequence;
- ev.colormap = cmap;
- ev.pad1 = ev.pad2 = ev.pad3 = ev.pad4 = ev.pad5 = ev.pad6 = 0;
-
- if (client->swapped)
- {
- swaps(&ev.sequenceNumber, n);
- swapl(&ev.colormap, n);
- }
-
- WriteToClient(client, sz_xLbxReleaseCmapEvent, (char *) &ev);
- LbxForceOutput(proxy);
-
-#ifdef COLOR_DEBUG
- fprintf (stderr,
- "Sent LbxReleaseCmapEvent to proxy %d, seq = 0x%x, cmap = 0x%x\n",
- proxy->pid, client->sequence, cmap);
-#endif
- }
-}
-
-
-/*
- * WaitForServerCmapControl checks if the colormap is grabbed by a proxy,
- * and if so, sends an LbxReleaseCmapEvent to the proxy. It then suspends
- * the current request until the server gets the ReleaseCmap message from
- * the proxy.
- */
-
-static Bool
-WaitForServerCmapControl (ClientPtr client,
- ColormapPtr pmap)
-{
- LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
- LbxStalled *stalled;
-
- if (cmapPriv->grab_status == CMAP_GRABBED)
- {
- /*
- * Send an LbxReleaseCmapEvent to the proxy that has the grab.
- */
-
- SendReleaseCmapEvent (cmapPriv->grabber, pmap->mid);
- cmapPriv->grab_status = CMAP_WAITING_FOR_UNGRAB;
- }
-
- stalled = (LbxStalled *)xalloc(sizeof(LbxStalled));
- if (!stalled)
- return FALSE;
- stalled->id = FakeClientID(client->index);
- stalled->next = cmapPriv->stalled_clients;
- cmapPriv->stalled_clients = stalled;
- return AddResource(stalled->id, StalledResType, (pointer)cmapPriv);
-}
-
-
-/*
- * When the X server gets any of the requests that allocate color cells,
- * it calls LbxCheckColorRequest on the request. This function will check
- * if the colormap is grabbed by a proxy, and if so, will suspend the
- * current request and wait for the proxy to release the colormap.
- */
-
-Bool
-LbxCheckColorRequest (ClientPtr client,
- ColormapPtr pmap,
- xReq *req)
-{
- LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
-
- if (!cmapPriv)
- return FALSE;
-
- if (cmapPriv->grab_status != CMAP_NOT_GRABBED)
- {
- /*
- * The colormap is grabbed by a proxy. Reset this request, and
- * process it after the server gets back control of the colormap.
- * Before we reset the request, we must put it back in the
- * client's byte order.
- */
-
- if (!WaitForServerCmapControl (client, pmap))
- return FALSE;
-
- if (client->swapped)
- {
- register int n;
-
- switch (req->reqType)
- {
- case X_AllocColor:
- {
- xAllocColorReq *stuff = (xAllocColorReq *) req;
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
- swaps(&stuff->red, n);
- swaps(&stuff->green, n);
- swaps(&stuff->blue, n);
- break;
- }
- case X_AllocNamedColor:
- {
- xAllocNamedColorReq *stuff = (xAllocNamedColorReq *) req;
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
- swaps(&stuff->nbytes, n);
- break;
- }
- case X_AllocColorCells:
- {
- xAllocColorCellsReq *stuff = (xAllocColorCellsReq *) req;
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
- swaps(&stuff->colors, n);
- swaps(&stuff->planes, n);
- break;
- }
- case X_AllocColorPlanes:
- {
- xAllocColorPlanesReq *stuff = (xAllocColorPlanesReq *) req;
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
- swaps(&stuff->colors, n);
- swaps(&stuff->red, n);
- swaps(&stuff->green, n);
- swaps(&stuff->blue, n);
- break;
- }
- default:
- break;
- }
- }
-
- ResetCurrentRequest(client);
- client->sequence--;
- IgnoreClient(client);
-
- return TRUE;
- }
-
- if (!LbxClient(client) ||
- LbxProxy(client)->uid != cmapPriv->last_grabber)
- {
- /*
- * Next time the proxy for this client does a colormap grab, it
- * will have to get the colormap state (a non-smart grab).
- */
-
- cmapPriv->smart_grab = FALSE;
- }
-
- return FALSE;
-}
-
-static Bool
-LbxGrabbedByClient (ClientPtr client,
- ColormapPtr pmap)
-{
- LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
- return (cmapPriv &&
- (cmapPriv->grab_status != CMAP_NOT_GRABBED) &&
- (cmapPriv->grabber == LbxProxy(client)));
-}
-
-/*
- * Check if a colormap is grabbed by a proxy.
- */
-
-int
-LbxCheckCmapGrabbed (ColormapPtr pmap)
-{
- LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
-
- return (cmapPriv && (cmapPriv->grab_status == CMAP_GRABBED));
-}
-
-
-/*
- * Disable a smart grab on the specified colormap.
- */
-
-void
-LbxDisableSmartGrab (ColormapPtr pmap)
-{
- LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
-
- if (cmapPriv)
- cmapPriv->smart_grab = FALSE;
-}
-
-
-/*
- * Send an LbxFreeCellsEvent to the specified proxy.
- */
-
-static void
-SendFreeCellsEvent (LbxProxyPtr proxy,
- Colormap cmap,
- Pixel pixel_start,
- Pixel pixel_end)
-{
- xLbxFreeCellsEvent ev;
- ClientPtr client;
- LbxClientPtr lbxcp;
- int n;
-
- lbxcp = proxy->lbxClients[0];
-
- if (lbxcp && (client = lbxcp->client))
- {
- ev.type = LbxEventCode;
- ev.lbxType = LbxFreeCellsEvent;
- ev.sequenceNumber = client->sequence;
- ev.colormap = cmap;
- ev.pixelStart = pixel_start;
- ev.pixelEnd = pixel_end;
- ev.pad1 = ev.pad2 = ev.pad3 = ev.pad4 = 0;
-
- if (client->swapped)
- {
- swaps(&ev.sequenceNumber, n);
- swapl(&ev.colormap, n);
- swapl(&ev.pixelStart, n);
- swapl(&ev.pixelEnd, n);
- }
-
- WriteToClient(client, sz_xLbxFreeCellsEvent, (char *) &ev);
- LbxForceOutput(proxy);
-#ifdef COLOR_DEBUG
- fprintf (stderr, "Sent LbxFreeCellsEvent to proxy %d, seq = 0x%x\n",
- proxy->pid, client->sequence);
- fprintf (stderr, " cmap = 0x%x, pixelStart = %d, pixelEnd = %d\n",
- cmap, pixel_start, pixel_end);
-#endif
- }
-}
-
-/* XXX use of globals like this is gross */
-static long pixel_start;
-static long pixel_end;
-
-
-/*
- * LbxFreeCellsEvent generation functions.
- */
-
-/*ARGSUSED*/
-void
-LbxBeginFreeCellsEvent (ColormapPtr pmap)
-{
- pixel_start = -1;
- pixel_end = -1;
-}
-
-
-void
-LbxAddFreeCellToEvent (ColormapPtr pmap,
- Pixel pixel)
-{
- /*
- * We must notify the proxy that has this colormap
- * grabbed which cells are being freed (their refcount
- * has reached zero).
- */
-
- if (pixel_start == -1)
- pixel_start = pixel;
- else
- {
- if (pixel_end == -1)
- pixel_end = pixel;
- else
- {
- if (pixel_end + 1 == pixel)
- pixel_end = pixel;
- else if (pixel > pixel_end + 1)
- {
- LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
-
- SendFreeCellsEvent (cmapPriv->grabber,
- pmap->mid, pixel_start, pixel_end);
-
- pixel_start = pixel;
- pixel_end = -1;
- }
- }
- }
-}
-
-void
-LbxEndFreeCellsEvent (ColormapPtr pmap)
-{
- /*
- * Check if there is an LbxFreeCellEvent we need to write.
- */
-
- if (pixel_start != -1)
- {
- LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
-
- SendFreeCellsEvent (cmapPriv->grabber,
- pmap->mid, pixel_start,
- pixel_end == -1 ? pixel_start : pixel_end);
- }
-}
-
-
-/*
- * Sort the specified pixel list. This optimizes generation
- * of LbxFreeCellsEvent.
- */
-
-void
-LbxSortPixelList (Pixel *pixels,
- int count)
-{
- int i, j;
-
- for (i = 0; i <= count - 2; i++)
- for (j = count - 1; j > i; j--)
- if (pixels[j - 1] > pixels[j])
- {
- Pixel temp = pixels[j - 1];
- pixels[j - 1] = pixels[j];
- pixels[j] = temp;
- }
-}
-
-
-/*
- * Handle a colormap grab request from a proxy.
- */
-
-int
-ProcLbxGrabCmap(ClientPtr client)
-{
- REQUEST(xLbxGrabCmapReq);
- xLbxGrabCmapReply *reply;
- Bool smartGrab;
- LbxColormapPriv *cmapPriv;
- ColormapPtr pmap;
- int bytes, n;
- LbxProxyPtr proxy = LbxProxy(client);
-
- client->sequence--; /* not a counted request */
-
- pmap = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap,
- RT_COLORMAP,
- SecurityWriteAccess);
-
- if (!pmap)
- {
- client->errorValue = stuff->cmap;
- return BadColor;
- }
-
- cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
- if (!cmapPriv)
- {
- cmapPriv = LbxColormapPrivInit (pmap);
- if (!cmapPriv)
- return BadAlloc;
- }
-
-
- /*
- * We have a SMART GRAB if since this proxy last ungrabbed the
- * colormap, no color cell was alloc'd by an entity other than
- * this proxy (this includes other proxies as well as clients
- * directly connected to the X server without a proxy).
- *
- * We want to optimize this special case because a proxy may give
- * up a grab because it got a request that it could not handle
- * (e.g. AllocNamedColor or LookupColor). When it asks back for
- * the grab, there is no need for the server to send the colormap
- * state, because the proxy is already up to date on the state of
- * the colormap.
- *
- * In order for this to work, the following assumptions are made
- * about the proxy:
- *
- * - the proxy is kept up to date on all cell allocations made on its
- * behalf resulting from the following requests: AllocNamedColor,
- * AllocColorCells, AllocColorPlanes
- * - the proxy is kept up to date on all cells freed by any client
- * via the LbxFreeCell event.
- */
-
- /* if proxy is this confused, give it full info */
- if (cmapPriv->grab_status == CMAP_GRABBED && cmapPriv->grabber == proxy)
- LbxReleaseCmap(pmap, FALSE);
-
- if (proxy->uid != cmapPriv->last_grabber)
- cmapPriv->smart_grab = FALSE;
- smartGrab = cmapPriv->smart_grab;
-
-#ifdef COLOR_DEBUG
- fprintf (stderr, "\nGot colormap grab request, ");
- fprintf (stderr, "seq = 0x%x, proxy = %d, client = %d, cmap = 0x%x\n",
- client->sequence, proxy->pid, client->index, stuff->cmap);
-
- if (cmapPriv->grab_status == CMAP_NOT_GRABBED)
- {
- fprintf (stderr, "cmap 0x%x is not grabbed by any proxy\n",
- stuff->cmap);
- if (smartGrab)
- fprintf (stderr, "This is a smart grab\n");
- }
- else if (cmapPriv->grab_status == CMAP_GRABBED)
- {
- if (cmapPriv->grabber == proxy)
- {
- fprintf (stderr, "cmap 0x%x is already grabbed by proxy %d\n",
- stuff->cmap, proxy->pid);
- }
- else
- {
- fprintf (stderr, "cmap 0x%x is currently grabbed by proxy %d\n",
- stuff->cmap, cmapPriv->grabber->pid);
- }
- }
- else if (cmapPriv->grab_status == CMAP_WAITING_FOR_UNGRAB)
- {
- fprintf (stderr,
- "Already waiting for cmap 0x%x to be ungrabbed by proxy %d\n",
- stuff->cmap, cmapPriv->grabber->pid);
- }
-#endif
-
- if (cmapPriv->grab_status != CMAP_NOT_GRABBED &&
- cmapPriv->grabber != proxy)
- {
- /*
- * The colormap is grabbed by a proxy other than the one that
- * is requesting this grab. Reset this grab request, and process
- * it after the server gets back control of the colormap. Before
- * we reset the request, we must put it back in the client's byte
- * order.
- */
-
- if (!WaitForServerCmapControl (client, pmap))
- return BadAlloc;
-
- if (client->swapped)
- {
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
- }
-
- ResetCurrentRequest(client);
- IgnoreClient(client);
-
- return Success;
- }
-
- if (pmap->pVisual->class & DynamicClass) {
- cmapPriv->grabber = proxy;
- cmapPriv->grab_status = CMAP_GRABBED;
- cmapPriv->next = proxy->grabbedCmaps;
- proxy->grabbedCmaps = pmap;
- } else
- smartGrab = FALSE;
-
- /*
- * For an smart grab (see comments above), there is no information
- * sent about the colormap cells because the proxy is all up to date.
- * Otherwise, the server sends the proxy the state of all allocated
- * cells in the colormap. All cells not specified are assumed free.
- */
-
- bytes = 0;
- if (!smartGrab) {
- if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
- bytes = NumAllocatedCells(pmap->red,
- NUMRED(pmap->pVisual)) * 9;
- bytes += NumAllocatedCells(pmap->green,
- NUMGREEN(pmap->pVisual)) * 9;
- bytes += NumAllocatedCells(pmap->blue,
- NUMBLUE(pmap->pVisual)) * 9;
- bytes += 2;
- } else
- bytes = NumAllocatedCells(pmap->red,
- pmap->pVisual->ColormapEntries) * 9;
- }
- bytes += sz_xLbxGrabCmapReply + 1;
- reply = (xLbxGrabCmapReply *) xalloc (bytes);
- bzero (reply, sz_xLbxGrabCmapReply);
-
- if (smartGrab)
- {
- reply->flags = LBX_SMART_GRAB;
- reply->length = 0;
- }
- else
- {
- GetAllocatedCells (pmap, &reply->flags,
- (CARD8 *) reply + sz_xLbxGrabCmapReplyHdr, &bytes);
- if (bytes <= (sz_xLbxGrabCmapReply - sz_xLbxGrabCmapReplyHdr))
- reply->length = 0;
- else
- reply->length = (sz_xLbxGrabCmapReplyHdr +
- bytes - sz_xLbxGrabCmapReply + 3) >> 2;
- }
-
- reply->type = X_Reply;
- reply->sequenceNumber = client->sequence;
-
- bytes = sz_xLbxGrabCmapReply + (reply->length << 2);
-
- if (client->swapped)
- {
- register char n;
-
- swaps (&reply->sequenceNumber, n);
- swapl (&reply->length, n);
- }
-
- WriteToClient (client, bytes, (char *)reply);
-
- xfree (reply);
-
- return (client->noClientException);
-}
-
-static int
-LbxUnstallClient(pointer data,
- XID id)
-{
- LbxColormapPriv *cmapPriv = (LbxColormapPriv *)data;
- LbxStalled **prev;
- ClientPtr client;
-
- for (prev = &cmapPriv->stalled_clients; *prev && (*prev)->id != id; )
- prev = &(*prev)->next;
- *prev = (*prev)->next;
- client = clients[CLIENT_ID(id)];
- if (!client->clientGone)
- AttendClient(client);
- return 0;
-}
-
-void
-LbxReleaseCmap(ColormapPtr pmap,
- Bool smart)
-{
- LbxColormapPriv *cmapPriv;
- ColormapPtr *prev;
-
- if (!pmap->devPrivates)
- return;
- cmapPriv = (LbxColormapPriv *)
- (pmap->devPrivates[lbxColormapPrivIndex].ptr);
- if (!cmapPriv || (cmapPriv->grab_status == CMAP_NOT_GRABBED))
- return;
-
- for (prev = &cmapPriv->grabber->grabbedCmaps; *prev && *prev != pmap; )
- prev = &((LbxColormapPriv *)
- (*prev)->devPrivates[lbxColormapPrivIndex].ptr)->next;
- if (*prev == pmap)
- *prev = cmapPriv->next;
-
- while (cmapPriv->stalled_clients)
- FreeResource(cmapPriv->stalled_clients->id, 0);
-
- cmapPriv->grab_status = CMAP_NOT_GRABBED;
- cmapPriv->last_grabber = smart ? cmapPriv->grabber->uid : 0;
- cmapPriv->grabber = NULL;
- cmapPriv->smart_grab = smart;
-}
-
-/*
- * Handle a colormap release request from a proxy.
- */
-
-int
-ProcLbxReleaseCmap(ClientPtr client)
-{
- REQUEST(xLbxReleaseCmapReq);
- ColormapPtr pmap;
-
-#ifdef COLOR_DEBUG
- fprintf (stderr, "Got colormap release request, ");
- fprintf (stderr, "seq = 0x%x, proxy = %d, client = %d, cmap = 0x%x\n",
- client->sequence, LbxProxyID(client), client->index, stuff->cmap);
-#endif
-
- pmap = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap,
- RT_COLORMAP,
- SecurityWriteAccess);
-
- if (!pmap)
- {
- client->errorValue = stuff->cmap;
- return BadColor;
- }
-
- if (LbxGrabbedByClient(client, pmap))
- LbxReleaseCmap(pmap, TRUE);
- return Success;
-}
-
-
-/*
- * Handle an LbxAllocColor request. The proxy did the alloc and
- * is telling the server what rgb and pixel value to use.
- */
-
-int
-ProcLbxAllocColor(ClientPtr client)
-{
- REQUEST(xLbxAllocColorReq);
- ColormapPtr pmap;
- CARD32 pixel = stuff->pixel;
-
- REQUEST_SIZE_MATCH (xLbxAllocColorReq);
- pmap = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap,
- RT_COLORMAP,
- SecurityWriteAccess);
-
-#ifdef COLOR_DEBUG
- fprintf (stderr,
- "Got LBX alloc color: seq = 0x%x, proxy = %d, client = %d\n",
- client->sequence, LbxProxyID(client), client->index);
- fprintf (stderr, " cmap = 0x%x, pixel = %d, rgb = (%d,%d,%d)\n",
- stuff->cmap, stuff->pixel, stuff->red, stuff->green, stuff->blue);
-#endif
-
- if (pmap)
- {
- int status;
- if (!LbxGrabbedByClient(client, pmap))
- return BadAccess;
-
- status = AllocColor (pmap,
- &stuff->red, &stuff->green, &stuff->blue,
- &pixel, client->index);
-
- if (status == Success && pixel != stuff->pixel)
- {
- /*
- * Internal error - Proxy allocated different pixel from server
- */
-#ifdef COLOR_DEBUG
- fprintf(stderr, "got pixel %d (%d, %d, %d), expected %d\n",
- pixel, stuff->red, stuff->green, stuff->blue, stuff->pixel);
-#endif
- FreeColors (pmap, client->index, 1, &pixel, 0L);
- return BadAlloc;
- }
-
- return status;
- }
- else
- {
- client->errorValue = stuff->cmap;
- return (BadColor);
- }
-}
-
-
-/*
- * The proxy sends an LbxIncrementPixel request when it short circuits
- * an AllocColor. The server must bump up the reference count the
- * specified amount.
- */
-
-int
-ProcLbxIncrementPixel(ClientPtr client)
-{
- REQUEST(xLbxIncrementPixelReq);
- ColormapPtr pmap;
- EntryPtr pent;
- Pixel pixel;
- unsigned short red, green, blue;
- VisualPtr pVisual;
- int status;
-
-#ifdef COLOR_DEBUG
- fprintf (stderr,
- "Got LBX increment pixel: seq = 0x%x, proxy = %d, client = %d\n",
- client->sequence, LbxProxyID(client), client->index);
- fprintf (stderr, " cmap = 0x%x, pixel = %d\n",
- stuff->cmap, stuff->pixel);
-#endif
-
- /*
- * Looks up the color associated with the pixel, and then call
- * AllocColor() - a bit round-about, but it should work.
- */
-
- pmap = (ColormapPtr) SecurityLookupIDByType(client, stuff->cmap,
- RT_COLORMAP,
- SecurityWriteAccess);
- if (!pmap) {
- client->errorValue = stuff->cmap;
- return BadColor;
- }
-
- pixel = stuff->pixel;
-
- switch (pmap->class) {
- case StaticColor:
- case StaticGray:
- red = pmap->red[pixel].co.local.red;
- green = pmap->red[pixel].co.local.green;
- blue = pmap->red[pixel].co.local.blue;
- break;
- case GrayScale:
- case PseudoColor:
- pent = pmap->red + pixel;
- red = pent->co.local.red;
- green = pent->co.local.green;
- blue = pent->co.local.blue;
- break;
- default:
- pVisual = pmap->pVisual;
- red = pmap->red[(pixel & pVisual->redMask) >> pVisual->offsetRed].co.local.red;
- green = pmap->green[(pixel & pVisual->greenMask) >> pVisual->offsetGreen].co.local.green;
- blue = pmap->blue[(pixel & pVisual->blueMask) >> pVisual->offsetBlue].co.local.blue;
- break;
- }
-
- status = AllocColor(pmap, &red, &green, &blue, &pixel, client->index);
-
- if (status == Success && pixel != stuff->pixel)
- {
- /*
- * Internal error - Proxy allocated different pixel from server
- */
-#ifdef COLOR_DEBUG
- fprintf(stderr, "got pixel %d, expected %d\n", pixel, stuff->pixel);
-#endif
- FreeColors (pmap, client->index, 1, &pixel, 0L);
- return BadAlloc;
- }
-
- return status;
-}
diff --git a/lbx/lbxdata.h b/lbx/lbxdata.h
deleted file mode 100644
index b577f6e50..000000000
--- a/lbx/lbxdata.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $Xorg: lbxdata.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
-/*
- * Copyright 1994 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _LBXDATA_H_
-#define _LBXDATA_H_
-#define NEED_REPLIES
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include "dixfontstr.h"
-
-extern int lbx_font_private;
-
-typedef struct _fonttaginfo {
- XID tid;
- FontPtr pfont;
- unsigned long size;
- int compression;
- xLbxFontInfo *fontinfo;
-} FontTagInfoRec, *FontTagInfoPtr;
-
-#endif /* _LBXDATA_H_ */
diff --git a/lbx/lbxdix.c b/lbx/lbxdix.c
deleted file mode 100644
index e2a1a7adc..000000000
--- a/lbx/lbxdix.c
+++ /dev/null
@@ -1,869 +0,0 @@
-/* $Xorg: lbxdix.c,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */
-/*
-
-Copyright 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/*
- * Copyright 1993 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxdix.c,v 1.7 2001/08/23 14:46:57 alanh Exp $ */
-
-/* various bits of DIX-level mangling */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#include <stdio.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "inputstr.h"
-#include "servermd.h"
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "propertyst.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include "lbxserve.h"
-#include "lbxtags.h"
-#include "lbxdata.h"
-#include <X11/Xfuncproto.h>
-#ifdef XAPPGROUP
-#include <X11/extensions/Xagsrv.h>
-#endif
-#include "swaprep.h"
-
-int lbx_font_private = -1;
-
-void
-LbxDixInit(void)
-{
- TagInit();
- lbx_font_private = AllocateFontPrivateIndex();
-}
-
-/* ARGSUSED */
-void
-LbxAllowMotion(ClientPtr client,
- int num)
-{
- LbxProxyPtr proxy = LbxProxy(client);
- proxy->motion_allowed_events += num;
-}
-
-extern xConnSetupPrefix connSetupPrefix;
-extern char *ConnectionInfo;
-extern int connBlockScreenStart;
-
-int
-LbxSendConnSetup(ClientPtr client,
- char *reason)
-{
- int dlength;
- int i, ndex, lim, wndex;
- CARD32 dataBuf[16];
- xLbxConnSetupPrefix csp;
- NewClientInfoRec nci;
- LbxProxyPtr proxy = LbxProxy(client);
-
- if (reason) {
- SendConnSetup(client, reason);
- LbxForceOutput(proxy); /* expedient to avoid another state variable */
- return (client->noClientException);
- }
-
- IncrementClientCount();
-
- client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
- client->sequence = 0;
- dataBuf[0] = client->clientAsMask;
-
- csp.success = TRUE;
- csp.majorVersion = connSetupPrefix.majorVersion;
- csp.minorVersion = connSetupPrefix.minorVersion;
- csp.tag = 0;
-#ifdef XAPPGROUP
- if (!client->appgroup) {
-#endif
- csp.changeType = 1; /* LbxNormalDeltas */
- csp.length = 2 + /* tag + resource-id-base */
- screenInfo.numScreens; /* input-mask per screen */
- wndex = 0; ndex = 1; lim = screenInfo.numScreens;
-#ifdef XAPPGROUP
- } else {
- csp.changeType = 2; /* LbxAppGroupDeltas */
- csp.length = 7 + /* tag, res-id-base, root, visual, colormap, b&w-pix */
- 1 + screenInfo.numScreens - screenInfo.numVideoScreens;
- XagGetDeltaInfo (client, &dataBuf[1]);
- for (i = 0; i < MAXSCREENS; i++) {
- if ((CARD32) WindowTable[i]->drawable.id == dataBuf[1]) {
- dataBuf[6] = WindowTable[i]->eventMask | wOtherEventMasks(WindowTable[i]);
- break;
- }
- }
- wndex = screenInfo.numVideoScreens;
- ndex = 7;
- lim = screenInfo.numScreens - screenInfo.numVideoScreens;
- }
-#endif
- for (i = 0; i < lim; i++, ndex++, wndex++) {
- dataBuf[ndex] =
- WindowTable[wndex]->eventMask | wOtherEventMasks(WindowTable[wndex]);
- }
- dlength = (csp.length - 1) << 2;
-
- if (LbxProxyClient(proxy)->swapped) {
- swaps(&csp.length, i);
- }
-
- if (client->swapped) {
- LbxWriteSConnSetupPrefix(client, &csp);
- SwapLongs(dataBuf, (1 + screenInfo.numScreens));
- WriteToClient(client, dlength, (pointer) dataBuf);
- } else {
- WriteToClient(client, sizeof(xLbxConnSetupPrefix), (char *) &csp);
- WriteToClient(client, dlength, (pointer) dataBuf);
- }
-
- LbxForceOutput(proxy); /* expedient to avoid another state variable */
- client->clientState = ClientStateRunning;
- if (ClientStateCallback) {
- if (LbxProxyClient(proxy)->swapped != client->swapped) {
- swaps(&csp.length, i);
- }
- nci.client = client;
- nci.prefix = (xConnSetupPrefix*) &csp;
- nci.setup = (xConnSetup *) ConnectionInfo;
- CallCallbacks(&ClientStateCallback, (pointer) &nci);
- }
-
- return client->noClientException;
-}
-
-static XID modifier_map_tag;
-
-int
-LbxGetModifierMapping(ClientPtr client)
-{
- TagData td;
- pointer tagdata;
- xLbxGetModifierMappingReply rep;
- register KeyClassPtr keyc = inputInfo.keyboard->key;
- int dlength = keyc->maxKeysPerModifier << 3;
- Bool tag_known = FALSE,
- send_data;
- int n;
-
- if (!modifier_map_tag) {
- tagdata = (pointer) keyc->modifierKeyMap;
- TagSaveTag(LbxTagTypeModmap, dlength, tagdata, &modifier_map_tag);
- } else {
- td = TagGetTag(modifier_map_tag);
- tagdata = td->tdata;
- tag_known = TagProxyMarked(modifier_map_tag, LbxProxyID(client));
- }
- if (modifier_map_tag)
- TagMarkProxy(modifier_map_tag, LbxProxyID(client));
-
- send_data = (!modifier_map_tag || !tag_known);
-
- rep.type = X_Reply;
- rep.keyspermod = keyc->maxKeysPerModifier;
- rep.sequenceNumber = client->sequence;
- rep.tag = modifier_map_tag;
- rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
-
- if (send_data)
- rep.length = dlength >> 2;
- else
- rep.length = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.tag, n);
- }
- WriteToClient(client, sizeof(xLbxGetModifierMappingReply), (char *)&rep);
-
- if (send_data)
- WriteToClient(client, dlength, (char *) tagdata);
-
- return client->noClientException;
-}
-
-void
-LbxFlushModifierMapTag(void)
-{
-
- if (modifier_map_tag)
- TagDeleteTag(modifier_map_tag);
-}
-
-static XID keyboard_map_tag;
-
-int
-LbxGetKeyboardMapping(ClientPtr client)
-{
- TagData td;
- pointer tagdata;
- xLbxGetKeyboardMappingReply rep;
-
- REQUEST(xLbxGetKeyboardMappingReq);
- KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
- int dlength;
- Bool tag_known = FALSE,
- send_data;
- int n;
-
- REQUEST_SIZE_MATCH(xLbxGetKeyboardMappingReq);
-
- if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
- (stuff->firstKeyCode > curKeySyms->maxKeyCode)) {
- client->errorValue = stuff->firstKeyCode;
- return BadValue;
- }
- if (stuff->firstKeyCode + stuff->count > curKeySyms->maxKeyCode + 1) {
- client->errorValue = stuff->count;
- return BadValue;
- }
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.keysperkeycode = curKeySyms->mapWidth;
- /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
-
- if (!keyboard_map_tag) {
- tagdata = (pointer) &curKeySyms->map[(stuff->firstKeyCode -
- curKeySyms->minKeyCode) * curKeySyms->mapWidth];
- dlength = (curKeySyms->mapWidth * stuff->count);
- TagSaveTag(LbxTagTypeKeymap, dlength, tagdata, &keyboard_map_tag);
- } else {
- td = TagGetTag(keyboard_map_tag);
- tagdata = td->tdata;
- tag_known = TagProxyMarked(keyboard_map_tag, LbxProxyID(client));
- }
- if (keyboard_map_tag)
- TagMarkProxy(keyboard_map_tag, LbxProxyID(client));
-
- send_data = (!keyboard_map_tag || !tag_known);
- rep.type = X_Reply;
- rep.keysperkeycode = curKeySyms->mapWidth;
- rep.sequenceNumber = client->sequence;
- rep.tag = keyboard_map_tag;
- rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
-
- if (send_data)
- rep.length = (curKeySyms->mapWidth * stuff->count);
- else
- rep.length = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.tag, n);
- }
- WriteToClient(client, sizeof(xLbxGetKeyboardMappingReply), (char *)&rep);
-
- if (send_data) {
- client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
- WriteSwappedDataToClient(client,
- curKeySyms->mapWidth * stuff->count * sizeof(KeySym),
- &curKeySyms->map[(stuff->firstKeyCode - curKeySyms->minKeyCode) *
- curKeySyms->mapWidth]);
- }
- return client->noClientException;
-}
-
-void
-LbxFlushKeyboardMapTag(void)
-{
- if (keyboard_map_tag)
- TagDeleteTag(keyboard_map_tag);
-}
-
-/* counts number of bits needed to hold value */
-static int
-_bitsize(int val)
-{
- int bits = 1; /* always need one for sign bit */
-
- if (val == 0)
- return (bits);
-
- if (val < 0) {
- val = -val;
- }
- while (val) {
- bits++;
- val >>= 1;
- }
-
- return bits;
-
-}
-
-/*
- * squashes the font (if possible), returning the new length and
- * a pointer to the new data (which has been allocated). if it can't
- * squish, it just returns a 0 and the data is sent in raw form.
- */
-int _lbx_fi_junklen = sizeof(BYTE) * 2 + sizeof(CARD16) + sizeof(CARD32);
-
-static int
-squish_font_info(xQueryFontReply *qfr,
- int rlen,
- xLbxFontInfo **sqrep)
-{
- int len,
- hlen;
- xLbxFontInfo *new;
- xCharInfo *minb,
- *maxb,
- *ci,
- bbox;
- int i;
- char *t;
- xLbxCharInfo *chars;
- int num_chars;
-
- num_chars = qfr->nCharInfos;
-
- if (num_chars == 0)
- return 0;
-
- minb = &qfr->minBounds;
- maxb = &qfr->maxBounds;
- /*
- * first do the quick check -- if the attribute fields aren't all the
- * same, punt
- */
-
- if (minb->attributes != maxb->attributes)
- return 0;
-
-#define compute(field) \
- bbox.field = max(_bitsize(minb->field), _bitsize(maxb->field))
-
- compute(characterWidth);
- compute(leftSideBearing);
- compute(rightSideBearing);
- compute(ascent);
- compute(descent);
-
-#undef compute
-
- /* make sure it fits */
- if (!((bbox.characterWidth <= LBX_WIDTH_BITS) &&
- (bbox.leftSideBearing <= LBX_LEFT_BITS) &&
- (bbox.rightSideBearing <= LBX_RIGHT_BITS) &&
- (bbox.ascent <= LBX_ASCENT_BITS) &&
- (bbox.descent <= LBX_DESCENT_BITS))) {
- return 0;
- }
-
- hlen = sizeof(xLbxFontInfo) + qfr->nFontProps * sizeof(xFontProp);
-
- len = hlen + (num_chars * sizeof(xLbxCharInfo));
-
- new = (xLbxFontInfo *) xalloc(len);
- if (!new)
- return 0;
-
- /* gross hack to avoid copying all the fields */
- t = (char *) qfr;
- t += _lbx_fi_junklen;
-
- /* copy all but the char infos */
- memcpy((char *) new, (char *) t, hlen);
-
- t = (char *) new;
- t += hlen;
- chars = (xLbxCharInfo *) t;
-
- t = (char *) qfr;
- t += sizeof(xQueryFontReply) + qfr->nFontProps * sizeof(xFontProp);
- ci = (xCharInfo *) t;
-
- /* now copy & pack the charinfos */
- for (i = 0; i < num_chars; i++, chars++, ci++) {
- chars->metrics = 0;
- chars->metrics |= (LBX_MASK_BITS(ci->characterWidth, LBX_WIDTH_BITS)
- << LBX_WIDTH_SHIFT);
- chars->metrics |= (LBX_MASK_BITS(ci->leftSideBearing, LBX_LEFT_BITS)
- << LBX_LEFT_SHIFT);
- chars->metrics |= (LBX_MASK_BITS(ci->rightSideBearing, LBX_RIGHT_BITS)
- << LBX_RIGHT_SHIFT);
- chars->metrics |= (LBX_MASK_BITS(ci->ascent, LBX_ASCENT_BITS)
- << LBX_ASCENT_SHIFT);
- chars->metrics |= (LBX_MASK_BITS(ci->descent, LBX_DESCENT_BITS)
- << LBX_DESCENT_SHIFT);
- }
-
- *sqrep = new;
- return len;
-}
-
-int
-LbxQueryFont(ClientPtr client)
-{
- xQueryFontReply *reply;
- xLbxQueryFontReply lbxrep;
- FontPtr pFont;
- register GC *pGC;
- Bool send_data = FALSE;
- Bool free_data = FALSE;
- int rlength = 0;
- FontTagInfoPtr ftip;
- int sqlen = 0;
- xLbxFontInfo *sqrep,
- *sreply = NULL;
-
- REQUEST(xLbxQueryFontReq);
-
- REQUEST_SIZE_MATCH(xLbxQueryFontReq);
-
- client->errorValue = stuff->fid; /* EITHER font or gc */
- pFont = (FontPtr) SecurityLookupIDByType(client, stuff->fid, RT_FONT,
- SecurityReadAccess);
- if (!pFont) {
- /* can't use VERIFY_GC because it might return BadGC */
- pGC = (GC *) SecurityLookupIDByType(client, stuff->fid, RT_GC,
- SecurityReadAccess);
- if (!pGC || !pGC->font) { /* catch a non-existent builtin font */
- client->errorValue = stuff->fid;
- return (BadFont); /* procotol spec says only error is BadFont */
- }
- pFont = pGC->font;
- }
-
- /* get tag (if any) */
- ftip = (FontTagInfoPtr) FontGetPrivate(pFont, lbx_font_private);
-
- if (!ftip) {
- xCharInfo *pmax = FONTINKMAX(pFont);
- xCharInfo *pmin = FONTINKMIN(pFont);
- int nprotoxcistructs;
-
- nprotoxcistructs = (
- pmax->rightSideBearing == pmin->rightSideBearing &&
- pmax->leftSideBearing == pmin->leftSideBearing &&
- pmax->descent == pmin->descent &&
- pmax->ascent == pmin->ascent &&
- pmax->characterWidth == pmin->characterWidth) ?
- 0 : N2dChars(pFont);
-
- rlength = sizeof(xQueryFontReply) +
- FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
- nprotoxcistructs * sizeof(xCharInfo);
- reply = (xQueryFontReply *) xalloc(rlength);
- if (!reply) {
- return (BadAlloc);
- }
- free_data = TRUE;
- send_data = TRUE;
- QueryFont(pFont, reply, nprotoxcistructs);
-
- sqlen = squish_font_info(reply, rlength, &sqrep);
- if (!sqlen) { /* if it failed to squish, send it raw */
- char *t;
-
- lbxrep.compression = 0;
-
- sqlen = rlength - _lbx_fi_junklen;
- t = (char *) reply;
- sqrep = (xLbxFontInfo *) (t + _lbx_fi_junklen);
- } else {
- lbxrep.compression = 1;
- xfree(reply); /* no longer needed */
- }
- } else { /* just get data from tag */
- sqrep = ftip->fontinfo;
- sqlen = ftip->size;
- lbxrep.compression = ftip->compression;
- }
-
- if (!ftip) {
- /* data allocation is done when font is first queried */
- ftip = (FontTagInfoPtr) xalloc(sizeof(FontTagInfoRec));
- if (ftip &&
- TagSaveTag(LbxTagTypeFont, sqlen, (pointer) ftip, &ftip->tid)) {
- FontSetPrivate(pFont, lbx_font_private, (pointer) ftip);
- ftip->pfont = pFont;
- ftip->size = sqlen;
- ftip->fontinfo = sqrep;
- ftip->compression = lbxrep.compression;
- free_data = FALSE;
- } else {
- xfree(ftip);
- }
- }
- if (ftip) {
- if (!TagProxyMarked(ftip->tid, LbxProxyID(client)))
- send_data = TRUE;
- TagMarkProxy(ftip->tid, LbxProxyID(client));
- lbxrep.tag = ftip->tid;
- } else {
- lbxrep.tag = 0;
- send_data = TRUE;
- }
-
- lbxrep.type = X_Reply;
- lbxrep.sequenceNumber = client->sequence;
- lbxrep.pad0 = lbxrep.pad1 = lbxrep.pad2 = lbxrep.pad3 = lbxrep.pad4 = 0;
-
- if (send_data)
- lbxrep.length = sqlen >> 2;
- else
- lbxrep.length = 0;
-
- if (client->swapped) {
- int n;
-
- swaps(&lbxrep.sequenceNumber, n);
- swapl(&lbxrep.length, n);
- swapl(&lbxrep.tag, n);
- sreply = (xLbxFontInfo *) ALLOCATE_LOCAL(sqlen);
- if (!sreply)
- return BadAlloc;
- memcpy((char *) sreply, (char *) sqrep, sqlen);
- LbxSwapFontInfo(sreply, lbxrep.compression);
- sqrep = sreply;
- }
- WriteToClient(client, sizeof(xLbxQueryFontReply), (char *) &lbxrep);
- if (send_data)
- WriteToClient(client, sqlen, (char *)sqrep);
- if (free_data)
- xfree(sqrep);
- if (sreply)
- DEALLOCATE_LOCAL(sreply);
- return (client->noClientException);
-}
-
-void
-LbxFreeFontTag(FontPtr pfont)
-{
- FontTagInfoPtr ftip;
-
- ftip = (FontTagInfoPtr) FontGetPrivate(pfont, lbx_font_private);
- if (ftip)
- TagDeleteTag(ftip->tid);
-}
-
-int
-LbxInvalidateTag(ClientPtr client,
- XID tag)
-{
- TagClearProxy(tag, LbxProxyID(client));
- return client->noClientException;
-}
-
-void
-LbxSendInvalidateTag(ClientPtr client,
- XID tag,
- int tagtype)
-{
- xLbxInvalidateTagEvent ev;
- int n;
-
- ev.type = LbxEventCode;
- ev.lbxType = LbxInvalidateTagEvent;
- ev.sequenceNumber = client->sequence;
- ev.tag = tag;
- ev.tagType = tagtype;
- ev.pad1 = ev.pad2 = ev.pad3 = ev.pad4 = ev.pad5 = 0;
-
- if (client->swapped) {
- swaps(&ev.sequenceNumber, n);
- swapl(&ev.tag, n);
- swapl(&ev.tagType, n);
- }
- DBG(DBG_CLIENT, (stderr, "Invalidating tag %d\n", tag));
- WriteToClient(client, sizeof(xLbxInvalidateTagEvent), (char *) &ev);
- LbxForceOutput(LbxProxy(client));
-}
-
-static void
-LbxSendSendTagData(int pid,
- XID tag,
- int tagtype)
-{
- xLbxSendTagDataEvent ev;
- int n;
- LbxProxyPtr proxy;
- ClientPtr client;
- LbxClientPtr lbxcp;
-
- proxy = LbxPidToProxy(pid);
- lbxcp = (proxy != NULL) ? proxy->lbxClients[0] : NULL;
- if (lbxcp && (client = lbxcp->client)) {
- ev.type = LbxEventCode;
- ev.lbxType = LbxSendTagDataEvent;
- ev.sequenceNumber = client->sequence;
- ev.tag = tag;
- ev.tagType = tagtype;
- ev.pad1 = ev.pad2 = ev.pad3 = ev.pad4 = ev.pad5 = 0;
-
- if (client->swapped) {
- swaps(&ev.sequenceNumber, n);
- swapl(&ev.tag, n);
- swapl(&ev.tagType, n);
- }
- DBG(DBG_CLIENT, (stderr, "Requesting tag %d\n", tag));
- WriteToClient(client, sizeof(xLbxSendTagDataEvent), (char *) &ev);
- LbxForceOutput(proxy);
- }
-}
-
-/*
- * keep track of clients stalled waiting for tags to come back from
- * a proxy. since multiple clinets can be waiting for the same tag,
- * we have to keep a list of all of them.
- */
-
-typedef struct _sendtagq {
- XID tag;
- int num_stalled;
- ClientPtr *stalled_clients;
- struct _sendtagq *next;
-} SendTagQRec, *SendTagQPtr;
-
-static SendTagQPtr queried_tags = NULL;
-
-#define LbxSendTagFailed -1
-#define LbxSendTagSendIt 0
-#define LbxSendTagAlreadySent 1
-
-static Bool
-LbxQueueSendTag(ClientPtr client,
- XID tag)
-{
- SendTagQPtr stqp, *prev, new;
- ClientPtr *newlist;
-
-
- /* see if we're asking for one already in the pipeline */
- for (prev = &queried_tags; (stqp = *prev); prev = &stqp->next) {
- if (stqp->tag == tag) {
- /* add new client to list */
- newlist = (ClientPtr *) xrealloc(stqp->stalled_clients,
- (sizeof(ClientPtr) * (stqp->num_stalled + 1)));
- if (!newlist)
- return LbxSendTagFailed;
- newlist[stqp->num_stalled++] = client;
- stqp->stalled_clients = newlist;
- DBG(DBG_CLIENT, (stderr, "Additional client requesting tag %d\n", tag));
- return LbxSendTagAlreadySent;
- }
- }
-
- /* make new one */
- new = (SendTagQPtr) xalloc(sizeof(SendTagQRec));
- newlist = (ClientPtr *) xalloc(sizeof(ClientPtr));
- if (!new || !newlist) {
- xfree(new);
- xfree(newlist);
- return LbxSendTagFailed;
- }
- *newlist = client;
- new->stalled_clients = newlist;
- new->num_stalled = 1;
- new->tag = tag;
- new->next = NULL;
-
- /* stick on end of list */
- *prev = new;
- return LbxSendTagSendIt;
-}
-
-static SendTagQPtr
-LbxFindQTag(XID tag)
-{
- SendTagQPtr stqp;
-
- for (stqp = queried_tags; stqp; stqp = stqp->next) {
- if (stqp->tag == tag)
- return stqp;
- }
- return NULL;
-}
-
-static void
-LbxFreeQTag(SendTagQPtr stqp)
-{
- xfree(stqp->stalled_clients);
- xfree(stqp);
-}
-
-static void
-LbxRemoveQTag(XID tag)
-{
- SendTagQPtr stqp, *prev;
-
- for (prev = &queried_tags; (stqp = *prev); prev = &stqp->next) {
- if (stqp->tag == tag) {
- *prev = stqp->next;
- LbxFreeQTag(stqp);
- return;
- }
- }
-}
-
-Bool
-LbxFlushQTag(XID tag)
-{
- SendTagQPtr stqp;
- ClientPtr *cp;
-
- stqp = LbxFindQTag(tag);
- if (!stqp)
- return FALSE;
- for (cp = stqp->stalled_clients; --stqp->num_stalled >= 0; cp++)
- AttendClient(*cp);
- LbxRemoveQTag(tag);
- return TRUE;
-}
-
-void
-ProcessQTagZombies(void)
-{
- SendTagQPtr stqp;
- ClientPtr *out, *in;
- int i;
-
- for (stqp = queried_tags; stqp; stqp = stqp->next) {
- out = stqp->stalled_clients;
- for (in = out, i = stqp->num_stalled; --i >= 0; in++) {
- if ((*in)->clientGone)
- --stqp->num_stalled;
- else
- *out++ = *in;
- }
- }
-}
-
-/*
- * server sends this
- */
-
-void
-LbxQueryTagData(ClientPtr client,
- int owner_pid,
- XID tag,
- int tagtype)
-{
- /* save the info and the client being stalled */
- if (LbxQueueSendTag(client, tag) == LbxSendTagSendIt)
- LbxSendSendTagData(owner_pid, tag, tagtype);
-}
-
-/*
- * server recieves this
- */
-int
-LbxTagData(ClientPtr client,
- XID tag,
- unsigned long len,
- pointer data)
-{
- TagData td;
- PropertyPtr pProp;
-
- td = TagGetTag(tag);
- if (!td || td->data_type != LbxTagTypeProperty)
- return Success;
- if (!td->global) {
- /* somebody changed contents while we were querying */
- TagDeleteTag(tag);
- return Success;
- }
- LbxFlushQTag(tag);
- pProp = (PropertyPtr) td->tdata;
- if (pProp->tag_id != tag || pProp->owner_pid != LbxProxyID(client))
- return Success;
- pProp->owner_pid = 0;
- if (len != td->size)
- pProp->size = len / (pProp->format >> 3);
- pProp->data = xrealloc(pProp->data, len);
- if (!pProp->data) {
- pProp->size = 0;
- return Success;
- }
- if (client->swapped) {
- switch (pProp->format) {
- case 32:
- SwapLongs((CARD32 *) data, len >> 2);
- break;
- case 16:
- SwapShorts((short *) data, len >> 1);
- break;
- default:
- break;
- }
- }
- memmove((char *) pProp->data, (char *) data, len);
- return Success;
-}
-
-/* when server resets, need to reset global tags */
-void
-LbxResetTags(void)
-{
- SendTagQPtr stqp;
-
- modifier_map_tag = 0;
- keyboard_map_tag = 0;
-
- /* clean out any pending tag requests */
- while ((stqp = queried_tags)) {
- queried_tags = stqp->next;
- LbxFreeQTag(stqp);
- }
-}
diff --git a/lbx/lbxexts.c b/lbx/lbxexts.c
deleted file mode 100644
index 1086b4bc5..000000000
--- a/lbx/lbxexts.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* $Xorg: lbxexts.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
-/*
- * Copyright 1994 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxexts.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "colormapst.h"
-#include "propertyst.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include "lbxserve.h"
-#ifdef XCSECURITY
-#define _SECURITY_SERVER
-#include <X11/extensions/security.h>
-#endif
-
-typedef struct _lbxext {
- char *name;
- char **aliases;
- int num_aliases;
- int idx;
- int opcode;
- int ev_base;
- int err_base;
- int num_reqs;
- CARD8 *rep_mask;
- CARD8 *ev_mask;
-#ifdef XCSECURITY
- Bool secure;
-#endif
-} LbxExtensionEntry;
-
-static LbxExtensionEntry **lbx_extensions = NULL;
-static int num_exts = 0;
-
-
-Bool
-LbxAddExtension(char *name,
- int opcode,
- int ev_base,
- int err_base)
-{
- int i;
- LbxExtensionEntry *ext,
- **newexts;
-
- ext = (LbxExtensionEntry *) xalloc(sizeof(LbxExtensionEntry));
- if (!ext)
- return FALSE;
- ext->name = (char *) xalloc(strlen(name) + 1);
- ext->num_aliases = 0;
- ext->aliases = (char **) NULL;
- if (!ext->name) {
- xfree(ext);
- return FALSE;
- }
- strcpy(ext->name, name);
- i = num_exts;
- newexts = (LbxExtensionEntry **) xrealloc(lbx_extensions,
- (i + 1) * sizeof(LbxExtensionEntry *));
- if (!newexts) {
- xfree(ext->name);
- xfree(ext);
- return FALSE;
- }
- num_exts++;
- lbx_extensions = newexts;
- lbx_extensions[i] = ext;
- ext->idx = i;
-
- ext->opcode = opcode;;
- ext->ev_base = ev_base;;
- ext->err_base = err_base;
- ext->ev_mask = NULL;
- ext->rep_mask = NULL;
- ext->num_reqs = 0;
-#ifdef XCSECURITY
- ext->secure = FALSE;
-#endif
-
- return TRUE;
-}
-
-Bool
-LbxAddExtensionAlias(int idx,
- char *alias)
-{
- char *name;
- char **aliases;
- LbxExtensionEntry *ext = lbx_extensions[idx];
-
- aliases = (char **) xrealloc(ext->aliases,
- (ext->num_aliases + 1) * sizeof(char *));
- if (!aliases)
- return FALSE;
- ext->aliases = aliases;
- name = (char *) xalloc(strlen(alias) + 1);
- if (!name)
- return FALSE;
- strcpy(name, alias);
- ext->aliases[ext->num_aliases] = name;
- ext->num_aliases++;
- return TRUE;
-}
-
-static int
-LbxFindExtension(char *extname,
- int len)
-{
- int i, j;
-
- for (i = 0; i < num_exts; i++) {
- if ((strlen(lbx_extensions[i]->name) == len) &&
- (strncmp(lbx_extensions[i]->name, extname, len) == 0))
- return i;
- for (j = lbx_extensions[i]->num_aliases; --j >= 0;) {
- if ((strlen(lbx_extensions[i]->aliases[j]) == len) &&
- (strncmp(lbx_extensions[i]->aliases[j], extname, len) == 0))
- return i;
- }
- }
- return -1;
-}
-
-void
-LbxDeclareExtensionSecurity(char *extname,
- Bool secure)
-{
-#ifdef XCSECURITY
- int i = LbxFindExtension(extname, strlen(extname));
- if (i >= 0)
- lbx_extensions[i]->secure = secure;
-#endif
-}
-
-Bool
-LbxRegisterExtensionGenerationMasks(int idx,
- int num_reqs,
- char *rep_mask,
- char *ev_mask)
-{
- LbxExtensionEntry *ext = lbx_extensions[idx];
- CARD8 *nrm,
- *nem;
- int mlen = mlen = num_reqs / (8 * sizeof(CARD8)) + 1;
-
- nrm = (CARD8 *) xalloc(sizeof(CARD8) * mlen);
- nem = (CARD8 *) xalloc(sizeof(CARD8) * mlen);
-
- if (!nrm || !nem) {
- xfree(nrm);
- xfree(nem);
- return FALSE;
- }
- memcpy((char *) nrm, (char *) rep_mask, mlen);
- memcpy((char *) nem, (char *) ev_mask, mlen);
- ext->rep_mask = nrm;
- ext->ev_mask = nem;
- ext->num_reqs = num_reqs;
-
- return TRUE;
-}
-
-int
-LbxQueryExtension(ClientPtr client,
- char *ename,
- int nlen)
-{
- xLbxQueryExtensionReply rep;
- int i;
- int mlen = 0;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.major_opcode = 0;
- rep.present = FALSE;
- rep.length = 0;
- rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
-
- i = LbxFindExtension(ename, nlen);
-
- if (i < 0
-#ifdef XCSECURITY
- /* don't show insecure extensions to untrusted clients */
- || (client->trustLevel == XSecurityClientUntrusted &&
- !lbx_extensions[i]->secure)
-#endif
- )
- rep.present = FALSE;
- else {
- rep.present = TRUE;
- rep.major_opcode = lbx_extensions[i]->opcode;
- rep.first_event = lbx_extensions[i]->ev_base;
- rep.first_error = lbx_extensions[i]->err_base;
- rep.numReqs = lbx_extensions[i]->num_reqs;
- if (lbx_extensions[i]->rep_mask) {
- mlen = (lbx_extensions[i]->num_reqs + 7) >> 3;
- rep.length = ((mlen + 3) >> 2) * 2;
- }
- }
- if (client->swapped) {
- char n;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
- WriteToClient(client, sizeof(xLbxQueryExtensionReply), (char *)&rep);
- if (mlen) {
- WriteToClient(client, mlen, (char *)lbx_extensions[i]->rep_mask);
- WriteToClient(client, mlen, (char *)lbx_extensions[i]->ev_mask);
- }
- return Success;
-}
-
-void
-LbxCloseDownExtensions(void)
-{
- int i,j;
-
- for (i = 0; i < num_exts; i++) {
- xfree(lbx_extensions[i]->name);
- for (j = 0; j < lbx_extensions[i]->num_aliases; j++)
- xfree(lbx_extensions[i]->aliases[j]);
- xfree(lbx_extensions[i]->aliases);
- xfree(lbx_extensions[i]->rep_mask);
- xfree(lbx_extensions[i]->ev_mask);
- xfree(lbx_extensions[i]);
- }
- xfree(lbx_extensions);
- lbx_extensions = NULL;
- num_exts = 0;
-
-}
-
-void
-LbxSetReqMask(CARD8 *mask,
- int req,
- Bool on)
-{
- int mword = req / (8 * sizeof(CARD8));
-
- req = req % (8 * sizeof(CARD8));
- if (on) {
- mask[mword] |= (1 << req);
- } else {
- mask[mword] &= ~(1 << req);
- }
-}
diff --git a/lbx/lbxgfx.c b/lbx/lbxgfx.c
deleted file mode 100644
index 506859a20..000000000
--- a/lbx/lbxgfx.c
+++ /dev/null
@@ -1,854 +0,0 @@
-/* $Xorg: lbxgfx.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
-/*
- * Copyright 1993 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxgfx.c,v 1.3 2001/01/17 22:36:59 dawes Exp $ */
-
-/* various bits of DIX-level mangling */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#include <stdio.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "servermd.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include "lbxserve.h"
-#include "lbxtags.h"
-#include <X11/Xfuncproto.h>
-#include <X11/extensions/lbximage.h>
-#include "lbxsrvopts.h"
-
-#define DrawableCache(client) (LbxClient(client)->drawableCache)
-#define GContextCache(client) (LbxClient(client)->gcontextCache)
-
-static void
-push (XID cache[GFX_CACHE_SIZE],
- XID xid)
-{
- memmove (cache+1, cache, (GFX_CACHE_SIZE - 1) * sizeof (cache[0]));
- cache[0] = xid;
-}
-
-static XID
-use (XID cache[GFX_CACHE_SIZE],
- int i)
-{
- XID tmp;
-
- tmp = cache[i];
- if (i != 0)
- {
- memmove (cache + 1, cache, i * sizeof (cache[0]));
- cache[0] = tmp;
- }
- return tmp;
-}
-
-extern char *ConnectionInfo;
-
-static int
-LbxDecodeGFXCache(ClientPtr client,
- CARD8 cacheEnts,
- char *after,
- Drawable *drawp,
- GContext *gcp)
-{
- int skip;
- int dcache, gcache;
-
- dcache = GFXdCacheEnt (cacheEnts);
- gcache = GFXgCacheEnt (cacheEnts);
- skip = 0;
- if (dcache == GFXCacheNone)
- {
- memcpy (drawp, after, sizeof (Drawable));
- push (DrawableCache(client), *drawp);
- after += sizeof (Drawable);
- skip += sizeof (Drawable);
- }
- else
- *drawp = use (DrawableCache(client), dcache);
- if (gcache == GFXCacheNone)
- {
- memcpy (gcp, after, sizeof (GContext));
- push (GContextCache(client), *gcp);
- skip += sizeof (GContext);
- }
- else
- *gcp = use (GContextCache(client), gcache);
- return skip;
-}
-
-static int
-LbxDecodeDrawableCache(ClientPtr client,
- CARD8 cacheEnts,
- char *after,
- Drawable *drawp)
-{
- int skip;
- int dcache;
-
- dcache = GFXdCacheEnt (cacheEnts);
- skip = 0;
- if (dcache == GFXCacheNone)
- {
- memcpy (drawp, after, sizeof (Drawable));
- push (DrawableCache(client), *drawp);
- after += sizeof (Drawable);
- skip += sizeof (Drawable);
- }
- else
- *drawp = use (DrawableCache(client), dcache);
- return skip;
-}
-
-#ifdef notyet
-static int
-LbxDecodeGCCache(ClientPtr client,
- CARD8 cacheEnts,
- char *after,
- GContext *gcp)
-{
- int skip;
- int gcache;
-
- gcache = GFXgCacheEnt (cacheEnts);
- skip = 0;
- if (gcache == GFXCacheNone)
- {
- memcpy (gcp, after, sizeof (GContext));
- push (GContextCache(client), *gcp);
- after += sizeof (GContext);
- skip += sizeof (GContext);
- }
- else
- *gcp = use (GContextCache(client), gcache);
- return skip;
-}
-#endif
-
-#define GFX_GET_DRAWABLE_AND_GC(type,in,len) {\
- int skip; \
- len = (client->req_len << 2) - SIZEOF(type); \
- in = ((char *) stuff) + SIZEOF(type);\
- skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
- &drawable, &gc); \
- in += skip; \
- len -= skip; \
-}
-
-#define GFX_GET_DST_DRAWABLE_AND_GC(type,in,len) {\
- int skip; \
- len = (client->req_len << 2) - SIZEOF(type); \
- in = ((char *) stuff) + SIZEOF(type);\
- skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
- &dstDrawable, &gc); \
- in += skip; \
- len -= skip; \
-}
-
-#define GFX_GET_SRC_DST_DRAWABLE_AND_GC(type, in, len) { \
- int skip; \
- len = (client->req_len << 2) - SIZEOF(type); \
- in = ((char *) stuff) + SIZEOF(type); \
- skip = LbxDecodeDrawableCache(client, stuff->srcCache, in, \
- &srcDrawable); \
- in += skip; \
- len -= skip; \
- skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
- &dstDrawable, &gc); \
- in += skip; \
- len -= skip; \
-}
-
-#define GFX_GET_GC(type, in, len) { \
- int skip; \
- len = (client->req_len << 2) - SIZEOF(type); \
- in = ((char *) stuff) + SIZEOF(type); \
- skip = LbxDecodeGCCache(client, stuff->gcCache, in, &gc); \
- in += skip; \
- len -= skip; \
-}
-
-int
-LbxDecodePoly(ClientPtr client,
- CARD8 xreqtype,
- int (*decode_rtn)(char *, char *, short *))
-{
- REQUEST(xLbxPolyPointReq);
- char *in;
- xPolyPointReq *xreq;
- int len;
- int retval;
- Drawable drawable;
- GContext gc;
-
- GFX_GET_DRAWABLE_AND_GC(xLbxPolyPointReq, in, len);
- if ((xreq = (xPolyPointReq *)
- xalloc(sizeof(xPolyPointReq) + (len << 1))) == NULL)
- return BadAlloc;
- len = (*decode_rtn)(in, in + len - stuff->padBytes, (short *)(&xreq[1]));
- xreq->reqType = xreqtype;
- xreq->coordMode = 1;
- xreq->drawable = drawable;
- xreq->gc = gc;
- xreq->length = client->req_len = (sizeof(xPolyPointReq) + len) >> 2;
- client->requestBuffer = (pointer)xreq;
-
- retval = (*ProcVector[xreqtype])(client);
- xfree(xreq);
- return retval;
-}
-
-int
-LbxDecodeFillPoly(ClientPtr client)
-{
- REQUEST(xLbxFillPolyReq);
- char *in;
- xFillPolyReq *xreq;
- int len;
- int retval;
- Drawable drawable;
- GContext gc;
-
- GFX_GET_DRAWABLE_AND_GC(xLbxFillPolyReq, in, len);
- if ((xreq = (xFillPolyReq *)
- xalloc(sizeof(xFillPolyReq) + (len << 1))) == NULL)
- return BadAlloc;
- len = LbxDecodePoints(in, in + len - stuff->padBytes, (short *) &xreq[1]);
- xreq->reqType = X_FillPoly;
- xreq->drawable = drawable;
- xreq->gc = gc;
- xreq->shape = stuff->shape;
- xreq->coordMode = 1;
- xreq->length = client->req_len = (sizeof(xFillPolyReq) + len) >> 2;
- client->requestBuffer = (pointer)xreq;
-
- retval = (*ProcVector[X_FillPoly])(client);
- xfree(xreq);
- return retval;
-}
-
-/*
- * Routines for decoding line drawing requests
- */
-
-#define DECODE_PSHORT(in, val) \
- if ((*(in) & 0xf0) != 0xf0) \
- (val) = *(CARD8 *)(in)++; \
- else { \
- (val) = ((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1); \
- if ((val) >= 0xe00) \
- (val) -= 0x1000; \
- else \
- (val) += 0xf0; \
- (in) += 2; \
- }
-
-#define DECODE_SHORT(in, val) \
- if ((*(in) & 0xf0) != 0x80) \
- (val) = *(INT8 *)(in)++; \
- else { \
- (val) = ((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1); \
- if ((val) & 0x0800) \
- (val) = ((val) | 0xf000) - 0x70; \
- else \
- (val) += 0x80; \
- (in) += 2; \
- }
-
-#define DECODE_USHORT(in, val) \
- if ((*(in) & 0xf0) != 0xf0) \
- (val) = *(CARD8 *)(in)++; \
- else { \
- (val) = (((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1)) + 0xf0; \
- (in) += 2; \
- }
-
-#define DECODE_ANGLE(in, val) \
- if (*(INT8 *)(in) >= 0x6e) \
- (val) = (*(INT8 *)(in)++ - 0x67) * (15 << 6); \
- else if (*(INT8 *)(in) >= 0x5a) \
- (val) = (*(INT8 *)(in)++ - 0x5a) * (5 << 6); \
- else if (*(INT8 *)(in) <= (INT8)0x91) \
- (val) = (*(INT8 *)(in)++ - (INT8)0x98) * (15 << 6); \
- else if (*(INT8 *)(in) <= (INT8)0xa5) \
- (val) = (*(INT8 *)(in)++ - (INT8)0xa6) * (5 << 6); \
- else { \
- (val) = (*(CARD8 *)(in) << 8) | *(CARD8 *)((in) + 1); \
- (in) += 2; \
- }
-
-int
-LbxDecodePoints(char *in,
- char *inend,
- short *out)
-{
- char *start_out = (char *)out;
-
- while (in < inend) {
- DECODE_SHORT(in, *out);
- out++;
- DECODE_SHORT(in, *out);
- out++;
- }
- return ((char *)out - start_out);
-}
-
-int
-LbxDecodeSegment(char *in,
- char *inend,
- short *out)
-{
- short diff;
- short last_x = 0;
- short last_y = 0;
- char *start_out = (char *)out;
-
- while (in < inend) {
- DECODE_SHORT(in, diff);
- *out = last_x + diff;
- last_x += diff;
- out++;
- DECODE_SHORT(in, diff);
- *out = last_y + diff;
- last_y += diff;
- out++;
-
- DECODE_SHORT(in, diff);
- *out = last_x + diff;
- out++;
- DECODE_SHORT(in, diff);
- *out = last_y + diff;
- out++;
- }
- return ((char *)out - start_out);
-}
-
-int
-LbxDecodeRectangle(char *in,
- char *inend,
- short *out)
-{
- short diff;
- short last_x = 0;
- short last_y = 0;
- char *start_out = (char *)out;
-
- while (in < inend) {
- DECODE_SHORT(in, diff);
- *out = last_x + diff;
- last_x += diff;
- out++;
- DECODE_SHORT(in, diff);
- *out = last_y + diff;
- last_y += diff;
- out++;
-
- DECODE_USHORT(in, *(unsigned short *)out);
- out++;
- DECODE_USHORT(in, *(unsigned short *)out);
- out++;
- }
- return ((char *)out - start_out);
-}
-
-int
-LbxDecodeArc(char *in,
- char *inend,
- short *out)
-{
- short diff;
- short last_x = 0;
- short last_y = 0;
- char *start_out = (char *)out;
-
- while (in < inend) {
- DECODE_SHORT(in, diff);
- *out = last_x + diff;
- last_x += diff;
- out++;
- DECODE_SHORT(in, diff);
- *out = last_y + diff;
- last_y += diff;
- out++;
-
- DECODE_USHORT(in, *(unsigned short *)out);
- out++;
- DECODE_USHORT(in, *(unsigned short *)out);
- out++;
-
- DECODE_ANGLE(in, *out);
- out++;
- DECODE_ANGLE(in, *out);
- out++;
- }
- return ((char *)out - start_out);
-}
-
-int
-LbxDecodeCopyArea (ClientPtr client)
-{
- REQUEST(xLbxCopyAreaReq);
- char *in;
- xCopyAreaReq req;
- int len;
- Drawable srcDrawable, dstDrawable;
- GContext gc;
-
- GFX_GET_SRC_DST_DRAWABLE_AND_GC(xLbxCopyAreaReq, in, len);
- req.reqType = X_CopyArea;
- req.length = client->req_len = SIZEOF(xCopyAreaReq) >> 2;
- req.srcDrawable = srcDrawable;
- req.dstDrawable = dstDrawable;
- req.gc = gc;
- DECODE_PSHORT (in, req.srcX);
- DECODE_PSHORT (in, req.srcY);
- DECODE_PSHORT (in, req.dstX);
- DECODE_PSHORT (in, req.dstY);
- DECODE_USHORT (in, req.width);
- DECODE_USHORT (in, req.height);
- client->requestBuffer = (pointer) &req;
- return (*ProcVector[X_CopyArea])(client);
-}
-
-int
-LbxDecodeCopyPlane (ClientPtr client)
-{
- REQUEST(xLbxCopyPlaneReq);
- char *in;
- xCopyPlaneReq req;
- int len;
- Drawable srcDrawable, dstDrawable;
- GContext gc;
-
- GFX_GET_SRC_DST_DRAWABLE_AND_GC(xLbxCopyPlaneReq, in, len);
- req.reqType = X_CopyPlane;
- req.length = client->req_len = SIZEOF(xCopyPlaneReq) >> 2;
- req.srcDrawable = srcDrawable;
- req.dstDrawable = dstDrawable;
- req.gc = gc;
- DECODE_PSHORT (in, req.srcX);
- DECODE_PSHORT (in, req.srcY);
- DECODE_PSHORT (in, req.dstX);
- DECODE_PSHORT (in, req.dstY);
- DECODE_USHORT (in, req.width);
- DECODE_USHORT (in, req.height);
- req.bitPlane = stuff->bitPlane;
- client->requestBuffer = (pointer) &req;
- return (*ProcVector[X_CopyPlane])(client);
-}
-
-static pointer
-get_gfx_buffer(ClientPtr client,
- int len)
-{
- LbxClientPtr lbxClient = LbxClient(client);
- pointer tmp;
-
- /* XXX should probably shrink this sucker too */
- if (len > lbxClient->gb_size) {
- tmp = (pointer) xrealloc(lbxClient->gfx_buffer, len);
- if (!tmp)
- return (pointer) NULL;
- lbxClient->gfx_buffer = tmp;
- lbxClient->gb_size = len;
- }
- return lbxClient->gfx_buffer;
-}
-
-int
-LbxDecodePolyText (ClientPtr client)
-{
- REQUEST(xLbxPolyTextReq);
- char *in, *pos;
- xPolyTextReq *xreq;
- int len;
- Drawable drawable;
- GContext gc;
-
- GFX_GET_DRAWABLE_AND_GC(xLbxPolyTextReq, in, len);
- xreq = (xPolyTextReq *) get_gfx_buffer(client, sizeof (xPolyTextReq) + len);
- if (!xreq)
- return BadAlloc;
- xreq->reqType = stuff->lbxReqType == X_LbxPolyText8? X_PolyText8 : X_PolyText16;
- xreq->drawable = drawable;
- xreq->gc = gc;
- pos = in;
- DECODE_PSHORT(in, xreq->x);
- DECODE_PSHORT(in, xreq->y);
- len -= (in - pos);
- memmove ((char *) (xreq + 1), in, len);
- xreq->length = client->req_len = (sizeof (xPolyTextReq) + len) >> 2;
- client->requestBuffer = (pointer) xreq;
- return (*ProcVector[xreq->reqType])(client);
-}
-
-int
-LbxDecodeImageText (ClientPtr client)
-{
- REQUEST(xLbxImageTextReq);
- char *in, *pos;
- xImageTextReq *xreq;
- int len;
- Drawable drawable;
- GContext gc;
-
- GFX_GET_DRAWABLE_AND_GC(xLbxImageTextReq, in, len);
- xreq = (xImageTextReq *) get_gfx_buffer(client, sizeof (xImageTextReq) + len);
- if (!xreq)
- return BadAlloc;
- xreq->reqType = stuff->lbxReqType == X_LbxImageText8? X_ImageText8 : X_ImageText16;
- xreq->drawable = drawable;
- xreq->gc = gc;
- xreq->nChars = stuff->nChars;
- pos = in;
- DECODE_PSHORT(in, xreq->x);
- DECODE_PSHORT(in, xreq->y);
- len -= (in - pos);
- memmove ((char *) (xreq + 1), in, len);
- xreq->length = client->req_len = (sizeof (xImageTextReq) + len) >> 2;
- client->requestBuffer = (pointer) xreq;
- return (*ProcVector[xreq->reqType])(client);
-}
-
-int
-LbxDecodePutImage (ClientPtr client)
-{
- REQUEST (xLbxPutImageReq);
- char *in, *data;
- xPutImageReq xreq;
- int ppl, bpl, nbytes;
- int retval;
- int n;
-
- xreq.reqType = X_PutImage;
-
- in = (char *) stuff + sz_xLbxPutImageReq;
-
- if (stuff->bitPacked & 0x80) {
- xreq.format = (stuff->bitPacked >> 5) & 0x3;
- xreq.depth = ((stuff->bitPacked >> 2) & 0x7) + 1;
- xreq.leftPad = 0;
- } else {
- xreq.depth = (stuff->bitPacked >> 2) + 1;
- xreq.format = (*in >> 5) & 0x3;
- xreq.leftPad = *in++ & 0x1f;
- }
- DECODE_USHORT(in, xreq.width);
- DECODE_USHORT(in, xreq.height);
- DECODE_PSHORT(in, xreq.dstX);
- DECODE_PSHORT(in, xreq.dstY);
- if (client->swapped) {
- if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone ||
- GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- {
- swapl (in, n);
- if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone &&
- GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- swapl (in + 4, n);
- }
- }
- in += LbxDecodeGFXCache(client, stuff->cacheEnts, in,
- &xreq.drawable, &xreq.gc);
-
- ppl = xreq.width + xreq.leftPad;
- if (xreq.format != ZPixmap ||
- (xreq.depth == 1 && screenInfo.formats->bitsPerPixel == 1)) {
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- bpl = BitmapBytePadProto(ppl);
-#else
- bpl = BitmapBytePad(ppl);
-#endif
- nbytes = bpl;
- if (xreq.format == XYPixmap)
- nbytes *= xreq.depth;
- } else {
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- bpl = PixmapBytePadProto(ppl, xreq.depth);
-#else
- bpl = PixmapBytePad(ppl, xreq.depth);
-#endif
- nbytes = bpl;
- }
- nbytes *= xreq.height;
- xreq.length = ((nbytes + 3) >> 2) + (sz_xPutImageReq >> 2);
- /* +1 is because fillspan in DecodeFaxG42D seems to go 1 byte too far,
- * and I don't want to mess with that code */
- if ((data = (char *) xalloc ((xreq.length << 2) + 1)) == NULL)
- return BadAlloc;
-
- *((xPutImageReq *)data) = xreq;
-
- if (!stuff->compressionMethod)
- {
- memcpy(data + sz_xPutImageReq, in, nbytes);
- }
- else if (xreq.format != ZPixmap ||
- (xreq.depth == 1 && screenInfo.formats->bitsPerPixel == 1))
- {
- LbxBitmapCompMethod *compMethod;
-
- compMethod = LbxSrvrLookupBitmapCompMethod (LbxProxy(client),
- stuff->compressionMethod);
-
- if (!compMethod)
- {
- xfree (data);
- return (BadValue);
- }
- else
- {
- if (!compMethod->inited)
- {
- if (compMethod->compInit)
- (*compMethod->compInit)();
- compMethod->inited = 1;
- }
-
- (*compMethod->decompFunc) (
- (unsigned char *) in, (unsigned char *) data + sz_xPutImageReq,
- nbytes,
-#if BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER
- (ppl + BITMAP_SCANLINE_UNIT - 1) & ~BITMAP_SCANLINE_UNIT,
-#else
- ppl,
-#endif
- bpl,
- ((xConnSetup *) ConnectionInfo)->bitmapBitOrder == LSBFirst);
- }
- }
- else
- {
- LbxPixmapCompMethod *compMethod;
-
- compMethod = LbxSrvrLookupPixmapCompMethod (LbxProxy(client),
- stuff->compressionMethod);
-
- if (!compMethod)
- {
- xfree (data);
- return (BadValue);
- }
- else
- {
- if (!compMethod->inited)
- {
- if (compMethod->compInit)
- (*compMethod->compInit)();
- compMethod->inited = 1;
- }
-
- (*compMethod->decompFunc) (
- in, (char *) data + sz_xPutImageReq,
- (int) xreq.height, bpl);
- }
- }
-
- client->req_len = xreq.length;
- client->requestBuffer = (pointer) data;
-
- retval = (*ProcVector[X_PutImage])(client);
- xfree(data);
- return retval;
-}
-
-int
-LbxDecodeGetImage (ClientPtr client)
-{
- REQUEST (xLbxGetImageReq);
- xLbxGetImageReply *reply = NULL;
- int lbxLen, xLen, n;
- int method = 0, bytes, status;
- xGetImageReply *theImage;
-
- REQUEST_SIZE_MATCH(xLbxGetImageReq);
-
- status = DoGetImage(client, stuff->format, stuff->drawable,
- stuff->x, stuff->y,
- (int)stuff->width, (int)stuff->height,
- stuff->planeMask, &theImage);
-
- if (status != Success)
- return (status);
-
- if ((reply = (xLbxGetImageReply *) xalloc (
- sz_xLbxGetImageReply + theImage->length)) == NULL)
- {
- xfree(theImage);
- return (BadAlloc);
- }
-
- if (stuff->format != ZPixmap ||
- (theImage->depth == 1 && screenInfo.formats->bitsPerPixel == 1))
- {
- LbxBitmapCompMethod *compMethod;
-
- compMethod = LbxSrvrFindPreferredBitmapCompMethod (LbxProxy(client));
-
- if (!compMethod)
- status = LBX_IMAGE_COMPRESS_NO_SUPPORT;
- else
- {
- if (!compMethod->inited)
- {
- if (compMethod->compInit)
- (*compMethod->compInit)();
- compMethod->inited = 1;
- }
-
- status = (*compMethod->compFunc) (
- (unsigned char *) &theImage[1],
- (unsigned char *) &reply[1],
- theImage->length,
- theImage->length,
-#if BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER
- (int) (stuff->width + BITMAP_SCANLINE_UNIT - 1) &
- ~BITMAP_SCANLINE_UNIT,
-#else
- (int) stuff->width,
-#endif
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- BitmapBytePadProto(stuff->width),
-#else
- BitmapBytePad(stuff->width),
-#endif
- ((xConnSetup *) ConnectionInfo)->bitmapBitOrder == LSBFirst,
- &bytes);
-
- method = compMethod->methodOpCode;
- }
- }
- else
- {
- LbxPixmapCompMethod *compMethod;
-
- compMethod = LbxSrvrFindPreferredPixmapCompMethod (
- LbxProxy(client), (int) stuff->format, theImage->depth);
-
- if (!compMethod)
- status = LBX_IMAGE_COMPRESS_NO_SUPPORT;
- else
- {
- if (!compMethod->inited)
- {
- if (compMethod->compInit)
- (*compMethod->compInit)();
- compMethod->inited = 1;
- }
-
- status = (*compMethod->compFunc) (
- (char *) &theImage[1],
- (char *) &reply[1],
- theImage->length,
- (int) stuff->format,
- theImage->depth,
- (int) stuff->height,
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- PixmapBytePadProto(stuff->width, theImage->depth),
-#else
- PixmapBytePad(stuff->width, theImage->depth),
-#endif
- &bytes);
-
- method = compMethod->methodOpCode;
- }
- }
-
- reply->type = X_Reply;
- reply->depth = theImage->depth;
- reply->sequenceNumber = client->sequence;
- reply->visual = theImage->visual;
- reply->pad1 = reply->pad2 = reply->pad3 = reply->pad4 = reply->pad5 = 0;
-
- if (status != LBX_IMAGE_COMPRESS_SUCCESS)
- {
- reply->compressionMethod = LbxImageCompressNone;
- reply->lbxLength = reply->xLength = (theImage->length + 3) >> 2;
- }
- else
- {
- reply->compressionMethod = method;
- reply->lbxLength = (bytes + 3) >> 2;
- reply->xLength = (theImage->length + 3) >> 2;
- }
-
- lbxLen = reply->lbxLength;
- xLen = reply->xLength;
-
- if (client->swapped)
- {
- swaps (&reply->sequenceNumber, n);
- swapl (&reply->lbxLength, n);
- swapl (&reply->xLength, n);
- swapl (&reply->visual, n);
- }
-
- if (reply->compressionMethod != LbxImageCompressNone)
- {
- /*
- * If the compressed image is greater that 25% of the original
- * image, run the GetImage reply through the regular stream
- * compressor. Otherwise, just write the compressed image.
- */
-
- if (lbxLen > (xLen / 4))
- {
- WriteToClient (client,
- sz_xLbxGetImageReply + (lbxLen << 2), (char *)reply);
- }
- else
- {
- UncompressedWriteToClient (client,
- sz_xLbxGetImageReply + (lbxLen << 2), (char *)reply);
- }
- }
- else
- {
- /*
- * Write back the original uncompressed image.
- */
-
- WriteToClient (client, sz_xLbxGetImageReply, (char *)reply);
- WriteToClient (client, lbxLen << 2, (char *)&theImage[1]);
- }
-
- xfree (theImage);
-
- if (reply)
- xfree ((char *) reply);
-
- return (Success);
-}
diff --git a/lbx/lbxmain.c b/lbx/lbxmain.c
deleted file mode 100644
index 9139dfbed..000000000
--- a/lbx/lbxmain.c
+++ /dev/null
@@ -1,1760 +0,0 @@
-/* $Xorg: lbxmain.c,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/*
- * Copyright 1992 Network Computing Devices
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of NCD. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. NCD. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxmain.c,v 1.12 2001/10/28 03:34:12 tsi Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "extnsionst.h"
-#include "servermd.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include <X11/extensions/lbxdeltastr.h>
-#include "lbxserve.h"
-#include <X11/extensions/lbximage.h>
-#include "lbxsrvopts.h"
-#include "lbxtags.h"
-#include <X11/Xfuncproto.h>
-#include <errno.h>
-#ifndef Lynx
-#include <sys/uio.h>
-#else
-#include <uio.h>
-#endif
-#include <stdio.h>
-
-#ifndef X_NOT_POSIX
-#include <unistd.h>
-#endif
-
-#define CloseLbxClient 0xff
-
-#define MAXBYTESDIFF 8
-
-int LbxWhoAmI = 1; /*
- * for lbx zlib library to know who we are
- * server = 1
- * proxy = 0
- */
-
-
-static void LbxResetProc ( ExtensionEntry *extEntry );
-static void LbxFreeClient ( ClientPtr client );
-static void LbxShutdownProxy ( LbxProxyPtr proxy );
-static int DecodeLbxDelta ( ClientPtr client );
-
-static LbxProxyPtr proxyList;
-unsigned char LbxReqCode;
-int LbxEventCode;
-static int BadLbxClientCode;
-static int uid_seed;
-
-static int lbxCompressWorkProcCount;
-
-LbxClientPtr lbxClients[MAXCLIENTS];
-
-extern xConnSetupPrefix connSetupPrefix;
-extern char *ConnectionInfo;
-extern int (*LbxInitialVector[3])(ClientPtr);
-
-#ifdef DEBUG
-int lbxDebug = 0;
-#endif
-
-
-void
-LbxExtensionInit(void)
-{
- ExtensionEntry *extEntry;
-
- lbxCompressWorkProcCount = 0;
- proxyList = NULL;
- uid_seed = 0;
- if ((extEntry = AddExtension(LBXNAME, LbxNumberEvents, LbxNumberErrors,
- ProcLbxDispatch, SProcLbxDispatch,
- LbxResetProc, StandardMinorOpcode)))
- {
- LbxReqCode = (unsigned char)extEntry->base;
- LbxEventCode = extEntry->eventBase;
- BadLbxClientCode = extEntry->errorBase + BadLbxClient;
- LbxDixInit();
-
- LbxCmapInit ();
- DeclareExtensionSecurity(LBXNAME, TRUE);
- }
-}
-
-/*ARGSUSED*/
-static void
-LbxResetProc (ExtensionEntry *extEntry)
-{
- LbxResetTags();
- uid_seed = 0;
-}
-
-void
-LbxCloseClient (ClientPtr client)
-{
- xLbxCloseEvent closeEvent;
- ClientPtr master;
- LbxProxyPtr proxy;
- LbxClientPtr lbxClient = LbxClient(client);
- CARD32 id;
-
- if (!lbxClient)
- return;
- id = lbxClient->id;
- proxy = lbxClient->proxy;
-
- DBG (DBG_CLIENT, (stderr, "Close client %d\n", client->index));
- LbxFreeClient (client);
- if (!id)
- {
- isItTimeToYield = TRUE;
- CloseDownFileDescriptor (client);
- LbxShutdownProxy (proxy);
- }
- else
- {
- master = NULL;
- if (proxy->lbxClients[0])
- master = LbxProxyClient(proxy);
- if (master && !master->clientGone)
- {
- closeEvent.type = LbxEventCode;
- closeEvent.lbxType = LbxCloseEvent;
- closeEvent.client = id;
- closeEvent.sequenceNumber = master->sequence;
- closeEvent.pad1 = closeEvent.pad2 = closeEvent.pad3 =
- closeEvent.pad4 = closeEvent.pad5 = closeEvent.pad6 = 0;
- if (master->swapped) {
- int n;
-
- swaps(&closeEvent.sequenceNumber, n);
- swapl(&closeEvent.client, n);
- }
- WriteToClient(master, sizeof (closeEvent), (char *)&closeEvent);
- LbxForceOutput(proxy);
- }
- }
-}
-
-static int
-LbxReencodeEvent(ClientPtr client,
- LbxProxyPtr proxy,
- char *buf)
-{
- xEvent *ev = (xEvent *)buf;
- int n;
- lbxMotionCache *motionCache = &proxy->motionCache;
- int motionDelta = 0;
- Bool swapCache;
- xEvent tev, *sev;
-
- if (ev->u.u.type != MotionNotify) {
- if (proxy->dosquishing)
- return LbxSquishEvent(buf);
- return 0;
- }
-
- /*
- * Check if we can generate a motion delta event.
- *
- * The motion cache contains the last motion event the server sent.
- *
- * The following are always stored in the cache in the server's
- * byte order:
- * sequenceNumber, time, rootX, rootY, eventX, eventY
- * This is because when determining if we can do a delta, all
- * arithmetic must be done using the server's byte order.
- *
- * The following are stored in the byte order of the latest client
- * receiving a motion event (indicated by motionCache->swapped):
- * root, event, child, state
- * These fields do not need to be stored in the server's byte order
- * because we only use the '==' operator on them.
- */
-
- if (!proxy->motion_allowed_events) {
- DBG(DBG_CLIENT, (stderr, "throttling motion event for client %d\n", client->index));
- return sz_xEvent;
- }
- proxy->motion_allowed_events--;
-
- motionCache = &proxy->motionCache;
-
- if (!client->swapped)
- {
- swapCache = motionCache->swapped;
- sev = ev;
- }
- else
- {
- swapCache = !motionCache->swapped;
- sev = &tev;
- cpswaps (ev->u.keyButtonPointer.rootX,
- sev->u.keyButtonPointer.rootX);
- cpswaps (ev->u.keyButtonPointer.rootY,
- sev->u.keyButtonPointer.rootY);
- cpswaps (ev->u.keyButtonPointer.eventX,
- sev->u.keyButtonPointer.eventX);
- cpswaps (ev->u.keyButtonPointer.eventY,
- sev->u.keyButtonPointer.eventY);
- cpswaps (ev->u.u.sequenceNumber,
- sev->u.u.sequenceNumber);
- cpswapl (ev->u.keyButtonPointer.time,
- sev->u.keyButtonPointer.time);
- }
-
- if (swapCache)
- {
- swapl (&motionCache->root, n);
- swapl (&motionCache->event, n);
- swapl (&motionCache->child, n);
- swaps (&motionCache->state, n);
-
- motionCache->swapped = !motionCache->swapped;
- }
-
- motionDelta = 0;
-
- if (ev->u.u.detail == motionCache->detail &&
- ev->u.keyButtonPointer.root == motionCache->root &&
- ev->u.keyButtonPointer.event == motionCache->event &&
- ev->u.keyButtonPointer.child == motionCache->child &&
- ev->u.keyButtonPointer.state == motionCache->state &&
- ev->u.keyButtonPointer.sameScreen == motionCache->sameScreen) {
-
- int root_delta_x =
- sev->u.keyButtonPointer.rootX - motionCache->rootX;
- int root_delta_y =
- sev->u.keyButtonPointer.rootY - motionCache->rootY;
- int event_delta_x =
- sev->u.keyButtonPointer.eventX - motionCache->eventX;
- int event_delta_y =
- sev->u.keyButtonPointer.eventY - motionCache->eventY;
- unsigned long sequence_delta =
- sev->u.u.sequenceNumber - motionCache->sequenceNumber;
- unsigned long time_delta =
- sev->u.keyButtonPointer.time - motionCache->time;
-
- if (root_delta_x == event_delta_x &&
- event_delta_x >= -128 && event_delta_x < 128 &&
- root_delta_y == event_delta_y &&
- event_delta_y >= -128 && event_delta_y < 128) {
-
- if (sequence_delta == 0 && time_delta < 256) {
-
- lbxQuickMotionDeltaEvent *mev =
- (lbxQuickMotionDeltaEvent *)(buf + sz_xEvent -
- sz_lbxQuickMotionDeltaEvent);
-
- mev->type = LbxEventCode + LbxQuickMotionDeltaEvent;
- mev->deltaTime = time_delta;
- mev->deltaX = event_delta_x;
- mev->deltaY = event_delta_y;
-
- motionDelta = sz_xEvent - sz_lbxQuickMotionDeltaEvent;
-
- } else if (sequence_delta < 65536 && time_delta < 65536) {
-
- lbxMotionDeltaEvent *mev =
- (lbxMotionDeltaEvent *)(buf + sz_xEvent -
- sz_lbxMotionDeltaEvent);
-
- mev->type = LbxEventCode;
- mev->lbxType = LbxMotionDeltaEvent;
- mev->deltaTime = time_delta;
- mev->deltaSequence = sequence_delta;
- mev->deltaX = event_delta_x;
- mev->deltaY = event_delta_y;
-
- if (LbxProxyClient(proxy)->swapped)
- {
- swaps (&mev->deltaTime, n);
- swaps (&mev->deltaSequence, n);
- }
-
- motionDelta = sz_xEvent - sz_lbxMotionDeltaEvent;
- }
- }
- }
-
- motionCache->sequenceNumber = sev->u.u.sequenceNumber;
- motionCache->time = sev->u.keyButtonPointer.time;
- motionCache->rootX = sev->u.keyButtonPointer.rootX;
- motionCache->rootY = sev->u.keyButtonPointer.rootY;
- motionCache->eventX = sev->u.keyButtonPointer.eventX;
- motionCache->eventY = sev->u.keyButtonPointer.eventY;
-
- if (motionDelta)
- return motionDelta;
-
- ev->u.keyButtonPointer.pad1 = 0;
- motionCache->detail = ev->u.u.detail;
- motionCache->root = ev->u.keyButtonPointer.root;
- motionCache->event = ev->u.keyButtonPointer.event;
- motionCache->child = ev->u.keyButtonPointer.child;
- motionCache->state = ev->u.keyButtonPointer.state;
- motionCache->sameScreen = ev->u.keyButtonPointer.sameScreen;
- return 0;
-}
-
-static int
-LbxComposeDelta(LbxProxyPtr proxy,
- char *reply,
- int len,
- char *buf)
-{
- int diffs;
- int cindex;
- int n;
- xLbxDeltaReq *p = (xLbxDeltaReq *)buf;
-
- diffs = LBXDeltaMinDiffs(&proxy->outdeltas, (unsigned char *)reply, len,
- min(MAXBYTESDIFF, (len - sz_xLbxDeltaReq) >> 1),
- &cindex);
- if (diffs < 0) {
- LBXAddDeltaOut(&proxy->outdeltas, (unsigned char *)reply, len);
- return 0;
- }
- LBXEncodeDelta(&proxy->outdeltas, (unsigned char *)reply, diffs, cindex,
- (unsigned char *)(&buf[sz_xLbxDeltaReq]));
- LBXAddDeltaOut(&proxy->outdeltas, (unsigned char *)reply, len);
- p->reqType = LbxEventCode;
- p->lbxReqType = LbxDeltaEvent;
- p->diffs = diffs;
- p->cindex = cindex;
- len = (sz_xLbxDeltaReq + sz_xLbxDiffItem * diffs + 3) & ~3;
- p->length = len >> 2;
- if (LbxProxyClient(proxy)->swapped) {
- swaps(&p->length, n);
- }
- return len;
-}
-
-void
-LbxReencodeOutput(ClientPtr client,
- char *pbuf,
- int *pcount,
- char *cbuf,
- int *ccount)
-{
- LbxClientPtr lbxClient = LbxClient(client);
- LbxProxyPtr proxy = lbxClient->proxy;
- CARD32 len;
- int n;
- int count = *ccount;
- char *obuf = cbuf;
-
- if (client->clientState != ClientStateRunning) {
- if (DELTA_CACHEABLE(&proxy->outdeltas, count) &&
- (n = LbxComposeDelta(proxy, cbuf, count, proxy->oDeltaBuf))) {
- memcpy(obuf, proxy->oDeltaBuf, n);
- *ccount -= (count - n);
- }
- return;
- }
- if (lbxClient->bytes_remaining) {
- if (count < lbxClient->bytes_remaining) {
- lbxClient->bytes_remaining -= count;
- return;
- }
- if (DELTA_CACHEABLE(&proxy->outdeltas, lbxClient->bytes_in_reply)) {
- len = lbxClient->bytes_in_reply - lbxClient->bytes_remaining;
- pbuf += (*pcount - len);
- memcpy(proxy->replyBuf, pbuf, len);
- memcpy(proxy->replyBuf + len, cbuf, lbxClient->bytes_remaining);
- n = LbxComposeDelta(proxy, proxy->replyBuf,
- lbxClient->bytes_in_reply, proxy->oDeltaBuf);
- if (!n)
- obuf += lbxClient->bytes_remaining;
- else if (n <= len) {
- memcpy(pbuf, proxy->oDeltaBuf, n);
- *pcount -= (len - n);
- *ccount -= lbxClient->bytes_remaining;
- } else {
- memcpy(pbuf, proxy->oDeltaBuf, len);
- memcpy(obuf, proxy->oDeltaBuf + len, n - len);
- *ccount -= lbxClient->bytes_remaining - (n - len);
- obuf += n - len;
- }
- } else
- obuf += lbxClient->bytes_remaining;
- cbuf += lbxClient->bytes_remaining;
- count -= lbxClient->bytes_remaining;
- lbxClient->bytes_remaining = 0;
- }
- while (count) {
- lbxClient->bytes_in_reply = sz_xEvent;
- if (((xGenericReply *)cbuf)->type == X_Reply) {
- len = ((xGenericReply *)cbuf)->length;
- if (client->swapped) {
- swapl(&len, n);
- }
- lbxClient->bytes_in_reply += (len << 2);
- if (LbxProxyClient(proxy)->swapped != client->swapped) {
- swapl(&((xGenericReply *)cbuf)->length, n);
- }
- if (count < lbxClient->bytes_in_reply) {
- lbxClient->bytes_remaining = lbxClient->bytes_in_reply - count;
- if (obuf != cbuf)
- memmove(obuf, cbuf, count);
- return;
- }
- } else if (((xGenericReply *)cbuf)->type > X_Reply &&
- ((xGenericReply *)cbuf)->type < LASTEvent &&
- (n = LbxReencodeEvent(client, proxy, cbuf))) {
- cbuf += n;
- *ccount -= n;
- count -= n;
- if (n == sz_xEvent)
- continue;
- lbxClient->bytes_in_reply -= n;
- }
- if (DELTA_CACHEABLE(&proxy->outdeltas, lbxClient->bytes_in_reply) &&
- (n = LbxComposeDelta(proxy, cbuf, lbxClient->bytes_in_reply,
- proxy->oDeltaBuf))) {
- memcpy(obuf, proxy->oDeltaBuf, n);
- obuf += n;
- *ccount -= (lbxClient->bytes_in_reply - n);
- } else {
- if (obuf != cbuf)
- memmove(obuf, cbuf, lbxClient->bytes_in_reply);
- obuf += lbxClient->bytes_in_reply;
- }
- cbuf += lbxClient->bytes_in_reply;
- count -= lbxClient->bytes_in_reply;
- }
-}
-
-/*ARGSUSED*/
-static void
-LbxReplyCallback(CallbackListPtr *pcbl,
- pointer nulldata,
- pointer calldata)
-{
- ReplyInfoRec *pri = (ReplyInfoRec *)calldata;
- ClientPtr client = pri->client;
- LbxClientPtr lbxClient;
- REQUEST(xReq);
-
- if (!pri->startOfReply || stuff->reqType > 127)
- return;
- lbxClient = LbxClient(client);
- if (lbxClient)
- ZeroReplyPadBytes(pri->replyData, stuff->reqType);
-}
-
-/*
- * XXX If you think this is moronic, you're in good company,
- * but things definitely hang if we don't have this.
- */
-/* ARGSUSED */
-static Bool
-LbxCheckCompressInput (ClientPtr dummy1,
- pointer dummy2)
-{
- LbxProxyPtr proxy;
-
- if (!lbxCompressWorkProcCount)
- return TRUE;
-
- for (proxy = proxyList; proxy; proxy = proxy->next) {
- if (proxy->compHandle &&
- proxy->streamOpts.streamCompInputAvail(proxy->fd))
- AvailableClientInput (LbxProxyClient(proxy));
- }
- return FALSE;
-}
-
-static Bool
-LbxIsClientBlocked (LbxClientPtr lbxClient)
-{
- LbxProxyPtr proxy = lbxClient->proxy;
-
- return (lbxClient->ignored ||
- (GrabInProgress && lbxClient->client->index != GrabInProgress &&
- lbxClient != proxy->lbxClients[0]));
-}
-
-static void
-LbxSwitchRecv (LbxProxyPtr proxy,
- LbxClientPtr lbxClient)
-{
- ClientPtr client;
-
- proxy->curRecv = lbxClient;
- if (!lbxClient || lbxClient->client->clientGone)
- {
- DBG(DBG_CLIENT, (stderr, "switching to dispose input\n"));
- lbxClient = proxy->lbxClients[0];
- if (!lbxClient)
- return;
- }
- client = lbxClient->client;
- DBG (DBG_SWITCH, (stderr, "switching input to client %d\n", client->index));
-
- SwitchClientInput (client, FALSE);
- proxy->curDix = lbxClient;
-}
-
-/* ARGSUSED */
-static Bool
-LbxWaitForUnblocked (ClientPtr client,
- pointer closure)
-{
- LbxClientPtr lbxClient;
- LbxProxyPtr proxy;
-
- if (client->clientGone)
- return TRUE;
- lbxClient = LbxClient(client);
- if (!lbxClient)
- return TRUE;
- proxy = lbxClient->proxy;
- if (LbxIsClientBlocked (lbxClient) ||
- ((lbxClient != proxy->curDix) && proxy->curDix->reqs_pending &&
- !LbxIsClientBlocked(proxy->curDix)))
- return FALSE;
- lbxClient->input_blocked = FALSE;
- DBG (DBG_BLOCK, (stderr, "client %d no longer blocked, switching\n",
- client->index));
- SwitchClientInput (client, TRUE);
- proxy->curDix = lbxClient;
- return TRUE;
-}
-
-void
-LbxSetForBlock(LbxClientPtr lbxClient)
-{
- lbxClient->reqs_pending++;
- if (!lbxClient->input_blocked)
- {
- lbxClient->input_blocked = TRUE;
- QueueWorkProc(LbxWaitForUnblocked, lbxClient->client, NULL);
- }
-}
-
-/* ARGSUSED */
-static int
-LbxWaitForUngrab (ClientPtr client,
- pointer closure)
-{
- LbxClientPtr lbxClient = LbxClient(client);
- LbxProxyPtr proxy;
- xLbxListenToAllEvent ungrabEvent;
-
- if (client->clientGone || !lbxClient)
- return TRUE;
- if (GrabInProgress)
- return FALSE;
- proxy = lbxClient->proxy;
- proxy->grabClient = 0;
- ungrabEvent.type = LbxEventCode;
- ungrabEvent.lbxType = LbxListenToAll;
- ungrabEvent.pad1 = ungrabEvent.pad2 = ungrabEvent.pad3 =
- ungrabEvent.pad4 = ungrabEvent.pad5 = ungrabEvent.pad6 =
- ungrabEvent.pad7 = 0;
- WriteToClient (client,
- sizeof(xLbxListenToAllEvent), (char *)&ungrabEvent);
- LbxForceOutput(proxy);
- return TRUE;
-}
-
-static void
-LbxServerGrab(LbxProxyPtr proxy)
-{
- LbxClientPtr grabbingLbxClient;
- xLbxListenToOneEvent grabEvent;
-
- /*
- * If the current grabbing client has changed, then we need
- * to send a message to update the proxy.
- */
-
- grabEvent.type = LbxEventCode;
- grabEvent.lbxType = LbxListenToOne;
- if (!(grabbingLbxClient = lbxClients[GrabInProgress]) ||
- grabbingLbxClient->proxy != proxy)
- grabEvent.client = 0xffffffff; /* client other than a proxy client */
- else
- grabEvent.client = grabbingLbxClient->id;
- grabEvent.pad1 = grabEvent.pad2 = grabEvent.pad3 =
- grabEvent.pad4 = grabEvent.pad5 = grabEvent.pad6 = 0;
- if (LbxProxyClient(proxy)->swapped) {
- int n;
- swapl(&grabEvent.client, n);
- }
- WriteToClient(LbxProxyClient(proxy),
- sizeof(xLbxListenToOneEvent), (char *)&grabEvent);
- LbxForceOutput(proxy);
- if (!proxy->grabClient)
- QueueWorkProc(LbxWaitForUngrab, LbxProxyClient(proxy), NULL);
- proxy->grabClient = GrabInProgress;
-}
-
-#define MAJOROP(client) ((xReq *)client->requestBuffer)->reqType
-#define MINOROP(client) ((xReq *)client->requestBuffer)->data
-
-static Bool lbxCacheable[] = {
- FALSE, /* LbxQueryVersion 0 */
- FALSE, /* LbxStartProxy 1 */
- TRUE, /* LbxStopProxy 2 */
- FALSE, /* LbxSwitch 3 */
- FALSE, /* LbxNewClient 4 */
- TRUE, /* LbxCloseClient 5 */
- TRUE, /* LbxModifySequence 6 */
- FALSE, /* LbxAllowMotion 7 */
- TRUE, /* LbxIncrementPixel 8 */
- FALSE, /* LbxDelta 9 */
- TRUE, /* LbxGetModifierMapping 10 */
- FALSE, /* nothing 11 */
- TRUE, /* LbxInvalidateTag 12 */
- TRUE, /* LbxPolyPoint 13 */
- TRUE, /* LbxPolyLine 14 */
- TRUE, /* LbxPolySegment 15 */
- TRUE, /* LbxPolyRectangle 16 */
- TRUE, /* LbxPolyArc 17 */
- TRUE, /* LbxFillPoly 18 */
- TRUE, /* LbxPolyFillRectangle 19 */
- TRUE, /* LbxPolyFillArc 20 */
- TRUE, /* LbxGetKeyboardMapping 21 */
- TRUE, /* LbxQueryFont 22 */
- TRUE, /* LbxChangeProperty 23 */
- TRUE, /* LbxGetProperty 24 */
- TRUE, /* LbxTagData 25 */
- TRUE, /* LbxCopyArea 26 */
- TRUE, /* LbxCopyPlane 27 */
- TRUE, /* LbxPolyText8 28 */
- TRUE, /* LbxPolyText16 29 */
- TRUE, /* LbxImageText8 30 */
- TRUE, /* LbxImageText16 31 */
- FALSE, /* LbxQueryExtension 32 */
- TRUE, /* LbxPutImage 33 */
- TRUE, /* LbxGetImage 34 */
- FALSE, /* LbxBeginLargeRequest 35 */
- FALSE, /* LbxLargeRequestData 36 */
- FALSE, /* LbxEndLargeRequest 37 */
- FALSE, /* LbxInternAtoms 38 */
- TRUE, /* LbxGetWinAttrAndGeom 39 */
- TRUE, /* LbxGrabCmap 40 */
- TRUE, /* LbxReleaseCmap 41 */
- TRUE, /* LbxAllocColor 42 */
- TRUE, /* LbxSync 43 */
-};
-
-#define NUM(a) (sizeof (a) / sizeof (a[0]))
-
-static int
-LbxReadRequestFromClient (ClientPtr client)
-{
- int ret;
- LbxClientPtr lbxClient = LbxClient(client);
- LbxProxyPtr proxy = lbxClient->proxy;
- ClientPtr masterClient = LbxProxyClient(proxy);
- Bool isblocked;
- Bool cacheable;
-
- DBG (DBG_READ_REQ, (stderr, "Reading request from client %d\n", client->index));
-
- if (GrabInProgress && (proxy->grabClient != GrabInProgress))
- LbxServerGrab(proxy);
- isblocked = LbxIsClientBlocked(lbxClient);
-
- if (lbxClient->reqs_pending && !isblocked) {
- ret = StandardReadRequestFromClient(client);
- if (ret > 0 && (MAJOROP(client) == LbxReqCode) &&
- (MINOROP(client) == X_LbxEndLargeRequest))
- ret = PrepareLargeReqBuffer(client);
- if (!--lbxClient->reqs_pending && (lbxClient != proxy->curRecv))
- LbxSwitchRecv (proxy, proxy->curRecv);
- return ret;
- }
- while (1) {
- ret = StandardReadRequestFromClient(masterClient);
- if (ret <= 0)
- return ret;
- client->requestBuffer = masterClient->requestBuffer;
- client->req_len = masterClient->req_len;
- cacheable = client->clientState == ClientStateRunning;
- if (cacheable && (MAJOROP(client) == LbxReqCode)) {
- /* Check to see if this request is delta cached */
- if (MINOROP(client) < NUM(lbxCacheable))
- cacheable = lbxCacheable[MINOROP(client)];
- switch (MINOROP(client)) {
- case X_LbxSwitch:
- /* Switch is sent by proxy */
- if (masterClient->swapped)
- SProcLbxSwitch (client);
- else
- ProcLbxSwitch (client);
- return 0;
- case X_LbxDelta:
- ret = DecodeLbxDelta (client);
- DBG(DBG_DELTA,
- (stderr,"delta decompressed msg %d, len = %d\n",
- (unsigned)((unsigned char *)client->requestBuffer)[0],
- ret));
- break;
- case X_LbxEndLargeRequest:
- if (!isblocked)
- ret = PrepareLargeReqBuffer(client);
- break;
- }
- }
- if (cacheable && DELTA_CACHEABLE(&proxy->indeltas, ret)) {
- DBG(DBG_DELTA,
- (stderr, "caching msg %d, len = %d, index = %d\n",
- (unsigned)((unsigned char *)client->requestBuffer)[0],
- ret, proxy->indeltas.nextDelta));
- LBXAddDeltaIn(&proxy->indeltas, client->requestBuffer, ret);
- }
- if (client->swapped != masterClient->swapped) {
- char n;
- /* put length in client order */
- swaps(&((xReq *)client->requestBuffer)->length, n);
- }
- if (!isblocked)
- return ret;
- DBG (DBG_BLOCK, (stderr, "Stashing %d bytes for %d\n",
- ret, client->index));
- AppendFakeRequest (client, client->requestBuffer, ret);
- LbxSetForBlock(lbxClient);
- }
-}
-
-static LbxClientPtr
-LbxInitClient (LbxProxyPtr proxy,
- ClientPtr client,
- CARD32 id)
-{
- LbxClientPtr lbxClient;
- int i;
-
- lbxClient = (LbxClientPtr) xalloc (sizeof (LbxClientRec));
- if (!lbxClient)
- return NULL;
- lbxClient->id = id;
- lbxClient->client = client;
- lbxClient->proxy = proxy;
- lbxClient->ignored = FALSE;
- lbxClient->input_blocked = FALSE;
- lbxClient->reqs_pending = 0;
- lbxClient->bytes_in_reply = 0;
- lbxClient->bytes_remaining = 0;
- client->readRequest = LbxReadRequestFromClient;
- bzero (lbxClient->drawableCache, sizeof (lbxClient->drawableCache));
- bzero (lbxClient->gcontextCache, sizeof (lbxClient->gcontextCache));
- lbxClients[client->index] = lbxClient;
- for (i = 0; proxy->lbxClients[i]; i++)
- ;
- if (i > proxy->maxIndex)
- proxy->maxIndex = i;
- proxy->lbxClients[i] = lbxClient;
- proxy->numClients++;
- lbxClient->gfx_buffer = (pointer) NULL;
- lbxClient->gb_size = 0;
- return lbxClient;
-}
-
-static void
-LbxFreeClient (ClientPtr client)
-{
- LbxClientPtr lbxClient = LbxClient(client);
- LbxProxyPtr proxy = lbxClient->proxy;
- int i;
-
- if (lbxClient != proxy->lbxClients[0]) {
- if (lbxClient == proxy->curRecv)
- LbxSwitchRecv(proxy, NULL);
- else if (lbxClient == proxy->curDix)
- LbxSwitchRecv(proxy, proxy->curRecv);
- }
-
- --proxy->numClients;
- lbxClients[client->index] = NULL;
- for (i = 0; i <= proxy->maxIndex; i++) {
- if (proxy->lbxClients[i] == lbxClient) {
- proxy->lbxClients[i] = NULL;
- break;
- }
- }
- while (proxy->maxIndex >= 0 && !proxy->lbxClients[proxy->maxIndex])
- --proxy->maxIndex;
- xfree(lbxClient->gfx_buffer);
- client->readRequest = StandardReadRequestFromClient;
- xfree (lbxClient);
-}
-
-static void
-LbxFreeProxy (LbxProxyPtr proxy)
-{
- LbxProxyPtr *p;
-
- LBXFreeDeltaCache(&proxy->indeltas);
- LBXFreeDeltaCache(&proxy->outdeltas);
- LbxFreeOsBuffers(proxy);
- if (proxy->iDeltaBuf)
- xfree(proxy->iDeltaBuf);
- if (proxy->replyBuf)
- xfree(proxy->replyBuf);
- if (proxy->oDeltaBuf)
- xfree(proxy->oDeltaBuf);
- if (proxy->compHandle)
- proxy->streamOpts.streamCompFreeHandle(proxy->compHandle);
- if (proxy->bitmapCompMethods)
- xfree (proxy->bitmapCompMethods);
- if (proxy->pixmapCompMethods)
- xfree (proxy->pixmapCompMethods);
- if (proxy->pixmapCompDepths)
- {
- int i;
- for (i = 0; i < proxy->numPixmapCompMethods; i++)
- xfree (proxy->pixmapCompDepths[i]);
- xfree (proxy->pixmapCompDepths);
- }
-
- for (p = &proxyList; *p; p = &(*p)->next) {
- if (*p == proxy) {
- *p = proxy->next;
- break;
- }
- }
- if (!proxyList)
- DeleteCallback(&ReplyCallback, LbxReplyCallback, NULL);
-
- xfree (proxy);
-}
-
-LbxProxyPtr
-LbxPidToProxy(int pid)
-{
- LbxProxyPtr proxy;
-
- for (proxy = proxyList; proxy; proxy = proxy->next) {
- if (proxy->pid == pid)
- return proxy;
- }
- return NULL;
-}
-
-static void
-LbxShutdownProxy (LbxProxyPtr proxy)
-{
- int i;
- ClientPtr client;
-
- if (proxy->compHandle)
- --lbxCompressWorkProcCount;
- while (proxy->grabbedCmaps)
- LbxReleaseCmap(proxy->grabbedCmaps, FALSE);
- for (i = 0; i <= proxy->maxIndex; i++)
- {
- if (proxy->lbxClients[i])
- {
- client = proxy->lbxClients[i]->client;
- if (!client->clientGone)
- CloseDownClient (client);
- }
- }
- LbxFlushTags(proxy);
- LbxFreeProxy(proxy);
-}
-
-
-int
-ProcLbxQueryVersion (ClientPtr client)
-{
- /* REQUEST(xLbxQueryVersionReq); */
- xLbxQueryVersionReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH(xLbxQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = LBX_MAJOR_VERSION;
- rep.minorVersion = LBX_MINOR_VERSION;
- rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- WriteToClient(client, sizeof(xLbxQueryVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-NextProxyID (void)
-{
- LbxProxyPtr proxy;
- int id;
-
- for (id = 1; id < MAX_NUM_PROXIES; id++) {
- for (proxy = proxyList; proxy && proxy->pid != id; proxy = proxy->next)
- ;
- if (!proxy)
- return id;
- }
- return -1;
-}
-
-int
-ProcLbxStartProxy (ClientPtr client)
-{
- REQUEST(xLbxStartProxyReq);
- LbxProxyPtr proxy;
- LbxClientPtr lbxClient;
- int reqlen;
- int replylen;
- xLbxStartReply *replybuf;
- LbxNegOptsRec negopt;
- register int n;
- pointer compHandle = NULL;
-
- REQUEST_AT_LEAST_SIZE(xLbxStartProxyReq);
- if (lbxClients[client->index])
- return BadLbxClientCode;
- proxy = (LbxProxyPtr) xalloc (sizeof (LbxProxyRec));
- if (!proxy)
- return BadAlloc;
- bzero(proxy, sizeof (LbxProxyRec));
- proxy->pid = NextProxyID();
- if (proxy->pid < 0) { /* too many proxies */
- xfree(proxy);
- return BadAlloc;
- }
- proxy->uid = ++uid_seed;
- if (!proxyList)
- AddCallback(&ReplyCallback, LbxReplyCallback, NULL);
-
- if(!proxyList)
- proxyList = proxy;
- else{
- proxy->next = proxyList;
- proxyList = proxy;
- }
-
- /*
- * Don't know exactly how big the reply will be, but it won't be
- * bigger than the request
- */
- reqlen = client->req_len << 2;
- replybuf = (xLbxStartReply *) xalloc(max(reqlen, sz_xLbxStartReply));
- if (!replybuf) {
- LbxFreeProxy(proxy);
- return BadAlloc;
- }
-
- LbxOptionInit(&negopt);
-
- replylen = LbxOptionParse(&negopt,
- (unsigned char *)&stuff[1],
- reqlen - sz_xLbxStartProxyReq,
- (unsigned char *)&replybuf->optDataStart);
- if (replylen < 0) {
- /*
- * Didn't understand option format, so we'll just end up
- * using the defaults. Set nopts so that the proxy will
- * be informed that we rejected the options because of
- * decoding problems.
- */
- LbxOptionInit(&negopt);
- negopt.nopts = 0xff;
- replylen = 0;
- }
-
- if (LBXInitDeltaCache(&proxy->indeltas, negopt.proxyDeltaN,
- negopt.proxyDeltaMaxLen) < 0
- ||
- LBXInitDeltaCache(&proxy->outdeltas, negopt.serverDeltaN,
- negopt.serverDeltaMaxLen) < 0) {
- LbxFreeProxy(proxy);
- xfree(replybuf);
- return BadAlloc;
- }
-
- n = 0;
- if (negopt.proxyDeltaN)
- n = negopt.proxyDeltaMaxLen;
- if (negopt.serverDeltaN && negopt.serverDeltaMaxLen > n)
- n = negopt.serverDeltaMaxLen;
- if (n &&
- (!(proxy->iDeltaBuf = (char *)xalloc (n)) ||
- !(proxy->replyBuf = (char *)xalloc (n)) ||
- !(proxy->oDeltaBuf = (char *)xalloc (n)))) {
- LbxFreeProxy(proxy);
- xfree(replybuf);
- return BadAlloc;
- }
-
- MakeClientGrabImpervious(client); /* proxy needs to be grab-proof */
- proxy->fd = ClientConnectionNumber(client);
- if (negopt.streamOpts.streamCompInit) {
- compHandle =
- (*negopt.streamOpts.streamCompInit)(proxy->fd, negopt.streamOpts.streamCompArg);
- if (!compHandle) {
- LbxFreeProxy(proxy);
- xfree(replybuf);
- return BadAlloc;
- }
- }
- proxy->ofirst = NULL;
- proxy->olast = NULL;
- if (!LbxInitClient (proxy, client, 0))
- {
- LbxFreeProxy(proxy);
- xfree(replybuf);
- return BadAlloc;
- }
- proxy->dosquishing = negopt.squish;
- proxy->numBitmapCompMethods = negopt.numBitmapCompMethods;
- proxy->bitmapCompMethods = negopt.bitmapCompMethods;
- proxy->numPixmapCompMethods = negopt.numPixmapCompMethods;
- proxy->pixmapCompMethods = negopt.pixmapCompMethods;
- proxy->pixmapCompDepths = negopt.pixmapCompDepths;
-
- proxy->streamOpts = negopt.streamOpts;
- proxy->useTags = negopt.useTags;
-
- proxy->grabbedCmaps = NULL;
-
- /* send reply */
- replybuf->type = X_Reply;
- replybuf->nOpts = negopt.nopts;
- replybuf->sequenceNumber = client->sequence;
-
- replylen += sz_xLbxStartReplyHdr;
- if (replylen < sz_xLbxStartReply)
- replylen = sz_xLbxStartReply;
- replybuf->length = (replylen - sz_xLbxStartReply + 3) >> 2;
- if (client->swapped) {
- swaps(&replybuf->sequenceNumber, n);
- swapl(&replybuf->length, n);
- }
- lbxClient = LbxClient(client);
- WriteToClient(client, replylen, (char *)replybuf);
-
- LbxProxyConnection(client, proxy);
- lbxClient = proxy->lbxClients[0];
- proxy->curDix = lbxClient;
- proxy->curRecv = lbxClient;
- proxy->compHandle = compHandle;
-
- if (proxy->compHandle && !lbxCompressWorkProcCount++)
- QueueWorkProc(LbxCheckCompressInput, NULL, NULL);
-
- xfree(replybuf);
- return Success;
-}
-
-int
-ProcLbxStopProxy(ClientPtr client)
-{
- /* REQUEST(xLbxStopProxyReq); */
- LbxProxyPtr proxy;
- LbxClientPtr lbxClient = LbxClient(client);
-
- REQUEST_SIZE_MATCH(xLbxStopProxyReq);
-
- if (!lbxClient)
- return BadLbxClientCode;
- if (lbxClient->id)
- return BadLbxClientCode;
-
- proxy = lbxClient->proxy;
- LbxFreeClient (client);
- LbxShutdownProxy (proxy);
- return Success;
-}
-
-int
-ProcLbxSwitch(ClientPtr client)
-{
- REQUEST(xLbxSwitchReq);
- LbxProxyPtr proxy = LbxMaybeProxy(client);
- LbxClientPtr lbxClient;
- int i;
-
- REQUEST_SIZE_MATCH(xLbxSwitchReq);
- if (!proxy)
- return BadLbxClientCode;
- for (i = 0; i <= proxy->maxIndex; i++) {
- lbxClient = proxy->lbxClients[i];
- if (lbxClient && lbxClient->id == stuff->client) {
- LbxSwitchRecv (proxy, lbxClient);
- return Success;
- }
- }
- LbxSwitchRecv (proxy, NULL);
- return BadLbxClientCode;
-}
-
-int
-ProcLbxBeginLargeRequest(ClientPtr client)
-{
- REQUEST(xLbxBeginLargeRequestReq);
-
- client->sequence--;
- REQUEST_SIZE_MATCH(xLbxBeginLargeRequestReq);
- if (!AllocateLargeReqBuffer(client, stuff->largeReqLength << 2))
- return BadAlloc;
- return Success;
-}
-
-
-int
-ProcLbxLargeRequestData(ClientPtr client)
-{
- REQUEST(xLbxLargeRequestDataReq);
-
- client->sequence--;
- REQUEST_AT_LEAST_SIZE(xLbxLargeRequestDataReq);
- if (!AddToLargeReqBuffer(client, (char *) (stuff + 1),
- (client->req_len - 1) << 2))
- return BadAlloc;
- return Success;
-}
-
-
-int
-ProcLbxEndLargeRequest(ClientPtr client)
-{
- /* REQUEST(xReq); */
-
- client->sequence--;
- REQUEST_SIZE_MATCH(xReq);
- return BadAlloc;
-}
-
-
-int
-ProcLbxInternAtoms(ClientPtr client)
-{
- REQUEST(xLbxInternAtomsReq);
- LbxClientPtr lbxClient = LbxClient(client);
- xLbxInternAtomsReply *replyRet;
- char *ptr = (char *) stuff + sz_xLbxInternAtomsReq;
- Atom *atomsRet;
- int replyLen, i;
- char lenbuf[2];
- CARD16 len;
- char n;
-
- REQUEST_AT_LEAST_SIZE(xLbxInternAtomsReq);
-
- if (!lbxClient)
- return BadLbxClientCode;
- if (lbxClient->id)
- return BadLbxClientCode;
-
- replyLen = sz_xLbxInternAtomsReplyHdr + stuff->num * sizeof (Atom);
- if (replyLen < sz_xLbxInternAtomsReply)
- replyLen = sz_xLbxInternAtomsReply;
-
- if (!(replyRet = (xLbxInternAtomsReply *) xalloc (replyLen)))
- return BadAlloc;
-
- atomsRet = (Atom *) ((char *) replyRet + sz_xLbxInternAtomsReplyHdr);
-
- for (i = 0; i < stuff->num; i++)
- {
- lenbuf[0] = ptr[0];
- lenbuf[1] = ptr[1];
- len = *((CARD16 *) lenbuf);
- ptr += 2;
-
- if ((atomsRet[i] = MakeAtom (ptr, len, TRUE)) == BAD_RESOURCE)
- {
- xfree (replyRet);
- return BadAlloc;
- }
-
- ptr += len;
- }
-
- if (client->swapped)
- for (i = 0; i < stuff->num; i++)
- swapl (&atomsRet[i], n);
-
- replyRet->type = X_Reply;
- replyRet->sequenceNumber = client->sequence;
- replyRet->length = (replyLen - sz_xLbxInternAtomsReply + 3) >> 2;
-
- if (client->swapped) {
- swaps(&replyRet->sequenceNumber, n);
- swapl(&replyRet->length, n);
- }
-
- WriteToClient (client, replyLen, (char *) replyRet);
-
- xfree (replyRet);
-
- return Success;
-}
-
-
-int
-ProcLbxGetWinAttrAndGeom(ClientPtr client)
-{
- REQUEST(xLbxGetWinAttrAndGeomReq);
- xGetWindowAttributesReply wa;
- xGetGeometryReply wg;
- xLbxGetWinAttrAndGeomReply reply;
- WindowPtr pWin;
- int status;
-
- REQUEST_SIZE_MATCH(xLbxGetWinAttrAndGeomReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
- SecurityReadAccess);
- if (!pWin)
- return(BadWindow);
- GetWindowAttributes(pWin, client, &wa);
-
- if ((status = GetGeometry(client, &wg)) != Success)
- return status;
-
- reply.type = X_Reply;
- reply.length = (sz_xLbxGetWinAttrAndGeomReply - 32) >> 2;
- reply.sequenceNumber = client->sequence;
-
- reply.backingStore = wa.backingStore;
- reply.visualID = wa.visualID;
-#if defined(__cplusplus) || defined(c_plusplus)
- reply.c_class = wa.c_class;
-#else
- reply.class = wa.class;
-#endif
- reply.bitGravity = wa.bitGravity;
- reply.winGravity = wa.winGravity;
- reply.backingBitPlanes = wa.backingBitPlanes;
- reply.backingPixel = wa.backingPixel;
- reply.saveUnder = wa.saveUnder;
- reply.mapInstalled = wa.mapInstalled;
- reply.mapState = wa.mapState;
- reply.override = wa.override;
- reply.colormap = wa.colormap;
- reply.allEventMasks = wa.allEventMasks;
- reply.yourEventMask = wa.yourEventMask;
- reply.doNotPropagateMask = wa.doNotPropagateMask;
- reply.pad1 = 0;
- reply.root = wg.root;
- reply.x = wg.x;
- reply.y = wg.y;
- reply.width = wg.width;
- reply.height = wg.height;
- reply.borderWidth = wg.borderWidth;
- reply.depth = wg.depth;
- reply.pad2 = 0;
-
- if (client->swapped)
- {
- register char n;
-
- swaps(&reply.sequenceNumber, n);
- swapl(&reply.length, n);
- swapl(&reply.visualID, n);
- swaps(&reply.class, n);
- swapl(&reply.backingBitPlanes, n);
- swapl(&reply.backingPixel, n);
- swapl(&reply.colormap, n);
- swapl(&reply.allEventMasks, n);
- swapl(&reply.yourEventMask, n);
- swaps(&reply.doNotPropagateMask, n);
- swapl(&reply.root, n);
- swaps(&reply.x, n);
- swaps(&reply.y, n);
- swaps(&reply.width, n);
- swaps(&reply.height, n);
- swaps(&reply.borderWidth, n);
- }
-
- WriteToClient(client, sizeof(xLbxGetWinAttrAndGeomReply), (char *)&reply);
- return(client->noClientException);
-}
-
-int
-ProcLbxNewClient(ClientPtr client)
-{
- REQUEST(xLbxNewClientReq);
- ClientPtr newClient;
- LbxProxyPtr proxy = LbxMaybeProxy(client);
- CARD32 id;
- int len, i;
- char *setupbuf;
- LbxClientPtr lbxClient;
-
- REQUEST_AT_LEAST_SIZE(xLbxNewClientReq);
-
- /* save info before our request disappears */
- id = stuff->client;
- if (!proxy || !id)
- return BadLbxClientCode;
- if (proxy->numClients == MAX_LBX_CLIENTS)
- return BadAlloc;
- for (i = 1; i <= proxy->maxIndex; i++) {
- if (proxy->lbxClients[i] && proxy->lbxClients[i]->id == id)
- return BadLbxClientCode;
- }
- len = (client->req_len << 2) - sizeof(xLbxNewClientReq);
- setupbuf = (char *)xalloc (len);
- if (!setupbuf)
- return BadAlloc;
- memcpy (setupbuf, (char *)&stuff[1], len);
-
- newClient = AllocLbxClientConnection (client, proxy);
- if (!newClient)
- return BadAlloc;
- newClient->requestVector = LbxInitialVector;
- lbxClient = LbxInitClient (proxy, newClient, id);
- if (!lbxClient)
- {
- CloseDownClient (newClient);
- return BadAlloc;
- }
-
- AppendFakeRequest (newClient, setupbuf, len);
- xfree (setupbuf);
- LbxSetForBlock(lbxClient);
-
- DBG (DBG_CLIENT, (stderr, "lbxNewClient X %d\n", newClient->index));
- return Success;
-}
-
-int
-ProcLbxEstablishConnection(ClientPtr client)
-{
- char *reason = NULL;
- char *auth_proto, *auth_string;
- register xConnClientPrefix *prefix;
- REQUEST(xReq);
-
- prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
- auth_proto = (char *)prefix + sz_xConnClientPrefix;
- auth_string = auth_proto + ((prefix->nbytesAuthProto + 3) & ~3);
- if ((prefix->majorVersion != X_PROTOCOL) ||
- (prefix->minorVersion != X_PROTOCOL_REVISION))
- reason = "Protocol version mismatch";
- else
- reason = ClientAuthorized(client,
- prefix->nbytesAuthProto,
- auth_proto,
- prefix->nbytesAuthString,
- auth_string);
-
- if (client->clientState == ClientStateCheckingSecurity ||
- client->clientState == ClientStateAuthenticating)
- return (client->noClientException = -1); /* XXX some day */
- return(LbxSendConnSetup(client, reason));
-}
-
-int
-ProcLbxCloseClient (ClientPtr client)
-{
- REQUEST(xLbxCloseClientReq);
- LbxClientPtr lbxClient = LbxClient(client);
-
- REQUEST_SIZE_MATCH(xLbxCloseClientReq);
- if (!lbxClient || lbxClient->id != stuff->client)
- return BadLbxClientCode;
-
- /* this will cause the client to be closed down back in Dispatch() */
- return(client->noClientException = CloseLbxClient);
-}
-
-int
-ProcLbxModifySequence (ClientPtr client)
-{
- REQUEST(xLbxModifySequenceReq);
-
- REQUEST_SIZE_MATCH(xLbxModifySequenceReq);
- client->sequence += (stuff->adjust - 1); /* Dispatch() adds 1 */
- return Success;
-}
-
-int
-ProcLbxAllowMotion (ClientPtr client)
-{
- REQUEST(xLbxAllowMotionReq);
-
- client->sequence--;
- REQUEST_SIZE_MATCH(xLbxAllowMotionReq);
- LbxAllowMotion(client, stuff->num);
- return Success;
-}
-
-
-static int
-DecodeLbxDelta (ClientPtr client)
-{
- REQUEST(xLbxDeltaReq);
- LbxClientPtr lbxClient = LbxClient(client);
- LbxProxyPtr proxy = lbxClient->proxy;
- int len;
- unsigned char *buf;
-
- /* Note that LBXDecodeDelta decodes and adds current msg to the cache */
- len = LBXDecodeDelta(&proxy->indeltas,
- (xLbxDiffItem *)(((char *)stuff) + sz_xLbxDeltaReq),
- stuff->diffs, stuff->cindex, &buf);
- /*
- * Some requests, such as FillPoly, result in the protocol input
- * buffer being modified. So we need to copy the request
- * into a temporary buffer where a write would be harmless.
- * Maybe some day do this copying on a case by case basis,
- * since not all requests are guilty of this.
- */
- memcpy(proxy->iDeltaBuf, buf, len);
-
- client->requestBuffer = proxy->iDeltaBuf;
- client->req_len = len >> 2;
- return len;
-}
-
-int
-ProcLbxGetModifierMapping(ClientPtr client)
-{
- /* REQUEST(xLbxGetModifierMappingReq); */
-
- REQUEST_SIZE_MATCH(xLbxGetModifierMappingReq);
- return LbxGetModifierMapping(client);
-}
-
-int
-ProcLbxGetKeyboardMapping(ClientPtr client)
-{
- /* REQUEST(xLbxGetKeyboardMappingReq); */
-
- REQUEST_SIZE_MATCH(xLbxGetKeyboardMappingReq);
- return LbxGetKeyboardMapping(client);
-}
-
-int
-ProcLbxQueryFont(ClientPtr client)
-{
- /* REQUEST(xLbxQueryFontReq); */
-
- REQUEST_SIZE_MATCH(xLbxQueryFontReq);
- return LbxQueryFont(client);
-}
-
-int
-ProcLbxChangeProperty(ClientPtr client)
-{
- /* REQUEST(xLbxChangePropertyReq); */
-
- REQUEST_SIZE_MATCH(xLbxChangePropertyReq);
- return LbxChangeProperty(client);
-}
-
-int
-ProcLbxGetProperty(ClientPtr client)
-{
- /* REQUEST(xLbxGetPropertyReq); */
-
- REQUEST_SIZE_MATCH(xLbxGetPropertyReq);
- return LbxGetProperty(client);
-}
-
-int
-ProcLbxTagData(ClientPtr client)
-{
- REQUEST(xLbxTagDataReq);
-
- client->sequence--; /* not a counted request */
- REQUEST_AT_LEAST_SIZE(xLbxTagDataReq);
-
- return LbxTagData(client, stuff->tag, stuff->real_length,
- (pointer)&stuff[1]); /* better not give any errors */
-}
-
-int
-ProcLbxInvalidateTag(ClientPtr client)
-{
- REQUEST(xLbxInvalidateTagReq);
-
- client->sequence--;
- REQUEST_SIZE_MATCH(xLbxInvalidateTagReq);
- return LbxInvalidateTag(client, stuff->tag);
-}
-
-int
-ProcLbxPolyPoint(ClientPtr client)
-{
- return LbxDecodePoly(client, X_PolyPoint, LbxDecodePoints);
-}
-
-int
-ProcLbxPolyLine(ClientPtr client)
-{
- return LbxDecodePoly(client, X_PolyLine, LbxDecodePoints);
-}
-
-int
-ProcLbxPolySegment(ClientPtr client)
-{
- return LbxDecodePoly(client, X_PolySegment, LbxDecodeSegment);
-}
-
-int
-ProcLbxPolyRectangle(ClientPtr client)
-{
- return LbxDecodePoly(client, X_PolyRectangle, LbxDecodeRectangle);
-}
-
-int
-ProcLbxPolyArc(ClientPtr client)
-{
- return LbxDecodePoly(client, X_PolyArc, LbxDecodeArc);
-}
-
-int
-ProcLbxFillPoly(ClientPtr client)
-{
- return LbxDecodeFillPoly(client);
-}
-
-int
-ProcLbxPolyFillRectangle(ClientPtr client)
-{
- return LbxDecodePoly(client, X_PolyFillRectangle, LbxDecodeRectangle);
-}
-
-int
-ProcLbxPolyFillArc(ClientPtr client)
-{
- return LbxDecodePoly(client, X_PolyFillArc, LbxDecodeArc);
-}
-
-int
-ProcLbxCopyArea(ClientPtr client)
-{
- return LbxDecodeCopyArea(client);
-}
-
-int
-ProcLbxCopyPlane(ClientPtr client)
-{
- return LbxDecodeCopyPlane(client);
-}
-
-
-int
-ProcLbxPolyText(ClientPtr client)
-{
- return LbxDecodePolyText(client);
-}
-
-int
-ProcLbxImageText(ClientPtr client)
-{
- return LbxDecodeImageText(client);
-}
-
-int
-ProcLbxQueryExtension(ClientPtr client)
-{
- REQUEST(xLbxQueryExtensionReq);
- char *ename;
-
- REQUEST_AT_LEAST_SIZE(xLbxQueryExtensionReq);
- ename = (char *) &stuff[1];
- return LbxQueryExtension(client, ename, stuff->nbytes);
-}
-
-int
-ProcLbxPutImage(ClientPtr client)
-{
- return LbxDecodePutImage(client);
-}
-
-int
-ProcLbxGetImage(ClientPtr client)
-{
- return LbxDecodeGetImage(client);
-}
-
-
-int
-ProcLbxSync(ClientPtr client)
-{
- xLbxSyncReply reply;
-
- client->sequence--; /* not a counted request */
-
-#ifdef COLOR_DEBUG
- fprintf (stderr, "Got LBX sync, seq = 0x%x\n", client->sequence);
-#endif
-
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.pad0 = reply.pad1 = reply.pad2 = reply.pad3 = reply.pad4 =
- reply.pad5 = reply.pad6 = 0;
-
- if (client->swapped)
- {
- register char n;
- swaps (&reply.sequenceNumber, n);
- }
-
- WriteToClient (client, sz_xLbxSyncReply, (char *)&reply);
-
- return (client->noClientException);
-}
-
-
-int
-ProcLbxDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_LbxQueryVersion:
- return ProcLbxQueryVersion(client);
- case X_LbxStartProxy:
- return ProcLbxStartProxy(client);
- case X_LbxStopProxy:
- return ProcLbxStopProxy(client);
- case X_LbxNewClient:
- return ProcLbxNewClient(client);
- case X_LbxCloseClient:
- return ProcLbxCloseClient(client);
- case X_LbxModifySequence:
- return ProcLbxModifySequence(client);
- case X_LbxAllowMotion:
- return ProcLbxAllowMotion(client);
- case X_LbxIncrementPixel:
- return ProcLbxIncrementPixel(client);
- case X_LbxGrabCmap:
- return ProcLbxGrabCmap(client);
- case X_LbxReleaseCmap:
- return ProcLbxReleaseCmap(client);
- case X_LbxAllocColor:
- return ProcLbxAllocColor(client);
- case X_LbxGetModifierMapping:
- return ProcLbxGetModifierMapping(client);
- case X_LbxGetKeyboardMapping:
- return ProcLbxGetKeyboardMapping(client);
- case X_LbxInvalidateTag:
- return ProcLbxInvalidateTag(client);
- case X_LbxPolyPoint:
- return ProcLbxPolyPoint (client);
- case X_LbxPolyLine:
- return ProcLbxPolyLine (client);
- case X_LbxPolySegment:
- return ProcLbxPolySegment (client);
- case X_LbxPolyRectangle:
- return ProcLbxPolyRectangle (client);
- case X_LbxPolyArc:
- return ProcLbxPolyArc (client);
- case X_LbxFillPoly:
- return ProcLbxFillPoly (client);
- case X_LbxPolyFillRectangle:
- return ProcLbxPolyFillRectangle (client);
- case X_LbxPolyFillArc:
- return ProcLbxPolyFillArc (client);
- case X_LbxQueryFont:
- return ProcLbxQueryFont (client);
- case X_LbxChangeProperty:
- return ProcLbxChangeProperty (client);
- case X_LbxGetProperty:
- return ProcLbxGetProperty (client);
- case X_LbxTagData:
- return ProcLbxTagData (client);
- case X_LbxCopyArea:
- return ProcLbxCopyArea (client);
- case X_LbxCopyPlane:
- return ProcLbxCopyPlane (client);
- case X_LbxPolyText8:
- case X_LbxPolyText16:
- return ProcLbxPolyText (client);
- case X_LbxImageText8:
- case X_LbxImageText16:
- return ProcLbxImageText (client);
- case X_LbxQueryExtension:
- return ProcLbxQueryExtension (client);
- case X_LbxPutImage:
- return ProcLbxPutImage (client);
- case X_LbxGetImage:
- return ProcLbxGetImage (client);
- case X_LbxInternAtoms:
- return ProcLbxInternAtoms(client);
- case X_LbxGetWinAttrAndGeom:
- return ProcLbxGetWinAttrAndGeom(client);
- case X_LbxSync:
- return ProcLbxSync(client);
- case X_LbxBeginLargeRequest:
- return ProcLbxBeginLargeRequest(client);
- case X_LbxLargeRequestData:
- return ProcLbxLargeRequestData(client);
- case X_LbxEndLargeRequest:
- return ProcLbxLargeRequestData(client);
- default:
- return BadRequest;
- }
-}
diff --git a/lbx/lbxopts.c b/lbx/lbxopts.c
deleted file mode 100644
index eac51bcea..000000000
--- a/lbx/lbxopts.c
+++ /dev/null
@@ -1,806 +0,0 @@
-/* $Xorg: lbxopts.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
-/*
- * Copyright 1994 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxopts.c,v 1.5 2001/01/17 22:37:00 dawes Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifdef OPTDEBUG
-#include <stdio.h>
-#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "colormapst.h"
-#include "propertyst.h"
-#include "lbxserve.h"
-#include <X11/extensions/lbxstr.h>
-#include <X11/extensions/lbximage.h>
-#include <X11/extensions/lbxopts.h>
-#include "lbxsrvopts.h"
-#ifndef NO_ZLIB
-#include <X11/extensions/lbxzlib.h>
-#endif /* NO_ZLIB */
-
-static int LbxProxyDeltaOpt ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-static int LbxServerDeltaOpt ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-static int LbxDeltaOpt ( unsigned char *popt, int optlen,
- unsigned char *preply, short *pn, short *pmaxlen );
-static int LbxStreamCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-static int ZlibParse ( LbxNegOptsPtr pno, unsigned char *popt, int optlen,
- unsigned char *preply );
-static int LbxMessageCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-static int LbxUseTagsOpt ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-static int LbxBitmapCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-static int LbxPixmapCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-static int MergeDepths ( int *depths, LbxPixmapCompMethod *method );
-static int LbxCmapAllOpt ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-
-/*
- * List of LBX options we recognize and are willing to negotiate
- */
-static struct _LbxOptionParser {
- CARD8 optcode;
- int (*parser)(LbxNegOptsPtr, unsigned char *,
- int, unsigned char *);
-} LbxOptions[] = {
- { LBX_OPT_DELTA_PROXY, LbxProxyDeltaOpt },
- { LBX_OPT_DELTA_SERVER, LbxServerDeltaOpt },
- { LBX_OPT_STREAM_COMP, LbxStreamCompOpt },
- { LBX_OPT_BITMAP_COMP, LbxBitmapCompOpt },
- { LBX_OPT_PIXMAP_COMP, LbxPixmapCompOpt },
- { LBX_OPT_MSG_COMP, LbxMessageCompOpt },
- { LBX_OPT_USE_TAGS, LbxUseTagsOpt },
- { LBX_OPT_CMAP_ALL, LbxCmapAllOpt }
-};
-
-#define LBX_N_OPTS (sizeof(LbxOptions) / sizeof(struct _LbxOptionParser))
-
-/*
- * Set option defaults
- */
-void
-LbxOptionInit(LbxNegOptsPtr pno)
-{
- bzero(pno, sizeof(LbxNegOptsRec));
- pno->proxyDeltaN = pno->serverDeltaN = LBX_OPT_DELTA_NCACHE_DFLT;
- pno->proxyDeltaMaxLen = pno->serverDeltaMaxLen = LBX_OPT_DELTA_MSGLEN_DFLT;
- pno->squish = TRUE;
- pno->numBitmapCompMethods = 0;
- pno->bitmapCompMethods = NULL;
- pno->numPixmapCompMethods = 0;
- pno->pixmapCompMethods = NULL;
- pno->pixmapCompDepths = NULL;
- pno->useTags = TRUE;
-}
-
-int
-LbxOptionParse(LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-{
- int i;
- int nopts = *popt++;
- unsigned char *pout = preply;
-
- for (i = 0; i < nopts; i++) {
- int j;
- int len;
- int hdrlen;
- int replylen;
-
- LBX_OPT_DECODE_LEN(popt + 1, len, hdrlen);
- if (len < ++hdrlen || len > optlen) {
-#ifdef OPTDEBUG
- fprintf(stderr, "bad option length, len = %d, hdrlen = %d, optlen = %d\n", len, hdrlen, optlen);
-#endif
- return -1;
- }
-
- for (j = 0; j < LBX_N_OPTS; j++) {
- if (popt[0] == LbxOptions[j].optcode) {
- replylen = (*LbxOptions[j].parser)(pno,
- popt + hdrlen,
- len - hdrlen,
- pout + LBX_OPT_SMALLHDR_LEN);
- if (replylen < 0)
- return -1;
- else if (replylen > 0) {
- /*
- * None of the current options require big headers,
- * so this works for now.
- */
- *pout++ = i;
- *pout++ = LBX_OPT_SMALLHDR_LEN + replylen;
- pout += replylen;
- pno->nopts++;
- }
- break;
- }
- }
-
- optlen -= len;
- popt += len;
- }
-
- return (pout - preply);
-}
-
-static int
-LbxProxyDeltaOpt(LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-{
- return LbxDeltaOpt(popt, optlen, preply,
- &pno->proxyDeltaN, &pno->proxyDeltaMaxLen);
-}
-
-static int
-LbxServerDeltaOpt(LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-{
- return LbxDeltaOpt(popt, optlen, preply,
- &pno->serverDeltaN, &pno->serverDeltaMaxLen);
-}
-
-static int
-LbxDeltaOpt(unsigned char *popt,
- int optlen,
- unsigned char *preply,
- short *pn,
- short *pmaxlen)
-{
- short n;
- short maxlen;
-
- /*
- * If there's more data than we expect, we just ignore it.
- */
- if (optlen < LBX_OPT_DELTA_REQLEN) {
-#ifdef OPTDEBUG
- fprintf(stderr, "bad delta option length = %d\n", optlen);
-#endif
- return -1;
- }
-
- /*
- * Accept whatever value the proxy prefers, so skip the
- * min/max offerings. Note that the max message len value is
- * encoded as the number of 4-byte values.
- */
- popt += 2;
- n = *popt++;
- popt += 2;
- maxlen = *popt++;
- if ((maxlen <<= 2) == 0)
- n = 0;
- else if (maxlen < 32) {
-#ifdef OPTDEBUG
- fprintf(stderr, "bad delta max msg length %d\n", maxlen);
-#endif
- return -1;
- }
-
- /*
- * Put the response in the reply buffer
- */
- *preply++ = n;
- *preply++ = maxlen >> 2;
-
- *pn = n;
- *pmaxlen = maxlen;
-
- return LBX_OPT_DELTA_REPLYLEN;
-}
-
-
-static struct _LbxStreamCompParser {
- int typelen;
- char *type;
- int (*parser)(LbxNegOptsPtr, unsigned char *,
- int, unsigned char *);
-} LbxStreamComp[] = {
-#ifndef NO_ZLIB
- { ZLIB_STRCOMP_OPT_LEN, ZLIB_STRCOMP_OPT, ZlibParse },
-#endif /* NO_ZLIB */
-};
-
-#define LBX_N_STRCOMP \
- (sizeof(LbxStreamComp) / sizeof(struct _LbxStreamCompParser))
-
-static int
-LbxStreamCompOpt(LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-{
- int i;
- int typelen;
- int nopts = *popt++;
-
- for (i = 0; i < nopts; i++) {
- int j;
- int len;
- int lensize;
- int replylen;
-
- typelen = popt[0];
- for (j = 0; j < LBX_N_STRCOMP; j++) {
- if (typelen == LbxStreamComp[j].typelen &&
- !strncmp((char *) popt + 1, LbxStreamComp[j].type, typelen))
- break;
- }
-
- popt += 1 + typelen;
- optlen -= 1 + typelen;
- LBX_OPT_DECODE_LEN(popt, len, lensize);
-
- if (j < LBX_N_STRCOMP) {
- if (len > optlen)
- return -1;
- replylen = (*LbxStreamComp[j].parser)(pno,
- popt + lensize,
- len - lensize,
- preply + 1);
- if (replylen == -1)
- return -1;
- else if (replylen >= 0) {
- *preply = i;
- return replylen + 1;
- }
- }
-
- optlen -= len;
- popt += len;
- }
-
- return 0;
-}
-
-
-static int
-ZlibParse(LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-{
- int level; /* compression level */
-
- if (*popt++ != 1) /* length should be 1 */
- return (-1);
-
- level = *popt;
- if (level < 1 || level > 9)
- return (-1);
-
- pno->streamOpts.streamCompInit =
- (LbxStreamCompHandle (*)(int, pointer))ZlibInit;
- pno->streamOpts.streamCompArg = (pointer)(long)level;
- pno->streamOpts.streamCompStuffInput = ZlibStuffInput;
- pno->streamOpts.streamCompInputAvail = ZlibInputAvail;
- pno->streamOpts.streamCompFlush = ZlibFlush;
- pno->streamOpts.streamCompRead = ZlibRead;
- pno->streamOpts.streamCompWriteV = ZlibWriteV;
- pno->streamOpts.streamCompOn = ZlibCompressOn;
- pno->streamOpts.streamCompOff = ZlibCompressOff;
- pno->streamOpts.streamCompFreeHandle =
- (void (*)(LbxStreamCompHandle))ZlibFree;
-
- return (0);
-}
-
-static int
-LbxMessageCompOpt(LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-{
-
- if (optlen == 0) {
-#ifdef OPTDEBUG
- fprintf(stderr, "bad message-comp option length specified %d\n", optlen);
-#endif
- return -1;
- }
-
- pno->squish = *preply = *popt;
- return 1;
-}
-
-
-static int
-LbxUseTagsOpt(LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-{
-
- if (optlen == 0) {
-#ifdef OPTDEBUG
- fprintf(stderr, "bad use-tags option length specified %d\n", optlen);
-#endif
- return -1;
- }
-
- pno->useTags = *preply = *popt;
- return 1;
-}
-
-
-/*
- * Option negotiation for image compression
- */
-
-LbxBitmapCompMethod
-LbxBitmapCompMethods [] = {
- {
- "XC-FaxG42D", /* compression method name */
- 0, /* inited */
- 2, /* method opcode */
- NULL, /* init function */
- LbxImageEncodeFaxG42D, /* encode function */
- LbxImageDecodeFaxG42D /* decode function */
- }
-};
-
-#define NUM_BITMAP_METHODS \
- (sizeof (LbxBitmapCompMethods) / sizeof (LbxBitmapCompMethod))
-
-
-#if 1
-/*
- * Currently, we don't support any pixmap compression algorithms
- * because regular stream compression does much better than PackBits.
- * If we want to plug in a better pixmap image compression algorithm,
- * it would go here.
- */
-
-#define NUM_PIXMAP_METHODS 0
-LbxPixmapCompMethod LbxPixmapCompMethods [1]; /* dummy */
-
-#else
-
-LbxPixmapCompMethod
-LbxPixmapCompMethods [] = {
- {
- "XC-PackBits", /* compression method name */
- 1 << ZPixmap, /* formats supported */
- 1, {8}, /* depths supported */
- 0, /* inited */
- 1, /* method opcode */
- NULL, /* init function */
- LbxImageEncodePackBits, /* encode function */
- LbxImageDecodePackBits /* decode function */
- }
-};
-
-#define NUM_PIXMAP_METHODS \
- (sizeof (LbxPixmapCompMethods) / sizeof (LbxPixmapCompMethod))
-#endif
-
-
-static int
-LbxImageCompOpt (Bool pixmap,
- LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-
-{
- unsigned char *preplyStart = preply;
- int numMethods = *popt++;
- unsigned char *myIndices, *hisIndices;
- unsigned int *retFormats = NULL;
- int **retDepths = NULL;
- int replyCount = 0;
- int status, i, j;
-
- if (numMethods == 0)
- {
- if (pixmap)
- pno->numPixmapCompMethods = 0;
- else
- pno->numBitmapCompMethods = 0;
-
- *preply++ = 0;
- return (1);
- }
-
- myIndices = (unsigned char *) xalloc (numMethods);
- hisIndices = (unsigned char *) xalloc (numMethods);
-
- if (!myIndices || !hisIndices)
- {
- if (myIndices)
- xfree (myIndices);
- if (hisIndices)
- xfree (hisIndices);
- return -1;
- }
-
- if (pixmap)
- {
- retFormats = (unsigned *) xalloc (numMethods);
- retDepths = (int **) xalloc (numMethods * sizeof (int *));
-
- if (!retFormats || !retDepths)
- {
- if (retFormats)
- xfree (retFormats);
- if (retDepths)
- xfree (retDepths);
- xfree (myIndices);
- xfree (hisIndices);
- return -1;
- }
- }
-
- /*
- * For each method in the list sent by the proxy, see if the server
- * supports this method. If YES, update the following lists:
- *
- * myIndices[] is a list of indices into the server's
- * LbxBit[Pix]mapCompMethods table.
- *
- * hisIndices[] is a list of indices into the list of
- * method names sent by the proxy.
- *
- * retFormats[] indicates for each pixmap compression method,
- * the pixmap formats supported.
- *
- * retDepths[] indicates for each pixmap compression method,
- * the pixmap depths supported.
- */
-
- for (i = 0; i < numMethods; i++)
- {
- unsigned int formatMask = 0, newFormatMask = 0;
- int depthCount, *depths = NULL, len;
- int freeDepths;
- char *methodName;
-
- freeDepths = 0;
- len = *popt++;
- methodName = (char *) popt;
- popt += len;
-
- if (pixmap)
- {
- formatMask = *popt++;
- depthCount = *popt++;
- depths = (int *) xalloc ((depthCount + 1) * sizeof (int));
- freeDepths = 1;
- depths[0] = depthCount;
- for (j = 1; j <= depthCount; j++)
- depths[j] = *popt++;
- }
-
- for (j = 0;
- j < (pixmap ? NUM_PIXMAP_METHODS : NUM_BITMAP_METHODS); j++)
- {
-
- status = strncmp (methodName,
- (pixmap ? LbxPixmapCompMethods[j].methodName :
- LbxBitmapCompMethods[j].methodName),
- len);
-
- if (status == 0 && pixmap)
- {
- newFormatMask =
- formatMask & LbxPixmapCompMethods[j].formatMask;
-
- depthCount = MergeDepths (depths, &LbxPixmapCompMethods[j]);
-
- if (newFormatMask == 0 || depthCount == 0)
- status = 1;
- }
-
- if (status == 0)
- {
- myIndices[replyCount] = j;
- hisIndices[replyCount] = i;
-
- if (pixmap)
- {
- retFormats[replyCount] = newFormatMask;
- retDepths[replyCount] = depths;
- freeDepths = 0;
- }
-
- replyCount++;
- break;
- }
- }
-
- if (freeDepths)
- xfree (depths);
- }
-
- *preply++ = replyCount;
-
- /*
- * Sort the lists by LBX server preference (increasing myIndices[] vals)
- */
-
- for (i = 0; i <= replyCount - 2; i++)
- for (j = replyCount - 1; j >= i; j--)
- if (myIndices[j - 1] > myIndices[j])
- {
- char temp1 = myIndices[j - 1];
- char temp2 = hisIndices[j - 1];
-
- myIndices[j - 1] = myIndices[j];
- myIndices[j] = temp1;
-
- hisIndices[j - 1] = hisIndices[j];
- hisIndices[j] = temp2;
-
- if (pixmap)
- {
- unsigned temp3 = retFormats[j - 1];
- int *temp4 = retDepths[j - 1];
-
- retFormats[j - 1] = retFormats[j];
- retFormats[j] = temp3;
-
- retDepths[j - 1] = retDepths[j];
- retDepths[j] = temp4;
- }
- }
-
- /*
- * For each method supported, return to the proxy an index into
- * the list sent by the proxy, the opcode to be used for the method,
- * the pixmap formats supported, and the list of depths supported.
- */
-
- for (i = 0; i < replyCount; i++)
- {
- *preply++ = hisIndices[i];
-
- if (pixmap)
- {
- int left;
- *preply++ = LbxPixmapCompMethods[myIndices[i]].methodOpCode;
- *preply++ = retFormats[i];
- *preply++ = left = retDepths[i][0];
- j = 1;
- while (left > 0)
- {
- *preply++ = retDepths[i][j];
- left--;
- }
- }
- else
- {
- *preply++ = LbxBitmapCompMethods[myIndices[i]].methodOpCode;
- }
- }
-
- if (pixmap)
- {
- pno->numPixmapCompMethods = replyCount;
- pno->pixmapCompMethods = myIndices;
- pno->pixmapCompDepths = retDepths;
- }
- else
- {
- pno->numBitmapCompMethods = replyCount;
- pno->bitmapCompMethods = myIndices;
- }
-
- if (hisIndices)
- xfree (hisIndices);
-
- if (pixmap)
- {
- if (retFormats)
- xfree (retFormats);
- }
-
- return (preply - preplyStart);
-}
-
-
-
-static int
-LbxBitmapCompOpt (LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-
-{
- return (LbxImageCompOpt (0 /* bitmap */, pno, popt, optlen, preply));
-}
-
-
-static int
-LbxPixmapCompOpt (LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-
-{
- return (LbxImageCompOpt (1 /* Pixmap */, pno, popt, optlen, preply));
-}
-
-
-LbxBitmapCompMethod *
-LbxSrvrLookupBitmapCompMethod (LbxProxyPtr proxy,
- int methodOpCode)
-
-{
- int i;
-
- for (i = 0; i < proxy->numBitmapCompMethods; i++)
- {
- LbxBitmapCompMethod *method;
-
- method = &LbxBitmapCompMethods[proxy->bitmapCompMethods[i]];
-
- if (method->methodOpCode == methodOpCode)
- return (method);
- }
-
- return (NULL);
-}
-
-
-LbxPixmapCompMethod *
-LbxSrvrLookupPixmapCompMethod (LbxProxyPtr proxy,
- int methodOpCode)
-
-{
- int i;
-
- for (i = 0; i < proxy->numPixmapCompMethods; i++)
- {
- LbxPixmapCompMethod *method;
-
- method = &LbxPixmapCompMethods[proxy->pixmapCompMethods[i]];
-
- if (method->methodOpCode == methodOpCode)
- return (method);
- }
-
- return (NULL);
-}
-
-
-LbxBitmapCompMethod *
-LbxSrvrFindPreferredBitmapCompMethod (LbxProxyPtr proxy)
-
-{
- if (proxy->numBitmapCompMethods == 0)
- return NULL;
- else
- return (&LbxBitmapCompMethods[proxy->bitmapCompMethods[0]]);
-}
-
-
-
-LbxPixmapCompMethod *
-LbxSrvrFindPreferredPixmapCompMethod (LbxProxyPtr proxy,
- int format,
- int depth)
-
-{
- if (proxy->numPixmapCompMethods == 0)
- return NULL;
- else
- {
- LbxPixmapCompMethod *method;
- int i, j;
-
- for (i = 0; i < proxy->numPixmapCompMethods; i++)
- {
- method = &LbxPixmapCompMethods[proxy->pixmapCompMethods[i]];
-
- if ((method->formatMask & (1 << format)))
- {
- int n = proxy->pixmapCompDepths[i][0];
- j = 1;
- while (n > 0)
- {
- if (depth == proxy->pixmapCompDepths[i][j])
- return method;
- else
- n--;
- }
- }
- }
-
- return NULL;
- }
-}
-
-
-static int
-MergeDepths (int *depths,
- LbxPixmapCompMethod *method)
-
-{
- int i, j, count;
- int temp[LBX_MAX_DEPTHS + 1];
-
- temp[0] = count = 0;
-
- for (i = 1; i <= depths[0]; i++)
- {
- for (j = 0; j < method->depthCount; j++)
- if (method->depths[j] == depths[i])
- {
- temp[0]++;
- temp[++count] = depths[i];
- break;
- }
- }
-
- memcpy (depths, temp, (count + 1) * sizeof (int));
-
- return (count);
-}
-
-
-#define LbxCmapAllMethod "XC-CMAP"
-
-static int
-LbxCmapAllOpt (LbxNegOptsPtr pno,
- unsigned char *popt,
- int optlen,
- unsigned char *preply)
-
-{
- int numMethods = *popt++;
- int i;
-
- for (i = 0; i < numMethods; i++)
- {
- int len;
- char *methodName;
-
- len = *popt++;
- methodName = (char *) popt;
- popt += len;
- if (!strncmp(methodName, LbxCmapAllMethod, len))
- break;
- }
- if (i >= numMethods)
- i = 0; /* assume first one is proxy's favorite */
- *preply = i;
- return 1;
-}
diff --git a/lbx/lbxprop.c b/lbx/lbxprop.c
deleted file mode 100644
index 53c4ef424..000000000
--- a/lbx/lbxprop.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/* $Xorg: lbxprop.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
-/*
-
-Copyright 1986, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/*
- * Copyright 1993 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxprop.c,v 1.4 2001/05/15 10:19:43 eich Exp $ */
-
-/* various bits of DIX-level mangling */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#include <stdio.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "servermd.h"
-#include "propertyst.h"
-#include "colormapst.h"
-#include "windowstr.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include "lbxserve.h"
-#include "lbxtags.h"
-#include <X11/Xfuncproto.h>
-#ifdef XCSECURITY
-#define _SECURITY_SERVER
-#include <X11/extensions/security.h>
-#endif
-#include "swaprep.h"
-
-void
-LbxStallPropRequest(ClientPtr client,
- PropertyPtr pProp)
-{
- xReq *req = (xReq *) client->requestBuffer;
- register char n;
-
- LbxQueryTagData(client, pProp->owner_pid,
- pProp->tag_id, LbxTagTypeProperty);
-
- /*
- * Before we reset the request, we must make sure
- * it is in the client's byte order.
- */
-
- if (client->swapped) {
- if (req->reqType == X_ChangeProperty) {
- xChangePropertyReq *stuff = (xChangePropertyReq *) req;
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->nUnits, n);
- switch ( stuff->format ) {
- case 16:
- SwapRestS(stuff);
- break;
- case 32:
- SwapRestL(stuff);
- break;
- }
- } else if (req->reqType == X_GetProperty) {
- xGetPropertyReq *stuff = (xGetPropertyReq *) req;
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->longOffset, n);
- swapl(&stuff->longLength, n);
- } else if (req->data == X_LbxChangeProperty) {
- xLbxChangePropertyReq *stuff = (xLbxChangePropertyReq *) req;
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->nUnits, n);
- } else if (req->data == X_LbxGetProperty) {
- xLbxGetPropertyReq *stuff = (xLbxGetPropertyReq *) req;
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->longOffset, n);
- swapl(&stuff->longLength, n);
- }
- }
- ResetCurrentRequest(client);
- client->sequence--;
- IgnoreClient(client);
-}
-
-int
-LbxChangeWindowProperty(ClientPtr client,
- WindowPtr pWin,
- Atom property,
- Atom type,
- int format,
- int mode,
- unsigned long len,
- Bool have_data,
- pointer value,
- Bool sendevent,
- XID *tag)
-{
- PropertyPtr pProp;
- xEvent event;
- int sizeInBytes;
- int totalSize;
- pointer data;
-
- sizeInBytes = format >> 3;
- totalSize = len * sizeInBytes;
-
- /* first see if property already exists */
-
- pProp = wUserProps(pWin);
- while (pProp) {
- if (pProp->propertyName == property)
- break;
- pProp = pProp->next;
- }
- if (!pProp) { /* just add to list */
- if (!pWin->optional && !MakeWindowOptional(pWin))
- return (BadAlloc);
- pProp = (PropertyPtr) xalloc(sizeof(PropertyRec));
- if (!pProp)
- return (BadAlloc);
- data = (pointer) xalloc(totalSize);
- if (!data && len) {
- xfree(pProp);
- return (BadAlloc);
- }
- pProp->propertyName = property;
- pProp->type = type;
- pProp->format = format;
- pProp->data = data;
- if (have_data) {
- if (len)
- memmove((char *) data, (char *) value, totalSize);
- pProp->tag_id = 0;
- pProp->owner_pid = 0;
- } else {
- if (!TagSaveTag(LbxTagTypeProperty, totalSize,
- (pointer)pProp, &pProp->tag_id)) {
- xfree(pProp);
- xfree(pProp->data);
- return BadAlloc;
- }
- pProp->owner_pid = LbxProxyID(client);
- TagMarkProxy(pProp->tag_id, pProp->owner_pid);
- }
- pProp->size = len;
- pProp->next = pWin->optional->userProps;
- pWin->optional->userProps = pProp;
- } else {
- /*
- * To append or prepend to a property the request format and type must
- * match those of the already defined property. The existing format
- * and type are irrelevant when using the mode "PropModeReplace" since
- * they will be written over.
- */
-
- if ((format != pProp->format) && (mode != PropModeReplace))
- return (BadMatch);
- if ((pProp->type != type) && (mode != PropModeReplace))
- return (BadMatch);
-
- /*
- * if its a modify instead of replace, make sure we have the current
- * value
- */
- if ((mode != PropModeReplace) && pProp->tag_id && pProp->owner_pid) {
- LbxStallPropRequest(client, pProp);
- return (client->noClientException);
- }
- /* make sure any old tag is flushed first */
- if (pProp->tag_id)
- TagDeleteTag(pProp->tag_id);
- if (mode == PropModeReplace) {
- if (totalSize != pProp->size * (pProp->format >> 3)) {
- data = (pointer) xrealloc(pProp->data, totalSize);
- if (!data && len)
- return (BadAlloc);
- pProp->data = data;
- }
- if (have_data) {
- if (len)
- memmove((char *) pProp->data, (char *) value, totalSize);
- } else {
- if (!TagSaveTag(LbxTagTypeProperty, totalSize,
- (pointer)pProp, &pProp->tag_id)) {
- xfree(pProp);
- xfree(pProp->data);
- return BadAlloc;
- }
- pProp->owner_pid = LbxProxyID(client);
- TagMarkProxy(pProp->tag_id, pProp->owner_pid);
- }
- pProp->size = len;
- pProp->type = type;
- pProp->format = format;
- } else if (len == 0) {
- /* do nothing */
- } else if (mode == PropModeAppend) {
- data = (pointer) xrealloc(pProp->data,
- sizeInBytes * (len + pProp->size));
- if (!data)
- return (BadAlloc);
- pProp->data = data;
- memmove(&((char *) data)[pProp->size * sizeInBytes],
- (char *) value,
- totalSize);
- pProp->size += len;
- } else if (mode == PropModePrepend) {
- data = (pointer) xalloc(sizeInBytes * (len + pProp->size));
- if (!data)
- return (BadAlloc);
- memmove(&((char *) data)[totalSize], (char *) pProp->data,
- (int) (pProp->size * sizeInBytes));
- memmove((char *) data, (char *) value, totalSize);
- xfree(pProp->data);
- pProp->data = data;
- pProp->size += len;
- }
- }
- if (sendevent) {
- event.u.u.type = PropertyNotify;
- event.u.property.window = pWin->drawable.id;
- event.u.property.state = PropertyNewValue;
- event.u.property.atom = pProp->propertyName;
- event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
- }
- if (pProp->tag_id)
- *tag = pProp->tag_id;
- return (Success);
-}
-
-int
-LbxChangeProperty(ClientPtr client)
-{
- WindowPtr pWin;
- char format,
- mode;
- unsigned long len;
- int err;
- int n;
- XID newtag;
- xLbxChangePropertyReply rep;
- REQUEST(xLbxChangePropertyReq);
-
- REQUEST_SIZE_MATCH(xLbxChangePropertyReq);
- UpdateCurrentTime();
- format = stuff->format;
- mode = stuff->mode;
- if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
- (mode != PropModePrepend)) {
- client->errorValue = mode;
- return BadValue;
- }
- if ((format != 8) && (format != 16) && (format != 32)) {
- client->errorValue = format;
- return BadValue;
- }
- len = stuff->nUnits;
- if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2))
- return BadLength;
-
- pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
- SecurityWriteAccess);
- if (!pWin)
- return (BadWindow);
- if (!ValidAtom(stuff->property)) {
- client->errorValue = stuff->property;
- return (BadAtom);
- }
- if (!ValidAtom(stuff->type)) {
- client->errorValue = stuff->type;
- return (BadAtom);
- }
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.pad = rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- }
-
-#ifdef XCSECURITY
- switch (SecurityCheckPropertyAccess(client, pWin, stuff->property,
- SecurityWriteAccess))
- {
- case SecurityErrorOperation:
- client->errorValue = stuff->property;
- return BadAtom;
- case SecurityIgnoreOperation:
- rep.tag = 0;
- WriteToClient(client, sizeof(xLbxChangePropertyReply), (char *)&rep);
- return client->noClientException;
- }
-#endif
-
- err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type,
- (int) format, (int) mode, len, FALSE, (pointer) &stuff[1],
- TRUE, &newtag);
- if (err)
- return err;
-
- rep.tag = newtag;
-
- if (client->swapped) {
- swapl(&rep.tag, n);
- }
- WriteToClient(client, sizeof(xLbxChangePropertyReply), (char *)&rep);
-
- return client->noClientException;
-}
-
-static void
-LbxWriteGetpropReply(ClientPtr client,
- xLbxGetPropertyReply *rep)
-{
- int n;
-
- if (client->swapped) {
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->propertyType, n);
- swapl(&rep->bytesAfter, n);
- swapl(&rep->nItems, n);
- swapl(&rep->tag, n);
- }
- WriteToClient(client, sizeof(xLbxGetPropertyReply), (char *)rep);
-}
-
-int
-LbxGetProperty(ClientPtr client)
-{
- PropertyPtr pProp,
- prevProp;
- unsigned long n,
- len,
- ind;
- WindowPtr pWin;
- xLbxGetPropertyReply reply;
- Bool send_data = FALSE;
-
- REQUEST(xLbxGetPropertyReq);
-
- REQUEST_SIZE_MATCH(xLbxGetPropertyReq);
-
- reply.pad1 = 0;
- reply.pad2 = 0;
-
- if (stuff->delete)
- UpdateCurrentTime();
- pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
- SecurityReadAccess);
- if (!pWin)
- return (BadWindow);
-
- if (!ValidAtom(stuff->property)) {
- client->errorValue = stuff->property;
- return (BadAtom);
- }
- if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) {
- client->errorValue = stuff->delete;
- return (BadValue);
- }
- if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
- {
- client->errorValue = stuff->type;
- return(BadAtom);
- }
- pProp = wUserProps(pWin);
- prevProp = (PropertyPtr) NULL;
- while (pProp) {
- if (pProp->propertyName == stuff->property)
- break;
- prevProp = pProp;
- pProp = pProp->next;
- }
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- if (!pProp) {
- reply.nItems = 0;
- reply.length = 0;
- reply.bytesAfter = 0;
- reply.propertyType = None;
- reply.format = 0;
- reply.tag = 0;
- LbxWriteGetpropReply(client, &reply);
- return client->noClientException;
- }
- /*
- * If the request type and actual type don't match. Return the
- * property information, but not the data.
- */
- if ((stuff->type != pProp->type) &&
- (stuff->type != AnyPropertyType)) {
- reply.bytesAfter = pProp->size;
- reply.format = pProp->format;
- reply.length = 0;
- reply.nItems = 0;
- reply.propertyType = pProp->type;
- reply.tag = 0;
- LbxWriteGetpropReply(client, &reply);
- return client->noClientException;
- }
- /*
- * Return type, format, value to client
- */
- n = (pProp->format >> 3) * pProp->size; /* size (bytes) of prop */
- ind = stuff->longOffset << 2;
-
- /*
- * If longOffset is invalid such that it causes "len" to be
- * negative, it's a value error.
- */
-
- if (n < ind) {
- client->errorValue = stuff->longOffset;
- return BadValue;
- }
-
- /* make sure we have the current value */
- if (pProp->tag_id && pProp->owner_pid) {
- LbxStallPropRequest(client, pProp);
- return client->noClientException;
- }
-
- len = min(n - ind, stuff->longLength << 2);
-
- reply.bytesAfter = n - (ind + len);
- reply.format = pProp->format;
- reply.propertyType = pProp->type;
-
- if (!pProp->tag_id) {
- if (n && (!stuff->delete || reply.bytesAfter)) {
- TagSaveTag(LbxTagTypeProperty, n, (pointer)pProp, &pProp->tag_id);
- pProp->owner_pid = 0;
- }
- send_data = TRUE;
- } else
- send_data = !TagProxyMarked(pProp->tag_id, LbxProxyID(client));
- if (pProp->tag_id && send_data)
- TagMarkProxy(pProp->tag_id, LbxProxyID(client));
- reply.tag = pProp->tag_id;
-
- if (!send_data)
- len = 0;
- else if (reply.tag) {
- len = n;
- ind = 0;
- }
- reply.nItems = len / (pProp->format >> 3);
- reply.length = (len + 3) >> 2;
-
- if (stuff->delete && (reply.bytesAfter == 0)) {
- xEvent event;
-
- event.u.u.type = PropertyNotify;
- event.u.property.window = pWin->drawable.id;
- event.u.property.state = PropertyDelete;
- event.u.property.atom = pProp->propertyName;
- event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
- }
- LbxWriteGetpropReply(client, &reply);
- if (len) {
- switch (reply.format) {
- case 32:
- client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
- break;
- case 16:
- client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
- break;
- default:
- client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
- break;
- }
- WriteSwappedDataToClient(client, len,
- (char *) pProp->data + ind);
- }
- if (stuff->delete && (reply.bytesAfter == 0)) {
- if (pProp->tag_id)
- TagDeleteTag(pProp->tag_id);
- if (prevProp == (PropertyPtr) NULL) {
- if (!(pWin->optional->userProps = pProp->next))
- CheckWindowOptionalNeed(pWin);
- } else
- prevProp->next = pProp->next;
- xfree(pProp->data);
- xfree(pProp);
- }
- return client->noClientException;
-}
diff --git a/lbx/lbxserve.h b/lbx/lbxserve.h
deleted file mode 100644
index 195e985b3..000000000
--- a/lbx/lbxserve.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/* $Xorg: lbxserve.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/*
- * Copyright 1992 Network Computing Devices
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of NCD. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. NCD. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxserve.h,v 1.4 2001/08/01 00:44:58 tsi Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _LBXSERVE_H_
-
-#include "colormap.h"
-#include "property.h"
-
-#define _LBXSERVE_H_
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include <X11/extensions/lbxdeltastr.h>
-#include <X11/extensions/lbxopts.h>
-
-#define MAX_LBX_CLIENTS MAXCLIENTS
-#define MAX_NUM_PROXIES (MAXCLIENTS >> 1)
-
-typedef struct _LbxClient *LbxClientPtr;
-typedef struct _LbxProxy *LbxProxyPtr;
-
-typedef struct _LbxClient {
- CARD32 id;
- ClientPtr client;
- LbxProxyPtr proxy;
- Bool ignored;
- Bool input_blocked;
- int reqs_pending;
- long bytes_in_reply;
- long bytes_remaining;
- Drawable drawableCache[GFX_CACHE_SIZE];
- GContext gcontextCache[GFX_CACHE_SIZE];
- pointer gfx_buffer; /* tmp buffer for unpacking gfx requests */
- unsigned long gb_size;
-} LbxClientRec;
-
-typedef struct _connectionOutput *OSBufPtr;
-
-typedef struct _LbxProxy {
- LbxProxyPtr next;
- /* this array is indexed by lbx proxy index */
- LbxClientPtr lbxClients[MAX_LBX_CLIENTS];
- LbxClientPtr curRecv,
- curDix;
- int fd;
- int pid; /* proxy ID */
- int uid;
- int numClients;
- int maxIndex;
- Bool aborted;
- int grabClient;
- pointer compHandle;
- Bool dosquishing;
- Bool useTags;
- LBXDeltasRec indeltas;
- LBXDeltasRec outdeltas;
- char *iDeltaBuf;
- char *replyBuf;
- char *oDeltaBuf;
- OSBufPtr ofirst;
- OSBufPtr olast;
- CARD32 cur_send_id;
-
- LbxStreamOpts streamOpts;
-
- int numBitmapCompMethods;
- unsigned char *bitmapCompMethods; /* array of indices */
- int numPixmapCompMethods;
- unsigned char *pixmapCompMethods; /* array of indices */
- int **pixmapCompDepths; /* depths supported from each method */
-
- struct _ColormapRec *grabbedCmaps; /* chained via lbx private */
- int motion_allowed_events;
- lbxMotionCache motionCache;
-} LbxProxyRec;
-
-/* This array is indexed by server client index, not lbx proxy index */
-
-extern LbxClientPtr lbxClients[MAXCLIENTS];
-
-#define LbxClient(client) (lbxClients[(client)->index])
-#define LbxProxy(client) (LbxClient(client)->proxy)
-#define LbxMaybeProxy(client) (LbxClient(client) ? LbxProxy(client) : 0)
-#define LbxProxyID(client) (LbxProxy(client)->pid)
-#define LbxProxyClient(proxy) ((proxy)->lbxClients[0]->client)
-
-extern int LbxEventCode;
-
-
-/* os/connection.c */
-extern ClientPtr AllocLbxClientConnection ( ClientPtr client,
- LbxProxyPtr proxy );
-extern void LbxProxyConnection ( ClientPtr client, LbxProxyPtr proxy );
-
-/* os/libxio.c */
-extern int UncompressedWriteToClient ( ClientPtr who, int count, char *buf );
-extern void LbxForceOutput ( LbxProxyPtr proxy );
-extern void SwitchClientInput ( ClientPtr client, Bool pending );
-extern int PrepareLargeReqBuffer ( ClientPtr client );
-extern Bool AppendFakeRequest ( ClientPtr client, char *data, int count );
-extern void LbxFreeOsBuffers ( LbxProxyPtr proxy );
-extern Bool AllocateLargeReqBuffer ( ClientPtr client, int size );
-extern Bool AddToLargeReqBuffer ( ClientPtr client, char *data, int size );
-extern void LbxPrimeInput ( ClientPtr client, LbxProxyPtr proxy );
-
-/* lbxcmap.c */
-extern int LbxCmapInit ( void );
-extern Bool LbxCheckColorRequest ( ClientPtr client, ColormapPtr pmap,
- xReq *req );
-extern int LbxCheckCmapGrabbed ( ColormapPtr pmap );
-extern void LbxDisableSmartGrab ( ColormapPtr pmap );
-extern void LbxBeginFreeCellsEvent ( ColormapPtr pmap );
-extern void LbxAddFreeCellToEvent ( ColormapPtr pmap, Pixel pixel );
-extern void LbxEndFreeCellsEvent ( ColormapPtr pmap );
-extern void LbxSortPixelList ( Pixel *pixels, int count );
-extern int ProcLbxGrabCmap ( ClientPtr client );
-extern void LbxReleaseCmap ( ColormapPtr pmap, Bool smart );
-extern int ProcLbxReleaseCmap ( ClientPtr client );
-extern int ProcLbxAllocColor ( ClientPtr client );
-extern int ProcLbxIncrementPixel ( ClientPtr client );
-
-/* lbxdix.h */
-extern void LbxDixInit ( void );
-extern void LbxResetTags ( void );
-extern int LbxSendConnSetup ( ClientPtr client, char *reason );
-extern int LbxGetModifierMapping ( ClientPtr client );
-extern int LbxGetKeyboardMapping ( ClientPtr client );
-extern int LbxQueryFont ( ClientPtr client );
-extern int LbxTagData ( ClientPtr client, XID tag, unsigned long len,
- pointer data );
-extern int LbxInvalidateTag ( ClientPtr client, XID tag );
-extern void LbxAllowMotion ( ClientPtr client, int num );
-extern void LbxFlushModifierMapTag ( void );
-extern void LbxFlushKeyboardMapTag ( void );
-extern void LbxFreeFontTag ( FontPtr pfont );
-extern void LbxSendInvalidateTag ( ClientPtr client, XID tag, int tagtype );
-extern Bool LbxFlushQTag ( XID tag );
-extern void ProcessQTagZombies ( void );
-extern void LbxQueryTagData ( ClientPtr client, int owner_pid, XID tag,
- int tagtype );
-
-/* lbxexts.c */
-extern Bool LbxAddExtension ( char *name, int opcode, int ev_base,
- int err_base );
-extern Bool LbxAddExtensionAlias ( int idx, char *alias );
-extern void LbxDeclareExtensionSecurity ( char *extname, Bool secure );
-extern Bool LbxRegisterExtensionGenerationMasks ( int idx, int num_reqs,
- char *rep_mask,
- char *ev_mask );
-extern int LbxQueryExtension ( ClientPtr client, char *ename, int nlen );
-extern void LbxCloseDownExtensions ( void );
-extern void LbxSetReqMask ( CARD8 *mask, int req, Bool on );
-
-/* lbxgfx.c */
-extern int LbxDecodePoly( ClientPtr client, CARD8 xreqtype,
- int (*decode_rtn)(char *, char *, short *) );
-extern int LbxDecodeFillPoly ( ClientPtr client );
-extern int LbxDecodeCopyArea ( ClientPtr client );
-extern int LbxDecodeCopyPlane ( ClientPtr client );
-extern int LbxDecodePolyText ( ClientPtr client );
-extern int LbxDecodeImageText ( ClientPtr client );
-extern int LbxDecodePutImage ( ClientPtr client );
-extern int LbxDecodeGetImage ( ClientPtr client );
-extern int LbxDecodePoints ( char *in, char *inend, short *out );
-extern int LbxDecodeSegment ( char *in, char *inend, short *out );
-extern int LbxDecodeRectangle ( char *in, char *inend, short *out );
-extern int LbxDecodeArc ( char *in, char *inend, short *out );
-
-/* lbxmain.c */
-extern LbxProxyPtr LbxPidToProxy ( int pid );
-extern void LbxReencodeOutput ( ClientPtr client, char *pbuf, int *pcount,
- char *cbuf, int *ccount );
-extern void LbxExtensionInit ( void );
-extern void LbxCloseClient ( ClientPtr client );
-extern void LbxSetForBlock ( LbxClientPtr lbxClient );
-extern int ProcLbxDispatch ( ClientPtr client );
-extern int ProcLbxSwitch ( ClientPtr client );
-extern int ProcLbxQueryVersion ( ClientPtr client );
-extern int ProcLbxStartProxy ( ClientPtr client );
-extern int ProcLbxStopProxy ( ClientPtr client );
-extern int ProcLbxBeginLargeRequest ( ClientPtr client );
-extern int ProcLbxLargeRequestData ( ClientPtr client );
-extern int ProcLbxEndLargeRequest ( ClientPtr client );
-extern int ProcLbxInternAtoms ( ClientPtr client );
-extern int ProcLbxGetWinAttrAndGeom ( ClientPtr client );
-extern int ProcLbxNewClient ( ClientPtr client );
-extern int ProcLbxEstablishConnection ( ClientPtr client );
-extern int ProcLbxCloseClient ( ClientPtr client );
-extern int ProcLbxModifySequence ( ClientPtr client );
-extern int ProcLbxAllowMotion ( ClientPtr client );
-extern int ProcLbxGetModifierMapping ( ClientPtr client );
-extern int ProcLbxGetKeyboardMapping ( ClientPtr client );
-extern int ProcLbxQueryFont ( ClientPtr client );
-extern int ProcLbxChangeProperty ( ClientPtr client );
-extern int ProcLbxGetProperty ( ClientPtr client );
-extern int ProcLbxTagData ( ClientPtr client );
-extern int ProcLbxInvalidateTag ( ClientPtr client );
-extern int ProcLbxPolyPoint ( ClientPtr client );
-extern int ProcLbxPolyLine ( ClientPtr client );
-extern int ProcLbxPolySegment ( ClientPtr client );
-extern int ProcLbxPolyRectangle ( ClientPtr client );
-extern int ProcLbxPolyArc ( ClientPtr client );
-extern int ProcLbxFillPoly ( ClientPtr client );
-extern int ProcLbxPolyFillRectangle ( ClientPtr client );
-extern int ProcLbxPolyFillArc ( ClientPtr client );
-extern int ProcLbxCopyArea ( ClientPtr client );
-extern int ProcLbxCopyPlane ( ClientPtr client );
-extern int ProcLbxPolyText ( ClientPtr client );
-extern int ProcLbxImageText ( ClientPtr client );
-extern int ProcLbxQueryExtension ( ClientPtr client );
-extern int ProcLbxPutImage ( ClientPtr client );
-extern int ProcLbxGetImage ( ClientPtr client );
-extern int ProcLbxSync ( ClientPtr client );
-
-/* lbxprop.c */
-extern int LbxChangeProperty ( ClientPtr client );
-extern int LbxGetProperty ( ClientPtr client );
-extern void LbxStallPropRequest ( ClientPtr client, PropertyPtr pProp );
-extern int LbxChangeWindowProperty ( ClientPtr client, WindowPtr pWin,
- Atom property, Atom type, int format,
- int mode, unsigned long len,
- Bool have_data, pointer value,
- Bool sendevent, XID *tag );
-/* lbxsquish.c */
-extern int LbxSquishEvent ( char *buf );
-
-/* lbwswap.c */
-extern int SProcLbxDispatch( ClientPtr client );
-extern int SProcLbxSwitch ( ClientPtr client );
-extern int SProcLbxBeginLargeRequest ( ClientPtr client );
-extern int SProcLbxLargeRequestData ( ClientPtr client );
-extern int SProcLbxEndLargeRequest ( ClientPtr client );
-extern void LbxWriteSConnSetupPrefix ( ClientPtr pClient,
- xLbxConnSetupPrefix *pcsp );
-extern void LbxSwapFontInfo ( xLbxFontInfo *pr, Bool compressed );
-
-/* lbxzerorep.c */
-extern void ZeroReplyPadBytes ( char *buf, int reqType );
-
-#endif /* _LBXSERVE_H_ */
diff --git a/lbx/lbxsquish.c b/lbx/lbxsquish.c
deleted file mode 100644
index 8f1cad7c0..000000000
--- a/lbx/lbxsquish.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $Xorg: lbxsquish.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/*
- * Copyright 1994 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxsquish.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include "misc.h"
-#include "colormapst.h"
-#include "propertyst.h"
-#include "lbxserve.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-
-/* handles server-side protocol squishing */
-
-static char lbxevdelta[] = {
- 0,
- 0,
- sz_xEvent - lbxsz_KeyButtonEvent,
- sz_xEvent - lbxsz_KeyButtonEvent,
- sz_xEvent - lbxsz_KeyButtonEvent,
- sz_xEvent - lbxsz_KeyButtonEvent,
- sz_xEvent - lbxsz_KeyButtonEvent,
- sz_xEvent - lbxsz_EnterLeaveEvent,
- sz_xEvent - lbxsz_EnterLeaveEvent,
- sz_xEvent - lbxsz_FocusEvent,
- sz_xEvent - lbxsz_FocusEvent,
- sz_xEvent - lbxsz_KeymapEvent,
- sz_xEvent - lbxsz_ExposeEvent,
- sz_xEvent - lbxsz_GfxExposeEvent,
- sz_xEvent - lbxsz_NoExposeEvent,
- sz_xEvent - lbxsz_VisibilityEvent,
- sz_xEvent - lbxsz_CreateNotifyEvent,
- sz_xEvent - lbxsz_DestroyNotifyEvent,
- sz_xEvent - lbxsz_UnmapNotifyEvent,
- sz_xEvent - lbxsz_MapNotifyEvent,
- sz_xEvent - lbxsz_MapRequestEvent,
- sz_xEvent - lbxsz_ReparentEvent,
- sz_xEvent - lbxsz_ConfigureNotifyEvent,
- sz_xEvent - lbxsz_ConfigureRequestEvent,
- sz_xEvent - lbxsz_GravityEvent,
- sz_xEvent - lbxsz_ResizeRequestEvent,
- sz_xEvent - lbxsz_CirculateEvent,
- sz_xEvent - lbxsz_CirculateEvent,
- sz_xEvent - lbxsz_PropertyEvent,
- sz_xEvent - lbxsz_SelectionClearEvent,
- sz_xEvent - lbxsz_SelectionRequestEvent,
- sz_xEvent - lbxsz_SelectionNotifyEvent,
- sz_xEvent - lbxsz_ColormapEvent,
- sz_xEvent - lbxsz_ClientMessageEvent,
- sz_xEvent - lbxsz_MappingNotifyEvent
-};
-
-static char lbxevpad[] = {
- 0,
- 0,
- lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
- lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
- lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
- lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
- lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
- lbxsz_EnterLeaveEvent - lbxupsz_EnterLeaveEvent,
- lbxsz_EnterLeaveEvent - lbxupsz_EnterLeaveEvent,
- lbxsz_FocusEvent - lbxupsz_FocusEvent,
- lbxsz_FocusEvent - lbxupsz_FocusEvent,
- lbxsz_KeymapEvent - lbxupsz_KeymapEvent,
- lbxsz_ExposeEvent - lbxupsz_ExposeEvent,
- lbxsz_GfxExposeEvent - lbxupsz_GfxExposeEvent,
- lbxsz_NoExposeEvent - lbxupsz_NoExposeEvent,
- lbxsz_VisibilityEvent - lbxupsz_VisibilityEvent,
- lbxsz_CreateNotifyEvent - lbxupsz_CreateNotifyEvent,
- lbxsz_DestroyNotifyEvent - lbxupsz_DestroyNotifyEvent,
- lbxsz_UnmapNotifyEvent - lbxupsz_UnmapNotifyEvent,
- lbxsz_MapNotifyEvent - lbxupsz_MapNotifyEvent,
- lbxsz_MapRequestEvent - lbxupsz_MapRequestEvent,
- lbxsz_ReparentEvent - lbxupsz_ReparentEvent,
- lbxsz_ConfigureNotifyEvent - lbxupsz_ConfigureNotifyEvent,
- lbxsz_ConfigureRequestEvent - lbxupsz_ConfigureRequestEvent,
- lbxsz_GravityEvent - lbxupsz_GravityEvent,
- lbxsz_ResizeRequestEvent - lbxupsz_ResizeRequestEvent,
- lbxsz_CirculateEvent - lbxupsz_CirculateEvent,
- lbxsz_CirculateEvent - lbxupsz_CirculateEvent,
- lbxsz_PropertyEvent - lbxupsz_PropertyEvent,
- lbxsz_SelectionClearEvent - lbxupsz_SelectionClearEvent,
- lbxsz_SelectionRequestEvent - lbxupsz_SelectionRequestEvent,
- lbxsz_SelectionNotifyEvent - lbxupsz_SelectionNotifyEvent,
- lbxsz_ColormapEvent - lbxupsz_ColormapEvent,
- lbxsz_ClientMessageEvent - lbxupsz_ClientMessageEvent,
- lbxsz_MappingNotifyEvent - lbxupsz_MappingNotifyEvent
-};
-
-int
-LbxSquishEvent(char *buf)
-{
- int delta = lbxevdelta[((xEvent *)buf)->u.u.type];
- int pad = lbxevpad[((xEvent *)buf)->u.u.type];
-
- if (delta)
- memmove(buf + delta, buf, sz_xEvent - delta);
- if (pad) {
- buf += sz_xEvent;
- while (--pad >= 0)
- *--buf = 0;
- }
- return delta;
-}
diff --git a/lbx/lbxsrvopts.h b/lbx/lbxsrvopts.h
deleted file mode 100644
index 9cf3d7630..000000000
--- a/lbx/lbxsrvopts.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $Xorg: lbxsrvopts.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
-/*
- * Copyright 1994 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxsrvopts.h,v 1.2 2000/05/18 23:46:24 dawes Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _LBX_SRVOPTS_H_
-#define _LBX_SRVOPTS_H_
-
-#include <X11/extensions/lbxopts.h>
-
-typedef struct _LbxNegOpts {
- int nopts;
- short proxyDeltaN;
- short proxyDeltaMaxLen;
- short serverDeltaN;
- short serverDeltaMaxLen;
- LbxStreamOpts streamOpts;
- int numBitmapCompMethods;
- unsigned char *bitmapCompMethods; /* array of indices */
- int numPixmapCompMethods;
- unsigned char *pixmapCompMethods; /* array of indices */
- int **pixmapCompDepths; /* depths supported from each method */
- Bool squish;
- Bool useTags;
-} LbxNegOptsRec;
-
-typedef LbxNegOptsRec *LbxNegOptsPtr;
-
-
-extern void LbxOptionInit ( LbxNegOptsPtr pno );
-extern int LbxOptionParse ( LbxNegOptsPtr pno, unsigned char *popt,
- int optlen, unsigned char *preply );
-extern LbxBitmapCompMethod *
-LbxSrvrLookupBitmapCompMethod ( LbxProxyPtr proxy, int methodOpCode );
-extern LbxPixmapCompMethod *
-LbxSrvrLookupPixmapCompMethod ( LbxProxyPtr proxy, int methodOpCode );
-extern LbxBitmapCompMethod *
-LbxSrvrFindPreferredBitmapCompMethod ( LbxProxyPtr proxy );
-extern LbxPixmapCompMethod *
-LbxSrvrFindPreferredPixmapCompMethod ( LbxProxyPtr proxy, int format, int depth );
-
-
-#endif /* _LBX_SRVOPTS_H_ */
diff --git a/lbx/lbxswap.c b/lbx/lbxswap.c
deleted file mode 100644
index 848be7f70..000000000
--- a/lbx/lbxswap.c
+++ /dev/null
@@ -1,828 +0,0 @@
-/* $Xorg: lbxswap.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/*
- * Copyright 1992 Network Computing Devices
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of NCD. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. NCD. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxswap.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#include "swaprep.h"
-#include "propertyst.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include "lbxserve.h"
-#include <X11/Xfuncproto.h>
-
-#include <stdio.h>
-
-static int
-SProcLbxQueryVersion(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxQueryVersionReq);
-
- swaps(&stuff->length, n);
- return ProcLbxQueryVersion(client);
-}
-
-static int
-SProcLbxStartProxy(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxStartProxyReq);
-
- swaps(&stuff->length, n);
- return ProcLbxStartProxy(client);
-}
-
-static int
-SProcLbxStopProxy(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxStopProxyReq);
-
- swaps(&stuff->length, n);
- return ProcLbxStopProxy(client);
-}
-
-int
-SProcLbxSwitch(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxSwitchReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->client, n);
- return ProcLbxSwitch(client);
-}
-
-int
-SProcLbxBeginLargeRequest (ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxBeginLargeRequestReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->largeReqLength, n);
- return ProcLbxBeginLargeRequest(client);
-}
-
-int
-SProcLbxLargeRequestData (ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxLargeRequestDataReq);
-
- swaps(&stuff->length, n);
- return ProcLbxLargeRequestData(client);
-}
-
-int
-SProcLbxEndLargeRequest (ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxEndLargeRequestReq);
-
- swaps(&stuff->length, n);
- return ProcLbxEndLargeRequest(client);
-}
-
-static int
-SProcLbxNewClient(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxNewClientReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->client, n);
- return ProcLbxNewClient(client);
-}
-
-static int
-SProcLbxCloseClient(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxCloseClientReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->client, n);
- return ProcLbxCloseClient(client);
-}
-
-static int
-SProcLbxModifySequence(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxModifySequenceReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->adjust, n);
- return ProcLbxModifySequence(client);
-}
-
-static int
-SProcLbxAllowMotion(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxAllowMotionReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->num, n);
- return ProcLbxAllowMotion(client);
-}
-
-static int
-SProcLbxIncrementPixel(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxIncrementPixelReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
- swapl(&stuff->pixel, n);
- return ProcLbxIncrementPixel(client);
-}
-
-static int
-SProcLbxGrabCmap(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxGrabCmapReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
-
- return ProcLbxGrabCmap(client);
-}
-
-static int
-SProcLbxReleaseCmap(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxReleaseCmapReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
-
- return ProcLbxReleaseCmap(client);
-}
-
-static int
-SProcLbxAllocColor(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxAllocColorReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->cmap, n);
- swapl(&stuff->pixel, n);
- swaps(&stuff->red, n);
- swaps(&stuff->green, n);
- swaps(&stuff->blue, n);
-
- return ProcLbxAllocColor(client);
-}
-
-static int
-SProcLbxGetModifierMapping(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxGetModifierMappingReq);
-
- swaps(&stuff->length, n);
- return ProcLbxGetModifierMapping(client);
-}
-
-static int
-SProcLbxGetKeyboardMapping(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxGetKeyboardMappingReq);
-
- swaps(&stuff->length, n);
- return ProcLbxGetKeyboardMapping(client);
-}
-
-static int
-SProcLbxQueryFont(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxQueryFontReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->fid, n);
- return ProcLbxQueryFont(client);
-}
-
-static int
-SProcLbxChangeProperty(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxChangePropertyReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xLbxChangePropertyReq);
- swapl(&stuff->window, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->nUnits, n);
- switch (stuff->format) {
- case 8:
- break;
- case 16:
- SwapRestS(stuff);
- break;
- case 32:
- SwapRestL(stuff);
- break;
- }
- return ProcLbxChangeProperty(client);
-}
-
-static int
-SProcLbxGetProperty(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxGetPropertyReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->longOffset, n);
- swapl(&stuff->longLength, n);
- return ProcLbxGetProperty(client);
-}
-
-static int
-SProcLbxTagData(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxTagDataReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->tag, n);
- swapl(&stuff->real_length, n);
- return ProcLbxTagData(client);
-}
-
-static int
-SProcLbxInvalidateTag(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxInvalidateTagReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->tag, n);
- return ProcLbxInvalidateTag(client);
-}
-
-static int
-SProcLbxPoly(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxPolyPointReq);
- char *after;
-
- swaps(&stuff->length, n);
- after = ((char *) stuff) + SIZEOF(xLbxPolyPointReq);
- if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- {
- swapl (((Drawable *) after), n);
- after += sizeof (Drawable);
- }
- if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- swapl (((GContext *) after), n);
- return ProcLbxDispatch(client);
-}
-
-static int
-SProcLbxFillPoly(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxFillPolyReq);
- char *after;
-
- swaps(&stuff->length, n);
- after = ((char *) stuff) + SIZEOF(xLbxFillPolyReq);
- if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- {
- swapl (((Drawable *) after), n);
- after += sizeof (Drawable);
- }
- if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- swapl (((GContext *) after), n);
- return ProcLbxFillPoly(client);
-}
-
-static int
-SProcLbxCopyArea(ClientPtr client)
-{
- int n;
-
- REQUEST(xLbxCopyAreaReq);
- char *after;
-
- swaps(&stuff->length, n);
- after = ((char *) stuff) + SIZEOF(xLbxCopyAreaReq);
- if (GFXdCacheEnt (stuff->srcCache) == GFXCacheNone)
- {
- swapl (((Drawable *) after), n);
- after += sizeof (Drawable);
- }
- if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- {
- swapl (((Drawable *) after), n);
- after += sizeof (Drawable);
- }
- if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- swapl (((GContext *) after), n);
- return ProcLbxCopyArea(client);
-}
-
-static int
-SProcLbxCopyPlane(ClientPtr client)
-{
- int n;
-
- REQUEST(xLbxCopyPlaneReq);
- char *after;
-
- swaps(&stuff->length, n);
- swapl(&stuff->bitPlane, n);
- after = ((char *) stuff) + SIZEOF(xLbxCopyPlaneReq);
- if (GFXdCacheEnt (stuff->srcCache) == GFXCacheNone)
- {
- swapl (((Drawable *) after), n);
- after += sizeof (Drawable);
- }
- if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- {
- swapl (((Drawable *) after), n);
- after += sizeof (Drawable);
- }
- if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- swapl (((GContext *) after), n);
- return ProcLbxCopyPlane(client);
-}
-
-static int
-SProcLbxPolyText(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxPolyTextReq);
- char *after;
-
- swaps(&stuff->length, n);
- after = ((char *) stuff) + SIZEOF(xLbxPolyTextReq);
- if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- {
- swapl (((Drawable *) after), n);
- after += sizeof (Drawable);
- }
- if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- swapl (((GContext *) after), n);
- return ProcLbxDispatch(client);
-}
-
-static int
-SProcLbxImageText(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxImageTextReq);
- char *after;
-
- swaps(&stuff->length, n);
- after = ((char *) stuff) + SIZEOF(xLbxImageTextReq);
- if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- {
- swapl (((Drawable *) after), n);
- after += sizeof (Drawable);
- }
- if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
- swapl (((GContext *) after), n);
- return ProcLbxDispatch(client);
-}
-
-
-static int
-SProcLbxPutImage(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxPutImageReq);
-
- swaps (&stuff->length, n);
- return ProcLbxPutImage(client);
-}
-
-static int
-SProcLbxGetImage(ClientPtr client)
-{
- register int n;
-
- REQUEST(xLbxGetImageReq);
-
- swaps (&stuff->length, n);
- swapl (&stuff->drawable, n);
- swaps (&stuff->x, n);
- swaps (&stuff->y, n);
- swaps (&stuff->width, n);
- swaps (&stuff->height, n);
- swapl (&stuff->planeMask, n);
- return ProcLbxGetImage(client);
-}
-
-static int
-SProcLbxInternAtoms(ClientPtr client)
-{
- register int n;
- char *ptr;
- char lenbuf[2];
- CARD16 len;
- int i;
-
- REQUEST(xLbxInternAtomsReq);
-
- swaps (&stuff->length, n);
- swaps (&stuff->num, n);
-
- ptr = (char *) stuff + sz_xLbxInternAtomsReq;
- for (i = 0; i < stuff->num; i++)
- {
- swaps (ptr, n);
- lenbuf[0] = ptr[0];
- lenbuf[1] = ptr[1];
- len = *((CARD16 *) lenbuf);
- ptr += (len + 2);
- }
-
- return ProcLbxInternAtoms(client);
-}
-
-
-static int
-SProcLbxGetWinAttrAndGeom(ClientPtr client)
-{
- int n;
-
- REQUEST(xLbxGetWinAttrAndGeomReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->id, n);
-
- return ProcLbxGetWinAttrAndGeom(client);
-}
-
-
-
-static int
-SProcLbxQueryExtension(ClientPtr client)
-{
- int n;
-
- REQUEST(xLbxQueryExtensionReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->nbytes, n);
- return ProcLbxQueryExtension(client);
-}
-
-int
-SProcLbxDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data) {
- case X_LbxQueryVersion:
- return SProcLbxQueryVersion(client);
- case X_LbxStartProxy:
- return SProcLbxStartProxy(client);
- case X_LbxStopProxy:
- return SProcLbxStopProxy(client);
- case X_LbxNewClient:
- return SProcLbxNewClient(client);
- case X_LbxCloseClient:
- return SProcLbxCloseClient(client);
- case X_LbxModifySequence:
- return SProcLbxModifySequence(client);
- case X_LbxAllowMotion:
- return SProcLbxAllowMotion(client);
- case X_LbxIncrementPixel:
- return SProcLbxIncrementPixel(client);
- case X_LbxGrabCmap:
- return SProcLbxGrabCmap(client);
- case X_LbxReleaseCmap:
- return SProcLbxReleaseCmap(client);
- case X_LbxAllocColor:
- return SProcLbxAllocColor(client);
- case X_LbxGetModifierMapping:
- return SProcLbxGetModifierMapping(client);
- case X_LbxGetKeyboardMapping:
- return SProcLbxGetKeyboardMapping(client);
- case X_LbxInvalidateTag:
- return SProcLbxInvalidateTag(client);
- case X_LbxPolyPoint:
- case X_LbxPolyLine:
- case X_LbxPolySegment:
- case X_LbxPolyRectangle:
- case X_LbxPolyArc:
- case X_LbxPolyFillRectangle:
- case X_LbxPolyFillArc:
- return SProcLbxPoly(client);
- case X_LbxFillPoly:
- return SProcLbxFillPoly(client);
- case X_LbxQueryFont:
- return SProcLbxQueryFont(client);
- case X_LbxChangeProperty:
- return SProcLbxChangeProperty(client);
- case X_LbxGetProperty:
- return SProcLbxGetProperty(client);
- case X_LbxTagData:
- return SProcLbxTagData(client);
- case X_LbxCopyArea:
- return SProcLbxCopyArea(client);
- case X_LbxCopyPlane:
- return SProcLbxCopyPlane(client);
- case X_LbxPolyText8:
- case X_LbxPolyText16:
- return SProcLbxPolyText(client);
- case X_LbxImageText8:
- case X_LbxImageText16:
- return SProcLbxImageText (client);
- case X_LbxQueryExtension:
- return SProcLbxQueryExtension(client);
- case X_LbxPutImage:
- return SProcLbxPutImage(client);
- case X_LbxGetImage:
- return SProcLbxGetImage(client);
- case X_LbxInternAtoms:
- return SProcLbxInternAtoms(client);
- case X_LbxGetWinAttrAndGeom:
- return SProcLbxGetWinAttrAndGeom(client);
- case X_LbxSync:
- return ProcLbxSync(client); /* nothing to swap */
- case X_LbxBeginLargeRequest:
- return SProcLbxBeginLargeRequest(client);
- case X_LbxLargeRequestData:
- return SProcLbxLargeRequestData(client);
- default:
- return BadRequest;
- }
-}
-
-#ifdef notyet
-void
-LbxWriteSConnectionInfo(ClientPtr pClient,
- unsigned long size,
- char *pInfo)
-{
- int i, j, k;
- ScreenPtr pScreen;
- DepthPtr pDepth;
- char *pInfoT, *pInfoTBase;
- xConnSetup *pConnSetup = (xConnSetup *)pInfo;
-
- pInfoT = pInfoTBase = (char *) ALLOCATE_LOCAL(size);
- if (!pInfoTBase)
- {
- pClient->noClientException = -1;
- return;
- }
- SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT);
- pInfo += sizeof(xConnSetup);
- pInfoT += sizeof(xConnSetup);
-
- /* Copy the vendor string */
- i = (pConnSetup->nbytesVendor + 3) & ~3;
- memmove(pInfoT, pInfo, i);
- pInfo += i;
- pInfoT += i;
-
- /* The Pixmap formats don't need to be swapped, just copied. */
- i = sizeof(xPixmapFormat) * screenInfo.numPixmapFormats;
- memmove(pInfoT, pInfo, i);
- pInfo += i;
- pInfoT += i;
-
- for(i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- SwapWinRoot((xWindowRoot *)pInfo, (xWindowRoot *)pInfoT);
- pInfo += sizeof(xWindowRoot);
- pInfoT += sizeof(xWindowRoot);
- pDepth = pScreen->allowedDepths;
- for(j = 0; j < pScreen->numDepths; j++, pDepth++)
- {
- ((xDepth *)pInfoT)->depth = ((xDepth *)pInfo)->depth;
- cpswaps(((xDepth *)pInfo)->nVisuals, ((xDepth *)pInfoT)->nVisuals);
- pInfo += sizeof(xDepth);
- pInfoT += sizeof(xDepth);
- for(k = 0; k < pDepth->numVids; k++)
- {
- SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT);
- pInfo += sizeof(xVisualType);
- pInfoT += sizeof(xVisualType);
- }
- }
- }
- (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase);
- DEALLOCATE_LOCAL(pInfoTBase);
-}
-
-void
-SwapConnSetup(xConnSetup *pConnSetup,
- xConnSetup *pConnSetupT)
-{
- cpswapl(pConnSetup->release, pConnSetupT->release);
- cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
- cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask);
- cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize);
- cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor);
- cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize);
- pConnSetupT->minKeyCode = pConnSetup->minKeyCode;
- pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode;
- pConnSetupT->numRoots = pConnSetup->numRoots;
- pConnSetupT->numFormats = pConnSetup->numFormats;
- pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder;
- pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder;
- pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit;
- pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad;
-}
-
-void
-SwapWinRoot(xWindowRoot *pRoot,
- xWindowRoot *pRootT)
-{
- cpswapl(pRoot->windowId, pRootT->windowId);
- cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
- cpswapl(pRoot->whitePixel, pRootT->whitePixel);
- cpswapl(pRoot->blackPixel, pRootT->blackPixel);
- cpswapl(pRoot->currentInputMask, pRootT->currentInputMask);
- cpswaps(pRoot->pixWidth, pRootT->pixWidth);
- cpswaps(pRoot->pixHeight, pRootT->pixHeight);
- cpswaps(pRoot->mmWidth, pRootT->mmWidth);
- cpswaps(pRoot->mmHeight, pRootT->mmHeight);
- cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps);
- cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps);
- cpswapl(pRoot->rootVisualID, pRootT->rootVisualID);
- pRootT->backingStore = pRoot->backingStore;
- pRootT->saveUnders = pRoot->saveUnders;
- pRootT->rootDepth = pRoot->rootDepth;
- pRootT->nDepths = pRoot->nDepths;
-}
-
-void
-SwapVisual(xVisualType *pVis,
- xVisualType *pVisT;
-{
- cpswapl(pVis->visualID, pVisT->visualID);
- pVisT->class = pVis->class;
- pVisT->bitsPerRGB = pVis->bitsPerRGB;
- cpswaps(pVis->colormapEntries, pVisT->colormapEntries);
- cpswapl(pVis->redMask, pVisT->redMask);
- cpswapl(pVis->greenMask, pVisT->greenMask);
- cpswapl(pVis->blueMask, pVisT->blueMask);
-}
-#endif
-
-void
-LbxWriteSConnSetupPrefix(ClientPtr pClient,
- xLbxConnSetupPrefix *pcsp)
-{
- xLbxConnSetupPrefix cspT;
-
- cspT.success = pcsp->success;
- cspT.changeType = pcsp->changeType;
- cspT.length = pcsp->length;
- cpswaps(pcsp->majorVersion, cspT.majorVersion);
- cpswaps(pcsp->minorVersion, cspT.minorVersion);
- cpswapl(pcsp->tag, cspT.tag);
-
- (void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT);
-}
-
-void
-LbxSwapFontInfo(xLbxFontInfo *pr,
- Bool compressed)
-{
- unsigned i;
- xCharInfo *pxci;
- unsigned nchars,
- nprops;
- char *pby;
- register char n;
-
- nchars = pr->nCharInfos;
- nprops = pr->nFontProps;
- swaps(&pr->minCharOrByte2, n);
- swaps(&pr->maxCharOrByte2, n);
- swaps(&pr->defaultChar, n);
- swaps(&pr->nFontProps, n);
- swaps(&pr->fontAscent, n);
- swaps(&pr->fontDescent, n);
- SwapCharInfo(&pr->minBounds);
- SwapCharInfo(&pr->maxBounds);
- swapl(&pr->nCharInfos, n);
-
- pby = (char *) &pr[1];
- /*
- * Font properties are an atom and either an int32 or a CARD32, so they
- * are always 2 4 byte values
- */
- for (i = 0; i < nprops; i++) {
- swapl(pby, n);
- pby += 4;
- swapl(pby, n);
- pby += 4;
- }
- if (!compressed) {
- pxci = (xCharInfo *) pby;
- for (i = 0; i < nchars; i++, pxci++)
- SwapCharInfo(pxci);
- } else {
- SwapLongs((CARD32 *) pby, nchars);
- }
-}
diff --git a/lbx/lbxtables.c b/lbx/lbxtables.c
deleted file mode 100644
index 5e8174eeb..000000000
--- a/lbx/lbxtables.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $Xorg: lbxtables.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */
-/*
- * Copyright 1993 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxtables.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "dix.h"
-
-extern int ProcInitialConnection(ClientPtr client);
-extern int ProcLbxEstablishConnection(ClientPtr client);
-
-int (* LbxInitialVector[3]) (ClientPtr) =
-{
- 0,
- ProcInitialConnection,
- ProcLbxEstablishConnection
-};
diff --git a/lbx/lbxtags.c b/lbx/lbxtags.c
deleted file mode 100644
index 84365b253..000000000
--- a/lbx/lbxtags.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* $Xorg: lbxtags.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/*
- * Copyright 1993 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxtags.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "lbxdata.h"
-#include "resource.h"
-#include "colormapst.h"
-#include "propertyst.h"
-#include "lbxtags.h"
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#include "propertyst.h"
-
-static RESTYPE TagResType;
-
-extern int _lbx_fi_junklen;
-
-/* ARGSUSED */
-static int
-tag_free(pointer data,
- XID id)
-{
- TagData td = (TagData) data;
- FontTagInfoPtr ftip;
- char *t;
-
- if (td->global)
- *(td->global) = 0;
- /* some types need to be freed, others are shared */
- if (td->data_type == LbxTagTypeFont) {
- /* remove any back links */
- ftip = (FontTagInfoPtr) td->tdata;
- FontSetPrivate(ftip->pfont, lbx_font_private, NULL);
- t = (char *) ftip->fontinfo;
- if (!ftip->compression) /* points to xQueryFont, so back up to it */
- t -= _lbx_fi_junklen;
- xfree(t);
- xfree(ftip);
- }
- xfree(data);
- return 0;
-}
-
-void
-TagInit(void)
-{
- TagResType = CreateNewResourceType(tag_free);
-}
-
-XID
-TagNewTag(void)
-{
- return FakeClientID(0);
-}
-
-void
-TagClearProxy(XID tid,
- int pid)
-{
- TagData td;
-
- td = (TagData) LookupIDByType(tid, TagResType);
- if (td)
- td->sent_to_proxy[pid >> 3] &= ~(1 << (pid & 7));
-}
-
-void
-TagMarkProxy(XID tid,
- int pid)
-{
- TagData td;
-
- td = (TagData) LookupIDByType(tid, TagResType);
- td->sent_to_proxy[pid >> 3] |= 1 << (pid & 7);
-}
-
-Bool
-TagProxyMarked(XID tid,
- int pid)
-{
- TagData td;
-
- td = (TagData) LookupIDByType(tid, TagResType);
- return (td->sent_to_proxy[pid >> 3] & (1 << (pid & 7))) != 0;
-}
-
-XID
-TagSaveTag(int dtype,
- int size,
- pointer data,
- XID *global)
-{
- TagData td;
-
- td = (TagData) xalloc(sizeof(TagDataRec));
- if (!td) {
- if (global)
- *global = 0;
- return 0;
- }
- bzero((char *) td->sent_to_proxy, (MAX_NUM_PROXIES + 7) / 8);
- td->tid = TagNewTag();
- td->data_type = dtype;
- td->tdata = data;
- td->size = size;
- td->global = global;
- if (!AddResource(td->tid, TagResType, (pointer) td))
- return 0;
- if (global)
- *global = td->tid;
- return td->tid;
-}
-
-void
-TagDeleteTag(XID tid)
-{
- int pid;
- TagData td;
- LbxProxyPtr proxy;
- ClientPtr client;
- LbxClientPtr lbxcp;
-
- td = (TagData) LookupIDByType(tid, TagResType);
- if (!td) /* shouldn't happen, but play it safe */
- return;
- for (pid = 1; pid < MAX_NUM_PROXIES; pid++) {
- if (td->sent_to_proxy[pid >> 3] & (1 << (pid & 7))) {
- proxy = LbxPidToProxy(pid);
- lbxcp = (proxy != NULL) ? proxy->lbxClients[0] : NULL;
- if (lbxcp && (client = lbxcp->client))
- LbxSendInvalidateTag(client, tid, td->data_type);
- td->sent_to_proxy[pid >> 3] &= ~(1 << (pid & 7));
- }
- }
- if (td->data_type != LbxTagTypeProperty || !LbxFlushQTag(tid))
- FreeResource(tid, 0);
- else if (td->global) {
- *(td->global) = 0;
- td->global = NULL;
- }
-}
-
-TagData
-TagGetTag(XID tid)
-{
- TagData td;
-
- td = (TagData) LookupIDByType(tid, TagResType);
- return td;
-}
-
-static void
-LbxFlushTag(pointer value,
- XID tid,
- pointer cdata)
-{
- TagData td = (TagData)value;
- LbxProxyPtr proxy = (LbxProxyPtr)cdata;
- int i;
-
- if ((td->data_type == LbxTagTypeProperty) && td->global) {
- PropertyPtr pProp = (PropertyPtr)td->tdata;
- if ((pProp->tag_id == tid) && (pProp->owner_pid == proxy->pid)) {
- LbxFlushQTag(tid);
- pProp->size = 0;
- FreeResource(tid, 0);
- return;
- }
- }
- td->sent_to_proxy[proxy->pid >> 3] &= ~(1 << (proxy->pid & 7));
- for (i = 0; i < (MAX_NUM_PROXIES + 7) / 8; i++) {
- if (td->sent_to_proxy[i])
- return;
- }
- FreeResource(tid, 0);
-}
-
-/*
- * clear out markers for proxies
- */
-void
-LbxFlushTags(LbxProxyPtr proxy)
-{
- FindClientResourcesByType(NULL, TagResType, LbxFlushTag, (pointer)proxy);
-}
diff --git a/lbx/lbxtags.h b/lbx/lbxtags.h
deleted file mode 100644
index 8577bd93c..000000000
--- a/lbx/lbxtags.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $Xorg: lbxtags.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/*
- * Copyright 1993 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/lbx/lbxtags.h,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _LBXTAGS_H_
-#define _LBXTAGS_H_
-#include "lbxserve.h"
-
-#include "os.h"
-#include "opaque.h"
-#include "resource.h"
-#include <X11/X.h>
-#include <X11/Xproto.h>
-
-typedef struct _tagdata {
- XID tid;
- short data_type;
- unsigned char sent_to_proxy[(MAX_NUM_PROXIES + 7) / 8];
- int size;
- pointer tdata;
- XID *global;
-} TagDataRec;
-
-typedef struct _tagdata *TagData;
-
-extern void TagInit ( void );
-extern XID TagNewTag ( void );
-extern void TagClearProxy ( XID tid, int pid );
-extern void TagMarkProxy ( XID tid, int pid );
-extern Bool TagProxyMarked ( XID tid, int pid );
-extern XID TagSaveTag ( int dtype, int size, pointer data, XID *global );
-extern void TagDeleteTag ( XID tid );
-extern TagData TagGetTag ( XID tid );
-extern void LbxFlushTags ( LbxProxyPtr proxy );
-
-#endif /* _LBXTAGS_H_ */
diff --git a/lbx/lbxzerorep.c b/lbx/lbxzerorep.c
deleted file mode 100644
index e376908c0..000000000
--- a/lbx/lbxzerorep.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/* $Xorg: lbxzerorep.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
-
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-/* $XFree86: xc/programs/Xserver/lbx/lbxzerorep.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
-
-/*
- * This module handles zeroing out unused pad bytes in core X replies.
- * This will hopefully improve both stream and delta compression,
- * since we are removing the random values in pad bytes.
- */
-
-#define NEED_REPLIES
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-
-void
-ZeroReplyPadBytes (char *buf,
- int reqType)
-{
- switch (reqType) {
- case X_GetWindowAttributes:
- {
- xGetWindowAttributesReply *reply = (xGetWindowAttributesReply *) buf;
- reply->pad = 0;
- break;
- }
- case X_GetGeometry:
- {
- xGetGeometryReply *reply = (xGetGeometryReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- break;
- }
- case X_QueryTree:
- {
- xQueryTreeReply *reply = (xQueryTreeReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- break;
- }
- case X_InternAtom:
- {
- xInternAtomReply *reply = (xInternAtomReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- break;
- }
- case X_GetAtomName:
- {
- xGetAtomNameReply *reply = (xGetAtomNameReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_GetProperty:
- {
- xGetPropertyReply *reply = (xGetPropertyReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- break;
- }
- case X_ListProperties:
- {
- xListPropertiesReply *reply = (xListPropertiesReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_GetSelectionOwner:
- {
- xGetSelectionOwnerReply *reply = (xGetSelectionOwnerReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- break;
- }
- case X_GrabKeyboard:
- case X_GrabPointer:
- {
- xGrabKeyboardReply *reply = (xGrabKeyboardReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- break;
- }
- case X_QueryPointer:
- {
- xQueryPointerReply *reply = (xQueryPointerReply *) buf;
- reply->pad1 = 0;
- reply->pad = 0;
- break;
- }
- case X_GetMotionEvents:
- {
- xGetMotionEventsReply *reply = (xGetMotionEventsReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- break;
- }
- case X_TranslateCoords:
- {
- xTranslateCoordsReply *reply = (xTranslateCoordsReply *) buf;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- break;
- }
- case X_GetInputFocus:
- {
- xGetInputFocusReply *reply = (xGetInputFocusReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- break;
- }
- case X_QueryKeymap:
- {
- xQueryKeymapReply *reply = (xQueryKeymapReply *) buf;
- reply->pad1 = 0;
- break;
- }
- case X_QueryFont:
- {
- xQueryFontReply *reply = (xQueryFontReply *) buf;
- reply->pad1 = 0;
- break;
- }
- case X_QueryTextExtents:
- {
- xQueryTextExtentsReply *reply = (xQueryTextExtentsReply *) buf;
- reply->pad = 0;
- break;
- }
- case X_ListFonts:
- {
- xListFontsReply *reply = (xListFontsReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_GetFontPath:
- {
- xGetFontPathReply *reply = (xGetFontPathReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_GetImage:
- {
- xGetImageReply *reply = (xGetImageReply *) buf;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_ListInstalledColormaps:
- {
- xListInstalledColormapsReply *reply =
- (xListInstalledColormapsReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_AllocColor:
- {
- xAllocColorReply *reply = (xAllocColorReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- break;
- }
- case X_AllocNamedColor:
- {
- xAllocNamedColorReply *reply = (xAllocNamedColorReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- break;
- }
- case X_AllocColorCells:
- {
- xAllocColorCellsReply *reply = (xAllocColorCellsReply *) buf;
- reply->pad1 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_AllocColorPlanes:
- {
- xAllocColorPlanesReply *reply = (xAllocColorPlanesReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- break;
- }
- case X_QueryColors:
- {
- xQueryColorsReply *reply = (xQueryColorsReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_LookupColor:
- {
- xLookupColorReply *reply = (xLookupColorReply *) buf;
- reply->pad1 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- break;
- }
- case X_QueryBestSize:
- {
- xQueryBestSizeReply *reply = (xQueryBestSizeReply *) buf;
- reply->pad1 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_QueryExtension:
- {
- xQueryExtensionReply *reply = (xQueryExtensionReply *) buf;
- reply->pad1 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_ListExtensions:
- {
- xListExtensionsReply *reply = (xListExtensionsReply *) buf;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_SetPointerMapping:
- case X_SetModifierMapping:
- {
- xSetMappingReply *reply = (xSetMappingReply *) buf;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_GetPointerMapping:
- {
- xGetPointerMappingReply *reply = (xGetPointerMappingReply *) buf;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_GetKeyboardMapping:
- {
- xGetKeyboardMappingReply *reply = (xGetKeyboardMappingReply *) buf;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- case X_GetModifierMapping:
- {
- xGetModifierMappingReply *reply = (xGetModifierMappingReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- break;
- }
- case X_GetKeyboardControl:
- {
- xGetKeyboardControlReply *reply = (xGetKeyboardControlReply *) buf;
- reply->pad = 0;
- break;
- }
- case X_GetPointerControl:
- {
- xGetPointerControlReply *reply = (xGetPointerControlReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- break;
- }
- case X_GetScreenSaver:
- {
- xGetScreenSaverReply *reply = (xGetScreenSaverReply *) buf;
- reply->pad1 = 0;
- reply->pad2 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- break;
- }
- case X_ListHosts:
- {
- xListHostsReply *reply = (xListHostsReply *) buf;
- reply->pad1 = 0;
- reply->pad3 = 0;
- reply->pad4 = 0;
- reply->pad5 = 0;
- reply->pad6 = 0;
- reply->pad7 = 0;
- break;
- }
- }
-}
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 5d93da07b..7626c8494 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: xserver/xorg/mi/miinitext.c,v 1.32 2006/03/12 00:11:34 krh Exp $ */
+/* $XdotOrg: xserver/xorg/mi/miinitext.c,v 1.33 2006/06/01 18:47:01 daniels Exp $ */
/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.67 2003/01/12 02:44:27 dawes Exp $ */
/***********************************************************
@@ -143,9 +143,6 @@ extern Bool noFontCacheExtension;
#ifdef GLXEXT
extern Bool noGlxExtension;
#endif
-#ifdef LBX
-extern Bool noLbxExtension;
-#endif
#ifdef SCREENSAVER
extern Bool noScreenSaverExtension;
#endif
@@ -241,10 +238,6 @@ typedef void (*InitExtension)(INITARGS);
#ifdef XKB
#include <X11/extensions/XKB.h>
#endif
-#ifdef LBX
-#define _XLBX_SERVER_
-#include <X11/extensions/lbxstr.h>
-#endif
#ifdef XPRINT
#include <X11/extensions/Print.h>
#endif
@@ -319,9 +312,6 @@ extern void XCMiscExtensionInit(INITARGS);
#ifdef XRECORD
extern void RecordExtensionInit(INITARGS);
#endif
-#ifdef LBX
-extern void LbxExtensionInit(INITARGS);
-#endif
#ifdef DBE
extern void DbeExtensionInit(INITARGS);
#endif
@@ -430,9 +420,6 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef GLXEXT
{ "GLX", &noGlxExtension },
#endif
-#ifdef LBX
- { "LBX", &noLbxExtension },
-#endif
#ifdef SCREENSAVER
{ "MIT-SCREEN-SAVER", &noScreenSaverExtension },
#endif
@@ -598,9 +585,6 @@ InitExtensions(argc, argv)
#ifdef XRECORD
if (!noTestExtensions) RecordExtensionInit();
#endif
-#ifdef LBX
- if (!noLbxExtension) LbxExtensionInit();
-#endif
#ifdef DBE
if (!noDbeExtension) DbeExtensionInit();
#endif
@@ -706,9 +690,6 @@ static ExtensionModule staticExtensions[] = {
#ifdef XKB
{ XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
#endif
-#ifdef LBX
- { LbxExtensionInit, LBXNAME, &noLbxExtension, NULL, NULL },
-#endif
#ifdef XAPPGROUP
{ XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL },
#endif
diff --git a/os/Makefile.am b/os/Makefile.am
index c4ebf21a5..d7fd58d28 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -9,7 +9,6 @@ INTERNALMALLOC_SOURCES = xalloc.c
XCSECURITY_SOURCES = secauth.c
XDMCP_SOURCES = xdmcp.c
-LBX_SOURCES = lbxio.c
STRLCAT_SOURCES = strlcat.c strlcpy.c
XORG_SOURCES = log.c
@@ -38,10 +37,6 @@ if XDMCP
libos_la_SOURCES += $(XDMCP_SOURCES)
endif
-if LBX
-libos_la_SOURCES += $(LBX_SOURCES)
-endif
-
if NEED_STRLCAT
libos_la_SOURCES += $(STRLCAT_SOURCES)
endif
diff --git a/os/access.c b/os/access.c
index 75e6de325..62af2f91f 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1,5 +1,5 @@
/* $Xorg: access.c,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */
-/* $XdotOrg: xserver/xorg/os/access.c,v 1.14 2006/01/07 00:45:17 ajax Exp $ */
+/* $XdotOrg: xserver/xorg/os/access.c,v 1.15 2006/02/15 20:44:13 ajax Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -1392,10 +1392,6 @@ _X_EXPORT Bool LocalClient(ClientPtr client)
return FALSE;
}
#endif
-#ifdef LBX
- if (!((OsCommPtr)client->osPrivate)->trans_conn)
- return FALSE;
-#endif
if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn,
&notused, &alen, &from))
{
diff --git a/os/connection.c b/os/connection.c
index 8a7eb872a..21c1ea641 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -154,12 +154,6 @@ extern __const__ int _nfiles;
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
-#ifdef LBX
-#include "colormapst.h"
-#include "propertyst.h"
-#include "lbxserve.h"
-#include "osdep.h"
-#endif
#ifdef X_NOT_POSIX
#define Pid_t int
@@ -300,14 +294,6 @@ int ListenTransCount;
static void ErrorConnMax(XtransConnInfo /* trans_conn */);
-#ifndef LBX
-static
-void CloseDownFileDescriptor(
- OsCommPtr /*oc*/
-);
-#endif
-
-
static XtransConnInfo
lookup_trans_conn (int fd)
{
@@ -564,10 +550,6 @@ AuthAudit (ClientPtr client, Bool letin,
char addr[128];
char *out = addr;
- if (!((OsCommPtr)client->osPrivate)->trans_conn) {
- strcpy(addr, "LBX proxy at ");
- out += strlen(addr);
- }
if (!len)
strcpy(out, "local host");
else
@@ -654,67 +636,13 @@ ClientAuthorized(ClientPtr client,
XID auth_id;
char *reason = NULL;
XtransConnInfo trans_conn;
-#ifdef LBX
- int restore_trans_conn = 0;
- ClientPtr lbxpc = NULL;
-#endif
priv = (OsCommPtr)client->osPrivate;
trans_conn = priv->trans_conn;
-#ifdef LBX
- if (!trans_conn) {
- /*
- * Since trans_conn is NULL, this must be a proxy's client for
- * which we have NO address. Therefore, we will temporarily
- * set the client's trans_conn to the proxy's trans_conn and
- * after CheckAuthorization the client's trans_conn will be
- * restored.
- *
- * If XDM-AUTHORIZATION-1 is being used, CheckAuthorization
- * will eventually call XdmAuthorizationValidate and this
- * later function may use the client's trans_conn to get the
- * client's address. Since a XDM-AUTH-1 auth string includes
- * the client's address, this address is compared to the address
- * in the client's trans_conn. If the proxy and client are
- * on the same host, the comparison will fail; otherwise the
- * comparison will fail and the client will not be authorized
- * to connect to the server.
- *
- * The basis for this additional code is to prevent a
- * NULL pointer dereference of the client's trans_conn.
- * The fundamental problem - the fact that the client's
- * trans_conn is NULL - is because the NewClient
- * request in version 1.0 of the LBX protocol does not
- * send the client's address to the server. When the
- * spec is changed and the client's address is sent to
- * server in the NewClient request, this additional code
- * should be removed.
- *
- * See defect number XWSog08218 for more information.
- */
- lbxpc = LbxProxyClient(priv->proxy);
- trans_conn = ((OsCommPtr)lbxpc->osPrivate)->trans_conn;
- priv->trans_conn = trans_conn;
- restore_trans_conn = 1;
- }
-#endif
-
auth_id = CheckAuthorization (proto_n, auth_proto,
string_n, auth_string, client, &reason);
-#ifdef LBX
- if (! priv->trans_conn) {
- if (auth_id == (XID) ~0L && !GetAccessControl())
- auth_id = ((OsCommPtr)lbxpc->osPrivate)->auth_id;
-#ifdef XCSECURITY
- else if (auth_id != (XID) ~0L && !SecuritySameLevel(lbxpc, auth_id)) {
- auth_id = (XID) ~0L;
- reason = "Client trust level differs from that of LBX Proxy";
- }
-#endif
- }
-#endif
if (auth_id == (XID) ~0L)
{
if (
@@ -725,11 +653,7 @@ ClientAuthorized(ClientPtr client,
_XSERVTransGetPeerAddr (trans_conn,
&family, &fromlen, &from) != -1)
{
- if (
-#ifdef LBX
- !trans_conn ||
-#endif
- InvalidHost ((struct sockaddr *) from, fromlen, client))
+ if (InvalidHost ((struct sockaddr *) from, fromlen, client))
AuthAudit(client, FALSE, (struct sockaddr *) from,
fromlen, proto_n, auth_proto, auth_id);
else
@@ -745,14 +669,6 @@ ClientAuthorized(ClientPtr client,
}
if (auth_id == (XID) ~0L) {
-#ifdef LBX
- /*
- * Restore client's trans_conn state
- */
- if (restore_trans_conn) {
- priv->trans_conn = NULL;
- }
-#endif
if (reason)
return reason;
else
@@ -787,34 +703,16 @@ ClientAuthorized(ClientPtr client,
* true purpose of the selfhosts list is to see who may change the
* access control list.
*/
-#ifdef LBX
- if (restore_trans_conn) {
- priv->trans_conn = NULL;
- }
-#endif
return((char *)NULL);
}
static ClientPtr
-#ifdef LBX
-AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time,
- int (*Flush)(
- ClientPtr /*who*/, OsCommPtr /*oc*/,
- char * /*extraBuf*/, int /*extraCount*/),
- void (*Close)(
- ClientPtr /*client*/),
- LbxProxyPtr proxy)
-#else
AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
-#endif
{
OsCommPtr oc;
ClientPtr client;
if (
-#ifdef LBX
- trans_conn &&
-#endif
#ifndef WIN32
fd >= lastfdesc
#else
@@ -831,36 +729,25 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
oc->output = (ConnectionOutputPtr)NULL;
oc->auth_id = None;
oc->conn_time = conn_time;
-#ifdef LBX
- oc->proxy = proxy;
- oc->Flush = Flush;
- oc->Close = Close;
- oc->largereq = (ConnectionInputPtr) NULL;
-#endif
if (!(client = NextAvailableClient((pointer)oc)))
{
xfree (oc);
return NullClient;
}
-#ifdef LBX
- if (trans_conn)
-#endif
- {
#if !defined(WIN32)
- ConnectionTranslation[fd] = client->index;
+ ConnectionTranslation[fd] = client->index;
#else
- SetConnectionTranslation(fd, client->index);
+ SetConnectionTranslation(fd, client->index);
#endif
- if (GrabInProgress)
- {
- FD_SET(fd, &SavedAllClients);
- FD_SET(fd, &SavedAllSockets);
- }
- else
- {
- FD_SET(fd, &AllClients);
- FD_SET(fd, &AllSockets);
- }
+ if (GrabInProgress)
+ {
+ FD_SET(fd, &SavedAllClients);
+ FD_SET(fd, &SavedAllSockets);
+ }
+ else
+ {
+ FD_SET(fd, &AllClients);
+ FD_SET(fd, &AllSockets);
}
#ifdef DEBUG
@@ -871,39 +758,6 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
return client;
}
-#ifdef LBX
-
-int
-ClientConnectionNumber (ClientPtr client)
-{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
-
- return oc->fd;
-}
-
-ClientPtr
-AllocLbxClientConnection (ClientPtr client, LbxProxyPtr proxy)
-{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
-
- return AllocNewConnection ((XtransConnInfo)NULL, oc->fd, GetTimeInMillis(),
- LbxFlushClient, LbxCloseClient, proxy);
-}
-
-void
-LbxProxyConnection (ClientPtr client, LbxProxyPtr proxy)
-{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
-
- FlushClient(client, oc, (char *)NULL, 0);
- oc->proxy = proxy;
- oc->Flush = LbxFlushClient;
- oc->Close = LbxCloseClient;
- LbxPrimeInput(client, proxy);
-}
-
-#endif
-
/*****************
* EstablishNewConnections
* If anyone is waiting on listened sockets, accept them.
@@ -982,12 +836,7 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure)
_XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1);
- if (!AllocNewConnection (new_trans_conn, newconn, connect_time
-#ifdef LBX
- , StandardFlushClient,
- CloseDownFileDescriptor, (LbxProxyPtr)NULL
-#endif
- ))
+ if (!AllocNewConnection (new_trans_conn, newconn, connect_time))
{
ErrorConnMax(new_trans_conn);
_XSERVTransClose(new_trans_conn);
@@ -1056,27 +905,15 @@ ErrorConnMax(XtransConnInfo trans_conn)
* Remove this file descriptor and it's I/O buffers, etc.
************/
-#ifdef LBX
-void
-CloseDownFileDescriptor(ClientPtr client)
-#else
static void
CloseDownFileDescriptor(OsCommPtr oc)
-#endif
{
-#ifdef LBX
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
-#endif
int connection = oc->fd;
if (oc->trans_conn) {
_XSERVTransDisconnect(oc->trans_conn);
_XSERVTransClose(oc->trans_conn);
}
-#ifndef LBX
- FreeOsBuffers(oc);
- xfree(oc);
-#endif
#ifndef WIN32
ConnectionTranslation[connection] = 0;
#else
@@ -1171,13 +1008,7 @@ CloseDownConnection(ClientPtr client)
#ifdef XDMCP
XdmcpCloseDisplay(oc->fd);
#endif
-#ifndef LBX
CloseDownFileDescriptor(oc);
-#else
- (*oc->Close) (client);
- FreeOsBuffers(oc);
- xfree(oc);
-#endif
client->osPrivate = (pointer)NULL;
if (auditTrailLevel > 1)
AuditF("client %d disconnected\n", client->index);
@@ -1266,17 +1097,8 @@ IgnoreClient (ClientPtr client)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
-#ifdef LBX
- LbxClientPtr lbxClient = LbxClient(client);
-#endif
isItTimeToYield = TRUE;
-#ifdef LBX
- if (lbxClient) {
- lbxClient->ignored = TRUE;
- return;
- }
-#endif
if (!GrabInProgress || FD_ISSET(connection, &AllClients))
{
if (FD_ISSET (connection, &ClientsWithInput))
@@ -1310,14 +1132,6 @@ AttendClient (ClientPtr client)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
-#ifdef LBX
- LbxClientPtr lbxClient = LbxClient(client);
-
- if (lbxClient) {
- lbxClient->ignored = FALSE;
- return;
- }
-#endif
if (!GrabInProgress || GrabInProgress == client->index ||
FD_ISSET(connection, &GrabImperviousClients))
{
diff --git a/os/io.c b/os/io.c
index 867512d55..a9527baa3 100644
--- a/os/io.c
+++ b/os/io.c
@@ -85,11 +85,6 @@ SOFTWARE.
#include "opaque.h"
#include "dixstruct.h"
#include "misc.h"
-#ifdef LBX
-#include "colormapst.h"
-#include "propertyst.h"
-#include "lbxserve.h"
-#endif
_X_EXPORT CallbackListPtr ReplyCallback;
_X_EXPORT CallbackListPtr FlushCallback;
@@ -200,26 +195,9 @@ OsCommPtr AvailableInput = (OsCommPtr)NULL;
#define YieldControlDeath() \
{ timesThisConnection = 0; }
-#ifdef hpux_not_tog
-#define LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
-#endif
-
-#ifdef LBX
-#ifdef LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
-#undef ReadRequestFromClient
int
ReadRequestFromClient(ClientPtr client)
{
- return (*client->readRequest)(client);
-}
-#endif
-int
-StandardReadRequestFromClient(ClientPtr client)
-#else
-int
-ReadRequestFromClient(ClientPtr client)
-#endif
-{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
ConnectionInputPtr oci = oc->input;
int fd = oc->fd;
@@ -368,13 +346,6 @@ ReadRequestFromClient(ClientPtr client)
YieldControlDeath();
return -1;
}
-#ifdef LBX
- if (oc->proxy && oc->proxy->compHandle)
- result = (*oc->proxy->streamOpts.streamCompRead)(fd,
- (unsigned char *)oci->buffer + oci->bufcnt,
- oci->size - oci->bufcnt);
- else
-#endif
result = _XSERVTransRead(oc->trans_conn, oci->buffer + oci->bufcnt,
oci->size - oci->bufcnt);
if (result <= 0)
@@ -382,18 +353,8 @@ ReadRequestFromClient(ClientPtr client)
if ((result < 0) && ETEST(errno))
{
#if defined(SVR4) && defined(i386) && !defined(sun)
-#if defined(LBX) && 0
- /*
- * For LBX connections, we can get a valid EWOULDBLOCK
- * There is probably a better way of distinguishing LBX
- * connections, but this works. (DHD)
- */
- extern int LbxRead();
- if (oc->Read == LbxRead)
-#else
if (0)
#endif
-#endif
{
YieldControlNoInput();
return 0;
@@ -610,18 +571,6 @@ ResetCurrentRequest(ClientPtr client)
int fd = oc->fd;
register xReq *request;
int gotnow, needed;
-#ifdef LBX
- LbxClientPtr lbxClient = LbxClient(client);
-
- if (lbxClient) {
- LbxSetForBlock(lbxClient);
- if (!oci) {
- AppendFakeRequest(client,
- client->requestBuffer, client->req_len << 2);
- return;
- }
- }
-#endif
if (AvailableInput == oc)
AvailableInput = (OsCommPtr)NULL;
oci->lenLastReq = 0;
@@ -850,11 +799,7 @@ FlushAllOutput(void)
if (client->clientGone)
continue;
oc = (OsCommPtr)client->osPrivate;
- if (
-#ifdef LBX
- !oc->proxy &&
-#endif
- FD_ISSET(oc->fd, &ClientsWithInput))
+ if (FD_ISSET(oc->fd, &ClientsWithInput))
{
FD_SET(oc->fd, &OutputPending); /* set the bit again */
NewOutputPending = TRUE;
@@ -874,11 +819,7 @@ FlushAllOutput(void)
if (client->clientGone)
continue;
oc = (OsCommPtr)client->osPrivate;
- if (
-#ifdef LBX
- !oc->proxy &&
-#endif
- FD_ISSET(oc->fd, &ClientsWithInput))
+ if (FD_ISSET(oc->fd, &ClientsWithInput))
{
FD_SET(oc->fd, &newOutputPending); /* set the bit again */
NewOutputPending = TRUE;
@@ -1055,22 +996,8 @@ WriteToClient (ClientPtr who, int count, char *buf)
*
**********************/
-#ifdef LBX
-#ifdef LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
-#undef FlushClient
-int
-FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
-{
- return (*oc->Flush)(who, oc, extraBuf, extraCount);
-}
-#endif
-int
-StandardFlushClient(ClientPtr who, OsCommPtr oc,
- char *extraBuf, int extraCount)
-#else
int
FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
-#endif
{
ConnectionOutputPtr oco = oc->output;
int connection = oc->fd;
@@ -1274,9 +1201,6 @@ AllocateOutputBuffer(void)
}
oco->size = BUFSIZE;
oco->count = 0;
-#ifdef LBX
- oco->nocompress = FALSE;
-#endif
return oco;
}
@@ -1318,12 +1242,6 @@ FreeOsBuffers(OsCommPtr oc)
oco->count = 0;
}
}
-#ifdef LBX
- if ((oci = oc->largereq)) {
- xfree(oci->buffer);
- xfree(oci);
- }
-#endif
}
void
diff --git a/os/lbxio.c b/os/lbxio.c
deleted file mode 100644
index 97ae958e3..000000000
--- a/os/lbxio.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.17 2002/05/31 18:46:06 dawes Exp $ */
-/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/***********************************************************
-Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts,
-and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $Xorg: lbxio.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/Xtrans/Xtrans.h>
-#include <X11/Xmd.h>
-#include <errno.h>
-#ifndef Lynx
-#include <sys/param.h>
-#ifndef __UNIXOS2__
-#include <sys/uio.h>
-#endif
-#else
-#include <uio.h>
-#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "os.h"
-#include <X11/Xpoll.h>
-#include "osdep.h"
-#include "opaque.h"
-#include "dixstruct.h"
-#include "misc.h"
-#include "colormapst.h"
-#include "propertyst.h"
-#include "lbxserve.h"
-
-/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
- * systems are broken and return EWOULDBLOCK when they should return EAGAIN
- */
-#if defined(EAGAIN) && defined(EWOULDBLOCK)
-#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
-#else
-#ifdef EAGAIN
-#define ETEST(err) (err == EAGAIN)
-#else
-#define ETEST(err) (err == EWOULDBLOCK)
-#endif
-#endif
-
-#define get_req_len(req,cli) ((cli)->swapped ? \
- lswaps((req)->length) : (req)->length)
-
-#define YieldControl() \
- { isItTimeToYield = TRUE; \
- timesThisConnection = 0; }
-#define YieldControlNoInput() \
- { YieldControl(); \
- FD_CLR(fd, &ClientsWithInput); }
-
-void
-SwitchClientInput (ClientPtr client, Bool pending)
-{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
-
-#ifndef WIN32
- ConnectionTranslation[oc->fd] = client->index;
-#else
- SetConnectionTranslation(oc->fd, client->index);
-#endif
- if (pending)
- FD_SET(oc->fd, &ClientsWithInput);
- else
- YieldControl();
-}
-
-void
-LbxPrimeInput(ClientPtr client, LbxProxyPtr proxy)
-{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
- ConnectionInputPtr oci = oc->input;
-
- if (oci && proxy->compHandle) {
- char *extra = oci->bufptr + oci->lenLastReq;
- int left = oci->bufcnt + oci->buffer - extra;
-
- (*proxy->streamOpts.streamCompStuffInput)(oc->fd,
- (unsigned char *)extra,
- left);
- oci->bufcnt -= left;
- AvailableInput = oc;
- }
-}
-
-void
-AvailableClientInput (ClientPtr client)
-{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
-
- if (FD_ISSET(oc->fd, &AllSockets))
- FD_SET(oc->fd, &ClientsWithInput);
-}
-
-/*****************************************************************
- * AppendFakeRequest
- * Append a (possibly partial) request in as the last request.
- *
- **********************/
-
-Bool
-AppendFakeRequest (ClientPtr client, char *data, int count)
-{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
- ConnectionInputPtr oci = oc->input;
- int fd = oc->fd;
- int gotnow;
-
- if (!oci)
- {
- if ((oci = FreeInputs))
- FreeInputs = oci->next;
- else if (!(oci = AllocateInputBuffer()))
- return FALSE;
- oc->input = oci;
- } else if (AvailableInput == oc)
- AvailableInput = (OsCommPtr)NULL;
- /* do not free AvailableInput here, it could be proxy's */
- oci->bufptr += oci->lenLastReq;
- oci->lenLastReq = 0;
- gotnow = oci->bufcnt + oci->buffer - oci->bufptr;
- if ((gotnow + count) > oci->size)
- {
- char *ibuf;
-
- ibuf = (char *)xrealloc(oci->buffer, gotnow + count);
- if (!ibuf)
- return(FALSE);
- oci->size = gotnow + count;
- oci->buffer = ibuf;
- oci->bufptr = ibuf + oci->bufcnt - gotnow;
- }
- if (oci->bufcnt + count > oci->size) {
- memmove(oci->buffer, oci->bufptr, gotnow);
- oci->bufcnt = gotnow;
- oci->bufptr = oci->buffer;
- }
- memmove(oci->bufptr + gotnow, data, count);
- oci->bufcnt += count;
- gotnow += count;
- if ((gotnow >= sizeof(xReq)) &&
- (gotnow >= (int)(get_req_len((xReq *)oci->bufptr, client) << 2)))
- FD_SET(fd, &ClientsWithInput);
- else
- YieldControlNoInput();
- return(TRUE);
-}
-
-static int
-LbxWrite(XtransConnInfo trans_conn, LbxProxyPtr proxy,
- char *buf, int len)
-{
- struct iovec iov;
- int n;
- int notWritten;
-
- notWritten = len;
- iov.iov_base = buf;
- iov.iov_len = len;
- while (notWritten) {
- errno = 0;
- if (proxy->compHandle)
- n = (*proxy->streamOpts.streamCompWriteV)(proxy->fd, &iov, 1);
- else
- n = _XSERVTransWritev(trans_conn, &iov, 1);
- if (n >= 0) {
- iov.iov_base = (char *)iov.iov_base + n;
- notWritten -= n;
- iov.iov_len = notWritten;
- }
- else if (ETEST(errno)
-#ifdef SUNSYSV /* check for another brain-damaged OS bug */
- || (errno == 0)
-#endif
-#ifdef EMSGSIZE /* check for another brain-damaged OS bug */
- || ((errno == EMSGSIZE) && (iov.iov_len == 1))
-#endif
- )
- break;
-#ifdef EMSGSIZE /* check for another brain-damaged OS bug */
- else if (errno == EMSGSIZE)
- iov.iov_len >>= 1;
-#endif
- else
- return -1;
- }
- return len - notWritten;
-}
-
-static Bool
-LbxAppendOutput(LbxProxyPtr proxy, ClientPtr client, ConnectionOutputPtr oco)
-{
- ConnectionOutputPtr noco = proxy->olast;
- LbxClientPtr lbxClient = LbxClient(client);
-
- if (!lbxClient) {
- xfree(oco->buf);
- xfree(oco);
- return TRUE;
- }
- if (noco)
- LbxReencodeOutput(client,
- (char *)noco->buf, &noco->count,
- (char *)oco->buf, &oco->count);
- else
- LbxReencodeOutput(client,
- (char *)NULL, (int *)NULL,
- (char *)oco->buf, &oco->count);
- if (!oco->count) {
- if (oco->size > BUFWATERMARK)
- {
- xfree(oco->buf);
- xfree(oco);
- }
- else
- {
- oco->next = FreeOutputs;
- FreeOutputs = oco;
- }
- return TRUE;
- }
- if ((lbxClient->id != proxy->cur_send_id) && proxy->lbxClients[0]) {
- xLbxSwitchEvent *ev;
- int n;
-
- if (!noco || (noco->size - noco->count) < sz_xLbxSwitchEvent) {
- if ((noco = FreeOutputs))
- FreeOutputs = noco->next;
- else
- noco = AllocateOutputBuffer();
- if (!noco) {
- MarkClientException(client);
- return FALSE;
- }
- noco->next = NULL;
- if (proxy->olast)
- proxy->olast->next = noco;
- else
- proxy->ofirst = noco;
- proxy->olast = noco;
- }
- ev = (xLbxSwitchEvent *) (noco->buf + noco->count);
- noco->count += sz_xLbxSwitchEvent;
- proxy->cur_send_id = lbxClient->id;
- ev->type = LbxEventCode;
- ev->lbxType = LbxSwitchEvent;
- ev->pad = 0;
- ev->client = proxy->cur_send_id;
- if (LbxProxyClient(proxy)->swapped) {
- swapl(&ev->client, n);
- }
- }
- oco->next = NULL;
- if (proxy->olast)
- proxy->olast->next = oco;
- else
- proxy->ofirst = oco;
- proxy->olast = oco;
- return TRUE;
-}
-
-static int
-LbxClientOutput(ClientPtr client, OsCommPtr oc,
- char *extraBuf, int extraCount, Bool nocompress)
-{
- ConnectionOutputPtr oco;
- int len;
-
- if ((oco = oc->output)) {
- oc->output = NULL;
- if (!LbxAppendOutput(oc->proxy, client, oco))
- return -1;
- }
-
- if (extraCount) {
- NewOutputPending = TRUE;
- FD_SET(oc->fd, &OutputPending);
- len = (extraCount + 3) & ~3;
- if ((oco = FreeOutputs) && (oco->size >= len))
- FreeOutputs = oco->next;
- else {
- oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput));
- if (!oco) {
- MarkClientException(client);
- return -1;
- }
- oco->size = len;
- if (oco->size < BUFSIZE)
- oco->size = BUFSIZE;
- oco->buf = (unsigned char *) xalloc(oco->size);
- if (!oco->buf) {
- xfree(oco);
- MarkClientException(client);
- return -1;
- }
- }
- oco->count = len;
- oco->nocompress = nocompress;
- memmove((char *)oco->buf, extraBuf, extraCount);
- if (!nocompress && oco->count < oco->size)
- oc->output = oco;
- else if (!LbxAppendOutput(oc->proxy, client, oco))
- return -1;
- }
- return extraCount;
-}
-
-void
-LbxForceOutput(LbxProxyPtr proxy)
-{
- int i;
- LbxClientPtr lbxClient;
- OsCommPtr coc;
- ConnectionOutputPtr oco;
-
- for (i = proxy->maxIndex; i >= 0; i--) { /* proxy must be last */
- lbxClient = proxy->lbxClients[i];
- if (!lbxClient)
- continue;
- coc = (OsCommPtr)lbxClient->client->osPrivate;
- if ((oco = coc->output)) {
- coc->output = NULL;
- LbxAppendOutput(proxy, lbxClient->client, oco);
- }
- }
-}
-
-int
-LbxFlushClient(ClientPtr who, OsCommPtr oc,
- char *extraBuf, int extraCount)
-{
- LbxProxyPtr proxy;
- ConnectionOutputPtr oco;
- int n;
- XtransConnInfo trans_conn = NULL;
-
- if (extraBuf)
- return LbxClientOutput(who, oc, extraBuf, extraCount, FALSE);
- proxy = oc->proxy;
- if (!proxy->lbxClients[0])
- return 0;
- LbxForceOutput(proxy);
- if (!proxy->compHandle)
- trans_conn = ((OsCommPtr)LbxProxyClient(proxy)->osPrivate)->trans_conn;
- while ((oco = proxy->ofirst)) {
- /* XXX bundle up into writev someday */
- if (proxy->compHandle) {
- if (oco->nocompress)
- (*proxy->streamOpts.streamCompOff)(proxy->fd);
- n = LbxWrite(NULL, proxy, (char *)oco->buf, oco->count);
- if (oco->nocompress)
- (*proxy->streamOpts.streamCompOn)(proxy->fd);
- } else
- n = LbxWrite(trans_conn, proxy, (char *)oco->buf, oco->count);
- if (n < 0) {
- ClientPtr pclient = LbxProxyClient(proxy);
- if (proxy->compHandle)
- trans_conn = ((OsCommPtr)pclient->osPrivate)->trans_conn;
- _XSERVTransDisconnect(trans_conn);
- _XSERVTransClose(trans_conn);
- ((OsCommPtr)pclient->osPrivate)->trans_conn = NULL;
- MarkClientException(pclient);
- return 0;
- } else if (n == oco->count) {
- proxy->ofirst = oco->next;
- if (!proxy->ofirst)
- proxy->olast = NULL;
- if (oco->size > BUFWATERMARK)
- {
- xfree(oco->buf);
- xfree(oco);
- }
- else
- {
- oco->next = FreeOutputs;
- oco->count = 0;
- FreeOutputs = oco;
- }
- } else {
- if (n) {
- oco->count -= n;
- memmove((char *)oco->buf, (char *)oco->buf + n, oco->count);
- }
- break;
- }
- }
- if ((proxy->compHandle &&
- (*proxy->streamOpts.streamCompFlush)(proxy->fd)) ||
- proxy->ofirst) {
- FD_SET(proxy->fd, &ClientsWriteBlocked);
- AnyClientsWriteBlocked = TRUE;
- }
- return 0;
-}
-
-int
-UncompressedWriteToClient (ClientPtr who, int count, char *buf)
-{
- return LbxClientOutput(who, (OsCommPtr)who->osPrivate, buf, count, TRUE);
-}
-
-void
-LbxFreeOsBuffers(LbxProxyPtr proxy)
-{
- ConnectionOutputPtr oco;
-
- while ((oco = proxy->ofirst)) {
- proxy->ofirst = oco->next;
- xfree(oco->buf);
- xfree(oco);
- }
-}
-
-Bool
-AllocateLargeReqBuffer(ClientPtr client, int size)
-{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
- ConnectionInputPtr oci;
-
- if (!(oci = oc->largereq)) {
- if ((oci = FreeInputs))
- FreeInputs = oci->next;
- else {
- oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput));
- if (!oci)
- return FALSE;
- oci->buffer = NULL;
- oci->size = 0;
- }
- }
- if (oci->size < size) {
- char *ibuf;
-
- oci->size = size;
- if (size < BUFSIZE)
- oci->size = BUFSIZE;
- if (!(ibuf = (char *)xrealloc(oci->buffer, oci->size)))
- {
- xfree(oci->buffer);
- xfree(oci);
- oc->largereq = NULL;
- return FALSE;
- }
- oci->buffer = ibuf;
- }
- oci->bufptr = oci->buffer;
- oci->bufcnt = 0;
- oci->lenLastReq = size;
- oc->largereq = oci;
- return TRUE;
-}
-
-Bool
-AddToLargeReqBuffer(ClientPtr client, char *data, int size)
-{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
- ConnectionInputPtr oci = oc->largereq;
-
- if (!oci || (oci->bufcnt + size > oci->lenLastReq))
- return FALSE;
- memcpy(oci->buffer + oci->bufcnt, data, size);
- oci->bufcnt += size;
- return TRUE;
-}
-
-static OsCommRec lbxAvailableInput;
-
-int
-PrepareLargeReqBuffer(ClientPtr client)
-{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
- ConnectionInputPtr oci = oc->largereq;
-
- if (!oci)
- return client->req_len << 2;
- oc->largereq = NULL;
- if (oci->bufcnt != oci->lenLastReq) {
- xfree(oci->buffer);
- xfree(oci);
- return client->req_len << 2;
- }
- client->requestBuffer = oci->buffer;
- client->req_len = oci->lenLastReq >> 2;
- oci->bufcnt = 0;
- oci->lenLastReq = 0;
- if (AvailableInput)
- {
- ConnectionInputPtr aci = AvailableInput->input;
- if (aci->size > BUFWATERMARK)
- {
- xfree(aci->buffer);
- xfree(aci);
- }
- else
- {
- aci->next = FreeInputs;
- FreeInputs = aci;
- }
- AvailableInput->input = (ConnectionInputPtr)NULL;
- }
- lbxAvailableInput.input = oci;
- AvailableInput = &lbxAvailableInput;
- return client->req_len << 2;
-}
diff --git a/os/osdep.h b/os/osdep.h
index f566ac5d1..259237d37 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -145,9 +145,6 @@ typedef struct _connectionOutput {
int size;
unsigned char *buf;
int count;
-#ifdef LBX
- Bool nocompress;
-#endif
} ConnectionOutput, *ConnectionOutputPtr;
#ifdef K5AUTH
@@ -160,10 +157,6 @@ typedef struct _k5_state {
} k5_state;
#endif
-#ifdef LBX
-typedef struct _LbxProxy *OsProxyPtr;
-#endif
-
struct _osComm;
#define AuthInitArgs void
@@ -204,33 +197,14 @@ typedef struct _osComm {
#endif
CARD32 conn_time; /* timestamp if not established, else 0 */
struct _XtransConnInfo *trans_conn; /* transport connection object */
-#ifdef LBX
- OsProxyPtr proxy;
- ConnectionInputPtr largereq;
- OsCloseFunc Close;
- OsFlushFunc Flush;
-#endif
} OsCommRec, *OsCommPtr;
-#ifdef LBX
-#define FlushClient(who, oc, extraBuf, extraCount) \
- (*(oc)->Flush)(who, oc, extraBuf, extraCount)
-extern int StandardFlushClient(
- ClientPtr /*who*/,
- OsCommPtr /*oc*/,
- char* /*extraBuf*/,
- int /*extraCount*/
-);
-extern int LbxFlushClient(ClientPtr /*who*/, OsCommPtr /*oc*/,
- char * /*extraBuf*/, int /*extraCount*/);
-#else
extern int FlushClient(
ClientPtr /*who*/,
OsCommPtr /*oc*/,
char* /*extraBuf*/,
int /*extraCount*/
);
-#endif
extern void FreeOsBuffers(
OsCommPtr /*oc*/
diff --git a/os/utils.c b/os/utils.c
index 173013ac1..bfbc367c5 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: xserver/xorg/os/utils.c,v 1.24 2006/02/16 07:17:31 keithp Exp $ */
+/* $XdotOrg: xserver/xorg/os/utils.c,v 1.25 2006/03/25 19:52:05 ajax Exp $ */
/* $Xorg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */
/*
@@ -164,9 +164,6 @@ _X_EXPORT Bool noFontCacheExtension = FALSE;
#ifdef GLXEXT
_X_EXPORT Bool noGlxExtension = FALSE;
#endif
-#ifdef LBX
-_X_EXPORT Bool noLbxExtension = FALSE;
-#endif
#ifdef SCREENSAVER
_X_EXPORT Bool noScreenSaverExtension = FALSE;
#endif