The Xserver now builds with X.Org 6.8.2. It doesn't run correctly yet, though.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@167 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/README b/README
index 76c01a4..73efd2b 100644
--- a/README
+++ b/README
@@ -37,15 +37,15 @@
                 X display, allowing it to be controlled via VNC.  It is
                 intended mainly as a demonstration of a simple VNC server.
 
-In addition to these standalone programs, this distribution can also be used to
-turn the native X server for a platform into a VNC server.  For XFree86 version
-4 servers, this is done using a module loaded at run-time.  For other X servers
-it requires replacing the native X server binary.
+In addition to these standalone programs, this distribution can also
+be used to turn the native X server for a platform into a VNC server.
+For X.Org servers, this is done using a module loaded at run-time.
+For other X servers it requires replacing the native X server binary.
 
 To build this distribution you need a C++ compiler as well as a C compiler.
 You also need a reasonably recent version of the X window system installed.
 This comes as standard with most unix machines.  If you don't have it
-installed, see http://www.xfree86.org or http://www.x.org
+installed, see http://www.x.org. 
 
 To build everything but Xvnc, do:
 
@@ -69,10 +69,7 @@
 with this distribution.  We have designed the distribution to be as independent
 as possible of the X tree used.
 
-We have successfully used XFree86 version 4.3.0, 4.2.0 and 3.3.6 (available
-from http://www.xfree86.org).  You could also try the original X.org tree
-available from http://www.x.org but this does not build as easily because of
-lack of support for C++, no support for building server only, and other issues.
+We have successfully used X.Org 6.8.2 (available from http://www.x.org/).  
 Note that the X tree is enormous and notoriously difficult to deal with -
 building it is not for the faint-hearted!
 
@@ -80,7 +77,7 @@
 level of this distribution, so that the xc directory of the X source tree
 matches the xc of this distribution, for example:
 
-  % tar xzf X420src-1.tgz
+  % tar xzf X11R6.8.2-src.tar.bz2
 
 Then you must apply a patch to some files in the X source tree:
 
@@ -97,7 +94,7 @@
 
 If successful, in the xc/programs/Xserver directory you should find an Xvnc
 binary, plus the native X server binary(ies) for your platform with VNC support
-compiled in.  If you are building from an XFree86 version 4 tree on a supported
+compiled in.  If you are building from an X.Org tree on a supported
 platform, you should also find a vnc.so module in
 xc/programs/Xserver/vnc/modules.
 
@@ -122,13 +119,13 @@
 
   % ./vncinstall /usr/local/bin /usr/local/man
 
-It will also try to install the vnc.so XFree86 version 4 module if appropriate.
+It will also try to install the vnc.so X.Org module if appropriate.
 This will be copied to the /usr/X11R6/lib/modules/extensions directory and can
 be enabled like any other module by adding a Load "vnc" line to the Module
-section of XF86Config.  The parameters listed in the Xvnc manual page can be
-set as options in XF86Config e.g. Option "passwordFile" "/root/.vnc/passwd".
+section of xorg.conf.  The parameters listed in the Xvnc manual page can be
+set as options in xorg.conf e.g. Option "passwordFile" "/root/.vnc/passwd".
 Note that for some reason options cannot be set in the Module section of
-XF86Config - try the Screen section.
+xorg.conf - try the Screen section.
 
 If you want to use the Java VNC viewer, you should copy the files from
 the java directory to some suitable installation directory such as
diff --git a/xc.patch b/xc.patch
index fb9baf6..c3444cb 100644
--- a/xc.patch
+++ b/xc.patch
@@ -1,55 +1,33 @@
-*** xc/programs/Xserver/Imakefile.orig	Fri Jun  6 11:02:36 2003
---- xc/programs/Xserver/Imakefile	Fri Jun  6 11:14:39 2003
+diff -bcr xc.xorg.org/config/cf/host.def xc/config/cf/host.def
+*** xc.xorg.org/config/cf/host.def	2004-10-08 11:44:16.000000000 +0200
+--- xc/config/cf/host.def	2005-02-11 14:08:51.000000000 +0100
 ***************
-*** 409,412 ****
---- 409,429 ----
-  #endif
-  #endif /* XsunServer */
-+ XCOMM
-+ XCOMM X VNC server
-+ XCOMM
-+ MFBDIR = mfb
-+ CFB8DIR = cfb
-+ CFB16DIR = cfb16
-+ CFB24DIR = cfb24
-+ CFB32DIR = cfb32
-+ XVNCDDXDIR = vnc/Xvnc
-+ XVNCDIRS = $(STDDIRS) $(MFBDIR) \
-+ 	    $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \
-+ 	    $(XVNCDDXDIR) $(DEPDIRS)
-+ XVNCOBJS = $(XVNCDDXDIR)/stubs.o $(XVNCDDXDIR)/miinitext.o
-+ XVNCLIBS = PreFbLibs vnc/Xvnc/LibraryTargetName(xvnc) CFBLibs PostFbLibs
-+ XVNCSYSLIBS = $(FONTLIBS) $(SYSLIBS)
-+ ServerTarget(Xvnc,$(XVNCDIRS),$(XVNCOBJS), \
-+ 	$(XVNCLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XVNCSYSLIBS))
+*** 1 ****
+--- 1,4 ----
+  #include <vnc.def>
++ #define HasFreetype2 NO
++ 
++ 
+diff -bcr xc.xorg.org/config/cf/vnc.def xc/config/cf/vnc.def
+*** xc.xorg.org/config/cf/vnc.def	2005-02-10 14:48:28.000000000 +0100
+--- xc/config/cf/vnc.def	2005-02-11 10:34:29.000000000 +0100
+***************
+*** 8,13 ****
+--- 8,15 ----
+  #define BuildGlxExt NO
+  #define XnestServer NO
+  #define XprtServer NO
++ #define XdmxServer NO
++ #define BuildDmx NO
   
-  
-*** xc/programs/Xserver/mi/miinitext.c.orig	Fri Jun  6 11:02:59 2003
---- xc/programs/Xserver/mi/miinitext.c	Fri Jun  6 11:17:15 2003
+  #ifdef SunArchitecture
+  #define ProjectRoot /usr/openwin
+diff -bcr xc.xorg.org/programs/Xserver/cfb/cfb8line.c xc/programs/Xserver/cfb/cfb8line.c
+*** xc.xorg.org/programs/Xserver/cfb/cfb8line.c	2004-04-23 21:00:12.000000000 +0200
+--- xc/programs/Xserver/cfb/cfb8line.c	2005-02-11 09:49:18.000000000 +0100
 ***************
-*** 150,153 ****
---- 150,156 ----
-  extern void MITMiscExtensionInit(INITARGS);
-  #endif
-+ #ifdef VNCEXT
-+ extern void vncExtensionInit(INITARGS);
-+ #endif
-  #ifdef XIDLE
-  extern void XIdleExtensionInit(INITARGS);
-***************
-*** 285,288 ****
---- 288,294 ----
-      MITMiscExtensionInit();
-  #endif
-+ #ifdef VNCEXT
-+     vncExtensionInit();
-+ #endif
-  #ifdef XIDLE
-      XIdleExtensionInit();
-*** xc/programs/Xserver/cfb/cfb8line.c.orig	Wed Sep 18 18:11:47 2002
---- xc/programs/Xserver/cfb/cfb8line.c	Thu Jun  5 18:32:04 2003
-***************
-*** 688,707 ****
+*** 695,716 ****
+  # if PSZ == 24
   	    y1_or_e1 = xOffset & 3;
   # else
 ! #  if PGSZ == 64 /* PIM value from <cfbmskbits.h> is not it! (for 16/32 PSZ)*/
@@ -70,7 +48,9 @@
 ! #endif /* PGSZ */
   # endif /* PSZ == 24 */
   #if PSZ == 24
---- 688,696 ----
+  	    {
+--- 695,705 ----
+  # if PSZ == 24
   	    y1_or_e1 = xOffset & 3;
   # else
 ! 	    /* Round addrp down to the next PixelGroup boundary, and
@@ -80,98 +60,10 @@
 ! 	    addrp -= y1_or_e1;
   # endif /* PSZ == 24 */
   #if PSZ == 24
-*** xc/programs/Xserver/cfb/cfbtile32.c.orig	Fri Dec 14 19:59:25 2001
---- xc/programs/Xserver/cfb/cfbtile32.c	Thu Jun  5 18:16:48 2003
-***************
-*** 73,77 ****
-                        (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p))))
-  
-! #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
-  # define Expand(left,right) {\
-      int part = nlwMiddle & ((PGSZB*2)-1); \
---- 73,83 ----
-                        (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p))))
-  
-! 
-! 
-! /* XXX TJR: I doubt that this optimised case works (because the non-24 bit case
-!    was broken), so I've added the #if 0 below.  Someone who knows what they're
-!    doing can re-enable it if they fix it */
-! 
-! #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) && 0
-  # define Expand(left,right) {\
-      int part = nlwMiddle & ((PGSZB*2)-1); \
-***************
-*** 145,150 ****
-  #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
-  # define Expand(left,right) {\
-!     int part = nlwMiddle & ((PGSZB*2)-1); \
-!     nlwMiddle >>= PWSH + 1; \
-      while (h--) { \
-  	srcpix = psrc[srcy]; \
---- 151,156 ----
-  #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
-  # define Expand(left,right) {\
-!     int part = nlwMiddle & 7; \
-!     nlwMiddle >>= 3; \
-      while (h--) { \
-  	srcpix = psrc[srcy]; \
-*** xc/programs/Xserver/cfb/cfbglblt8.c.orig	Fri Dec 14 19:59:23 2001
---- xc/programs/Xserver/cfb/cfbglblt8.c	Tue Aug 12 10:05:57 2003
-***************
-*** 284,288 ****
-      register glyphPointer   glyphBits;
-      register int	xoff;
-! #if defined(USE_LEFT_BITS) || (!defined(STIPPLE) && !defined(USE_STIPPLE_CODE))
-      register CfbBits	*dst;
-  #endif
---- 284,288 ----
-      register glyphPointer   glyphBits;
-      register int	xoff;
-! #if defined(USE_LEFTBITS) || (!defined(STIPPLE) && !defined(USE_STIPPLE_CODE))
-      register CfbBits	*dst;
-  #endif
-***************
-*** 292,296 ****
-      CfbBits		*dstLine;
-      CfbBits		*pdstBase;
-! #ifdef USE_LEFT_BITS
-      CARD32		*cTmp;
-  #endif
---- 292,296 ----
-      CfbBits		*dstLine;
-      CfbBits		*pdstBase;
-! #ifdef USE_LEFTBITS
-      CARD32		*cTmp;
-  #endif
-***************
-*** 399,403 ****
-  	    	} while (--hTmp);
-  	    	break;
-! #else /* !USE_LEFT_BITS */
-  	    	{
-  		    int h;
---- 399,403 ----
-  	    	} while (--hTmp);
-  	    	break;
-! #else /* !USE_LEFTBITS */
-  	    	{
-  		    int h;
-***************
-*** 412,416 ****
-  	    	glyphBits = clips;
-  	    	/* fall through */
-! #endif /* USE_LEFT_BITS */
-  	    case rgnIN:
-  #ifdef STIPPLE
---- 412,416 ----
-  	    	glyphBits = clips;
-  	    	/* fall through */
-! #endif /* USE_LEFTBITS */
-  	    case rgnIN:
-  #ifdef STIPPLE
-*** xc/programs/Xserver/cfb/cfbcppl.c.orig	Fri Dec 14 19:59:22 2001
---- xc/programs/Xserver/cfb/cfbcppl.c	Sun Apr 18 12:53:36 2004
+  	    {
+diff -bcr xc.xorg.org/programs/Xserver/cfb/cfbcppl.c xc/programs/Xserver/cfb/cfbcppl.c
+*** xc.xorg.org/programs/Xserver/cfb/cfbcppl.c	2004-04-23 21:00:12.000000000 +0200
+--- xc/programs/Xserver/cfb/cfbcppl.c	2005-02-11 09:49:18.000000000 +0100
 ***************
 *** 383,389 ****
   	psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + srcx;
@@ -189,3 +81,120 @@
   	{
   	    mfbmaskpartialbits(dstx, width, startmask);
   	    nlMiddle = 0;
+diff -bcr xc.xorg.org/programs/Xserver/cfb/cfbtile32.c xc/programs/Xserver/cfb/cfbtile32.c
+*** xc.xorg.org/programs/Xserver/cfb/cfbtile32.c	2004-04-23 21:00:12.000000000 +0200
+--- xc/programs/Xserver/cfb/cfbtile32.c	2005-02-11 09:49:18.000000000 +0100
+***************
+*** 72,78 ****
+                        (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \
+                        (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p))))
+  
+! #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
+  # define Expand(left,right) {\
+      int part = nlwMiddle & ((PGSZB*2)-1); \
+      nlwMiddle *= 3; \
+--- 72,84 ----
+                        (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \
+                        (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p))))
+  
+! 
+! 
+! /* XXX TJR: I doubt that this optimised case works (because the non-24 bit case
+!    was broken), so I've added the #if 0 below.  Someone who knows what they're
+!    doing can re-enable it if they fix it */
+! 
+! #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) && 0
+  # define Expand(left,right) {\
+      int part = nlwMiddle & ((PGSZB*2)-1); \
+      nlwMiddle *= 3; \
+***************
+*** 144,151 ****
+  
+  #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
+  # define Expand(left,right) {\
+!     int part = nlwMiddle & ((PGSZB*2)-1); \
+!     nlwMiddle >>= PWSH + 1; \
+      while (h--) { \
+  	srcpix = psrc[srcy]; \
+  	MROP_PREBUILD(srcpix); \
+--- 150,157 ----
+  
+  #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
+  # define Expand(left,right) {\
+!     int part = nlwMiddle & 7; \
+!     nlwMiddle >>= 3; \
+      while (h--) { \
+  	srcpix = psrc[srcy]; \
+  	MROP_PREBUILD(srcpix); \
+diff -bcr xc.xorg.org/programs/Xserver/Imakefile xc/programs/Xserver/Imakefile
+*** xc.xorg.org/programs/Xserver/Imakefile	2004-12-15 20:22:53.000000000 +0100
+--- xc/programs/Xserver/Imakefile	2005-02-11 13:36:54.000000000 +0100
+***************
+*** 414,419 ****
+--- 414,435 ----
+  #define ServerToInstall Xsun
+  #endif
+  #endif /* XsunServer */
++ XCOMM
++ XCOMM X VNC server
++ XCOMM
++ MFBSUBDIR = mfb
++ CFB8SUBDIR  = cfb   (8 bit cfb)
++ CFB16SUBDIR = cfb16 (16 bit cfb)
++ CFB24SUBDIR = cfb24 (24 bit cfb)
++ CFB32SUBDIR = cfb32 (32 bit cfb)
++ XVNCDDXDIR = vnc/Xvnc
++ XVNCDIRS = $(STDDIRS) $(MFBDIR) \
++ 	    $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \
++ 	    $(XVNCDDXDIR) $(DEPDIRS)
++ XVNCOBJS = $(XVNCDDXDIR)/stubs.o $(XVNCDDXDIR)/miinitext.o
++ XVNCLIBS = PreFbLibs vnc/Xvnc/LibraryTargetName(xvnc) CFBLibs PostFbLibs
++ ServerTarget(Xvnc,$(XVNCDIRS),$(XVNCOBJS), \
++ 	$(LIBCWRAPPER) $(XVNCLIBS) $(LOADABLEEXTS),$(FONTLIBS) $(SYSLIBS))
+  
+  
+  #if defined(Xsun24Server) && Xsun24Server
+diff -bcr xc.xorg.org/programs/Xserver/mi/miinitext.c xc/programs/Xserver/mi/miinitext.c
+*** xc.xorg.org/programs/Xserver/mi/miinitext.c	2004-12-13 06:48:41.000000000 +0100
+--- xc/programs/Xserver/mi/miinitext.c	2005-02-11 09:49:18.000000000 +0100
+***************
+*** 286,291 ****
+--- 286,294 ----
+  #ifdef MITMISC
+  extern void MITMiscExtensionInit(INITARGS);
+  #endif
++ #ifdef VNCEXT
++ extern void vncExtensionInit(INITARGS);
++ #endif
+  #ifdef XIDLE
+  extern void XIdleExtensionInit(INITARGS);
+  #endif
+***************
+*** 587,592 ****
+--- 590,598 ----
+  #ifdef MITMISC
+      if (!noMITMiscExtension) MITMiscExtensionInit();
+  #endif
++ #ifdef VNCEXT
++     vncExtensionInit();
++ #endif
+  #ifdef XIDLE
+      if (!noXIdleExtension) XIdleExtensionInit();
+  #endif
+diff -bcr xc.xorg.org/programs/Xserver/vnc/Xvnc/xvnc.cc xc/programs/Xserver/vnc/Xvnc/xvnc.cc
+*** xc.xorg.org/programs/Xserver/vnc/Xvnc/xvnc.cc	2004-10-08 11:44:19.000000000 +0200
+--- xc/programs/Xserver/vnc/Xvnc/xvnc.cc	2005-02-11 11:28:36.000000000 +0100
+***************
+*** 911,916 ****
+--- 911,921 ----
+    dispatchException &= ~DE_RESET;
+  }
+  
++ /* ddxInitGlobals - called by |InitGlobals| from os/util.c */
++ void ddxInitGlobals(void)
++ {
++ }
++ 
+  void InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
+  {
+    ErrorF("\nXvnc version %s - built %s\n", XVNCVERSION, buildtime);
diff --git a/xc/config/cf/host.def b/xc/config/cf/host.def
index 2de89af..ccfd4e9 100644
--- a/xc/config/cf/host.def
+++ b/xc/config/cf/host.def
@@ -1 +1,4 @@
 #include <vnc.def>
+#define HasFreetype2 NO
+
+
diff --git a/xc/config/cf/vnc.def b/xc/config/cf/vnc.def
index 35265e0..715044e 100644
--- a/xc/config/cf/vnc.def
+++ b/xc/config/cf/vnc.def
@@ -8,6 +8,8 @@
 #define BuildGlxExt NO
 #define XnestServer NO
 #define XprtServer NO
+#define XdmxServer NO
+#define BuildDmx NO
 
 #ifdef SunArchitecture
 #define ProjectRoot /usr/openwin
diff --git a/xc/programs/Xserver/vnc/Xvnc/xvnc.cc b/xc/programs/Xserver/vnc/Xvnc/xvnc.cc
index cf8fdf9..4936016 100644
--- a/xc/programs/Xserver/vnc/Xvnc/xvnc.cc
+++ b/xc/programs/Xserver/vnc/Xvnc/xvnc.cc
@@ -911,6 +911,11 @@
   dispatchException &= ~DE_RESET;
 }
 
+/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
+void ddxInitGlobals(void)
+{
+}
+
 void InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
 {
   ErrorF("\nXvnc version %s - built %s\n", XVNCVERSION, buildtime);