aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Imakefile146
-rw-r--r--nx-X11/programs/Xserver/Imakefile590
-rw-r--r--nx-X11/programs/Xserver/Xext/Imakefile16
-rw-r--r--nx-X11/programs/Xserver/Xext/dmx.c1133
-rw-r--r--nx-X11/programs/Xserver/Xext/xprint.c2760
-rw-r--r--nx-X11/programs/Xserver/dix/Imakefile6
-rw-r--r--nx-X11/programs/Xserver/dix/main.c9
-rw-r--r--nx-X11/programs/Xserver/dix/xpstubs.c27
-rw-r--r--nx-X11/programs/Xserver/hw/Imakefile26
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Imakefile3
-rw-r--r--nx-X11/programs/Xserver/mi/miinitext.c45
-rw-r--r--nx-X11/programs/Xserver/os/Imakefile2
-rw-r--r--nx-X11/programs/Xserver/os/utils.c13
13 files changed, 11 insertions, 4765 deletions
diff --git a/nx-X11/programs/Imakefile b/nx-X11/programs/Imakefile
index 9480baf6e..77a84a65f 100644
--- a/nx-X11/programs/Imakefile
+++ b/nx-X11/programs/Imakefile
@@ -1,8 +1,3 @@
-XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:47:01 cpqbld Exp $
-
-
-
-XCOMM $XFree86: xc/programs/Imakefile,v 3.54 2003/04/14 20:37:16 herrb Exp $
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
@@ -23,156 +18,15 @@ XCOMM $XFree86: xc/programs/Imakefile,v 3.54 2003/04/14 20:37:16 herrb Exp $
#define IHaveSubdirs
#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
-#if BuildServer || UseRgbTxt
- RGBSRCDIR = rgb
-#endif
#if BuildServer
XSSRCDIR = Xserver
#endif
-#if BuildXkbcomp
- XKBCOMPDIR = xkbcomp
-#endif
-#ifndef Win32Architecture
-#if HasXServer
- XINITSRCDIR = xinit
-#endif
-#if BuildFontServer
- XFSSRCDIR = xfs
-#endif
-#if BuildXKBlib
- XKBSRCDIRS = setxkbmap $(XKBCOMPDIR) xkbevd xkbprint xkbutils
-#endif
-#if BuildScreenSaverLibrary
-SCREENSAVESRCDIR = beforelight
-#endif
-#if BuildXF86VidModeLibrary
- XVIDTUNESRCDIR = xvidtune
-#endif
-#if BuildXF86DGALibrary
- XF86DGASRCDIR = xf86dga
-#endif
-#if BuildXAServer
- XASSRCDIR = Xaserver
-#endif
-#if BuildLBX
- LBXPROXYSRCDIR = lbxproxy
-#endif
-#if BuildXprintClients
- XPSRCDIRS = xplsprinters xprehashprinterlist xphelloworld xpr
-#endif
- PROXYMGRSRCDIR = proxymngr
- RSTARTSRCDIR = rstart
- SMPROXYSRCDIR = smproxy
- TWMSRCDIR = twm
- XCONSOLESRCDIR = xconsole
- XDMSRCDIR = xdm
-XFINDPROXYSRCDIR = xfindproxy
- XFWPSRCDIR = xfwp
-#if BuildXF86VidModeLibrary
- XGAMMASRCDIR = xgamma
-#endif
-#if BuildXvLibrary
- XVINFOSRCDIR = xvinfo
-#endif
- XHOSTSRCDIR = xhost
-#if BuildPlugin && BuildXaw
- XRXSRCDIR = xrx
-#endif
- XSMSRCDIR = xsm
-#if BuildXterm
- XTERMSRCDIR = xterm
-#endif
- SCRIPTSDIR = scripts
-#endif /* Win32Architecture */
-#if BuildCID
- MKCFMSRCDIR = mkcfm
-#endif
-
-#if (HasFreetype2 || BuildFreetype2Library) && BuildFontEncLib
- MKFONTSCALEDIR = mkfontscale
-#endif
-#if BuildXInputLib
-XINPUTCLIENTDIRS = xsetmode xsetpointer
-#endif
-
-#if BuildXTrapLibrary
-XTRAPCLIENTDIRS = xtrap
-#endif
-
-/* makepsres should be considered as part of the DPS libraries */
-#if BuildDPSLibraries
- MAKEPSRESDIR = makepsres
-#endif
-
-/* on the other hand, the following are independent clients */
-#if BuildDPSClients
- DPSCLIENTDIRS = dpsinfo dpsexec texteroids
-#endif
-#if BuildDBElib && BuildXprintClients
- DBECLIENTDIRS = xdbedizzy
-#endif
-
- XPMCLIENTDIRS = cxpm sxpm
-
-#if BuildGLXLibrary
- GLXCLIENTDIRS = glxinfo glxgears
-#endif
-
- XLOADDIR = xload
-
-#if BuildRandRLibrary
- XRANDRDIR = xrandr
-#endif
-
-#if BuildXcursorgen
- XCURSORGENDIR = xcursorgen
-#endif
-
-#if BuildFontconfigLibrary
- FCDIRS = fc-cache fc-list
-#endif
-#if 0
- FCLANGDIR = fc-lang
-#endif
-
-#if BuildXDriInfo
- XDRIINFO = xdriinfo
-#endif
-
-#if BuildXaw
- XMORE = xmore
-#endif
-
-#if BuildServersOnly || !BuildClients
#if defined(NXEmbeddedXServer)
SUBDIRS = $(XSSRCDIR)
#else
SUBDIRS = $(XSSRCDIR) nxauth
#endif
-#else
-SUBDIRS = \
- appres bdftopcf bitmap \
- $(SCREENSAVESRCDIR) editres $(FCDIRS) $(FCLANGDIR) fslsfonts fstobdf \
- iceauth ico listres luit \
- $(MAKEPSRESDIR) $(DPSCLIENTDIRS) $(DBECLIENTDIRS) \
- $(MKCFMSRCDIR) \
- mkfontdir $(MKFONTSCALEDIR) oclock $(PROXYMGRSRCDIR) \
- $(RGBSRCDIR) $(RSTARTSRCDIR) showfont \
- $(SMPROXYSRCDIR) $(TWMSRCDIR) viewres x11perf xauth xbiff xcalc \
- xclipboard xclock \
- xcmsdb $(XCONSOLESRCDIR) xditview $(XDMSRCDIR) xdpyinfo \
- $(XF86DGASRCDIR) xedit xev xeyes xfd xfontsel $(XFSSRCDIR) xfsinfo \
- $(XFINDPROXYSRCDIR) $(XFWPSRCDIR) $(XGAMMASRCDIR) xgc $(XHOSTSRCDIR) \
- $(XINITSRCDIR) $(XKBSRCDIRS) xkill $(XLOADDIR) xlogo xlsatoms \
- xlsclients xlsfonts xmag xman xmessage xmh xmodmap $(XMORE) xprop \
- xrdb xrefresh $(XRXSRCDIR) xset \
- xsetroot $(XSMSRCDIR) xstdcmap $(XINPUTCLIENTDIRS) \
- $(XTERMSRCDIR) $(XTRAPCLIENTDIRS) $(XVIDTUNESRCDIR) xwd xwininfo xwud \
- $(XPMCLIENTDIRS) $(XVINFOSRCDIR) \
- $(XSSRCDIR) $(XASSRCDIR) $(LBXPROXYSRCDIR) $(XPSRCDIRS) $(SCRIPTSDIR) \
- $(GLXCLIENTDIRS) $(XRANDRDIR) $(XCURSORGENDIR) $(XDRIINFO)
-#endif
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile
index d18364b23..d6e67d864 100644
--- a/nx-X11/programs/Xserver/Imakefile
+++ b/nx-X11/programs/Xserver/Imakefile
@@ -158,49 +158,6 @@ INSTPGMFLAGS =
LIBCWRAPPER = os/libcwrapper.o
#endif
-#if BuildXprint
-
-XPCONFIGDIR = XpConfig
-
-#ifndef XpRasterDDX
-#define XpRasterDDX YES
-#endif
-#ifndef XpColorPclDDX
-#define XpColorPclDDX YES
-#endif
-#ifndef XpMonoPclDDX
-#define XpMonoPclDDX NO
-#endif
-#ifndef XpPostScriptDDX
-#define XpPostScriptDDX YES
-#endif
-
-#if XpRasterDDX
-XPRASTLIB = Xprint/raster/LibraryTargetName(raster)
-#endif
-#if XpColorPclDDX
-XPPCLLIB = Xprint/pcl/LibraryTargetName(pcl)
-#endif
-#if XpMonoPclDDX
-XPMPCLLIB = Xprint/pcl-mono/LibraryTargetName(pcl)
-#endif
-#if XpPostScriptDDX
-XPPSLIB = Xprint/ps/LibraryTargetName(ps)
-#endif
-
-XPDDXLIBS = Xprint/LibraryTargetName(printer) \
- $(XPRASTLIB) $(XPPCLLIB) $(XPMPCLLIB) $(XPPSLIB)
-XPDDXFBLIBS = $(MFB) $(CFB32)
-#if !PrintOnlyServer
- XPFBLIBS = $(XPDDXFBLIBS)
- XPDDX = $(XPDDXLIBS)
-#endif
- XPDDXDIR = Xprint
-#endif
-#if !BuildXprint || PrintOnlyServer
-XPFBLIBS = dix/LibraryTargetName(xpstubs)
-#endif
-
#if BuildRender
RENDERDIR = render
RENDERLIB = $(RENDERDIR)/librender.a
@@ -377,161 +334,6 @@ XCOMM
* even if multiple servers that share subdirectories are being built.
*/
-#if defined(XdecServer) && XdecServer
-XCOMM
-XCOMM Digital MIPS based WS server (ultrix 4.2 and beyond)
-XCOMM
-MFBSUBDIR = mfb
-CFB8SUBDIR = cfb
-DECWSDDXDIR = hw/dec/ws
-DECDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DECWSDDXDIR) $(DEPDIRS)
-DECOBJS = hw/dec/ws/init.o hw/dec/ws/sdepthinit.o
-DECLIBS = hw/dec/ws/LibraryTargetName(dec) CFB8Libs
-ServerTarget(Xdec,$(DECDIRS),$(DECOBJS), \
- $(DECLIBS),$(FONTLIBS) $(SYSLIBS))
-#ifndef ServerToInstall
-#define ServerToInstall Xdec
-#endif
-#endif /* XdecServer */
-
-
-#if defined(XdecMultiDepthServer) && XdecMultiDepthServer
-XCOMM
-XCOMM Digital MIPS based WS server (ultrix 4.2 and beyond)
-XCOMM Supports 8, 12, and 24 bit pixmaps
-XCOMM
-MFBSUBDIR = mfb
-CFB8SUBDIR = cfb
-CFB16SUBDIR = cfb16
-CFB24SUBDIR = cfb24
-CFB32SUBDIR = cfb32
-DECWSDDXDIR = hw/dec/ws
-DECDIRS1 = $(STDDIRS) $(MFBDIR) \
- $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \
- $(DECWSDDXDIR) $(DEPDIRS)
-DECOBJS1 = hw/dec/ws/init.o hw/dec/ws/mdepthinit.o
-DECLIBS1 = hw/dec/ws/LibraryTargetName(dec) CFBLibs
-ServerTarget(Xdec_md,$(DECDIRS1),$(DECOBJS1), \
- $(DECLIBS1),$(FONTLIBS) $(SYSLIBS))
-#ifndef ServerToInstall
-#define ServerToInstall Xdec_md
-#endif
-#endif /* XdecMultiDepthServer */
-
-
-#if defined(XsunServer) && XsunServer
-XCOMM
-XCOMM Sun server
-XCOMM
-MFBSUBDIR = mfb
-CFB8SUBDIR = cfb
-SUNDDXDIR = hw/sun
-#if DoLoadableServer
-SUNOBJS = hw/sun/sunInit.o hw/sun/sunInitExt.o hw/sun/stubs.o
-#elif (defined(XF86Server) && XF86Server) \
- || (defined(XorgServer) && XorgServer)
-SUNOBJS = hw/sun/sunInit.o hw/sun/stubs.o
-#else
-SUNOBJS = hw/sun/sunInit.o
-#endif
-SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(SUNDDXDIR) $(DEPDIRS)
-SUNLIBS = hw/sun/LibraryTargetName(sun) CFB8Libs
-SUNSYSLIBS = $(FONTLIBS) $(WIDECHARSYSLIB) $(SYSLIBS)
-SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \
- $(LIBCWRAPPER) $(SUNLIBS) $(LOADABLEEXTS),$(SUNSYSLIBS))
-#ifndef ServerToInstall
-#define ServerToInstall Xsun
-#endif
-#endif /* XsunServer */
-
-
-#if defined(Xsun24Server) && Xsun24Server
-XCOMM
-XCOMM Sun multiple pixmap depth (8, 12, 24) server
-XCOMM
-MFBSUBDIR = mfb
-CFB8SUBDIR = cfb
-CFB16SUBDIR = cfb16
-CFB24SUBDIR = cfb24
-CFB32SUBDIR = cfb32
-SUNDDXDIR = hw/sun
-SUN24DIRS = $(STDDIRS) $(MFBDIR) \
- $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \
- $(SUNDDXDIR) $(DEPDIRS)
-#if DoLoadableServer
-SUN24OBJS = hw/sun/sunInitMulti.o hw/sun/sunInitExt.o hw/sun/stubs.o
-#elif defined(XF86Server) && XF86Server \
- || (defined(XorgServer) && XorgServer)
-SUN24OBJS = hw/sun/sunInitMulti.o hw/sun/stubs.o
-#else
-SUN24OBJS = hw/sun/sunInitMulti.o
-#endif
-SUN24LIBS = hw/sun/LibraryTargetName(sun) CFBLibs
-SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS), \
- $(LIBCWRAPPER) $(SUN24LIBS) $(LOADABLEEXTS),$(FONTLIBS) $(SYSLIBS))
-#ifndef ServerToInstall
-#define ServerToInstall Xsun24
-#endif
-#endif /* Xsun24Server */
-
-
-#if defined(XsunMonoServer) && XsunMonoServer
-XCOMM
-XCOMM Sun monochrome server
-XCOMM
-MFBSUBDIR = mfb
-SUNDDXDIR = hw/sun
-SUNMDIRS = $(STDDIRS) $(MFBDIR) $(SUNDDXDIR) $(DEPDIRS)
-#if defined(XF86Server) && XF86Server \
- || (defined(XorgServer) && XorgServer)
-SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o hw/sun/stubs.o
-#else
-SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o
-#endif
-SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBBareLibs $(EXTENSIONS)
-SetUIDServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \
- $(LIBCWRAPPER) $(SUNMLIBS) $(LOADABLEEXTS),$(FONTLIBS) $(SYSLIBS))
-#ifndef ServerToInstall
-#define ServerToInstall XsunMono
-#endif
-#endif /* XsunMonoServer */
-
-
-#if defined(XsunLynxServer) && XsunLynxServer
-XCOMM
-XCOMM Sun server for LynxOS microSPARC 2.4.0
-XCOMM
-MFBSUBDIR = mfb
-CFB8SUBDIR = cfb
-LYNXDDXDIR = hw/sunLynx
-SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(LYNXDDXDIR) $(DEPDIRS)
-SUNOBJS = hw/sunLynx/sunLyInit.o
-SUNLIBS = hw/sunLynx/libsun.a CFB8Libs
-ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \
- $(SUNLIBS),$(FONTLIBS) $(SYSLIBS))
-#ifndef ServerToInstall
-#define ServerToInstall Xsun
-#endif
-#endif /* XsunLynxServer */
-
-
-#if defined(XsunLynxMonoServer) && XsunLynxMonoServer
-XCOMM
-XCOMM Sun monochrome server for LynxOS microSPARC 2.4.0
-XCOMM
-MFBSUBDIR = mfb
-LYNXDDXDIR = hw/sunLynx
-SUNMDIRS = $(STDDIRS) $(MFBDIR) $(LYNXDDXDIR) $(DEPDIRS)
-SUNMOBJS = hw/sunLynx/sunInitMono.o hw/sunLynx/sunInExMono.o
-SUNMLIBS = hw/sunLynx/libsun.a MFBBareLibs $(OTHEREXTS)
-ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \
- $(SUNMLIBS),$(FONTLIBS) $(SYSLIBS))
-#ifndef ServerToInstall
-#define ServerToInstall XsunMono
-#endif
-#endif /* XsunLynxMonoServer */
-
-
#if HasParallelMake
XCOMM
XCOMM force non-parallel build of XF86 servers to prevent MUTEX overrides
@@ -542,18 +344,6 @@ XF86SERVER = XFree86
#if defined(XorgServer) && XorgServer
XF86SERVER = Xorg
#endif
-#if defined(XnestServer) && XnestServer
-XNEST = Xnext
-#endif
-#if defined(XVirtualFramebufferServer) && XVirtualFramebufferServer
-XVFB = Xvfb
-#endif
-#if XdmxServer
-XDMX = Xdmx
-#endif
-#if defined(XWinServer) && XWinServer && !MakeDllModules
-XWIN = XWin
-#endif
#if defined(NXAgentServer) && NXAgentServer
NXAGENT = nxagent
#endif
@@ -562,13 +352,9 @@ NXWIN = NXWin
#endif
#if (defined(XF86Server) && XF86Server) || \
(defined(XorgServer) && XorgServer) || \
- (defined(XnestServer) && XnestServer) || \
(defined(NXAgentServer) && NXAgentServer) || \
- (defined(XVirtualFramebufferServer) && XVirtualFramebufferServer) || \
- (defined(XdmxServer) && XdmxServer) || \
- (!MakeDllModules && defined(XWinServer) && XWinServer) || \
(!MakeDllModules && defined(NXWinServer) && NXWinServer)
-MakeMutex($(XF86SERVER) $(XNEST) $(XVFB) $(XWIN) $(NXAGENT) $(NXWIN))
+MakeMutex($(XF86SERVER) $(NXAGENT) $(NXWIN))
#endif
MakeMutex($(STDDIRS) mfb fb cfb cfb16 cfb24 cfb32)
#endif
@@ -850,73 +636,6 @@ ServerDriverSDKTarget(Xorg)
#endif
#endif /* XorgServer */
-#if defined(XprtServer) && XprtServer
-XCOMM
-XCOMM Print Server
-XCOMM
-MFBSUBDIR = mfb
-CFB8SUBDIR = cfb
-CFB32SUBDIR = cfb32
-MIDAMAGEDIR = miext/damage
-XPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DEPDIRS) \
- $(MIDAMAGEDIR)
-XPOBJS = Xprint/ddxInit.o Xprint/dpmsstubs.o Xprint/miinitext.o
-#if PrintOnlyServer
-XPLIBS = PreFbLibs $(XPDDXLIBS) $(XPDDXFBLIBS) PostFbLibs
-#else
-XPLIBS = PreFbLibs PostFbLibs
-#endif
-#if (defined(SunArchitecture) || defined(SparcArchitecture)) && \
- defined(SVR4Architecture)
-XPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) $(XONLYLIB) -lw
-#else
-XPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) $(XONLYLIB)
-#endif
-#if HasParallelMake
-MakeMutex($(XPSUBDIRS) $(XPOBJS) $(XPLIBS) $(XPSYSLIBS))
-#endif
-#if ForceServerRemake
-$(XPOBJS) $(XPLIBS) $(XPSYSLIBS):: $(XPSUBDIRS)
- @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi
-#endif
-ServerTarget(Xprt,$(XPSUBDIRS),$(XPOBJS), \
- $(LIBCWRAPPER) $(XPLIBS) $(LOADABLEEXTS),$(XPSYSLIBS))
-#endif /* XprtServer */
-
-#if defined(XnestServer) && XnestServer
-XCOMM
-XCOMM Server with Xlib-based ddx
-XCOMM
-#ifndef Win32Architecture
-XNESTDDXDIR = hw/xnest
-#else
-XNESTDDXDIR = hw
-#endif
-#if BuildDPMS
-XNESTDPMSSTUBOBJS = $(XNESTDDXDIR)/dpmsstubs.o
-#endif
-XNESTDIRS = $(STDDIRS) $(XNESTDDXDIR) $(DEPDIRS)
-#if !defined(LynxOSArchitecture) && \
- !defined(Win32Architecture) && \
- !defined(QNX4Architecture)
-XNESTOBJS = hw/xnest/miinitext.o $(XNESTDPMSSTUBOBJS)
-#else
-XNESTOBJS = hw/xnest/miinitext.o dix/main.o $(XNESTDPMSSTUBOBJS)
-#endif
-XNEST = hw/xnest/LibraryTargetName(xnest)
-XNESTLIBS = PreFbLibs $(XNEST) NoMfbPostFbLibs $(XNEST)
-XNESTSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS)
-#if HasParallelMake
-MakeMutex($(XNESTDIRS) $(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS))
-#endif
-#if ForceServerRemake
-$(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS):: $(XNESTDIRS)
- @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi
-#endif
-ServerTarget(Xnest,$(XNESTDIRS),$(XNESTOBJS) $(XNESTDEFFILE), \
- $(LIBCWRAPPER) $(XNESTLIBS) $(LOADABLEEXTS),$(XNESTSYSLIBS))
-#endif /* XnestServer */
-
#if defined(NXAgentServer) && NXAgentServer
XCOMM
XCOMM Nested server with NXlib-based ddx and compressed transport.
@@ -1081,194 +800,6 @@ nxagent_static_nolibs: nxagent
$(LDPRELIBS) $(SYSLIBS) -Wl,-Bdynamic -lNX_Xext -lNX_X11 $(EXTRA_LOAD_FLAGS)
#endif /* NXAgentServer */
-#if defined(XnonServer) && XnonServer
-XCOMM
-XCOMM non server, just compile sources for build test
-XCOMM
-MFBSUBDIR = mfb
-CFB8SUBDIR = cfb
-CFB16SUBDIR = cfb16
-CFB32SUBDIR = cfb32
-#if HasParallelMake
-MakeMutex($(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DEPDIRS))
-#endif
-Xnon: $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DEPDIRS)
-#endif /* XnonServer */
-
-
-#if defined(XVirtualFramebufferServer) && XVirtualFramebufferServer
-XCOMM
-XCOMM server with Virtual (malloced) framebuffer
-XCOMM
-MFBSUBDIR = mfb
-FBSUBDIR = fb
-#if defined(Win32Architecture)
-XVFBDDXDIR = hw
-#else
-XVFBDDXDIR = hw/vfb
-#endif
-XVFBDIRS = $(STDDIRS) $(MFBDIR) $(FBDIR) $(XVFBDDXDIR) $(DEPDIRS)
-#ifndef Win32Architecture
-#if BuildDPMS
-XVFBDPMSSTUBOBJS = $(XVFBDDXDIR)/dpmsstubs.o
-#endif
-XVFBOBJS = $(XVFBDDXDIR)/stubs.o $(XVFBDDXDIR)/miinitext.o $(XVFBDPMSSTUBOBJS)
-#else
-XVFBOBJS = dix/main.o hw/vfb/stubs.o hw/vfb/miinitext.o
-#endif
-XVFB = $(XVFBDDXDIR)/LibraryTargetName(vfb)
-XVFBLIBS = PreFbLibs $(XVFB) $(FB) PostFbLibs $(MI)
-XVFBSYSLIBS = $(FONTLIBS) $(SYSLIBS)
-#if HasParallelMake
-MakeMutex($(XVFBDIRS) $(XVFBOBJS) $(XVFB) $(XVFBLIBS) $(XVFBSYSLIBS))
-#endif
-#if ForceServerRemake
-$(XVFBOBJS) $(XVFB) $(XVFBLIBS) $(XVFBSYSLIBS):: $(XVFBDIRS)
- @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi
-#endif
-ServerTarget(Xvfb,$(XVFBDIRS),$(XVFBOBJS) $(XVFBDEFFILE), \
- $(LIBCWRAPPER) $(XVFBLIBS) $(LOADABLEEXTS),$(XVFBSYSLIBS))
-#endif /* XVirtualFramebufferServer */
-
-#if defined(XdmxServer) && XdmxServer
-XCOMM
-XCOMM distribued multihead Server
-XCOMM
-#ifndef Win32Architecture
-XDMXDDXDIR = hw/dmx
-#else
-XDMXDDXDIR = hw
-#endif
-FBDIR = fb
-FBSUBDIR = fb
-MIDAMAGEDIR = miext/damage
-SHADOWDIR = miext/shadow
-XDMXDIRS = $(STDDIRS) $(XDMXDDXDIR) $(SHADOWDIR) $(DEPDIRS) $(FBDIR) $(MIDAMAGEDIR)
-#if BuildGlxExt
-#if BuildXinerama
-GLXPROXY_EXTRAOBJS = hw/dmx/panoramiX.o
-#endif
-GLXPROXYLIB = hw/dmx/glxProxy/LibraryTargetName(glxProxy)
-#endif
-#if !defined(LynxOSArchitecture) && \
- !defined(Win32Architecture) && \
- !defined(QNX4Architecture)
-XDMXOBJS = hw/dmx/miinitext.o $(GLXPROXY_EXTRAOBJS)
-#else
-XDMXOBJS = hw/dmx/miinitext.o $(GLXPROXY_EXTRAOBJS) dix/main.o
-#endif
-XDMX = hw/dmx/LibraryTargetName(dmx) \
- hw/dmx/input/LibraryTargetName(dmxinput) \
- hw/dmx/config/LibraryTargetName(dmxconfig) \
- $(GLXPROXYLIB)
-XDMXLIBS = PreFbLibs $(XDMX) MiExtLibs FbPostFbLibs $(XDMX)
-#if BuildRender
-XDMXRENDERLIB = $(XRENDERLIB)
-#endif
-XDMXSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XILIB) $(XLIB) $(SYSLIBS) $(XMULIB) $(XDMXRENDERLIB)
-#if HasParallelMake
-MakeMutex($(XDMXDIRS) $(XDMXOBJS) $(XDMXLIBS) $(XDMXSYSLIBS))
-#endif
-#if ForceServerRemake
-$(XDMXOBJS) $(XDMXLIBS) $(XDMXSYSLIBS):: $(XDMXDIRS)
- @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi
-#endif
-ServerTarget(Xdmx,$(XDMXDIRS),$(XDMXOBJS), \
- $(LIBCWRAPPER) $(XDMXLIBS) $(LOADABLEEXTS),$(XDMXSYSLIBS))
-#endif /* XdmxServer */
-
-#if defined(XWinServer) && XWinServer
-XCOMM
-XCOMM X Server for MS Windows
-XCOMM
-FBSUBDIR = fb
-MIDAMAGEDIR = miext/damage
-SHADOWDIR = miext/shadow
-#if BuildXWinLayer
-LAYERDIR = miext/layer
-XWINLAYERLIB = $(LAYER)
-#else
-LAYERDIR =
-XWINLAYERLIB =
-#endif
-#if BuildXWinMultiWindowExtWM
-ROOTLESSDIR = miext/rootless
-ROOTLESSLIB = $(ROOTLESSDIR)/LibraryTargetName(rootless) \
- $(ROOTLESSDIR)/safeAlpha/LibraryTargetName(safeAlpha) \
- $(ROOTLESSDIR)/accel/LibraryTargetName(rlAccel)
-#else
-ROOTLESSDIR =
-ROOTLESSLIB =
-#endif
-XWINDDXDIR = hw/xwin
-#if BuildXWinXF86Config
-XWINPARSERDIR = hw/xfree86/parser
-XWINPARSERLIB = $(XWINPARSERDIR)/LibraryTargetName(xf86config)
-#else
-XWINPARSERDIR =
-XWINPARSERLIB =
-#endif
-#if defined(GlxUseWindows) && GlxUseWindows
-XWINOPENGLLIB = -lopengl32
-#else
-XWINOPENGLLIB =
-#endif
-
-XWINLIB = $(XWINDDXDIR)/LibraryTargetName(XWin)
-XWINDIRS = $(STDDIRS) $(FBDIR) $(SHADOWDIR) $(LAYERDIR) $(XWINDDXDIR) \
- $(DEPDIRS) $(XWINPARSERDIR) $(ROOTLESSDIR) $(MIDAMAGEDIR)
-XWINOBJS = $(XWINDDXDIR)/stubs.o $(XWINDDXDIR)/XWin.res
-XWINLIBS = PreFbLibs $(XWINLIB) FbPostFbLibs $(XWINLIB) $(XWINLAYERLIB) \
- $(SHADOW) $(XWINPARSERLIB) $(ROOTLESSLIB) $(OS)
-#if BuildXWinMultiWindow || BuildXWinClipboard
-XWINX11 = $(XONLYLIB)
-# if defined(Win32Architecture)
-PTHREADLIB = -lpthreadGC2
-# endif
-#endif
-#if defined(Win32Architecture)
-# if defined(GlxUseWindows) && GlxUseWindows
-XWINGL32 = -lopengl32
-# endif
-XWINW32 = -lgdi32 -lwsock32 $(XWINGL32) $(PTHREADLIB)
-#else
-XWINW32 = -lgdi32
-#endif
-XWINSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XWINX11) $(SYSLIBS) $(XWINW32)
-
-EXTRA_LDOPTIONS = -e _mainCRTStartup
-
-#if HasParallelMake
-MakeMutex($(XWINDIRS) $(XWINOBJS) $(XWINLIB) $(XWINLIBS) $(XWINSYSLIBS))
-#endif
-
-#if ForceServerRemake
-$(XWINOBJS) $(XWINLIB) $(XWINLIBS) $(XWINSYSLIBS):: $(XWINDIRS)
- @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi
-#endif
-
-#ifdef mingwArchitecture
-XWINSERVERNAME=Xming
-XWINGLSERVERNAME=XmingGL
-#else
-XWINSERVERNAME=XWin
-XWINGLSERVERNAME=XWin_GL
-#endif
-ServerTarget($(XWINSERVERNAME),$(XWINDIRS),$(XWINOBJS), \
- $(LIBCWRAPPER) $(XWINLIBS) $(LOADABLEEXTS),$(XWINSYSLIBS))
-#if defined(cygwinArchitecture) && defined(GlxUseWindows) && GlxUseWindows
-ServerTarget($(XWINGLSERVERNAME),$(XWINDIRS),$(XWINOBJS), \
- $(LIBCWRAPPER) $(XWINLIBS) $(LOADABLEEXTS),$(XWINSYSLIBS) \
- $(XWINOPENGLLIB))
-#endif
-
-#ifndef ServerToInstall
-# define ServerToInstall $(XWINSERVERNAME)
-#endif
-
-#endif /* XWinServer */
-
-
#if defined(NXWinServer) && NXWinServer
XCOMM
XCOMM X Server for MS Windows
@@ -1423,127 +954,12 @@ ServerTarget(NXWin,$(NXWINDIRS),$(NXWINOBJS), \
#endif /* NXWinServer */
#endif
-#ifdef DarwinArchitecture
-/*
- * To allow building even when building the client-side libraries is turned
- * off, libraries in ProjectRoot are listed as dependencies for some targets.
- * This causes problems unless we tell make where to find these dependencies.
- */
-VPATH = $(BUILDLIBDIR):$(USRLIBDIR)
-#endif
-
-#if defined(XDarwinServer) && XDarwinServer
-XCOMM
-XCOMM X Darwin server for Mac OS X / Darwin
-XCOMM
-FBSUBDIR = fb
-MIDAMAGEDIR = miext/damage
-SHADOWDIR = miext/shadow
-ROOTLESSDIR = miext/rootless
-DARWINDDXDIR = hw/darwin
-DARWINDIRS = $(STDDIRS) $(FBDIR) $(SHADOWDIR) $(DARWINDDXDIR) $(DEPDIRS)
-DARWINOBJS = $(DARWINDDXDIR)/miinitext.o
-DARWINLIBS = PreFbLibs $(DARWINDDXDIR)/LibraryTargetName(darwin)
-DARWINEXTLIBS = MiExtLibs FbPostFbLibs $(DARWINDDXDIR)/LibraryTargetName(darwin)
-DARWINSYSLIBS = $(FONTLIBS) $(SYSLIBS) -framework IOKit
-IOKITLIB = $(DARWINDDXDIR)/iokit/LibraryTargetName(iokit)
-
-/*
- * IOKit X server
- */
-SetUIDServerTarget(XDarwin,$(DARWINDIRS),$(DARWINOBJS), \
- $(DARWINLIBS) $(IOKITLIB) $(DARWINEXTLIBS),$(DARWINSYSLIBS))
-
-#if DarwinQuartzSupport
-
-QUARTZDIR = $(DARWINDDXDIR)/quartz
-QUARTZLIB = $(QUARTZDIR)/LibraryTargetName(XQuartz)
-QUARTZSYSLIBS = -framework ApplicationServices -framework Cocoa \
- -framework CoreAudio -framework Carbon -ObjC
-ROOTLESSLIB = $(ROOTLESSDIR)/LibraryTargetName(rootless) \
- $(ROOTLESSDIR)/safeAlpha/LibraryTargetName(safeAlpha) \
- $(ROOTLESSDIR)/accel/LibraryTargetName(rlAccel)
-XPLUGINLIB = XpluginLibrary
-
-#if NothingOutsideProjectRoot
-XDARWINAPPDIR = $(BINDIR)/XDarwin.app/Contents
-#else
-XDARWINAPPDIR = /Applications/XDarwin.app/Contents
-#endif
-
-/*
- * Quartz X server (installed in its application bundle)
- */
-SetUIDServerTarget(XDarwinApp,$(DARWINDIRS),$(DARWINOBJS), \
- $(DARWINLIBS) $(QUARTZLIB) $(DARWINEXTLIBS), \
- $(DARWINSYSLIBS) $(QUARTZSYSLIBS) -u _miDCInitialize)
-
-install::
- $(MKDIRHIER) $(DESTDIR)$(XDARWINAPPDIR)/MacOS
- $(MV) $(DESTDIR)$(BINDIR)/XDarwinApp \
- $(DESTDIR)$(XDARWINAPPDIR)/MacOS/XDarwin
- -(cd $(DESTDIR)$(BINDIR); $(RM) XDarwinQuartz; \
- $(LN) $(XDARWINAPPDIR)/MacOS/XDarwin XDarwinQuartz)
-
-/*
- * Display mode bundles for Quartz
- * (installed in their own bundles inside XDarwin's)
- */
-#if HasXplugin
-XPRDIRS = $(QUARTZDIR)/xpr $(ROOTLESSDIR) $(ROOTLESSDIR)/safeAlpha
-XPRLIBS = $(QUARTZDIR)/xpr/LibraryTargetName(xpr) $(ROOTLESSLIB)
-
-BundleProgramTarget(xpr,XDarwinApp,$(XPRDIRS),$(QUARTZDIR)/xpr/xprScreen.o, \
- $(XPRLIBS),-framework ApplicationServices \
- $(XPLUGINLIB),$(XDARWINAPPDIR)/Resources)
-#endif
-
-CRDIRS = $(QUARTZDIR)/cr $(ROOTLESSDIR) $(ROOTLESSDIR)/safeAlpha
-CRLIBS = $(QUARTZDIR)/cr/LibraryTargetName(cr) $(ROOTLESSLIB)
-
-BundleProgramTarget(cr,XDarwinApp,$(CRDIRS),$(QUARTZDIR)/cr/crScreen.o, \
- $(CRLIBS),-framework ApplicationServices -framework Cocoa \
- -framework Carbon -ObjC,$(XDARWINAPPDIR)/Resources)
-
-FSDIRS = $(QUARTZDIR)/fullscreen $(SHADOWDIR)
-FSLIBS = $(QUARTZDIR)/fullscreen/LibraryTargetName(fullscreen) $(SHADOW)
-
-BundleProgramTarget(fullscreen,XDarwinApp,$(FSDIRS), \
- $(QUARTZDIR)/fullscreen/fullscreen.o,$(FSLIBS), \
- -framework ApplicationServices,$(XDARWINAPPDIR)/Resources)
-
-/*
- * GLX bundles for Quartz
- * (installed in their own bundles inside XDarwin's)
- */
-BundleProgramTarget(glxAGL,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a \
- GL/apple/libAGLcore.a, \
- -framework AGL -framework OpenGL,$(XDARWINAPPDIR)/Resources)
-
-#if BuildAppleDRI
-BundleProgramTarget(glxCGL,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a \
- GL/apple/libCGLcore.a, \
- -framework OpenGL $(XPLUGINLIB),$(XDARWINAPPDIR)/Resources)
-#endif
-
-BundleProgramTarget(glxMesa,XDarwinApp,GL,GL/glx/glxext.o,GL/glx/libglx.a \
- GL/mesa/GLcore/libGLcore.a,NullParameter,$(XDARWINAPPDIR)/Resources)
-
-#else /* !DarwinQuartzSupport */
-
-#define ServerToInstall XDarwin
-
-#endif /* DarwinQuartzSupport */
-
-#endif /* XDarwinServer */
-
-
CFBSUBDIRS = $(CFB8SUBDIR) $(CFB16SUBDIR) $(CFB24SUBDIR) $(CFB32SUBDIR)
MIEXTDIRS = $(SHADOWDIR) $(LAYERDIR) $(ROOTLESSDIR) $(MIDAMAGEDIR)
IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR)
DDXDIRS = $(DECWSDDXDIR) $(SUNDDXDIR) $(LYNXDDXDIR) \
- $(HPDDXDIR) $(XFREE86DDXDIR) $(XWINDDXDIR) $(DARWINDDXDIR) \
- $(XVFBDDXDIR) $(XNESTDDXDIR) $(XDMXDDXDIR) $(NXAGENTDDXDIR) $(NXWINDDXDIR)
+ $(HPDDXDIR) $(XFREE86DDXDIR) \
+ $(NXAGENTDDXDIR) $(NXWINDDXDIR)
SUBDIRS = $(STDDIRS) $(MFBSUBDIR) $(CFBSUBDIRS) \
$(IPLANDIRS) $(ILBMDIR) $(AFBSUBDIR) \
$(DDXDIRS) $(FBSUBDIR) $(KDRIVEDIRS) $(MIEXTDIRS)
diff --git a/nx-X11/programs/Xserver/Xext/Imakefile b/nx-X11/programs/Xserver/Xext/Imakefile
index b75f8913b..6c2c060f8 100644
--- a/nx-X11/programs/Xserver/Xext/Imakefile
+++ b/nx-X11/programs/Xserver/Xext/Imakefile
@@ -113,11 +113,6 @@ XF86BIGFOBJS = xf86bigfont.o
PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o
PNRXINCLUDES = -I$(FONTINCSRC) -I../mi -I../render
#endif
-#if XdmxServer
- DMXSRCS = dmx.c
- DMXOBJS = dmx.o
- DMXINCLUDES = -I../hw/dmx
-#endif
#if BuildDPMS
DPMSSRCS = dpms.c
DPMSOBJS = dpms.o
@@ -136,16 +131,11 @@ XF86BIGFOBJS = xf86bigfont.o
XEVIEOBJS = xevie.o
#endif
-#if BuildXprint
- XPRINTSRCS = xprint.c
- XPRINTOBJS = xprint.o
-#endif
-
SRCS = shape.c $(SHMSRCS) $(MULTIBUFSRC) \
mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
$(XF86MISCSRCS) $(XF86BIGFSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \
- $(APPGROUPSRCS) $(XPRINTSRCS) $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \
+ $(APPGROUPSRCS) $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \
$(XEVIESRCS) \
$(EVISRCS) $(XVSRCS) $(FONTCACHESRCS) $(XRESSRCS) $(DMXSRCS)
@@ -153,11 +143,11 @@ XF86BIGFOBJS = xf86bigfont.o
mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \
$(XF86MISCOBJS) $(XF86BIGFOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \
- $(APPGROUPOBJS) $(XPRINTOBJS) $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \
+ $(APPGROUPOBJS) $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \
$(XEVIEOBJS) \
$(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) $(XRESOBJS) $(DMXOBJS)
- SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) $(XPRINTOBJS) \
+ SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) \
shape.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \
$(XEVIEOBJS) \
$(XF86BIGFOBJS)
diff --git a/nx-X11/programs/Xserver/Xext/dmx.c b/nx-X11/programs/Xserver/Xext/dmx.c
deleted file mode 100644
index 75623e696..000000000
--- a/nx-X11/programs/Xserver/Xext/dmx.c
+++ /dev/null
@@ -1,1133 +0,0 @@
-/* $XFree86$ */
-/*
- * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * This file implements the server-side part of the DMX protocol. A
- * vector of fucntions is provided at extension initialization time, so
- * most all of the useful functions in this file are declared static and
- * do not appear in the doxygen documentation.
- *
- * Much of the low-level work is done by functions in #dmxextension.c
- *
- * Please see the Client-to-Server DMX Extension to the X Protocol
- * document for details about the protocol. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#define EXTENSION_PROC_ARGS void *
-#include "extnsionst.h"
-#include "opaque.h"
-
-#include "dmxextension.h"
-#include <X11/extensions/dmxproto.h>
-
-#define _DMX_SERVER_
-#include <X11/extensions/dmxext.h>
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
-extern unsigned long XRT_WINDOW;
-extern int PanoramiXNumScreens;
-#endif
-
-extern void DMXExtensionInit(void);
-
-static unsigned char DMXCode;
-
-static DISPATCH_PROC(ProcDMXDispatch);
-static DISPATCH_PROC(ProcDMXQueryVersion);
-static DISPATCH_PROC(ProcDMXSync);
-static DISPATCH_PROC(ProcDMXForceWindowCreation);
-static DISPATCH_PROC(ProcDMXGetScreenCount);
-static DISPATCH_PROC(ProcDMXGetScreenAttributes);
-static DISPATCH_PROC(ProcDMXChangeScreensAttributes);
-static DISPATCH_PROC(ProcDMXAddScreen);
-static DISPATCH_PROC(ProcDMXRemoveScreen);
-static DISPATCH_PROC(ProcDMXGetWindowAttributes);
-static DISPATCH_PROC(ProcDMXGetDesktopAttributes);
-static DISPATCH_PROC(ProcDMXChangeDesktopAttributes);
-static DISPATCH_PROC(ProcDMXGetInputCount);
-static DISPATCH_PROC(ProcDMXGetInputAttributes);
-static DISPATCH_PROC(ProcDMXAddInput);
-static DISPATCH_PROC(ProcDMXRemoveInput);
-
-static DISPATCH_PROC(SProcDMXDispatch);
-static DISPATCH_PROC(SProcDMXQueryVersion);
-static DISPATCH_PROC(SProcDMXSync);
-static DISPATCH_PROC(SProcDMXForceWindowCreation);
-static DISPATCH_PROC(SProcDMXGetScreenCount);
-static DISPATCH_PROC(SProcDMXGetScreenAttributes);
-static DISPATCH_PROC(SProcDMXChangeScreensAttributes);
-static DISPATCH_PROC(SProcDMXAddScreen);
-static DISPATCH_PROC(SProcDMXRemoveScreen);
-static DISPATCH_PROC(SProcDMXGetWindowAttributes);
-static DISPATCH_PROC(SProcDMXGetDesktopAttributes);
-static DISPATCH_PROC(SProcDMXChangeDesktopAttributes);
-static DISPATCH_PROC(SProcDMXGetInputCount);
-static DISPATCH_PROC(SProcDMXGetInputAttributes);
-static DISPATCH_PROC(SProcDMXAddInput);
-static DISPATCH_PROC(SProcDMXRemoveInput);
-
-static int _DMXXineramaActive(void)
-{
-#ifdef PANORAMIX
- return !noPanoramiXExtension;
-#endif
- return 0;
-}
-
-static void DMXResetProc(ExtensionEntry *extEntry)
-{
-}
-
-/** Initialize the extension. */
-void DMXExtensionInit(void)
-{
- ExtensionEntry *extEntry;
-
- if ((extEntry = AddExtension(DMX_EXTENSION_NAME, 0, 0,
- ProcDMXDispatch, SProcDMXDispatch,
- DMXResetProc, StandardMinorOpcode)))
- DMXCode = extEntry->base;
-}
-
-static void dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr,
- CARD32 value)
-{
- switch (1 << bit) {
- case DMXScreenWindowWidth: attr->screenWindowWidth = value; break;
- case DMXScreenWindowHeight: attr->screenWindowHeight = value; break;
- case DMXScreenWindowXoffset: attr->screenWindowXoffset = value; break;
- case DMXScreenWindowYoffset: attr->screenWindowYoffset = value; break;
- case DMXRootWindowWidth: attr->rootWindowWidth = value; break;
- case DMXRootWindowHeight: attr->rootWindowHeight = value; break;
- case DMXRootWindowXoffset: attr->rootWindowXoffset = value; break;
- case DMXRootWindowYoffset: attr->rootWindowYoffset = value; break;
- case DMXRootWindowXorigin: attr->rootWindowXorigin = value; break;
- case DMXRootWindowYorigin: attr->rootWindowYorigin = value; break;
- }
-}
-
-static int dmxFetchScreenAttributes(unsigned int mask,
- DMXScreenAttributesPtr attr,
- CARD32 *value_list)
-{
- int i;
- CARD32 *value = value_list;
- int count = 0;
-
- for (i = 0; i < 32; i++) {
- if (mask & (1 << i)) {
- dmxSetScreenAttribute(i, attr, *value);
- ++value;
- ++count;
- }
- }
- return count;
-}
-
-static void dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr,
- CARD32 value)
-{
- switch (1 << bit) {
- case DMXDesktopWidth: attr->width = value; break;
- case DMXDesktopHeight: attr->height = value; break;
- case DMXDesktopShiftX: attr->shiftX = value; break;
- case DMXDesktopShiftY: attr->shiftY = value; break;
- }
-}
-
-static int dmxFetchDesktopAttributes(unsigned int mask,
- DMXDesktopAttributesPtr attr,
- CARD32 *value_list)
-{
- int i;
- CARD32 *value = value_list;
- int count = 0;
-
- for (i = 0; i < 32; i++) {
- if (mask & (1 << i)) {
- dmxSetDesktopAttribute(i, attr, *value);
- ++value;
- ++count;
- }
- }
- return count;
-}
-
-static void dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr,
- CARD32 value)
-{
- switch (1 << bit) {
- case DMXInputType: attr->inputType = value; break;
- case DMXInputPhysicalScreen: attr->physicalScreen = value; break;
- case DMXInputSendsCore: attr->sendsCore = !!value; break;
- }
-}
-
-static int dmxFetchInputAttributes(unsigned int mask,
- DMXInputAttributesPtr attr,
- CARD32 *value_list)
-{
- int i;
- CARD32 *value = value_list;
- int count = 0;
-
- for (i = 0; i < 32; i++) {
- if (mask & (1 << i)) {
- dmxSetInputAttribute(i, attr, *value);
- ++value;
- ++count;
- }
- }
- return count;
-}
-
-static int ProcDMXQueryVersion(ClientPtr client)
-{
- xDMXQueryVersionReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = DMX_EXTENSION_MAJOR;
- rep.minorVersion = DMX_EXTENSION_MINOR;
- rep.patchVersion = DMX_EXTENSION_PATCH;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.majorVersion, n);
- swapl(&rep.minorVersion, n);
- swapl(&rep.patchVersion, n);
- }
- WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXSync(ClientPtr client)
-{
- xDMXSyncReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXSyncReq);
-
- dmxFlushPendingSyncs();
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = 0;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client, sizeof(xDMXSyncReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXForceWindowCreation(ClientPtr client)
-{
- xDMXForceWindowCreationReply rep;
- REQUEST(xDMXForceWindowCreationReq);
- WindowPtr pWin;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- PanoramiXRes *win;
- int i;
-
- if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW,
- SecurityReadAccess)))
- return -1; /* BadWindow */
-
- FOR_NSCREENS(i) {
- if (!(pWin = SecurityLookupWindow(win->info[i].id, client,
- SecurityReadAccess)))
- return -1; /* BadWindow */
-
- dmxForceWindowCreation(pWin);
- }
- goto doreply;
- }
-#endif
-
- if (!(pWin = SecurityLookupWindow(stuff->window, client,
- SecurityReadAccess)))
- return -1; /* BadWindow */
-
- dmxForceWindowCreation(pWin);
- doreply:
- dmxFlushPendingSyncs();
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = 0;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *)&rep);
- return Success;
-}
-
-static int ProcDMXGetScreenCount(ClientPtr client)
-{
- xDMXGetScreenCountReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.screenCount = dmxGetNumScreens();
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.screenCount, n);
- }
- WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXGetScreenAttributes(ClientPtr client)
-{
- REQUEST(xDMXGetScreenAttributesReq);
- xDMXGetScreenAttributesReply rep;
- int n;
- int length;
- int paddedLength;
- DMXScreenAttributesRec attr;
-
- REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
-
- if (stuff->physicalScreen < 0
- || stuff->physicalScreen >= dmxGetNumScreens()) return BadValue;
-
- if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr))
- return BadValue;
-
- rep.logicalScreen = attr.logicalScreen;
- rep.screenWindowWidth = attr.screenWindowWidth;
- rep.screenWindowHeight = attr.screenWindowHeight;
- rep.screenWindowXoffset = attr.screenWindowXoffset;
- rep.screenWindowYoffset = attr.screenWindowYoffset;
- rep.rootWindowWidth = attr.rootWindowWidth;
- rep.rootWindowHeight = attr.rootWindowHeight;
- rep.rootWindowXoffset = attr.rootWindowXoffset;
- rep.rootWindowYoffset = attr.rootWindowYoffset;
- rep.rootWindowXorigin = attr.rootWindowXorigin;
- rep.rootWindowYorigin = attr.rootWindowYorigin;
-
- length = attr.displayName ? strlen(attr.displayName) : 0;
- paddedLength = (length + 3) & ~3;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = paddedLength >> 2;
- rep.displayNameLength = length;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.displayNameLength, n);
- swapl(&rep.logicalScreen, n);
- swaps(&rep.screenWindowWidth, n);
- swaps(&rep.screenWindowHeight, n);
- swaps(&rep.screenWindowXoffset, n);
- swaps(&rep.screenWindowYoffset, n);
- swaps(&rep.rootWindowWidth, n);
- swaps(&rep.rootWindowHeight, n);
- swaps(&rep.rootWindowXoffset, n);
- swaps(&rep.rootWindowYoffset, n);
- swaps(&rep.rootWindowXorigin, n);
- swaps(&rep.rootWindowYorigin, n);
- }
- WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *)&rep);
- if (length) WriteToClient(client, length, (char *)attr.displayName);
- return client->noClientException;
-}
-
-static int ProcDMXChangeScreensAttributes(ClientPtr client)
-{
- REQUEST(xDMXChangeScreensAttributesReq);
- xDMXChangeScreensAttributesReply rep;
- int n;
- int status = DMX_BAD_XINERAMA;
- unsigned int mask = 0;
- unsigned int i;
- CARD32 *screen_list;
- CARD32 *mask_list;
- CARD32 *value_list;
- DMXScreenAttributesPtr attribs;
- int errorScreen = 0;
- unsigned int len;
- int ones = 0;
-
-
- REQUEST_AT_LEAST_SIZE(xDMXChangeScreensAttributesReq);
- len = client->req_len - (sizeof(xDMXChangeScreensAttributesReq) >> 2);
- if (len < stuff->screenCount + stuff->maskCount)
- return BadLength;
-
- screen_list = (CARD32 *)(stuff + 1);
- mask_list = &screen_list[stuff->screenCount];
- value_list = &mask_list[stuff->maskCount];
-
- for (i = 0; i < stuff->maskCount; i++) ones += Ones(mask_list[i]);
- if (len != stuff->screenCount + stuff->maskCount + ones)
- return BadLength;
-
- if (!_DMXXineramaActive()) goto noxinerama;
-
- if (!(attribs = ALLOCATE_LOCAL(stuff->screenCount * sizeof(*attribs))))
- return BadAlloc;
-
- for (i = 0; i < stuff->screenCount; i++) {
- int count;
-
- if (i < stuff->maskCount) mask = mask_list[i];
- dmxGetScreenAttributes(screen_list[i], &attribs[i]);
- count = dmxFetchScreenAttributes(mask, &attribs[i], value_list);
- value_list += count;
- }
-
-#if PANORAMIX
- status = dmxConfigureScreenWindows(stuff->screenCount,
- screen_list,
- attribs,
- &errorScreen);
-#endif
-
- DEALLOCATE_LOCAL(attribs);
-
- if (status == BadValue) return status;
-
- noxinerama:
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.errorScreen = errorScreen;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- swapl(&rep.errorScreen, n);
- }
- WriteToClient(client,
- sizeof(xDMXChangeScreensAttributesReply),
- (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXAddScreen(ClientPtr client)
-{
- REQUEST(xDMXAddScreenReq);
- xDMXAddScreenReply rep;
- int n;
- int status = 0;
- CARD32 *value_list;
- DMXScreenAttributesRec attr;
- int count;
- char *name;
- int len;
- int paddedLength;
-
- REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
- paddedLength = (stuff->displayNameLength + 3) & ~3;
- len = client->req_len - (sizeof(xDMXAddScreenReq) >> 2);
- if (len != Ones(stuff->valueMask) + paddedLength/4)
- return BadLength;
-
- memset(&attr, 0, sizeof(attr));
- dmxGetScreenAttributes(stuff->physicalScreen, &attr);
- value_list = (CARD32 *)(stuff + 1);
- count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
-
- if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4)))
- return BadAlloc;
- memcpy(name, &value_list[count], stuff->displayNameLength);
- name[stuff->displayNameLength] = '\0';
- attr.displayName = name;
-
- status = dmxAttachScreen(stuff->physicalScreen, &attr);
-
- DEALLOCATE_LOCAL(name);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.physicalScreen = stuff->physicalScreen;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- swapl(&rep.physicalScreen, n);
- }
- WriteToClient(client,
- sizeof(xDMXAddScreenReply),
- (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXRemoveScreen(ClientPtr client)
-{
- REQUEST(xDMXRemoveScreenReq);
- xDMXRemoveScreenReply rep;
- int n;
- int status = 0;
-
- REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
-
- status = dmxDetachScreen(stuff->physicalScreen);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client,
- sizeof(xDMXRemoveScreenReply),
- (char *)&rep);
- return client->noClientException;
-}
-
-
-#ifdef PANORAMIX
-static int dmxPopulatePanoramiX(ClientPtr client, Window window,
- CARD32 *screens, CARD32 *windows,
- xRectangle *pos, xRectangle *vis)
-{
- WindowPtr pWin;
- PanoramiXRes *win;
- int i;
- int count = 0;
- DMXWindowAttributesRec attr;
-
- if (!(win = SecurityLookupIDByType(client, window, XRT_WINDOW,
- SecurityReadAccess)))
- return -1; /* BadWindow */
-
- FOR_NSCREENS(i) {
- if (!(pWin = SecurityLookupWindow(win->info[i].id, client,
- SecurityReadAccess)))
- return -1; /* BadWindow */
- if (dmxGetWindowAttributes(pWin, &attr)) {
- screens[count] = attr.screen;
- windows[count] = attr.window;
- pos[count] = attr.pos;
- vis[count] = attr.vis;
- ++count; /* Only count existing windows */
- }
- }
- return count;
-}
-#endif
-
-static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
- CARD32 *windows, xRectangle *pos, xRectangle *vis)
-{
- WindowPtr pWin;
- DMXWindowAttributesRec attr;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- return dmxPopulatePanoramiX(client, window, screens, windows,
- pos, vis);
-#endif
-
- if (!(pWin = SecurityLookupWindow(window, client, SecurityReadAccess)))
- return -1; /* BadWindow */
-
- dmxGetWindowAttributes(pWin, &attr);
- *screens = attr.screen;
- *windows = attr.window;
- *pos = attr.pos;
- *vis = attr.vis;
- return 1;
-}
-
-static int dmxMaxNumScreens(void)
-{
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) return PanoramiXNumScreens;
-#endif
- return 1;
-}
-
-static int ProcDMXGetWindowAttributes(ClientPtr client)
-{
- REQUEST(xDMXGetWindowAttributesReq);
- xDMXGetWindowAttributesReply rep;
- int i, n;
- CARD32 *screens;
- CARD32 *windows;
- xRectangle *pos, *vis;
- int count = dmxMaxNumScreens();
-
- REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
-
- if (!(screens = ALLOCATE_LOCAL(count * sizeof(*screens))))
- return BadAlloc;
- if (!(windows = ALLOCATE_LOCAL(count * sizeof(*windows)))) {
- DEALLOCATE_LOCAL(screens);
- return BadAlloc;
- }
- if (!(pos = ALLOCATE_LOCAL(count * sizeof(*pos)))) {
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
- return BadAlloc;
- }
- if (!(vis = ALLOCATE_LOCAL(count * sizeof(*vis)))) {
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
- return BadAlloc;
- }
-
- if ((count = dmxPopulate(client, stuff->window, screens, windows,
- pos, vis)) < 0) {
- DEALLOCATE_LOCAL(vis);
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
- return BadWindow;
- }
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = count * 6;
- rep.screenCount = count;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.screenCount, n);
- for (i = 0; i < count; i++) {
- swapl(&screens[i], n);
- swapl(&windows[i], n);
-
- swaps(&pos[i].x, n);
- swaps(&pos[i].y, n);
- swaps(&pos[i].width, n);
- swaps(&pos[i].height, n);
-
- swaps(&vis[i].x, n);
- swaps(&vis[i].y, n);
- swaps(&vis[i].width, n);
- swaps(&vis[i].height, n);
- }
- }
-
- dmxFlushPendingSyncs();
-
- WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *)&rep);
- if (count) {
- WriteToClient(client, count * sizeof(*screens), (char *)screens);
- WriteToClient(client, count * sizeof(*windows), (char *)windows);
- WriteToClient(client, count * sizeof(*pos), (char *)pos);
- WriteToClient(client, count * sizeof(*vis), (char *)vis);
- }
-
- DEALLOCATE_LOCAL(vis);
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
-
- return client->noClientException;
-}
-
-static int ProcDMXGetDesktopAttributes(ClientPtr client)
-{
- xDMXGetDesktopAttributesReply rep;
- int n;
- DMXDesktopAttributesRec attr;
-
- REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
-
- dmxGetDesktopAttributes(&attr);
-
- rep.width = attr.width;
- rep.height = attr.height;
- rep.shiftX = attr.shiftX;
- rep.shiftY = attr.shiftY;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.width, n);
- swapl(&rep.height, n);
- swapl(&rep.shiftX, n);
- swapl(&rep.shiftY, n);
- }
- WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXChangeDesktopAttributes(ClientPtr client)
-{
- REQUEST(xDMXChangeDesktopAttributesReq);
- xDMXChangeDesktopAttributesReply rep;
- int n;
- int status = DMX_BAD_XINERAMA;
- CARD32 *value_list;
- DMXDesktopAttributesRec attr;
- int len;
-
- REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
- len = client->req_len - (sizeof(xDMXChangeDesktopAttributesReq) >> 2);
- if (len != Ones(stuff->valueMask))
- return BadLength;
-
- if (!_DMXXineramaActive()) goto noxinerama;
-
- value_list = (CARD32 *)(stuff + 1);
-
- dmxGetDesktopAttributes(&attr);
- dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list);
-
-#if PANORAMIX
- status = dmxConfigureDesktop(&attr);
-#endif
- if (status == BadValue) return status;
-
- noxinerama:
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client,
- sizeof(xDMXChangeDesktopAttributesReply),
- (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXGetInputCount(ClientPtr client)
-{
- xDMXGetInputCountReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.inputCount = dmxGetInputCount();
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.inputCount, n);
- }
- WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXGetInputAttributes(ClientPtr client)
-{
- REQUEST(xDMXGetInputAttributesReq);
- xDMXGetInputAttributesReply rep;
- int n;
- int length;
- int paddedLength;
- DMXInputAttributesRec attr;
-
- REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
-
- if (dmxGetInputAttributes(stuff->deviceId, &attr)) return BadValue;
- rep.inputType = attr.inputType;
- rep.physicalScreen = attr.physicalScreen;
- rep.physicalId = attr.physicalId;
- rep.isCore = attr.isCore;
- rep.sendsCore = attr.sendsCore;
- rep.detached = attr.detached;
-
- length = attr.name ? strlen(attr.name) : 0;
- paddedLength = (length + 3) & ~3;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = paddedLength >> 2;
- rep.nameLength = length;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.inputType, n);
- swapl(&rep.physicalScreen, n);
- swapl(&rep.physicalId, n);
- swapl(&rep.nameLength, n);
- }
- WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *)&rep);
- if (length) WriteToClient(client, length, (char *)attr.name);
- return client->noClientException;
-}
-
-static int ProcDMXAddInput(ClientPtr client)
-{
- REQUEST(xDMXAddInputReq);
- xDMXAddInputReply rep;
- int n;
- int status = 0;
- CARD32 *value_list;
- DMXInputAttributesRec attr;
- int count;
- char *name;
- int len;
- int paddedLength;
- int id = -1;
-
- REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
- paddedLength = (stuff->displayNameLength + 3) & ~3;
- len = client->req_len - (sizeof(xDMXAddInputReq) >> 2);
- if (len != Ones(stuff->valueMask) + paddedLength/4)
- return BadLength;
-
- memset(&attr, 0, sizeof(attr));
- value_list = (CARD32 *)(stuff + 1);
- count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
-
- if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4)))
- return BadAlloc;
- memcpy(name, &value_list[count], stuff->displayNameLength);
- name[stuff->displayNameLength] = '\0';
- attr.name = name;
-
- status = dmxAddInput(&attr, &id);
-
- DEALLOCATE_LOCAL(name);
-
- if (status) return status;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.physicalId = id;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- swapl(&rep.physicalId, n);
- }
- WriteToClient(client, sizeof(xDMXAddInputReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXRemoveInput(ClientPtr client)
-{
- REQUEST(xDMXRemoveInputReq);
- xDMXRemoveInputReply rep;
- int n;
- int status = 0;
-
- REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
-
- status = dmxRemoveInput(stuff->physicalId);
-
- if (status) return status;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.status, n);
- }
- WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *)&rep);
- return client->noClientException;
-}
-
-static int ProcDMXDispatch(ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data) {
- case X_DMXQueryVersion: return ProcDMXQueryVersion(client);
- case X_DMXSync: return ProcDMXSync(client);
- case X_DMXForceWindowCreation: return ProcDMXForceWindowCreation(client);
- case X_DMXGetScreenCount: return ProcDMXGetScreenCount(client);
- case X_DMXGetScreenAttributes: return ProcDMXGetScreenAttributes(client);
- case X_DMXChangeScreensAttributes:
- return ProcDMXChangeScreensAttributes(client);
- case X_DMXAddScreen: return ProcDMXAddScreen(client);
- case X_DMXRemoveScreen: return ProcDMXRemoveScreen(client);
- case X_DMXGetWindowAttributes: return ProcDMXGetWindowAttributes(client);
- case X_DMXGetDesktopAttributes: return ProcDMXGetDesktopAttributes(client);
- case X_DMXChangeDesktopAttributes:
- return ProcDMXChangeDesktopAttributes(client);
- case X_DMXGetInputCount: return ProcDMXGetInputCount(client);
- case X_DMXGetInputAttributes: return ProcDMXGetInputAttributes(client);
- case X_DMXAddInput: return ProcDMXAddInput(client);
- case X_DMXRemoveInput: return ProcDMXRemoveInput(client);
-
- case X_DMXGetScreenInformationDEPRECATED:
- case X_DMXForceWindowCreationDEPRECATED:
- case X_DMXReconfigureScreenDEPRECATED:
- return BadImplementation;
-
- default: return BadRequest;
- }
-}
-
-static int SProcDMXQueryVersion(ClientPtr client)
-{
- int n;
- REQUEST(xDMXQueryVersionReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
- return ProcDMXQueryVersion(client);
-}
-
-static int SProcDMXSync(ClientPtr client)
-{
- int n;
- REQUEST(xDMXSyncReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXSyncReq);
- return ProcDMXSync(client);
-}
-
-static int SProcDMXForceWindowCreation(ClientPtr client)
-{
- int n;
- REQUEST(xDMXForceWindowCreationReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
- swaps(&stuff->window, n);
- return ProcDMXForceWindowCreation(client);
-}
-
-static int SProcDMXGetScreenCount(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetScreenCountReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
- return ProcDMXGetScreenCount(client);
-}
-
-static int SProcDMXGetScreenAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetScreenAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
- swapl(&stuff->physicalScreen, n);
- return ProcDMXGetScreenAttributes(client);
-}
-
-static int SProcDMXChangeScreensAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXChangeScreensAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xDMXGetScreenAttributesReq);
- swapl(&stuff->screenCount, n);
- swapl(&stuff->maskCount, n);
- SwapRestL(stuff);
- return ProcDMXGetScreenAttributes(client);
-}
-
-static int SProcDMXAddScreen(ClientPtr client)
-{
- int n;
- int paddedLength;
- REQUEST(xDMXAddScreenReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
- swapl(&stuff->displayNameLength, n);
- swapl(&stuff->valueMask, n);
- paddedLength = (stuff->displayNameLength + 3) & ~3;
- SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
- return ProcDMXAddScreen(client);
-}
-
-static int SProcDMXRemoveScreen(ClientPtr client)
-{
- int n;
- REQUEST(xDMXRemoveScreenReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
- swapl(&stuff->physicalScreen, n);
- return ProcDMXRemoveScreen(client);
-}
-
-static int SProcDMXGetWindowAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetWindowAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
- swapl(&stuff->window, n);
- return ProcDMXGetWindowAttributes(client);
-}
-
-static int SProcDMXGetDesktopAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetDesktopAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
- return ProcDMXGetDesktopAttributes(client);
-}
-
-static int SProcDMXChangeDesktopAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXChangeDesktopAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
- swapl(&stuff->valueMask, n);
- SwapRestL(stuff);
- return ProcDMXChangeDesktopAttributes(client);
-}
-
-static int SProcDMXGetInputCount(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetInputCountReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
- return ProcDMXGetInputCount(client);
-}
-
-static int SProcDMXGetInputAttributes(ClientPtr client)
-{
- int n;
- REQUEST(xDMXGetInputAttributesReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
- swapl(&stuff->deviceId, n);
- return ProcDMXGetInputAttributes(client);
-}
-
-static int SProcDMXAddInput(ClientPtr client)
-{
- int n;
- int paddedLength;
- REQUEST(xDMXAddInputReq);
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
- swapl(&stuff->displayNameLength, n);
- swapl(&stuff->valueMask, n);
- paddedLength = (stuff->displayNameLength + 3) & ~3;
- SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
- return ProcDMXAddInput(client);
-}
-
-static int SProcDMXRemoveInput(ClientPtr client)
-{
- int n;
- REQUEST(xDMXRemoveInputReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
- swapl(&stuff->physicalId, n);
- return ProcDMXRemoveInput(client);
-}
-
-static int SProcDMXDispatch (ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data) {
- case X_DMXQueryVersion: return SProcDMXQueryVersion(client);
- case X_DMXSync: return SProcDMXSync(client);
- case X_DMXForceWindowCreation: return SProcDMXForceWindowCreation(client);
- case X_DMXGetScreenCount: return SProcDMXGetScreenCount(client);
- case X_DMXGetScreenAttributes: return SProcDMXGetScreenAttributes(client);
- case X_DMXChangeScreensAttributes:
- return SProcDMXChangeScreensAttributes(client);
- case X_DMXAddScreen: return SProcDMXAddScreen(client);
- case X_DMXRemoveScreen: return SProcDMXRemoveScreen(client);
- case X_DMXGetWindowAttributes: return SProcDMXGetWindowAttributes(client);
- case X_DMXGetDesktopAttributes:
- return SProcDMXGetDesktopAttributes(client);
- case X_DMXChangeDesktopAttributes:
- return SProcDMXChangeDesktopAttributes(client);
- case X_DMXGetInputCount: return SProcDMXGetInputCount(client);
- case X_DMXGetInputAttributes: return SProcDMXGetInputAttributes(client);
- case X_DMXAddInput: return SProcDMXAddInput(client);
- case X_DMXRemoveInput: return SProcDMXRemoveInput(client);
-
- case X_DMXGetScreenInformationDEPRECATED:
- case X_DMXForceWindowCreationDEPRECATED:
- case X_DMXReconfigureScreenDEPRECATED:
- return BadImplementation;
-
- default: return BadRequest;
- }
-}
diff --git a/nx-X11/programs/Xserver/Xext/xprint.c b/nx-X11/programs/Xserver/Xext/xprint.c
deleted file mode 100644
index 60512d372..000000000
--- a/nx-X11/programs/Xserver/Xext/xprint.c
+++ /dev/null
@@ -1,2760 +0,0 @@
-/* $Xorg: xprint.c,v 1.5 2001/03/05 20:42:26 pookie Exp $ */
-/*
-(c) Copyright 1996 Hewlett-Packard Company
-(c) Copyright 1996 International Business Machines Corp.
-(c) Copyright 1996 Sun Microsystems, Inc.
-(c) Copyright 1996 Novell, Inc.
-(c) Copyright 1996 Digital Equipment Corp.
-(c) Copyright 1996 Fujitsu Limited
-(c) Copyright 1996 Hitachi, Ltd.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the names of the copyright holders shall
-not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from said
-copyright holders.
-*/
-/*******************************************************************
-**
-** *********************************************************
-** *
-** * File: xprint.c
-** *
-** * Copyright: Copyright 1993, 1995 Hewlett-Packard Company
-** *
-** * Copyright 1989 by The Massachusetts Institute of Technology
-** *
-** * Permission to use, copy, modify, and distribute this
-** * software and its documentation for any purpose and without
-** * fee is hereby granted, provided that the above copyright
-** * notice appear in all copies and that both that copyright
-** * notice and this permission notice appear in supporting
-** * documentation, and that the name of MIT not be used in
-** * advertising or publicity pertaining to distribution of the
-** * software without specific prior written permission.
-** * M.I.T. makes no representation about the suitability of
-** * this software for any purpose. It is provided "as is"
-** * without any express or implied warranty.
-** *
-** * MIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-** * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-** * NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MIT BE LI-
-** * ABLE 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/Xext/xprint.c,v 1.14tsi Exp $ */
-
-#define _XP_PRINT_SERVER_
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xos.h>
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#undef NEED_EVENTS
-#include "misc.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include <X11/Xatom.h>
-#include <X11/extensions/Print.h>
-#include <X11/extensions/Printstr.h>
-#include "../Xprint/DiPrint.h"
-#include "../Xprint/attributes.h"
-#include "modinit.h"
-
-static void XpResetProc(ExtensionEntry *);
-
-static int ProcXpDispatch(ClientPtr);
-static int ProcXpSwappedDispatch(ClientPtr);
-
-static int ProcXpQueryVersion(ClientPtr);
-static int ProcXpGetPrinterList(ClientPtr);
-static int ProcXpCreateContext(ClientPtr);
-static int ProcXpSetContext(ClientPtr);
-static int ProcXpGetContext(ClientPtr);
-static int ProcXpDestroyContext(ClientPtr);
-static int ProcXpGetContextScreen(ClientPtr);
-static int ProcXpStartJob(ClientPtr);
-static int ProcXpEndJob(ClientPtr);
-static int ProcXpStartDoc(ClientPtr);
-static int ProcXpEndDoc(ClientPtr);
-static int ProcXpStartPage(ClientPtr);
-static int ProcXpEndPage(ClientPtr);
-static int ProcXpSelectInput(ClientPtr);
-static int ProcXpInputSelected(ClientPtr);
-static int ProcXpPutDocumentData(ClientPtr);
-static int ProcXpGetDocumentData(ClientPtr);
-static int ProcXpGetAttributes(ClientPtr);
-static int ProcXpGetOneAttribute(ClientPtr);
-static int ProcXpSetAttributes(ClientPtr);
-static int ProcXpRehashPrinterList(ClientPtr);
-static int ProcXpQueryScreens(ClientPtr);
-static int ProcXpGetPageDimensions(ClientPtr);
-static int ProcXpSetImageResolution(ClientPtr);
-static int ProcXpGetImageResolution(ClientPtr);
-
-static void SwapXpNotifyEvent(xPrintPrintEvent *, xPrintPrintEvent *);
-static void SwapXpAttributeEvent(xPrintAttributeEvent *, xPrintAttributeEvent *);
-
-static int SProcXpGetPrinterList(ClientPtr);
-static int SProcXpCreateContext(ClientPtr);
-static int SProcXpSetContext(ClientPtr);
-static int SProcXpGetContext(ClientPtr);
-static int SProcXpDestroyContext(ClientPtr);
-static int SProcXpGetContextScreen(ClientPtr);
-static int SProcXpStartJob(ClientPtr);
-static int SProcXpEndJob(ClientPtr);
-static int SProcXpStartDoc(ClientPtr);
-static int SProcXpEndDoc(ClientPtr);
-static int SProcXpStartPage(ClientPtr);
-static int SProcXpEndPage(ClientPtr);
-static int SProcXpSelectInput(ClientPtr);
-static int SProcXpInputSelected(ClientPtr);
-static int SProcXpPutDocumentData(ClientPtr);
-static int SProcXpGetDocumentData(ClientPtr);
-static int SProcXpGetAttributes(ClientPtr);
-static int SProcXpGetOneAttribute(ClientPtr);
-static int SProcXpSetAttributes(ClientPtr);
-static int SProcXpRehashPrinterList(ClientPtr);
-static int SProcXpGetPageDimensions(ClientPtr);
-static int SProcXpSetImageResolution(ClientPtr);
-static int SProcXpGetImageResolution(ClientPtr);
-
-static void SendXpNotify(XpContextPtr, int, int);
-static void SendAttributeNotify(XpContextPtr, int);
-static int XpFreeClient(pointer, XID);
-static int XpFreeContext(pointer, XID);
-static int XpFreePage(pointer, XID);
-static Bool XpCloseScreen(int, ScreenPtr);
-static CARD32 GetAllEventMasks(XpContextPtr);
-static struct _XpClient *CreateXpClient(ClientPtr);
-static void InitContextPrivates(XpContextPtr);
-static void ResetContextPrivates(void);
-static struct _XpClient *FindClient(XpContextPtr, ClientPtr);
-static struct _XpClient *AcquireClient(XpContextPtr, ClientPtr);
-
-typedef struct _driver {
- struct _driver *next;
- char *name;
- int (* CreateContext)(XpContextPtr);
-} XpDriverRec, *XpDriverPtr;
-
-typedef struct _xpScreen {
- Bool (* CloseScreen)(int, ScreenPtr);
- struct _driver *drivers;
-} XpScreenRec, *XpScreenPtr;
-
-/*
- * Each context has a list of XpClients indicating which clients have
- * associated this context with their connection.
- * Each such client has a RTclient resource allocated for it,
- * and this per-client
- * resource is used to delete the XpClientRec if/when the client closes
- * its connection.
- * The list of XpClients is also walked if/when the context is destroyed
- * so that the ContextPtr can be removed from the client's devPrivates.
- */
-typedef struct _XpClient {
- struct _XpClient *pNext;
- ClientPtr client;
- XpContextPtr context;
- CARD32 eventMask;
- XID contextClientID; /* unneeded sanity check? */
-} XpClientRec, *XpClientPtr;
-
-static void FreeXpClient(XpClientPtr, Bool);
-
-/*
- * Each StartPage request specifies a window which forms the top level
- * window of the page. One of the following structs is created as a
- * RTpage resource with the same ID as the window itself. This enables
- * us to clean up when/if the window is destroyed, and to prevent the
- * same window from being simultaneously referenced in multiple contexts.
- * The page resource is created at the first StartPage on a given window,
- * and is only destroyed when/if the window is destroyed. When the
- * EndPage is recieved (or an EndDoc or EndJob) the context field is
- * set to NULL, but the resource remains alive.
- */
-typedef struct _XpPage {
- XpContextPtr context;
-} XpPageRec, *XpPagePtr;
-
-typedef struct _XpStPageRec {
- XpContextPtr pContext;
- Bool slept;
- XpPagePtr pPage;
- WindowPtr pWin;
-} XpStPageRec, *XpStPagePtr;
-
-typedef struct _XpStDocRec {
- XpContextPtr pContext;
- Bool slept;
- CARD8 type;
-} XpStDocRec, *XpStDocPtr;
-
-#define QUADPAD(x) ((((x)+3)>>2)<<2)
-
-/*
- * Possible bit-mask values in the "state" field of a XpContextRec.
- */
-#define JOB_STARTED (1 << 0)
-#define DOC_RAW_STARTED (1 << 1)
-#define DOC_COOKED_STARTED (1 << 2)
-#define PAGE_STARTED (1 << 3)
-#define GET_DOC_DATA_STARTED (1 << 4)
-#define JOB_GET_DATA (1 << 5)
-
-static XpScreenPtr XpScreens[MAXSCREENS];
-static unsigned char XpReqCode;
-static int XpEventBase;
-static int XpErrorBase;
-static unsigned long XpGeneration = 0;
-static int XpClientPrivateIndex;
-
-/* Variables for the context private machinery.
- * These must be initialized at compile time because
- * main() calls InitOutput before InitExtensions, and the
- * output drivers are likely to call AllocateContextPrivate.
- * These variables are reset at CloseScreen time. CloseScreen
- * is used because it occurs after FreeAllResources, and before
- * the next InitOutput cycle.
- */
-static int contextPrivateCount = 0;
-static int contextPrivateLen = 0;
-static unsigned *contextPrivateSizes = (unsigned *)NULL;
-static unsigned totalContextSize = sizeof(XpContextRec);
-
-/*
- * There are three types of resources involved. One is the resource associated
- * with the context itself, with an ID specified by a printing client. The
- * next is a resource created by us on the client's behalf (and unknown to
- * the client) when a client inits or sets a context which allows us to
- * track each client's interest in events
- * on a particular context, and also allows us to clean up this interest
- * record when/if the client's connection is closed. Finally, there is
- * a resource created for each window that's specified in a StartPage. This
- * resource carries the same ID as the window itself, and enables us to
- * easily prevent the same window being referenced in multiple contexts
- * simultaneously, and enables us to clean up if the window is destroyed
- * before the EndPage.
- */
-static RESTYPE RTclient, RTcontext, RTpage;
-
-/*
- * allEvents is the OR of all the legal event mask bits.
- */
-static CARD32 allEvents = XPPrintMask | XPAttributeMask;
-
-
-/*******************************************************************************
- *
- * ExtensionInit, Driver Init functions, QueryVersion, and Dispatch procs
- *
- ******************************************************************************/
-
-/*
- * XpExtensionInit
- *
- * Called from InitExtensions in main() usually through miinitextension
- *
- */
-
-void
-XpExtensionInit(INITARGS)
-{
- ExtensionEntry *extEntry;
- int i;
-
- RTclient = CreateNewResourceType(XpFreeClient);
- RTcontext = CreateNewResourceType(XpFreeContext);
- RTpage = CreateNewResourceType(XpFreePage);
- if (RTclient && RTcontext && RTpage &&
- (extEntry = AddExtension(XP_PRINTNAME, XP_EVENTS, XP_ERRORS,
- ProcXpDispatch, ProcXpSwappedDispatch,
- XpResetProc, StandardMinorOpcode)))
- {
- XpReqCode = (unsigned char)extEntry->base;
- XpEventBase = extEntry->eventBase;
- XpErrorBase = extEntry->errorBase;
- EventSwapVector[XpEventBase] = (EventSwapPtr) SwapXpNotifyEvent;
- EventSwapVector[XpEventBase+1] = (EventSwapPtr) SwapXpAttributeEvent;
- }
-
- if(XpGeneration != serverGeneration)
- {
- XpClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * We allocate 0 length & simply stuff a pointer to the
- * ContextRec in the DevUnion.
- */
- if(AllocateClientPrivate(XpClientPrivateIndex, 0) != TRUE)
- {
- /* we can't alloc a client private, should we bail??? XXX */
- }
- XpGeneration = serverGeneration;
- }
-
- for(i = 0; i < MAXSCREENS; i++)
- {
- /*
- * If a screen has registered with our extension, then we
- * wrap the screen's CloseScreen function to allow us to
- * reset our ContextPrivate stuff. Note that this
- * requires a printing DDX to call XpRegisterInitFunc
- * _before_ this extension is initialized - i.e. at screen init
- * time, _not_ at root window creation time.
- */
- if(XpScreens[i] != (XpScreenPtr)NULL)
- {
- XpScreens[i]->CloseScreen = screenInfo.screens[i]->CloseScreen;
- screenInfo.screens[i]->CloseScreen = XpCloseScreen;
- }
- }
- DeclareExtensionSecurity(XP_PRINTNAME, TRUE);
-}
-
-static void
-XpResetProc(ExtensionEntry *extEntry)
-{
- /*
- * We can't free up the XpScreens recs here, because extensions are
- * closed before screens, and our CloseScreen function uses the XpScreens
- * recs.
-
- int i;
-
- for(i = 0; i < MAXSCREENS; i++)
- {
- if(XpScreens[i] != (XpScreenPtr)NULL)
- Xfree(XpScreens[i]);
- XpScreens[i] = (XpScreenPtr)NULL;
- }
- */
-}
-
-static Bool
-XpCloseScreen(int index, ScreenPtr pScreen)
-{
- Bool (* CloseScreen)(int, ScreenPtr);
-
- CloseScreen = XpScreens[index]->CloseScreen;
- if(XpScreens[index] != (XpScreenPtr)NULL)
- {
- XpDriverPtr pDriv, nextDriv;
-
- pDriv = XpScreens[index]->drivers;
- while(pDriv != (XpDriverPtr)NULL)
- {
- nextDriv = pDriv->next;
- Xfree(pDriv);
- pDriv = nextDriv;
- }
- Xfree(XpScreens[index]);
- }
- XpScreens[index] = (XpScreenPtr)NULL;
-
- /*
- * It's wasteful to call ResetContextPrivates() at every CloseScreen,
- * but it's the best we know how to do for now. We do this because we
- * have to wait until after all resources have been freed (so we know
- * how to free the ContextRecs), and before the next InitOutput cycle.
- * See dix/main.c for the order of initialization and reset.
- */
- ResetContextPrivates();
- return (*CloseScreen)(index, pScreen);
-}
-
-#if 0 /* NOT USED */
-static void
-FreeScreenEntry(XpScreenPtr pScreenEntry)
-{
- XpDriverPtr pDriver;
-
- pDriver = pScreenEntry->drivers;
- while(pDriver != (XpDriverPtr)NULL)
- {
- XpDriverPtr tmp;
-
- tmp = pDriver->next;
- xfree(pDriver);
- pDriver = tmp;
- }
- xfree(pScreenEntry);
-}
-#endif
-
-/*
- * XpRegisterInitFunc tells the print extension which screens
- * are printers as opposed to displays, and what drivers are
- * supported on each screen. This eliminates the need of
- * allocating print-related private structures on windows on _all_ screens.
- * It also hands the extension a pointer to the routine to be called
- * whenever a context gets created for a particular driver on this screen.
- */
-void
-XpRegisterInitFunc(ScreenPtr pScreen, char *driverName, int (*initContext)(struct _XpContext *))
-{
- XpDriverPtr pDriver;
-
- if(XpScreens[pScreen->myNum] == 0)
- {
- if((XpScreens[pScreen->myNum] =
- (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == 0)
- return;
- XpScreens[pScreen->myNum]->CloseScreen = 0;
- XpScreens[pScreen->myNum]->drivers = 0;
- }
-
- if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) == 0)
- return;
- pDriver->next = XpScreens[pScreen->myNum]->drivers;
- pDriver->name = driverName;
- pDriver->CreateContext = initContext;
- XpScreens[pScreen->myNum]->drivers = pDriver;
-}
-
-static int
-ProcXpDispatch(ClientPtr client)
-{
- REQUEST(xReq);
-
- switch(stuff->data)
- {
- case X_PrintQueryVersion:
- return ProcXpQueryVersion(client);
- case X_PrintGetPrinterList:
- return ProcXpGetPrinterList(client);
- case X_PrintCreateContext:
- return ProcXpCreateContext(client);
- case X_PrintSetContext:
- return ProcXpSetContext(client);
- case X_PrintGetContext:
- return ProcXpGetContext(client);
- case X_PrintDestroyContext:
- return ProcXpDestroyContext(client);
- case X_PrintGetContextScreen:
- return ProcXpGetContextScreen(client);
- case X_PrintStartJob:
- return ProcXpStartJob(client);
- case X_PrintEndJob:
- return ProcXpEndJob(client);
- case X_PrintStartDoc:
- return ProcXpStartDoc(client);
- case X_PrintEndDoc:
- return ProcXpEndDoc(client);
- case X_PrintStartPage:
- return ProcXpStartPage(client);
- case X_PrintEndPage:
- return ProcXpEndPage(client);
- case X_PrintSelectInput:
- return ProcXpSelectInput(client);
- case X_PrintInputSelected:
- return ProcXpInputSelected(client);
- case X_PrintPutDocumentData:
- return ProcXpPutDocumentData(client);
- case X_PrintGetDocumentData:
- return ProcXpGetDocumentData(client);
- case X_PrintSetAttributes:
- return ProcXpSetAttributes(client);
- case X_PrintGetAttributes:
- return ProcXpGetAttributes(client);
- case X_PrintGetOneAttribute:
- return ProcXpGetOneAttribute(client);
- case X_PrintRehashPrinterList:
- return ProcXpRehashPrinterList(client);
- case X_PrintQueryScreens:
- return ProcXpQueryScreens(client);
- case X_PrintGetPageDimensions:
- return ProcXpGetPageDimensions(client);
- case X_PrintSetImageResolution:
- return ProcXpSetImageResolution(client);
- case X_PrintGetImageResolution:
- return ProcXpGetImageResolution(client);
- default:
- return BadRequest;
- }
-}
-
-static int
-ProcXpSwappedDispatch(ClientPtr client)
-{
- int temp;
- REQUEST(xReq);
-
- switch(stuff->data)
- {
- case X_PrintQueryVersion:
- swaps(&stuff->length, temp);
- return ProcXpQueryVersion(client);
- case X_PrintGetPrinterList:
- return SProcXpGetPrinterList(client);
- case X_PrintCreateContext:
- return SProcXpCreateContext(client);
- case X_PrintSetContext:
- return SProcXpSetContext(client);
- case X_PrintGetContext:
- return SProcXpGetContext(client);
- case X_PrintDestroyContext:
- return SProcXpDestroyContext(client);
- case X_PrintGetContextScreen:
- return SProcXpGetContextScreen(client);
- case X_PrintStartJob:
- return SProcXpStartJob(client);
- case X_PrintEndJob:
- return SProcXpEndJob(client);
- case X_PrintStartDoc:
- return SProcXpStartDoc(client);
- case X_PrintEndDoc:
- return SProcXpEndDoc(client);
- case X_PrintStartPage:
- return SProcXpStartPage(client);
- case X_PrintEndPage:
- return SProcXpEndPage(client);
- case X_PrintSelectInput:
- return SProcXpSelectInput(client);
- case X_PrintInputSelected:
- return SProcXpInputSelected(client);
- case X_PrintPutDocumentData:
- return SProcXpPutDocumentData(client);
- case X_PrintGetDocumentData:
- return SProcXpGetDocumentData(client);
- case X_PrintSetAttributes:
- return SProcXpSetAttributes(client);
- case X_PrintGetAttributes:
- return SProcXpGetAttributes(client);
- case X_PrintGetOneAttribute:
- return SProcXpGetOneAttribute(client);
- case X_PrintRehashPrinterList:
- return SProcXpRehashPrinterList(client);
- case X_PrintQueryScreens:
- swaps(&stuff->length, temp);
- return ProcXpQueryScreens(client);
- case X_PrintGetPageDimensions:
- return SProcXpGetPageDimensions(client);
- case X_PrintSetImageResolution:
- return SProcXpSetImageResolution(client);
- case X_PrintGetImageResolution:
- return SProcXpGetImageResolution(client);
- default:
- return BadRequest;
- }
-}
-
-static int
-ProcXpQueryVersion(ClientPtr client)
-{
- /* REQUEST(xPrintQueryVersionReq); */
- xPrintQueryVersionReply rep;
- register int n;
- long l;
-
- REQUEST_SIZE_MATCH(xPrintQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XP_MAJOR_VERSION;
- rep.minorVersion = XP_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- WriteToClient(client, sz_xPrintQueryVersionReply, (char *)&rep);
- return client->noClientException;
-}
-
-/*******************************************************************************
- *
- * GetPrinterList : Return a list of all printers associated with this
- * server. Calls XpDiGetPrinterList, which is defined in
- * the device-independent code in Xserver/Xprint.
- *
- ******************************************************************************/
-
-static int
-ProcXpGetPrinterList(ClientPtr client)
-{
- REQUEST(xPrintGetPrinterListReq);
- int totalSize;
- int numEntries;
- XpDiListEntry **pList;
- xPrintGetPrinterListReply *rep;
- int n, i, totalBytes;
- long l;
- char *curByte;
-
- REQUEST_AT_LEAST_SIZE(xPrintGetPrinterListReq);
-
- totalSize = ((sz_xPrintGetPrinterListReq) >> 2) +
- ((stuff->printerNameLen + 3) >> 2) +
- ((stuff->localeLen + 3) >> 2);
- if(totalSize != client->req_len)
- return BadLength;
-
- pList = XpDiGetPrinterList(stuff->printerNameLen, (char *)(stuff + 1),
- stuff->localeLen, (char *)((stuff + 1) +
- QUADPAD(stuff->printerNameLen)));
-
- for(numEntries = 0, totalBytes = sz_xPrintGetPrinterListReply;
- pList[numEntries] != (XpDiListEntry *)NULL;
- numEntries++)
- {
- totalBytes += 2 * sizeof(CARD32);
- totalBytes += QUADPAD(strlen(pList[numEntries]->name));
- totalBytes += QUADPAD(strlen(pList[numEntries]->description));
- }
-
- if((rep = (xPrintGetPrinterListReply *)xalloc(totalBytes)) ==
- (xPrintGetPrinterListReply *)NULL)
- return BadAlloc;
-
- rep->type = X_Reply;
- rep->length = (totalBytes - sz_xPrintGetPrinterListReply) >> 2;
- rep->sequenceNumber = client->sequence;
- rep->listCount = numEntries;
- if (client->swapped) {
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, l);
- swapl(&rep->listCount, l);
- }
-
- for(i = 0, curByte = (char *)(rep + 1); i < numEntries; i++)
- {
- CARD32 *pCrd;
- int len;
-
- pCrd = (CARD32 *)curByte;
- len = strlen(pList[i]->name);
- *pCrd = len;
- if (client->swapped)
- swapl((long *)curByte, l);
- curByte += sizeof(CARD32);
- strncpy(curByte, pList[i]->name, len);
- curByte += QUADPAD(len);
-
- pCrd = (CARD32 *)curByte;
- len = strlen(pList[i]->description);
- *pCrd = len;
- if (client->swapped)
- swapl((long *)curByte, l);
- curByte += sizeof(CARD32);
- strncpy(curByte, pList[i]->description, len);
- curByte += QUADPAD(len);
- }
-
- XpDiFreePrinterList(pList);
-
- WriteToClient(client, totalBytes, (char *)rep);
- xfree(rep);
- return client->noClientException;
-}
-
-/*******************************************************************************
- *
- * QueryScreens: Returns the list of screens which are associated with
- * print drivers.
- *
- ******************************************************************************/
-
-static int
-ProcXpQueryScreens(ClientPtr client)
-{
- /* REQUEST(xPrintQueryScreensReq); */
- int i, numPrintScreens, totalSize;
- WINDOW *pWinId;
- xPrintQueryScreensReply *rep;
- long l;
-
- REQUEST_SIZE_MATCH(xPrintQueryScreensReq);
-
- rep = (xPrintQueryScreensReply *)xalloc(sz_xPrintQueryScreensReply);
- pWinId = (WINDOW *)(rep + 1);
-
- for(i = 0, numPrintScreens = 0, totalSize = sz_xPrintQueryScreensReply;
- i < MAXSCREENS; i++)
- {
- /*
- * If a screen has registered with our extension, then it's
- * a printer screen.
- */
- if(XpScreens[i] != (XpScreenPtr)NULL)
- {
- numPrintScreens++;
- totalSize += sizeof(WINDOW);
- rep = (xPrintQueryScreensReply *)xrealloc(rep, totalSize);
- /* fix of bug: pWinId should be set again after reallocate rep */
- pWinId = (WINDOW *)(rep + 1);
- *pWinId = WindowTable[i]->drawable.id;
- if (client->swapped)
- swapl((long *)pWinId, l);
- }
- }
-
- rep->type = X_Reply;
- rep->sequenceNumber = client->sequence;
- rep->length = (totalSize - sz_xPrintQueryScreensReply) >> 2;
- rep->listCount = numPrintScreens;
- if (client->swapped)
- {
- int n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, l);
- swapl(&rep->listCount, l);
- }
-
- WriteToClient(client, totalSize, (char *)rep);
- xfree(rep);
- return client->noClientException;
-}
-
-static int
-ProcXpGetPageDimensions(ClientPtr client)
-{
- REQUEST(xPrintGetPageDimensionsReq);
- CARD16 width, height;
- xRectangle rect;
- xPrintGetPageDimensionsReply rep;
- XpContextPtr pContext;
- int result;
-
- REQUEST_SIZE_MATCH(xPrintGetPageDimensionsReq);
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if((pContext->funcs.GetMediumDimensions == 0) ||
- (pContext->funcs.GetReproducibleArea == 0))
- return BadImplementation;
-
- result = pContext->funcs.GetMediumDimensions(pContext, &width, &height);
- if(result != Success)
- return result;
-
- result = pContext->funcs.GetReproducibleArea(pContext, &rect);
- if(result != Success)
- return result;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.width = width;
- rep.height = height;
- rep.rx = rect.x;
- rep.ry = rect.y;
- rep.rwidth = rect.width;
- rep.rheight = rect.height;
-
- if(client->swapped)
- {
- int n;
- long l;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swaps(&rep.width, n);
- swaps(&rep.height, n);
- swaps(&rep.rx, n);
- swaps(&rep.ry, n);
- swaps(&rep.rwidth, n);
- swaps(&rep.rheight, n);
- }
-
- WriteToClient(client, sz_xPrintGetPageDimensionsReply, (char *)&rep);
- return client->noClientException;
-}
-
-static int
-ProcXpSetImageResolution(ClientPtr client)
-{
- REQUEST(xPrintSetImageResolutionReq);
- xPrintSetImageResolutionReply rep;
- XpContextPtr pContext;
- Bool status;
- int result;
-
- REQUEST_SIZE_MATCH(xPrintSetImageResolutionReq);
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- rep.prevRes = pContext->imageRes;
- if(pContext->funcs.SetImageResolution != 0) {
- result = pContext->funcs.SetImageResolution(pContext,
- (int)stuff->imageRes,
- &status);
- if(result != Success)
- status = FALSE;
- } else
- status = FALSE;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
-
- if(client->swapped)
- {
- int n;
- long l;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swaps(&rep.prevRes, n);
- }
-
- WriteToClient(client, sz_xPrintSetImageResolutionReply, (char *)&rep);
- return client->noClientException;
-}
-
-static int
-ProcXpGetImageResolution(ClientPtr client)
-{
- REQUEST(xPrintGetImageResolutionReq);
- xPrintGetImageResolutionReply rep;
- XpContextPtr pContext;
-
- REQUEST_SIZE_MATCH(xPrintGetImageResolutionReq);
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.imageRes = pContext->imageRes;
-
- if(client->swapped)
- {
- int n;
- long l;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swaps(&rep.imageRes, n);
- }
-
- WriteToClient(client, sz_xPrintGetImageResolutionReply, (char *)&rep);
- return client->noClientException;
-}
-
-/*******************************************************************************
- *
- * RehashPrinterList : Cause the server's list of printers to be rebuilt.
- * This allows new printers to be added, or old ones
- * deleted without needing to restart the server.
- *
- ******************************************************************************/
-
-static int
-ProcXpRehashPrinterList(ClientPtr client)
-{
- /* REQUEST(xPrintRehashPrinterListReq); */
-
- REQUEST_SIZE_MATCH(xPrintRehashPrinterListReq);
-
- return XpRehashPrinterList();
-}
-
-/******************************************************************************
- *
- * Context functions: Init, Set, Destroy, FreeContext
- * AllocateContextPrivateIndex, AllocateContextPrivate
- * and supporting functions.
- *
- * Init creates a context, creates a XpClientRec for the calling
- * client, and stores the contextPtr in the client's devPrivates.
- *
- * Set creates a XpClientRec for the calling client, and stores the
- * contextPtr in the client's devPrivates unless the context is None.
- * If the context is None, then the client's connection association
- * with any context is removed.
- *
- * Destroy frees any and all XpClientRecs associated with the context,
- * frees the context itself, and removes the contextPtr from any
- * relevant client devPrivates.
- *
- * FreeContext is called by FreeResource to free up a context.
- *
- ******************************************************************************/
-
-/*
- * CreateContext creates and initializes the memory for the context itself.
- * The driver's CreateContext function
- * is then called.
- */
-static int
-ProcXpCreateContext(ClientPtr client)
-{
- REQUEST(xPrintCreateContextReq);
- XpScreenPtr pPrintScreen;
- WindowPtr pRoot;
- char *driverName;
- XpContextPtr pContext;
- int result = Success;
- XpDriverPtr pDriver;
-
- REQUEST_AT_LEAST_SIZE(xPrintCreateContextReq);
-
- LEGAL_NEW_RESOURCE(stuff->contextID, client);
-
- /*
- * Check to see if the printer name is valid.
- */
- if((pRoot = XpDiValidatePrinter((char *)(stuff + 1), stuff->printerNameLen)) ==
- (WindowPtr)NULL)
- return BadMatch;
-
- pPrintScreen = XpScreens[pRoot->drawable.pScreen->myNum];
-
- /*
- * Allocate and add the context resource.
- */
- if((pContext = (XpContextPtr) xalloc(totalContextSize)) ==
- (XpContextPtr) NULL)
- return BadAlloc;
-
- InitContextPrivates(pContext);
-
- if(AddResource(stuff->contextID, RTcontext, (pointer) pContext)
- != TRUE)
- {
- xfree(pContext);
- return BadAlloc;
- }
-
- pContext->contextID = stuff->contextID;
- pContext->clientHead = (XpClientPtr)NULL;
- pContext->screenNum = pRoot->drawable.pScreen->myNum;
- pContext->state = 0;
- pContext->clientSlept = (ClientPtr)NULL;
- pContext->imageRes = 0;
-
- pContext->funcs.DestroyContext = 0;
- pContext->funcs.StartJob = 0;
- pContext->funcs.EndJob = 0;
- pContext->funcs.StartDoc = 0;
- pContext->funcs.EndDoc = 0;
- pContext->funcs.StartPage = 0;
- pContext->funcs.EndPage = 0;
- pContext->funcs.PutDocumentData = 0;
- pContext->funcs.GetDocumentData = 0;
- pContext->funcs.GetAttributes = 0;
- pContext->funcs.GetOneAttribute = 0;
- pContext->funcs.SetAttributes = 0;
- pContext->funcs.AugmentAttributes = 0;
- pContext->funcs.GetMediumDimensions = 0;
- pContext->funcs.GetReproducibleArea = 0;
- pContext->funcs.SetImageResolution = 0;
-
- if((pContext->printerName = (char *)xalloc(stuff->printerNameLen + 1)) ==
- (char *)NULL)
- {
- /* Freeing the context also causes the XpClients to be freed. */
- FreeResource(stuff->contextID, RT_NONE);
- return BadAlloc;
- }
- strncpy(pContext->printerName, (char *)(stuff + 1), stuff->printerNameLen);
- pContext->printerName[stuff->printerNameLen] = (char)'\0';
-
- driverName = XpDiGetDriverName(pRoot->drawable.pScreen->myNum,
- pContext->printerName);
-
- for(pDriver = pPrintScreen->drivers;
- pDriver != (XpDriverPtr)NULL;
- pDriver = pDriver->next)
- {
- if(!strcmp(driverName, pDriver->name))
- {
- if(pDriver->CreateContext != 0)
- pDriver->CreateContext(pContext);
- else
- return BadImplementation;
- break;
- }
- }
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-/*
- * SetContext creates the calling client's contextClient resource,
- * and stashes the contextID in the client's devPrivate.
- */
-static int
-ProcXpSetContext(ClientPtr client)
-{
- REQUEST(xPrintSetContextReq);
-
- XpContextPtr pContext;
- XpClientPtr pPrintClient;
- int result = Success;
-
- REQUEST_AT_LEAST_SIZE(xPrintSetContextReq);
-
- if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) !=
- (pointer)NULL)
- {
- /*
- * Erase this client's knowledge of its old context, if any.
- */
- if((pPrintClient = FindClient(pContext, client)) != (XpClientPtr)NULL)
- {
- XpUnsetFontResFunc(client);
-
- if(pPrintClient->eventMask == 0)
- FreeXpClient(pPrintClient, TRUE);
- }
-
- client->devPrivates[XpClientPrivateIndex].ptr = (pointer)NULL;
- }
- if(stuff->printContext == None)
- return Success;
-
- /*
- * Check to see that the supplied XID is really a valid print context
- * in this server.
- */
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL)
- return BadAlloc;
-
- client->devPrivates[XpClientPrivateIndex].ptr = pContext;
-
- XpSetFontResFunc(client);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-XpContextPtr
-XpGetPrintContext(ClientPtr client)
-{
- return (client->devPrivates[XpClientPrivateIndex].ptr);
-}
-
-static int
-ProcXpGetContext(ClientPtr client)
-{
- /* REQUEST(xPrintGetContextReq); */
- xPrintGetContextReply rep;
-
- XpContextPtr pContext;
- register int n;
- register long l;
-
- REQUEST_SIZE_MATCH(xPrintGetContextReq);
-
- if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) ==
- (pointer)NULL)
- rep.printContext = None;
- else
- rep.printContext = pContext->contextID;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swapl(&rep.printContext, l);
- }
- WriteToClient(client, sz_xPrintGetContextReply, (char *)&rep);
- return client->noClientException;
-}
-
-
-/*
- * DestroyContext frees the context associated with the calling client.
- * It operates by freeing the context resource ID, thus causing XpFreeContext
- * to be called.
- */
-static int
-ProcXpDestroyContext(ClientPtr client)
-{
- REQUEST(xPrintDestroyContextReq);
-
- XpContextPtr pContext;
-
- REQUEST_SIZE_MATCH(xPrintDestroyContextReq);
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityDestroyAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- XpUnsetFontResFunc(client);
-
- FreeResource(pContext->contextID, RT_NONE);
-
- return Success;
-}
-
-static int
-ProcXpGetContextScreen(ClientPtr client)
-{
- REQUEST(xPrintGetContextScreenReq);
- xPrintGetContextScreenReply rep;
- XpContextPtr pContext;
- int n;
- long l;
-
- if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadContext;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.rootWindow = WindowTable[pContext->screenNum]->drawable.id;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swapl(&rep.rootWindow, l);
- }
-
- WriteToClient(client, sz_xPrintGetContextScreenReply, (char *)&rep);
- return client->noClientException;
-}
-
-/*
- * XpFreeContext is the routine called by dix:FreeResource when a context
- * resource ID is freed.
- * It checks to see if there's a partial job pending on the context, and
- * if so it calls the appropriate End procs with the cancel flag set.
- * It calls the driver's DestroyContext routine to allow the driver to clean
- * up any context-related memory or state.
- * It calls FreeXpClient to free all the
- * associated XpClientRecs and to set all the client->devPrivates to NULL.
- * It frees the printer name string, and frees the context
- * itself.
- */
-static int
-XpFreeContext(pointer data, XID id)
-{
- XpContextPtr pContext = (XpContextPtr)data;
-
- /* Clean up any pending job on this context */
- if(pContext->state != 0)
- {
- if(pContext->state & PAGE_STARTED)
- {
- WindowPtr pWin = (WindowPtr )LookupIDByType(
- pContext->pageWin, RT_WINDOW);
- XpPagePtr pPage = (XpPagePtr)LookupIDByType(
- pContext->pageWin, RTpage);
-
- pContext->funcs.EndPage(pContext, pWin);
- SendXpNotify(pContext, XPEndPageNotify, TRUE);
- pContext->state &= ~PAGE_STARTED;
- if(pPage)
- pPage->context = (XpContextPtr)NULL;
- }
- if((pContext->state & DOC_RAW_STARTED) ||
- (pContext->state & DOC_COOKED_STARTED))
- {
- pContext->funcs.EndDoc(pContext, TRUE);
- SendXpNotify(pContext, XPEndDocNotify, TRUE);
- pContext->state &= ~DOC_RAW_STARTED;
- pContext->state &= ~DOC_COOKED_STARTED;
- }
- if(pContext->funcs.EndJob != 0)
- {
- pContext->funcs.EndJob(pContext, TRUE);
- SendXpNotify(pContext, XPEndJobNotify, TRUE);
- pContext->state &= ~JOB_STARTED;
- pContext->state &= ~GET_DOC_DATA_STARTED;
- }
- }
-
- /*
- * Tell the driver we're destroying the context
- * This allows the driver to free and ContextPrivate data
- */
- if(pContext->funcs.DestroyContext != 0)
- pContext->funcs.DestroyContext(pContext);
-
- /* Free up all the XpClientRecs */
- while(pContext->clientHead != (XpClientPtr)NULL)
- {
- FreeXpClient(pContext->clientHead, TRUE);
- }
-
- xfree(pContext->printerName);
- xfree(pContext);
- return Success; /* ??? */
-}
-
-/*
- * XpFreeClient is the routine called by dix:FreeResource when a RTclient
- * is freed. It simply calls the FreeXpClient routine to do the work.
- */
-static int
-XpFreeClient(pointer data, XID id)
-{
- FreeXpClient((XpClientPtr)data, TRUE);
- return Success;
-}
-
-/*
- * FreeXpClient
- * frees the ClientRec passed in, and sets the client->devPrivates to NULL
- * if the client->devPrivates points to the same context as the XpClient.
- * Called from XpFreeContext(from FreeResource), and
- * XpFreeClient. The boolean freeResource specifies whether or not to call
- * FreeResource for the XpClientRec's XID. We should free it except if we're
- * called from XpFreeClient (which is itself called from FreeResource for the
- * XpClientRec's XID).
- */
-static void
-FreeXpClient(XpClientPtr pXpClient, Bool freeResource)
-{
- XpClientPtr pCurrent, pPrev;
- XpContextPtr pContext = pXpClient->context;
-
- /*
- * If we're freeing the clientRec associated with the context tied
- * to the client's devPrivates, then we need to clear the devPrivates.
- */
- if(pXpClient->client->devPrivates[XpClientPrivateIndex].ptr ==
- pXpClient->context)
- {
- pXpClient->client->devPrivates[XpClientPrivateIndex].ptr =
- (pointer)NULL;
- }
-
- for(pPrev = (XpClientPtr)NULL, pCurrent = pContext->clientHead;
- pCurrent != (XpClientPtr)NULL;
- pCurrent = pCurrent->pNext)
- {
- if(pCurrent == pXpClient)
- {
- if(freeResource == TRUE)
- FreeResource (pCurrent->contextClientID, RTclient);
-
- if (pPrev != (XpClientPtr)NULL)
- pPrev->pNext = pCurrent->pNext;
- else
- pContext->clientHead = pCurrent->pNext;
-
- xfree (pCurrent);
- break;
- }
- pPrev = pCurrent;
- }
-}
-
-/*
- * CreateXpClient takes a ClientPtr and returns a pointer to a
- * XpClientRec which it allocates. It also initializes the Rec,
- * including adding a resource on behalf of the client to enable the
- * freeing of the Rec when the client's connection is closed.
- */
-static XpClientPtr
-CreateXpClient(ClientPtr client)
-{
- XpClientPtr pNewPrintClient;
- XID clientResource;
-
- if((pNewPrintClient = (XpClientPtr)xalloc(sizeof(XpClientRec))) ==
- (XpClientPtr)NULL)
- return (XpClientPtr)NULL;
-
- clientResource = FakeClientID(client->index);
- if(!AddResource(clientResource, RTclient, (pointer)pNewPrintClient))
- {
- xfree (pNewPrintClient);
- return (XpClientPtr)NULL;
- }
-
- pNewPrintClient->pNext = (XpClientPtr)NULL;
- pNewPrintClient->client = client;
- pNewPrintClient->context = (XpContextPtr)NULL;
- pNewPrintClient->eventMask = 0;
- pNewPrintClient->contextClientID = clientResource;
-
- return pNewPrintClient;
-}
-
-/*
- * XpFreePage is the routine called by dix:FreeResource to free the page
- * resource built with the same ID as a page window. It checks to see
- * if we're in the middle of a page, and if so calls the driver's EndPage
- * function with 'cancel' set TRUE. It frees the memory associated with
- * the page resource.
- */
-static int
-XpFreePage(pointer data, XID id)
-{
- XpPagePtr page = (XpPagePtr)data;
- int result = Success;
- WindowPtr pWin = (WindowPtr )LookupIDByType(id, RT_WINDOW);
-
- /* Check to see if the window's being deleted in the middle of a page */
- if(page->context != (XpContextPtr)NULL &&
- page->context->state & PAGE_STARTED)
- {
- if(page->context->funcs.EndPage != 0)
- result = page->context->funcs.EndPage(page->context, pWin);
- SendXpNotify(page->context, XPEndPageNotify, (int)TRUE);
- page->context->pageWin = 0; /* None, NULL??? XXX */
- }
-
- xfree(page);
- return result;
-}
-
-/*
- * ContextPrivate machinery.
- * Context privates are intended for use by the drivers, allowing the
- * drivers to maintain context-specific data. The driver should free
- * the associated data at DestroyContext time.
- */
-
-static void
-InitContextPrivates(XpContextPtr context)
-{
- register char *ptr;
- DevUnion *ppriv;
- register unsigned *sizes;
- register unsigned size;
- register int i;
-
- if (totalContextSize == sizeof(XpContextRec))
- ppriv = (DevUnion *)NULL;
- else
- ppriv = (DevUnion *)(context + 1);
-
- context->devPrivates = ppriv;
- sizes = contextPrivateSizes;
- ptr = (char *)(ppriv + contextPrivateLen);
- for (i = contextPrivateLen; --i >= 0; ppriv++, sizes++)
- {
- if ( (size = *sizes) )
- {
- ppriv->ptr = (pointer)ptr;
- ptr += size;
- }
- else
- ppriv->ptr = (pointer)NULL;
- }
-}
-
-static void
-ResetContextPrivates(void)
-{
- contextPrivateCount = 0;
- contextPrivateLen = 0;
- xfree(contextPrivateSizes);
- contextPrivateSizes = (unsigned *)NULL;
- totalContextSize = sizeof(XpContextRec);
-
-}
-
-int
-XpAllocateContextPrivateIndex(void)
-{
- return contextPrivateCount++;
-}
-
-Bool
-XpAllocateContextPrivate(int index, unsigned amount)
-{
- unsigned oldamount;
-
- if (index >= contextPrivateLen)
- {
- unsigned *nsizes;
- nsizes = (unsigned *)xrealloc(contextPrivateSizes,
- (index + 1) * sizeof(unsigned));
- if (!nsizes)
- return FALSE;
- while (contextPrivateLen <= index)
- {
- nsizes[contextPrivateLen++] = 0;
- totalContextSize += sizeof(DevUnion);
- }
- contextPrivateSizes = nsizes;
- }
- oldamount = contextPrivateSizes[index];
- if (amount > oldamount)
- {
- contextPrivateSizes[index] = amount;
- totalContextSize += (amount - oldamount);
- }
- return TRUE;
-}
-
-static XpClientPtr
-AcquireClient(XpContextPtr pContext, ClientPtr client)
-{
- XpClientPtr pXpClient;
-
- if((pXpClient = FindClient(pContext, client)) != (XpClientPtr)NULL)
- return pXpClient;
-
- if((pXpClient = CreateXpClient(client)) == (XpClientPtr)NULL)
- return (XpClientPtr)NULL;
-
- pXpClient->context = pContext;
- pXpClient->pNext = pContext->clientHead;
- pContext->clientHead = pXpClient;
-
- return pXpClient;
-}
-
-static XpClientPtr
-FindClient(XpContextPtr pContext, ClientPtr client)
-{
- XpClientPtr pXpClient;
-
- for(pXpClient = pContext->clientHead; pXpClient != (XpClientPtr)NULL;
- pXpClient = pXpClient->pNext)
- {
- if(pXpClient->client == client) return pXpClient;
- }
- return (XpClientPtr)NULL;
-}
-
-
-/******************************************************************************
- *
- * Start/End Functions: StartJob, EndJob, StartDoc, EndDoc, StartPage, EndPage
- *
- ******************************************************************************/
-
-static int
-ProcXpStartJob(ClientPtr client)
-{
- REQUEST(xPrintStartJobReq);
- XpContextPtr pContext;
- int result = Success;
-
- REQUEST_SIZE_MATCH(xPrintStartJobReq);
-
- /* Check to see that a context has been established by this client. */
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadContext;
-
- if(pContext->state != 0)
- return XpErrorBase+XPBadSequence;
-
- if(stuff->saveData != XPSpool && stuff->saveData != XPGetData)
- {
- client->errorValue = stuff->saveData;
- return BadValue;
- }
-
- if(pContext->funcs.StartJob != 0)
- result = pContext->funcs.StartJob(pContext,
- (stuff->saveData == XPGetData)? TRUE:FALSE,
- client);
- else
- return BadImplementation;
-
- pContext->state = JOB_STARTED;
- if(stuff->saveData == XPGetData)
- pContext->state |= JOB_GET_DATA;
-
- SendXpNotify(pContext, XPStartJobNotify, FALSE);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static int
-ProcXpEndJob(ClientPtr client)
-{
- REQUEST(xPrintEndJobReq);
- int result = Success;
- XpContextPtr pContext;
-
- REQUEST_SIZE_MATCH(xPrintEndJobReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & JOB_STARTED))
- return XpErrorBase+XPBadSequence;
-
- /* Check for missing EndDoc */
- if((pContext->state & DOC_RAW_STARTED) ||
- (pContext->state & DOC_COOKED_STARTED))
- {
- if(pContext->state & PAGE_STARTED)
- {
- WindowPtr pWin = (WindowPtr )LookupIDByType(
- pContext->pageWin, RT_WINDOW);
- XpPagePtr pPage = (XpPagePtr)LookupIDByType(
- pContext->pageWin, RTpage);
-
- if(stuff->cancel != TRUE)
- return XpErrorBase+XPBadSequence;
-
- if(pContext->funcs.EndPage != 0)
- result = pContext->funcs.EndPage(pContext, pWin);
- else
- return BadImplementation;
-
- SendXpNotify(pContext, XPEndPageNotify, TRUE);
-
- pContext->state &= ~PAGE_STARTED;
-
- if(pPage)
- pPage->context = (XpContextPtr)NULL;
-
- if(result != Success) return result;
- }
-
- if(pContext->funcs.EndDoc != 0)
- result = pContext->funcs.EndDoc(pContext, stuff->cancel);
- else
- return BadImplementation;
-
- SendXpNotify(pContext, XPEndDocNotify, stuff->cancel);
- }
-
- if(pContext->funcs.EndJob != 0)
- result = pContext->funcs.EndJob(pContext, stuff->cancel);
- else
- return BadImplementation;
-
- pContext->state = 0;
-
- SendXpNotify(pContext, XPEndJobNotify, stuff->cancel);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static Bool
-DoStartDoc(ClientPtr client, XpStDocPtr c)
-{
- XpContextPtr pContext = c->pContext;
-
- if(c->pContext->state & JOB_GET_DATA &&
- !(c->pContext->state & GET_DOC_DATA_STARTED))
- {
- if(!c->slept)
- {
- c->slept = TRUE;
- ClientSleep(client, (ClientSleepProcPtr)DoStartDoc, (pointer) c);
- c->pContext->clientSlept = client;
- }
- return TRUE;
- }
-
- if(pContext->funcs.StartDoc != 0)
- (void) pContext->funcs.StartDoc(pContext, c->type);
- else
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadImplementation);
- return TRUE;
- }
-
- if(c->type == XPDocNormal)
- pContext->state |= DOC_COOKED_STARTED;
- else
- pContext->state |= DOC_RAW_STARTED;
-
- SendXpNotify(pContext, XPStartDocNotify, (int)FALSE);
-
- xfree(c);
- return TRUE;
-}
-
-static int
-ProcXpStartDoc(ClientPtr client)
-{
- REQUEST(xPrintStartDocReq);
- int result = Success;
- XpContextPtr pContext;
- XpStDocPtr c;
-
- REQUEST_SIZE_MATCH(xPrintStartDocReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & JOB_STARTED) ||
- pContext->state & DOC_RAW_STARTED ||
- pContext->state & DOC_COOKED_STARTED)
- return XpErrorBase+XPBadSequence;
-
- if(stuff->type != XPDocNormal && stuff->type != XPDocRaw)
- {
- client->errorValue = stuff->type;
- return BadValue;
- }
-
- c = (XpStDocPtr)xalloc(sizeof(XpStDocRec));
- c->pContext = pContext;
- c->type = stuff->type;
- c->slept = FALSE;
- (void)DoStartDoc(client, c);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static int
-ProcXpEndDoc(ClientPtr client)
-{
- REQUEST(xPrintEndDocReq);
- XpContextPtr pContext;
- int result = Success;
-
- REQUEST_SIZE_MATCH(xPrintEndDocReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & DOC_RAW_STARTED) &&
- !(pContext->state & DOC_COOKED_STARTED))
- return XpErrorBase+XPBadSequence;
-
- if(pContext->state & PAGE_STARTED)
- {
- if(stuff->cancel == TRUE)
- {
- WindowPtr pWin = (WindowPtr )LookupIDByType(
- pContext->pageWin, RT_WINDOW);
- XpPagePtr pPage = (XpPagePtr)LookupIDByType(
- pContext->pageWin, RTpage);
-
- if(pContext->funcs.EndPage != 0)
- result = pContext->funcs.EndPage(pContext, pWin);
- else
- return BadImplementation;
-
- SendXpNotify(pContext, XPEndPageNotify, TRUE);
-
- if(pPage)
- pPage->context = (XpContextPtr)NULL;
- }
- else
- return XpErrorBase+XPBadSequence;
- if(result != Success)
- return result;
- }
-
- if(pContext->funcs.EndDoc != 0)
- result = pContext->funcs.EndDoc(pContext, stuff->cancel);
- else
- return BadImplementation;
-
- pContext->state &= ~DOC_RAW_STARTED;
- pContext->state &= ~DOC_COOKED_STARTED;
-
- SendXpNotify(pContext, XPEndDocNotify, stuff->cancel);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static Bool
-DoStartPage(
- ClientPtr client,
- XpStPagePtr c)
-{
- WindowPtr pWin = c->pWin;
- int result = Success;
- XpContextPtr pContext = c->pContext;
- XpPagePtr pPage;
-
- if(c->pContext->state & JOB_GET_DATA &&
- !(c->pContext->state & GET_DOC_DATA_STARTED))
- {
- if(!c->slept)
- {
- c->slept = TRUE;
- ClientSleep(client, (ClientSleepProcPtr)DoStartPage, (pointer) c);
- c->pContext->clientSlept = client;
- }
- return TRUE;
- }
-
- if(!(pContext->state & DOC_COOKED_STARTED))
- {
- /* Implied StartDoc if it was omitted */
- if(pContext->funcs.StartDoc != 0)
- result = pContext->funcs.StartDoc(pContext, XPDocNormal);
- else
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadImplementation);
- return TRUE;
- }
-
- if(result != Success)
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, result);
- return TRUE;
- }
-
- pContext->state |= DOC_COOKED_STARTED;
- SendXpNotify(pContext, XPStartDocNotify, (int)FALSE);
- }
-
- /* ensure the window's not already being used as a page */
- if((pPage = (XpPagePtr)LookupIDByType(c->pWin->drawable.id, RTpage)) !=
- (XpPagePtr)NULL)
- {
- if(pPage->context != (XpContextPtr)NULL)
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadWindow);
- return TRUE;
- }
- }
- else
- {
- if((pPage = (XpPagePtr)xalloc(sizeof(XpPageRec))) == (XpPagePtr)NULL)
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadAlloc);
- return TRUE;
- }
- if(AddResource(c->pWin->drawable.id, RTpage, pPage) == FALSE)
- {
- xfree(pPage);
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadAlloc);
- return TRUE;
- }
- }
-
- pPage->context = pContext;
- pContext->pageWin = c->pWin->drawable.id;
-
- if(pContext->funcs.StartPage != 0)
- result = pContext->funcs.StartPage(pContext, pWin);
- else
- {
- SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
- BadImplementation);
- return TRUE;
- }
-
- pContext->state |= PAGE_STARTED;
-
- (void)MapWindow(pWin, client);
-
- SendXpNotify(pContext, XPStartPageNotify, (int)FALSE);
-
- return TRUE;
-}
-
-static int
-ProcXpStartPage(ClientPtr client)
-{
- REQUEST(xPrintStartPageReq);
- WindowPtr pWin;
- int result = Success;
- XpContextPtr pContext;
- XpStPagePtr c;
-
- REQUEST_SIZE_MATCH(xPrintStartPageReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & JOB_STARTED))
- return XpErrorBase+XPBadSequence;
-
- /* can't have pages in a raw documented */
- if(pContext->state & DOC_RAW_STARTED)
- return XpErrorBase+XPBadSequence;
-
- if(pContext->state & PAGE_STARTED)
- return XpErrorBase+XPBadSequence;
-
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- SecurityWriteAccess);
- if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum)
- return BadWindow;
-
- if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL)
- return BadAlloc;
- c->pContext = pContext;
- c->slept = FALSE;
- c->pWin = pWin;
-
- (void)DoStartPage(client, c);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static int
-ProcXpEndPage(ClientPtr client)
-{
- REQUEST(xPrintEndPageReq);
- int result = Success;
- XpContextPtr pContext;
- XpPagePtr page;
- WindowPtr pWin;
-
- REQUEST_SIZE_MATCH(xPrintEndPageReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & PAGE_STARTED))
- return XpErrorBase+XPBadSequence;
-
- pWin = (WindowPtr )LookupIDByType(pContext->pageWin, RT_WINDOW);
-
- /* Call the ddx's EndPage proc. */
- if(pContext->funcs.EndPage != 0)
- result = pContext->funcs.EndPage(pContext, pWin);
- else
- return BadImplementation;
-
- if((page = (XpPagePtr)LookupIDByType(pContext->pageWin, RTpage)) !=
- (XpPagePtr)NULL)
- page->context = (XpContextPtr)NULL;
-
- pContext->state &= ~PAGE_STARTED;
- pContext->pageWin = 0; /* None, NULL??? XXX */
-
- (void)UnmapWindow(pWin, FALSE);
-
- SendXpNotify(pContext, XPEndPageNotify, stuff->cancel);
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-/*******************************************************************************
- *
- * Document Data Functions: PutDocumentData, GetDocumentData
- *
- ******************************************************************************/
-
-static int
-ProcXpPutDocumentData(ClientPtr client)
-{
- REQUEST(xPrintPutDocumentDataReq);
- XpContextPtr pContext;
- DrawablePtr pDraw;
- int result = Success;
- unsigned totalSize;
- char *pData, *pDoc_fmt, *pOptions;
-
- REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq);
-
- if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
- == (XpContextPtr)NULL)
- return XpErrorBase+XPBadSequence;
-
- if(!(pContext->state & DOC_RAW_STARTED) &&
- !(pContext->state & DOC_COOKED_STARTED))
- return XpErrorBase+XPBadSequence;
-
- if (stuff->drawable) {
- if (pContext->state & DOC_RAW_STARTED)
- return BadDrawable;
- pDraw = (DrawablePtr)LookupDrawable(stuff->drawable, client);
- if (!pDraw || pDraw->pScreen->myNum != pContext->screenNum)
- return BadDrawable;
- } else {
- if (pContext->state & DOC_COOKED_STARTED)
- return BadDrawable;
- pDraw = NULL;
- }
-
- pData = (char *)(&stuff[1]);
-
- totalSize = (stuff->len_data + 3) >> 2;
- pDoc_fmt = pData + (totalSize << 2);
-
- totalSize += (stuff->len_fmt + 3) >> 2;
- pOptions = pData + (totalSize << 2);
-
- totalSize += (stuff->len_options + 3) >> 2;
- if((totalSize + (sz_xPrintPutDocumentDataReq >> 2)) != client->req_len)
- return BadLength;
-
- if(pContext->funcs.PutDocumentData != 0)
- {
- result = (*pContext->funcs.PutDocumentData)(pContext, pDraw,
- pData, stuff->len_data,
- pDoc_fmt, stuff->len_fmt,
- pOptions, stuff->len_options,
- client);
- }
- else
- return BadImplementation;
-
- if (client->noClientException != Success)
- return client->noClientException;
- else
- return result;
-}
-
-static int
-ProcXpGetDocumentData(ClientPtr client)
-{
- REQUEST(xPrintGetDocumentDataReq);
- xPrintGetDocumentDataReply rep;
- XpContextPtr pContext;
- int result = Success;
-
- REQUEST_SIZE_MATCH(xPrintGetDocumentDataReq);
-
- if((pContext = (XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(pContext->funcs.GetDocumentData == 0)
- return BadImplementation;
-
- if(!(pContext->state & JOB_GET_DATA) ||
- pContext->state & GET_DOC_DATA_STARTED)
- return XpErrorBase+XPBadSequence;
-
- if(stuff->maxBufferSize <= 0)
- {
- client->errorValue = stuff->maxBufferSize;
- return BadValue; /* gotta have a positive buffer size */
- }
-
- result = (*pContext->funcs.GetDocumentData)(pContext, client,
- stuff->maxBufferSize);
- if(result != Success)
- {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.dataLen = 0;
- rep.statusCode = 1;
- rep.finishedFlag = TRUE;
- if (client->swapped) {
- int n;
- long l;
-
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.statusCode, l); /* XXX Why are these longs??? */
- swapl(&rep.finishedFlag, l); /* XXX Why are these longs??? */
- }
- (void)WriteToClient(client,sz_xPrintGetDocumentDataReply,(char *)&rep);
- }
- else
- pContext->state |= GET_DOC_DATA_STARTED;
-
- if(pContext->clientSlept != (ClientPtr)NULL)
- {
- ClientSignal(pContext->clientSlept);
- ClientWakeup(pContext->clientSlept);
- pContext->clientSlept = (ClientPtr)NULL;
- }
-
- return result;
-}
-
-/*******************************************************************************
- *
- * Attribute requests: GetAttributes, SetAttributes, GetOneAttribute
- *
- ******************************************************************************/
-
-static int
-ProcXpGetAttributes(ClientPtr client)
-{
- REQUEST(xPrintGetAttributesReq);
- XpContextPtr pContext;
- char *attrs;
- xPrintGetAttributesReply *pRep;
- int totalSize, n;
- unsigned long l;
-
- REQUEST_SIZE_MATCH(xPrintGetAttributesReq);
-
- if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
- {
- client->errorValue = stuff->type;
- return BadValue;
- }
-
- if(stuff->type != XPServerAttr)
- {
- if((pContext = (XpContextPtr)SecurityLookupIDByType(
- client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(pContext->funcs.GetAttributes == 0)
- return BadImplementation;
- if((attrs = (*pContext->funcs.GetAttributes)(pContext, stuff->type)) ==
- (char *)NULL)
- return BadAlloc;
- }
- else
- {
- if((attrs = XpGetAttributes((XpContextPtr)NULL, XPServerAttr)) ==
- (char *)NULL)
- return BadAlloc;
- }
-
- totalSize = sz_xPrintGetAttributesReply + QUADPAD(strlen(attrs));
- if((pRep = (xPrintGetAttributesReply *)malloc(totalSize)) ==
- (xPrintGetAttributesReply *)NULL)
- return BadAlloc;
-
- pRep->type = X_Reply;
- pRep->length = (totalSize - sz_xPrintGetAttributesReply) >> 2;
- pRep->sequenceNumber = client->sequence;
- pRep->stringLen = strlen(attrs);
-
- if (client->swapped) {
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, l);
- swapl(&pRep->stringLen, l);
- }
-
- strncpy((char*)(pRep + 1), attrs, strlen(attrs));
- xfree(attrs);
-
- WriteToClient(client, totalSize, (char *)pRep);
-
- xfree(pRep);
-
- return client->noClientException;
-}
-
-static int
-ProcXpSetAttributes(ClientPtr client)
-{
- REQUEST(xPrintSetAttributesReq);
- int result = Success;
- XpContextPtr pContext;
- char *attr;
-
- REQUEST_AT_LEAST_SIZE(xPrintSetAttributesReq);
-
- if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
- {
- client->errorValue = stuff->type;
- return BadValue;
- }
-
- /*
- * Disallow changing of read-only attribute pools
- */
- if(stuff->type == XPPrinterAttr || stuff->type == XPServerAttr)
- return BadMatch;
-
- if((pContext = (XpContextPtr)SecurityLookupIDByType(
- client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(pContext->funcs.SetAttributes == 0)
- return BadImplementation;
-
- /*
- * Check for attributes being set after their relevant phase
- * has already begun (e.g. Job attributes set after StartJob).
- */
- if((pContext->state & JOB_STARTED) && stuff->type == XPJobAttr)
- return XpErrorBase+XPBadSequence;
- if(((pContext->state & DOC_RAW_STARTED) ||
- (pContext->state & DOC_COOKED_STARTED)) && stuff->type == XPDocAttr)
- return XpErrorBase+XPBadSequence;
- if((pContext->state & PAGE_STARTED) && stuff->type == XPPageAttr)
- return XpErrorBase+XPBadSequence;
-
- if((attr = (char *)malloc(stuff->stringLen + 1)) == (char *)NULL)
- return BadAlloc;
-
- strncpy(attr, (char *)(stuff + 1), stuff->stringLen);
- attr[stuff->stringLen] = (char)'\0';
-
- if(stuff->rule == XPAttrReplace)
- (*pContext->funcs.SetAttributes)(pContext, stuff->type, attr);
- else if(stuff->rule == XPAttrMerge)
- (*pContext->funcs.AugmentAttributes)(pContext, stuff->type, attr);
- else
- {
- client->errorValue = stuff->rule;
- result = BadValue;
- }
-
- xfree(attr);
-
- SendAttributeNotify(pContext, stuff->type);
-
- return result;
-}
-
-static int
-ProcXpGetOneAttribute(ClientPtr client)
-{
- REQUEST(xPrintGetOneAttributeReq);
- XpContextPtr pContext;
- char *value, *attrName;
- xPrintGetOneAttributeReply *pRep;
- int totalSize;
- int n;
- unsigned long l;
-
- REQUEST_AT_LEAST_SIZE(xPrintGetOneAttributeReq);
-
- totalSize = ((sz_xPrintGetOneAttributeReq) >> 2) +
- ((stuff->nameLen + 3) >> 2);
- if(totalSize != client->req_len)
- return BadLength;
-
- if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
- {
- client->errorValue = stuff->type;
- return BadValue;
- }
-
- if((attrName = (char *)malloc(stuff->nameLen + 1)) == (char *)NULL)
- return BadAlloc;
- strncpy(attrName, (char *)(stuff+1), stuff->nameLen);
- attrName[stuff->nameLen] = (char)'\0';
-
- if(stuff->type != XPServerAttr)
- {
- if((pContext = (XpContextPtr)SecurityLookupIDByType(
- client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(pContext->funcs.GetOneAttribute == 0)
- return BadImplementation;
- if((value = (*pContext->funcs.GetOneAttribute)(pContext, stuff->type,
- attrName)) == (char *)NULL)
- return BadAlloc;
- }
- else
- {
- if((value = XpGetOneAttribute((XpContextPtr)NULL, XPServerAttr,
- attrName)) == (char *)NULL)
- return BadAlloc;
- }
-
- free(attrName);
-
- totalSize = sz_xPrintGetOneAttributeReply + QUADPAD(strlen(value));
- if((pRep = (xPrintGetOneAttributeReply *)malloc(totalSize)) ==
- (xPrintGetOneAttributeReply *)NULL)
- return BadAlloc;
-
- pRep->type = X_Reply;
- pRep->length = (totalSize - sz_xPrintGetOneAttributeReply) >> 2;
- pRep->sequenceNumber = client->sequence;
- pRep->valueLen = strlen(value);
-
- if (client->swapped) {
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, l);
- swapl(&pRep->valueLen, l);
- }
-
- strncpy((char*)(pRep + 1), value, strlen(value));
-
- WriteToClient(client, totalSize, (char *)pRep);
-
- xfree(pRep);
-
- return client->noClientException;
-}
-
-/*******************************************************************************
- *
- * Print Event requests: SelectInput InputSelected, SendXpNotify
- *
- ******************************************************************************/
-
-
-static int
-ProcXpSelectInput(ClientPtr client)
-{
- REQUEST(xPrintSelectInputReq);
- int result = Success;
- XpContextPtr pContext;
- XpClientPtr pPrintClient;
-
- REQUEST_SIZE_MATCH(xPrintSelectInputReq);
-
- /*
- * Check to see that the supplied XID is really a valid print context
- * in this server.
- */
- if((pContext=(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityWriteAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- if(stuff->eventMask & ~allEvents)
- {
- client->errorValue = stuff->eventMask;
- return BadValue; /* bogus event mask bits */
- }
-
- if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL)
- return BadAlloc;
-
- pPrintClient->eventMask = stuff->eventMask;
-
- return result;
-}
-
-static int
-ProcXpInputSelected(ClientPtr client)
-{
- REQUEST(xPrintInputSelectedReq);
- xPrintInputSelectedReply rep;
- register int n;
- long l;
- XpClientPtr pXpClient;
- XpContextPtr pContext;
-
- REQUEST_SIZE_MATCH(xPrintInputSelectedReq);
-
- if((pContext=(XpContextPtr)SecurityLookupIDByType(client,
- stuff->printContext,
- RTcontext,
- SecurityReadAccess))
- == (XpContextPtr)NULL)
- {
- client->errorValue = stuff->printContext;
- return XpErrorBase+XPBadContext;
- }
-
- pXpClient = FindClient(pContext, client);
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.eventMask = (pXpClient != (XpClientPtr)NULL)? pXpClient->eventMask : 0;
- rep.allEventsMask = GetAllEventMasks(pContext);
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, l);
- swapl(&rep.eventMask, l);
- swapl(&rep.allEventsMask, l);
- }
-
- WriteToClient(client, sz_xPrintInputSelectedReply, (char *)&rep);
- return client->noClientException;
-}
-
-static void
-SendAttributeNotify(XpContextPtr pContext, int which)
-{
- XpClientPtr pXpClient;
- xPrintAttributeEvent ae;
- ClientPtr client;
-
- pXpClient = pContext->clientHead;
- if(pXpClient == (XpClientPtr)NULL)
- return; /* Nobody's interested in the events (or this context). */
-
- for (pXpClient = pContext->clientHead;
- pXpClient != (XpClientPtr)NULL;
- pXpClient = pXpClient->pNext)
- {
- client = pXpClient->client;
- if (client == serverClient || client->clientGone ||
- !(pXpClient->eventMask & XPAttributeMask))
- continue;
- ae.type = XPAttributeNotify + XpEventBase;
- ae.detail = which;
- ae.printContext = pContext->contextID;
- ae.sequenceNumber = client->sequence;
- WriteEventsToClient (client, 1, (xEvent *) &ae);
- }
-}
-
-static void
-SendXpNotify(XpContextPtr pContext, int which, int val)
-{
- XpClientPtr pXpClient;
- xPrintPrintEvent pe;
- ClientPtr client;
-
- pXpClient = pContext->clientHead;
- if(pXpClient == (XpClientPtr)NULL)
- return; /* Nobody's interested in the events (or this context). */
-
- for (pXpClient = pContext->clientHead;
- pXpClient != (XpClientPtr)NULL;
- pXpClient = pXpClient->pNext)
- {
- client = pXpClient->client;
- if (client == serverClient || client->clientGone ||
- !(pXpClient->eventMask & XPPrintMask))
- continue;
- pe.type = XPPrintNotify + XpEventBase;
- pe.detail = which;
- pe.printContext = pContext->contextID;
- pe.cancel = (Bool)val;
- pe.sequenceNumber = client->sequence;
- WriteEventsToClient (client, 1, (xEvent *) &pe);
- }
-}
-
-static CARD32
-GetAllEventMasks(XpContextPtr pContext)
-{
- XpClientPtr pPrintClient;
- CARD32 totalMask = (CARD32)0;
-
- for (pPrintClient = pContext->clientHead;
- pPrintClient != (XpClientPtr)NULL;
- pPrintClient = pPrintClient->pNext)
- {
- totalMask |= pPrintClient->eventMask;
- }
- return totalMask;
-}
-
-/*
- * XpContextOfClient - returns the XpContextPtr to the context
- * associated with the specified client, or NULL if the client
- * does not currently have a context set.
- */
-XpContextPtr
-XpContextOfClient(ClientPtr client)
-{
- return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr;
-}
-
-
-/*******************************************************************************
- *
- * Swap-request functions
- *
- ******************************************************************************/
-
-static int
-SProcXpCreateContext(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintCreateContextReq);
-
- swaps(&stuff->length, i);
- swapl(&stuff->contextID, n);
- swapl(&stuff->printerNameLen, n);
- swapl(&stuff->localeLen, n);
- return ProcXpCreateContext(client);
-}
-
-static int
-SProcXpGetPrinterList(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintGetPrinterListReq);
-
- swaps(&stuff->length, i);
- swapl(&stuff->printerNameLen, n);
- swapl(&stuff->localeLen, n);
- return ProcXpGetPrinterList(client);
-}
-
-static int
-SProcXpRehashPrinterList(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintRehashPrinterListReq);
- swaps(&stuff->length, i);
- return ProcXpRehashPrinterList(client);
-}
-
-static int
-SProcXpSetContext(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintSetContextReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, i);
- return ProcXpSetContext(client);
-}
-
-static int
-SProcXpGetContext(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintGetContextReq);
- swaps(&stuff->length, i);
- return ProcXpGetContext(client);
-}
-
-static int
-SProcXpDestroyContext(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintDestroyContextReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpDestroyContext(client);
-}
-
-static int
-SProcXpGetContextScreen(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintGetContextScreenReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpGetContextScreen(client);
-}
-
-static int
-SProcXpInputSelected(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintInputSelectedReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpInputSelected(client);
-}
-
-static int
-SProcXpStartJob(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintStartJobReq);
- swaps(&stuff->length, i);
- return ProcXpStartJob(client);
-}
-
-static int
-SProcXpEndJob(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintEndJobReq);
- swaps(&stuff->length, i);
- return ProcXpEndJob(client);
-}
-
-static int
-SProcXpStartDoc(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintStartDocReq);
- swaps(&stuff->length, i);
- return ProcXpStartDoc(client);
-}
-
-static int
-SProcXpEndDoc(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintEndDocReq);
- swaps(&stuff->length, i);
- return ProcXpEndDoc(client);
-}
-
-static int
-SProcXpStartPage(ClientPtr client)
-{
- int i;
- long n;
-
- REQUEST(xPrintStartPageReq);
- swaps(&stuff->length, i);
- swapl(&stuff->window, n);
- return ProcXpStartPage(client);
-}
-
-static int
-SProcXpEndPage(ClientPtr client)
-{
- int i;
-
- REQUEST(xPrintEndPageReq);
- swaps(&stuff->length, i);
- return ProcXpEndPage(client);
-}
-
-static int
-SProcXpPutDocumentData(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintPutDocumentDataReq);
- swaps(&stuff->length, i);
- swapl(&stuff->drawable, n);
- swapl(&stuff->len_data, n);
- swaps(&stuff->len_fmt, i);
- swaps(&stuff->len_options, i);
- return ProcXpPutDocumentData(client);
-}
-
-static int
-SProcXpGetDocumentData(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetDocumentDataReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- swapl(&stuff->maxBufferSize, n);
- return ProcXpGetDocumentData(client);
-}
-
-static int
-SProcXpGetAttributes(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetAttributesReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpGetAttributes(client);
-}
-
-static int
-SProcXpSetAttributes(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintSetAttributesReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- swapl(&stuff->stringLen, n);
- return ProcXpSetAttributes(client);
-}
-
-static int
-SProcXpGetOneAttribute(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetOneAttributeReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- swapl(&stuff->nameLen, n);
- return ProcXpGetOneAttribute(client);
-}
-
-static int
-SProcXpSelectInput(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintSelectInputReq);
- swaps(&stuff->length, i);
- swapl(&stuff->eventMask, n);
- swapl(&stuff->printContext, n);
- return ProcXpSelectInput(client);
-}
-
-static int
-SProcXpGetPageDimensions(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetPageDimensionsReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpGetPageDimensions(client);
-}
-
-static int
-SProcXpSetImageResolution(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintSetImageResolutionReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- swaps(&stuff->imageRes, i);
- return ProcXpSetImageResolution(client);
-}
-
-static int
-SProcXpGetImageResolution(ClientPtr client)
-{
- long n;
- int i;
-
- REQUEST(xPrintGetImageResolutionReq);
- swaps(&stuff->length, i);
- swapl(&stuff->printContext, n);
- return ProcXpGetImageResolution(client);
-}
-
-static void
-SwapXpNotifyEvent(xPrintPrintEvent *src, xPrintPrintEvent *dst)
-{
- /*
- * Swap the sequence number and context fields.
- */
- cpswaps(src->sequenceNumber, dst->sequenceNumber);
- cpswapl(src->printContext, dst->printContext);
-
- /*
- * Copy the byte-long fields.
- */
- dst->type = src->type;
- dst->detail = src->detail;
- dst->cancel = src->cancel;
-}
-
-static void
-SwapXpAttributeEvent(xPrintAttributeEvent *src, xPrintAttributeEvent *dst)
-{
- /*
- * Swap the sequence number and context fields.
- */
- cpswaps(src->sequenceNumber, dst->sequenceNumber);
- cpswapl(src->printContext, dst->printContext);
-
- /*
- * Copy the byte-long fields.
- */
- dst->type = src->type;
- dst->detail = src->detail;
-}
diff --git a/nx-X11/programs/Xserver/dix/Imakefile b/nx-X11/programs/Xserver/dix/Imakefile
index 529e5623e..a0d420851 100644
--- a/nx-X11/programs/Xserver/dix/Imakefile
+++ b/nx-X11/programs/Xserver/dix/Imakefile
@@ -7,10 +7,8 @@ XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.17 2003/04/15 18:30:43 ala
#include <Server.tmpl>
-#if !BuildXprint || PrintOnlyServer
XPSRC = xpstubs.c
XPOBJ = xpstubs.o
-#endif
#if !HasFfs
FFS_SRC = ffs.c
@@ -27,7 +25,7 @@ OBJS = atom.o colormap.o cursor.o devices.o dispatch.o dixutils.o events.o \
tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o $(FFS_OBJ)
INCLUDES = -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC) \
- -I$(SERVERSRC)/Xext -I$(SERVERSRC)/lbx -I../Xprint
+ -I$(SERVERSRC)/Xext -I$(SERVERSRC)/lbx
LINTLIBS = ../os/llib-los.ln
/*
@@ -94,8 +92,6 @@ SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_))
SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_))
SpecialCObjectRule(window,$(ICONFIGFILES),$(QUARTZ_DEFINES))
-#if !BuildXprint || PrintOnlyServer
NormalLibraryTarget(xpstubs,$(XPOBJ))
-#endif
DependTarget()
diff --git a/nx-X11/programs/Xserver/dix/main.c b/nx-X11/programs/Xserver/dix/main.c
index 6a8f79a96..270de6ced 100644
--- a/nx-X11/programs/Xserver/dix/main.c
+++ b/nx-X11/programs/Xserver/dix/main.c
@@ -104,9 +104,6 @@ Equipment Corporation.
#include "site.h"
#include "dixfont.h"
#include "extnsionst.h"
-#ifdef XPRINT
-#include "DiPrint.h"
-#endif
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#else
@@ -255,9 +252,6 @@ main(int argc, char *argv[], char *envp[])
display = "0";
InitGlobals();
-#ifdef XPRINT
- PrinterInitGlobals();
-#endif
/* Quartz support on Mac OS X requires that the Cocoa event loop be in
* the main thread. This allows the X server main to be called again
@@ -370,9 +364,6 @@ main(int argc, char *argv[], char *envp[])
InitCallbackManager();
InitVisualWrap();
InitOutput(&screenInfo, argc, argv);
-#ifdef XPRINT
- PrinterInitOutput(&screenInfo, argc, argv);
-#endif
if (screenInfo.numScreens < 1)
FatalError("no screens found");
diff --git a/nx-X11/programs/Xserver/dix/xpstubs.c b/nx-X11/programs/Xserver/dix/xpstubs.c
index 5135cc398..89481c601 100644
--- a/nx-X11/programs/Xserver/dix/xpstubs.c
+++ b/nx-X11/programs/Xserver/dix/xpstubs.c
@@ -33,9 +33,6 @@ from The Open Group.
#include "misc.h"
#include <X11/fonts/font.h>
-#ifdef XPRINT
-#include "DiPrint.h"
-#endif
Bool
XpClientIsBitmapClient(
@@ -51,27 +48,3 @@ XpClientIsPrintClient(
{
return FALSE;
}
-#ifdef XPRINT
-int
-PrinterOptions(
- int argc,
- char **argv,
- int i)
-{
- return i;
-}
-void
-PrinterInitOutput(
- ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
-{
-}
-void PrinterUseMsg(void)
-{
-}
-void PrinterInitGlobals(void)
-{
-}
-#endif /* XPRINT */
-
diff --git a/nx-X11/programs/Xserver/hw/Imakefile b/nx-X11/programs/Xserver/hw/Imakefile
deleted file mode 100644
index 6ea7f00a1..000000000
--- a/nx-X11/programs/Xserver/hw/Imakefile
+++ /dev/null
@@ -1,26 +0,0 @@
-XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:48:20 cpqbld Exp $
-XCOMM This is only used on NT where we do not know how to jump over this dir
-
-#ifdef Win32Architecture
-
-#define IHaveSubdirs
-#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
-
-#if XnestServer
-XNESTDIR = xnest
-#endif
-
-#if XVirtualFramebufferServer
-XVFBDIR = vfb
-#endif
-
-#if XdmxServer
-XDMXDIR = dmx
-#endif
-
-SUBDIRS= $(XNESTDIR) $(XVFBDIR) $(XDMXDIR)
-
-MakeSubdirs($(SUBDIRS))
-DependSubdirs($(SUBDIRS))
-
-#endif
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
index 6c075fa9f..874e82565 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile
+++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
@@ -66,6 +66,7 @@ SRCS = NXwindow.c \
Composite.c \
Pixels.c \
stubs.c \
+ xpstubs.c \
miinitext.c \
$(SRCS1)
@@ -128,6 +129,7 @@ OBJS = NXwindow.o \
Composite.o \
Pixels.o \
stubs.o \
+ xpstubs.o \
miinitext.o \
$(OBJS1)
@@ -220,6 +222,7 @@ DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) $(NX_DEFINES) \
all:: $(OBJS)
LinkSourceFile(stubs.c,$(SERVERSRC)/Xi)
+LinkSourceFile(xpstubs.c,$(SERVERSRC)/dix)
SpecialCObjectRule(Init,$(ICONFIGFILES),$(_NOOP_))
LinkSourceFile(miinitext.c,$(SERVERSRC)/mi)
SpecialCObjectRule(miinitext,$(ICONFIGFILES), $(_NOOP_))
diff --git a/nx-X11/programs/Xserver/mi/miinitext.c b/nx-X11/programs/Xserver/mi/miinitext.c
index f3be9da5d..b70a6a67e 100644
--- a/nx-X11/programs/Xserver/mi/miinitext.c
+++ b/nx-X11/programs/Xserver/mi/miinitext.c
@@ -73,34 +73,6 @@ SOFTWARE.
#undef GLXEXT
#endif
-/* Make sure Xprt only announces extensions it supports */
-#ifdef PRINT_ONLY_SERVER
-#undef MITSHM /* this is incompatible to the vector-based Xprint DDX */
-#undef XKB
-#undef PANORAMIX
-#undef RES
-#undef XINPUT
-#undef XV
-#undef SCREENSAVER
-#undef XIDLE
-#undef XRECORD
-#undef XF86VIDMODE
-#undef XF86MISC
-#undef XFreeXDGA
-#undef XF86DRI
-#undef DPMSExtension
-#undef DPSEXT
-#undef FONTCACHE
-#undef DAMAGE
-#undef XFIXES
-#undef XEVIE
-#else
-#ifndef LOADABLEPRINTDDX
-#undef XPRINT
-#endif /* LOADABLEPRINTDDX */
-#endif /* PRINT_ONLY_SERVER */
-
-
extern Bool noTestExtensions;
#ifdef BIGREQS
@@ -232,9 +204,6 @@ typedef void (*InitExtension)(INITARGS);
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#endif
-#ifdef XPRINT
-#include "Print.h"
-#endif
#ifdef XAPPGROUP
#define _XAG_SERVER_
#include <X11/extensions/Xagstr.h>
@@ -321,9 +290,6 @@ extern void XagExtensionInit(INITARGS);
#ifdef XCSECURITY
extern void SecurityExtensionInit(INITARGS);
#endif
-#ifdef XPRINT
-extern void XpExtensionInit(INITARGS);
-#endif
#ifdef XF86BIGFONT
extern void XFree86BigfontExtensionInit(INITARGS);
#endif
@@ -606,9 +572,6 @@ InitExtensions(argc, argv)
#ifdef XCSECURITY
if (!noSecurityExtension) SecurityExtensionInit();
#endif
-#ifdef XPRINT
- XpExtensionInit(); /* server-specific extension, cannot be disabled */
-#endif
#ifdef TOGCUP
if (!noXcupExtension) XcupExtensionInit();
#endif
@@ -642,11 +605,6 @@ InitExtensions(argc, argv)
if (!noGlxExtension) DarwinGlxExtensionInit();
#endif
#endif
-#ifdef DPSEXT
-#ifndef XPRINT
- if (!noDPSExtension) DPSExtensionInit();
-#endif
-#endif
#ifdef XFIXES
/* must be before Render to layer DisplayCursor correctly */
if (!noXFixesExtension) XFixesExtensionInit();
@@ -717,9 +675,6 @@ static ExtensionModule staticExtensions[] = {
#ifdef XCSECURITY
{ SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
#endif
-#ifdef XPRINT
- { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
-#endif
#ifdef PANORAMIX
{ PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL },
#endif
diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile
index 22be06074..55f8e41fb 100644
--- a/nx-X11/programs/Xserver/os/Imakefile
+++ b/nx-X11/programs/Xserver/os/Imakefile
@@ -166,7 +166,7 @@ BOOTSTRAPCFLAGS =
$(RANDOM_DEFINES) $(BUGMSG) $(XTRANS_FAILDEFINES) $(NX_DEFINES)
INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
-I$(SERVERSRC)/Xext -I$(FONTINCSRC) -I$(SERVERSRC)/render \
- -I$(TOP)/lib/Xau -I../lbx -I../Xprint Krb5Includes $(NX_INCLUDES)
+ -I$(TOP)/lib/Xau -I../lbx Krb5Includes $(NX_INCLUDES)
DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) \
$(TRANS_INCLUDES) $(CONNECTION_FLAGS) $(GETPEER_DEFINES) \
DependDefines
diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c
index 79e49d5b1..5f189c949 100644
--- a/nx-X11/programs/Xserver/os/utils.c
+++ b/nx-X11/programs/Xserver/os/utils.c
@@ -147,10 +147,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include "picture.h"
#endif
-#ifdef XPRINT
-#include "DiPrint.h"
-#endif
-
Bool noTestExtensions;
#ifdef BIGREQS
Bool noBigReqExtension = FALSE;
@@ -691,9 +687,6 @@ void UseMsg(void)
#ifdef XCSECURITY
ErrorF("-sp file security policy file\n");
#endif
-#ifdef XPRINT
- PrinterUseMsg();
-#endif
ErrorF("-su disable any save under support\n");
ErrorF("-t # mouse threshold (pixels)\n");
ErrorF("-terminate terminate at server reset\n");
@@ -1102,12 +1095,6 @@ ProcessCommandLine(int argc, char *argv[])
i = skip - 1;
}
#endif
-#ifdef XPRINT
- else if ((skip = PrinterOptions(argc, argv, i)) != i)
- {
- i = skip - 1;
- }
-#endif
#ifdef XCSECURITY
else if ((skip = XSecurityOptions(argc, argv, i)) != i)
{