| 22 |
|
|
| 23 |
|
char *progname; /* program name */ |
| 24 |
|
|
| 25 |
+ |
char *picture; /* picture name */ |
| 26 |
+ |
|
| 27 |
|
FILE *pin; /* input stream */ |
| 28 |
|
|
| 29 |
|
Display *theDisplay = NULL; /* connection to server */ |
| 54 |
|
break; |
| 55 |
|
if (i > argc-2) { |
| 56 |
|
fprintf(stderr, "Usage: %s [-s] [rtrace args] octree picture\n", |
| 57 |
< |
argv[0]); |
| 57 |
> |
progname); |
| 58 |
|
exit(1); |
| 59 |
|
} |
| 60 |
+ |
picture = argv[argc-1]; |
| 61 |
|
/* get the viewing parameters */ |
| 62 |
< |
if (viewfile(argv[argc-1], &ourview, &xres, &yres) <= 0 || |
| 62 |
> |
if (viewfile(picture, &ourview, &xres, &yres) <= 0 || |
| 63 |
|
setview(&ourview) != NULL) { |
| 64 |
|
fprintf(stderr, "%s: cannot get view from \"%s\"\n", |
| 65 |
< |
argv[0], argv[argc-1]); |
| 65 |
> |
progname, picture); |
| 66 |
|
exit(1); |
| 67 |
|
} |
| 68 |
|
/* open the display */ |
| 69 |
|
if ((theDisplay = XOpenDisplay(NULL)) == NULL) { |
| 70 |
|
fprintf(stderr, |
| 71 |
|
"%s: cannot open display; DISPLAY variable set?\n", |
| 72 |
< |
argv[0]); |
| 72 |
> |
progname); |
| 73 |
|
exit(1); |
| 74 |
|
} |
| 75 |
|
/* build input command */ |
| 76 |
< |
sprintf(combuf, "%s %s | %s", xicom, argv[argc-1], rtcom); |
| 76 |
> |
sprintf(combuf, "%s %s | %s", xicom, picture, rtcom); |
| 77 |
|
for ( ; i < argc-1; i++) { |
| 78 |
|
strcat(combuf, " "); |
| 79 |
|
strcat(combuf, argv[i]); |
| 181 |
|
Window rw, cw; |
| 182 |
|
unsigned int pm; |
| 183 |
|
/* compute pointer location */ |
| 184 |
< |
if (gwind == 0) { |
| 185 |
< |
XQueryPointer(theDisplay, rwind, &rw, &gwind, |
| 186 |
< |
&rx, &ry, &wx, &wy, &pm); |
| 184 |
> |
if (gwind == 0 && |
| 185 |
> |
(gwind = xfindwind(theDisplay, rwind, picture, 2)) == 0) { |
| 186 |
> |
fprintf(stderr, "%s: cannot find display window!\n", progname); |
| 187 |
> |
exit(1); |
| 188 |
|
} |
| 189 |
< |
XQueryPointer(theDisplay, gwind, &rw, &cw, |
| 186 |
< |
&rx, &ry, &wx, &wy, &pm); |
| 189 |
> |
XQueryPointer(theDisplay, gwind, &rw, &cw, &rx, &ry, &wx, &wy, &pm); |
| 190 |
|
xoff = wx - ipt[0]*xres; |
| 191 |
|
yoff = wy - (1.-ipt[1])*yres; |
| 192 |
|
/* set graphics context */ |