russell@turing.ac.uk (Russell Ritchie ) (02/03/89)
Hello, I have a query regarding X11R3 and TeXX. We are using SUN machines (3/60, 3/110, 3/160) and cannot get TeXX to work on colour displays (/dev/cgfour0). It fails with a protocol error, viz: X Protocol error: BadMatch, invalid parameter attributes Major opcode of failed request: 70 (X_PolyFillRectangle) Minor opcode of failed request: 0 Resource id in failed request: 0x4077ffff Serial number of failed request: 31 Current serial number in output stream: 1245 Is this a known bug? It works (seemingly) the monochrome frame buffer. Am I missing something obvious? Thanks in advance, Russell Ritchie, Scottish HCI Centre
mic@ut-emx.UUCP (Mic (... K[a-z]+) Kaczmarczik) (02/05/89)
In article <574@tivax.turing.ac.uk> russell@turing.ac.uk (Russell Ritchie ) writes: >We are using SUN machines (3/60, 3/110, 3/160) and cannot get TeXX to >work on colour displays (/dev/cgfour0). It fails with a protocol >error, viz: I think the protocol error occurs because TeXX doesn't open its paste-up pixmaps with the right depth (it always uses 1 regardless of the depth of the screen). At least, I think this because when I changed the 2 calls to XCreatePixmap() in contrib/clients/texx/previewers/texx.c to use DisplayPlanes(DISP, DefaultScreen) instead of 1, it then worked on a Sun-4 with a CG3 running the distribution cfb server. I don't know enough about X 11 to be sure that this is the proper way to determine the particular depth texx needs here, but it seems to work ok in practice. -- Mic Kaczmarczik If you drink, don't drill. UT Austin Computation Center -- Matt Groening mic@emx.utexas.edu MIC@UTAIVC.BITNET
jgarb@CSD360B.ERIM.ORG (Joe Garbarino) (02/06/89)
Russell,
Here is a patch that should repair TeXX.
Joe Garbarino
ERIM
P.O. Box 8618
Ann Arbor, Mi. 48107
(313)994-1200 x2508
jgarb@csd360b.erim.org
-----------cut here--------------cut here-------------cut here-----------------
*** texx.c Mon Aug 29 13:22:08 1988
--- /usr/src/local/X11R3/contrib/clients/texx/previewers/texx.c Fri Feb 26 01:05:37 1988
***************
*** 18,24 ****
#include <ctype.h>
#include "dvistuff.h"
! static char *rcsid="$Header: texx.c,v 1.20 88/08/29 13:20:48 grunwald 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.2 88/02/11 16:55:22 jim Exp $" ;
/*
* These constants may need to be changed on your implementation
*/
***************
*** 30,37 ****
#define BitsPerByteMask 0x7
#define BitsPerByteShift 3
! #define GCallbits ((1L<<(GCLastBit+1))-1)
!
/*
* Note that ROUNDUP evaluates Y twice.
*/
--- 30,36 ----
#define BitsPerByteMask 0x7
#define BitsPerByteShift 3
! #define BytesPerShot 2
/*
* Note that ROUNDUP evaluates Y twice.
*/
***************
*** 104,114 ****
/*
* I don't know why this is needed, but our sun seems to thing
! * and is or & vice versa. This is true even running X11R2
*/
! /*
! #if defined(sun) || defined(USE_SUN)
#define GXAND GXand
#define GXOR GXor
#else
--- 103,112 ----
/*
* I don't know why this is needed, but our sun seems to thing
! * and is or & vice versa
*/
! #ifdef mc68000
#define GXAND GXand
#define GXOR GXor
#else
***************
*** 115,124 ****
#define GXAND GXor
#define GXOR GXand
#endif
- */
- int Black_Pixel = 0;
-
main(argc, argv)
int argc;
char **argv;
--- 113,119 ----
***************
*** 159,165 ****
ProgName, XDisplayName(display));
exit(1);
}
- Black_Pixel = XBlackPixel(DISP, 0);
if ((option = XGetDefault(DISP, ProgName, "ReverseVideo")) &&
strcmp(option, "on") == 0)
--- 154,159 ----
***************
*** 348,366 ****
* Based on the shrink factor, choose a shrink factor for the enlarged
* display
*/
if (shrinkFactor[SHRINK_LARGE] == 0) {
shrinkFactor[SHRINK_LARGE] = shrinkFactor[SHRINK_NORMAL] / 2;
}
shrinkFactor[SHRINK_LARGE] = MIN(shrinkFactor[SHRINK_LARGE],
shrinkFactor[SHRINK_NORMAL]-1);
shrinkFactor[SHRINK_LARGE] = MAX(shrinkFactor[SHRINK_LARGE], 1);
page_h[SHRINK_LARGE]=(rawDviHeight + shrinkFactor[SHRINK_LARGE] - 1)
/ shrinkFactor[SHRINK_LARGE];
leaf_w[SHRINK_LARGE]=(rawDviWidth + shrinkFactor[SHRINK_LARGE] - 1)
/ shrinkFactor[SHRINK_LARGE];
/*
* 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) {
--- 342,364 ----
* Based on the shrink factor, choose a shrink factor for the enlarged
* display
*/
+
if (shrinkFactor[SHRINK_LARGE] == 0) {
shrinkFactor[SHRINK_LARGE] = shrinkFactor[SHRINK_NORMAL] / 2;
}
+
shrinkFactor[SHRINK_LARGE] = MIN(shrinkFactor[SHRINK_LARGE],
shrinkFactor[SHRINK_NORMAL]-1);
shrinkFactor[SHRINK_LARGE] = MAX(shrinkFactor[SHRINK_LARGE], 1);
+
page_h[SHRINK_LARGE]=(rawDviHeight + shrinkFactor[SHRINK_LARGE] - 1)
/ shrinkFactor[SHRINK_LARGE];
leaf_w[SHRINK_LARGE]=(rawDviWidth + shrinkFactor[SHRINK_LARGE] - 1)
/ shrinkFactor[SHRINK_LARGE];
+
/*
* 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) {
***************
*** 378,385 ****
highpix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
forepix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
! XCopyGC(DISP, DefaultGC(DISP, 0), GCallbits, highpix);
! XCopyGC(DISP, highpix, GCallbits, 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, 0), (1L<<(GCLastBit+1))-1, highpix);
! XCopyGC(DISP, highpix, (1L<<(GCLastBit+1))-1, forepix);
if (reverse) {
***************
*** 388,400 ****
backpix = BlackPixel(DISP, defaultScreen);
bdrpix = WhitePixel(DISP, defaultScreen);
mouspix = WhitePixel(DISP, defaultScreen);
! if (Black_Pixel) {
! XSetFunction(DISP, forepix, GXand); /* or */
! XSetFunction(DISP, highpix, GXand);
! } else {
! XSetFunction(DISP, forepix, GXor); /* or */
! XSetFunction(DISP, highpix, GXor);
! }
} else {
XSetForeground(DISP, forepix, BlackPixel(DISP, defaultScreen));
--- 386,394 ----
backpix = BlackPixel(DISP, defaultScreen);
bdrpix = WhitePixel(DISP, defaultScreen);
mouspix = WhitePixel(DISP, defaultScreen);
! XSetFunction(DISP, forepix, GXAND); /* or */
! XSetFunction(DISP, highpix, GXAND);
!
} else {
XSetForeground(DISP, forepix, BlackPixel(DISP, defaultScreen));
***************
*** 402,414 ****
backpix = WhitePixel(DISP, defaultScreen);
bdrpix = BlackPixel(DISP, defaultScreen);
mouspix = BlackPixel(DISP, defaultScreen);
! if (Black_Pixel) {
! XSetFunction(DISP, forepix, GXor); /* and */
! XSetFunction(DISP, highpix, GXor);
! } else {
! XSetFunction(DISP, forepix, GXand); /* and */
! XSetFunction(DISP, highpix, GXand);
! }
}
if (DisplayCells(DISP, 0) > 2) {
--- 396,403 ----
backpix = WhitePixel(DISP, defaultScreen);
bdrpix = BlackPixel(DISP, defaultScreen);
mouspix = BlackPixel(DISP, defaultScreen);
! XSetFunction(DISP, forepix, GXOR); /* and */
! XSetFunction(DISP, highpix, GXOR);
}
if (DisplayCells(DISP, 0) > 2) {
***************
*** 486,492 ****
XFlush(DISP);
specialGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
! XCopyGC(DISP, forepix, GCallbits, specialGC);
mainLoop();
stop_output(0);
--- 475,481 ----
XFlush(DISP);
specialGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
! XCopyGC(DISP, forepix, (1L<<(GCLastBit+1))-1, specialGC);
mainLoop();
stop_output(0);
***************
*** 533,541 ****
ProgName, shrinkSize);
exit(1);
}
XFillRectangle(DISP, pasteUpPixmap[shrinkSize][leaf], pasteFillGC, 0, 0,
leaf_w[shrinkSize], page_h[shrinkSize]);
- XSync(DISP, 0);
}
static void
--- 522,530 ----
ProgName, shrinkSize);
exit(1);
}
+
XFillRectangle(DISP, pasteUpPixmap[shrinkSize][leaf], pasteFillGC, 0, 0,
leaf_w[shrinkSize], page_h[shrinkSize]);
}
static void
***************
*** 550,562 ****
allocatePixmaps()
{
int i;
- XWindowAttributes wa;
- XGetWindowAttributes(DISP, RootWindow(DISP,0), &wa);
for (i = 0; i < Leaves; i++ ) {
pasteUpPixmap[SHRINK_NORMAL][i] =
XCreatePixmap(DISP, win, leaf_w[SHRINK_NORMAL],
! page_h[SHRINK_NORMAL], wa.depth);
if (pasteUpPixmap[SHRINK_NORMAL][i] == 0) {
fprintf(stderr,"[%s] erp! out of PIXMAP memory!\n",
ProgName);
--- 539,550 ----
allocatePixmaps()
{
int i;
for (i = 0; i < Leaves; i++ ) {
pasteUpPixmap[SHRINK_NORMAL][i] =
XCreatePixmap(DISP, win, leaf_w[SHRINK_NORMAL],
! page_h[SHRINK_NORMAL], 1);
!
if (pasteUpPixmap[SHRINK_NORMAL][i] == 0) {
fprintf(stderr,"[%s] erp! out of PIXMAP memory!\n",
ProgName);
***************
*** 569,576 ****
if (pasteFillGC == 0) {
pasteFillGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen),0,NULL);
pasteCopyGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen),0,NULL);
! XCopyGC(DISP, forepix, GCallbits, pasteFillGC);
! XCopyGC(DISP, forepix, GCallbits, pasteCopyGC);
if (reverse) {
XSetForeground(DISP, pasteFillGC, BlackPixel(DISP, defaultScreen));
} else {
--- 557,564 ----
if (pasteFillGC == 0) {
pasteFillGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen),0,NULL);
pasteCopyGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen),0,NULL);
! XCopyGC(DISP, forepix, (1L<<(GCLastBit+1))-1, pasteFillGC);
! XCopyGC(DISP, forepix, (1L<<(GCLastBit+1))-1, pasteCopyGC);
if (reverse) {
XSetForeground(DISP, pasteFillGC, BlackPixel(DISP, defaultScreen));
} else {
***************
*** 591,603 ****
allocateLargePixmaps()
{
int i;
- XWindowAttributes wa;
-
- XGetWindowAttributes(DISP, RootWindow(DISP,0), &wa);
for (i = 0; i < Leaves; i++) {
pasteUpPixmap[SHRINK_LARGE][i] =
XCreatePixmap(DISP, win, leaf_w[SHRINK_LARGE],
! page_h[SHRINK_LARGE], wa.depth);
clearPixmap(i, SHRINK_LARGE);
}
--- 579,588 ----
allocateLargePixmaps()
{
int i;
for (i = 0; i < Leaves; i++) {
pasteUpPixmap[SHRINK_LARGE][i] =
XCreatePixmap(DISP, win, leaf_w[SHRINK_LARGE],
! page_h[SHRINK_LARGE], 1);
clearPixmap(i, SHRINK_LARGE);
}
***************
*** 675,681 ****
displayLeaves()
{
int leaf;
-
XClearWindow(DISP,win);
for (leaf = 0; leaf < Leaves; leaf++) {
XCopyArea(DISP, pasteUpPixmap[SHRINK_NORMAL][leaf], win, forepix,
--- 660,665 ----
***************
*** 683,689 ****
leaf_w[SHRINK_NORMAL], page_h[SHRINK_NORMAL],
leaf_w[SHRINK_NORMAL] * leaf, 0);
}
-
}
static void displayLeaf(leaf)
--- 667,672 ----
***************
*** 958,966 ****
g->g_width, g->g_height,
16, 0);
- image -> bitmap_unit = 8;
- image -> bitmap_bit_order = MSBFirst;
-
shrunkenImages[currentShrink][key][charCode] = image;
}
--- 941,946 ----
***************
*** 976,982 ****
0, 0,
x + currentLeaf * leaf_w[currentShrink], y,
g->g_width, g->g_height);
- XSync(DISP, 0);
}
}
--- 956,961 ----
***************
*** 1056,1069 ****
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)
*/
--- 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)
*/
***************
*** 1082,1088 ****
#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.
*
--- 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.
*
***************
*** 1119,1129 ****
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);
}
--- 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);
}
***************
*** 1207,1215 ****
continue;
case Expose:
- if ( event.xexpose.count > 0 ) break; /* no more flicker!
- * [eichin:19880328.1332EST]
- */
string = "\f";
nbytes = 1;
break;
--- 1184,1189 ----