[comp.windows.x] TeXx patches

grunwald@uiucdcsm.cs.uiuc.edu (04/06/88)

Enclosed is the current set of fixes I have for TeXx as a context diff with
the X11-R2 version of TeXx.

The most important fixes deal with the byte order for Vaxen. I don't know why
it's like this, to be honest.

Other fixes include eliminating extra EXPOSE events. Also, there was a glitch
concerning \specials which is now fixed.

TeXx (and a very much improved TeXsun, which is what I'd like TeXx to look
like) is also available via anonymous FTP from a.cs.uiuc.edu in file
'pub/TeX/iptex.tar.Z'

Dirk Grunwald
Univ. of Illinois
grunwald@m.cs.uiuc.edu
----- DIFFS -----
*** old-texx.c	Tue Apr  5 15:32:17 1988
--- texx.c	Tue Apr  5 15:27:40 1988
***************
*** 18,24 ****
  #include <ctype.h>
  
  #include "dvistuff.h"
! static char *rcsid="$Header: texx.c,v 1.2 88/02/11 16:55:22 jim Exp $" ;
  /*
   *	These constants may need to be changed on your implementation
   */
--- 18,24 ----
  #include <ctype.h>
  
  #include "dvistuff.h"
! static char *rcsid="$Header: texx.c,v 1.17 88/02/19 17:00:23 grunwald Exp $" ;
  /*
   *	These constants may need to be changed on your implementation
   */
***************
*** 358,364 ****
  
  /*
   *	Compute the page size given the number of leaves. We may have
!  *	to scale back if everything can't fit.
   */
      
      if (leaf_w[SHRINK_NORMAL] * Leaves <= maxWidth) {
--- 358,364 ----
  
  /*
   *	Compute the page size given the number of leaves. We may have
!  *	to scale back if everything cant fit.
   */
      
      if (leaf_w[SHRINK_NORMAL] * Leaves <= maxWidth) {
***************
*** 376,382 ****
      highpix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
      forepix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
      
!     XCopyGC(DISP, DefaultGC(DISP, 0), (1L<<(GCLastBit+1))-1, highpix);
      XCopyGC(DISP, highpix, (1L<<(GCLastBit+1))-1, forepix);
      
      if (reverse) {
--- 376,383 ----
      highpix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
      forepix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
      
!     XCopyGC(DISP, DefaultGC(DISP, defaultScreen),
! 	    (1L<<(GCLastBit+1))-1, highpix);
      XCopyGC(DISP, highpix, (1L<<(GCLastBit+1))-1, forepix);
      
      if (reverse) {
***************
*** 940,945 ****
--- 941,971 ----
  			     0, g->g_raster,
  			     g->g_width, g->g_height,
  			     16, 0);
+ #ifdef vax
+ /*
+  * This should get some runtime checking. At any rate, this
+  * little routine (taken from reverse_bytes() in xdvi.c) swaps
+  * the byte pairs into the correct order. I am still not sure
+  * why we must do this... [eichin:19880313.1601EST]
+  */
+     {
+ 	register long x,y;
+ 	register char *bp;
+ 	register char c;
+ 	
+ 	bp = g->g_raster ;
+ 	for ( y = 0 ; y < g->g_height ; y++) {
+             for ( x = 0 ; x < image->bytes_per_line ; x += 2) {
+ 		c = *bp ;
+ 		*bp = *(bp + 1) ;
+ 		bp++;
+ 		*bp++ = c ;
+             }
+ 	}  
+     }  
+         image->bitmap_bit_order = MSBFirst; /* MSB IS Correct (vax). */
+ #endif vax
+ 	
  
  	shrunkenImages[currentShrink][key][charCode] = image;
      }
***************
*** 1035,1046 ****
  	XDrawLine(DISP, pasteUpPixmap[currentShrink][currentLeaf],
  		   specialGC, xconv(fx), yconv(fy), xconv(tx), yconv(ty));
      } else {
  	XDrawLine(DISP, win,
! 		   specialGC, xconv(fx), yconv(fy), xconv(tx), yconv(ty));
      }
  }
  
- 
  /*
   * Draw a dot at (x,y)
   */
--- 1061,1074 ----
  	XDrawLine(DISP, pasteUpPixmap[currentShrink][currentLeaf],
  		   specialGC, xconv(fx), yconv(fy), xconv(tx), yconv(ty));
      } else {
+ 	int offset = currentLeaf * leaf_w[currentShrink];
  	XDrawLine(DISP, win,
! 		   specialGC,
! 		  xconv(fx) + offset, yconv(fy),
! 		  xconv(tx) + offset, yconv(ty));
      }
  }
  
  /*
   * Draw a dot at (x,y)
   */
***************
*** 1059,1065 ****
  
  #ifdef UNDEF
  /*
!  *	This is the code as it appears in TeXsun. I don't have the time to
   *	make this do the shading in X-11. If someone does this, please post
   *	diffs to the net.
   *
--- 1087,1093 ----
  
  #ifdef UNDEF
  /*
!  *	This is the code as it appears in TeXsun. I dont have the time to
   *	make this do the shading in X-11. If someone does this, please post
   *	diffs to the net.
   *
***************
*** 1096,1106 ****
  		    PIX_SRC, shade_pr, 0, 0);
  	    }
  	    else {
  		pw_replrop(ptube,
! 		    xconv(last_min_x) + currentLeaf*leaf_w[currentShrink]
! 			   + pen_size,
  		    yconv(last_min_y) + pen_size,
! 		    xconv(last_max_x) - xconv(last_min_x) - pen_size,
  		    yconv(last_max_y) - yconv(last_min_y) - pen_size,
  		    PIX_SRC, shade_pr, 0, 0);
  	    }
--- 1124,1134 ----
  		    PIX_SRC, shade_pr, 0, 0);
  	    }
  	    else {
+ 		int offset = currentLeaf*leaf_w[currentShrink]
  		pw_replrop(ptube,
! 		    xconv(last_min_x) + pen_size + offset,
  		    yconv(last_min_y) + pen_size,
! 		    xconv(last_max_x) - xconv(last_min_x) - pen_size + offset,
  		    yconv(last_max_y) - yconv(last_min_y) - pen_size,
  		    PIX_SRC, shade_pr, 0, 0);
  	    }
***************
*** 1184,1189 ****
--- 1212,1220 ----
  	    continue;
  	    
  	case Expose:
+             if ( event.xexpose.count > 0 ) break; /* no more flicker!
+                                                    * [eichin:19880328.1332EST]
+                                                    */
  	    string = "\f";
  	    nbytes = 1;
  	    break;