ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/xshowtrace.c
(Generate patch)

Comparing ray/src/px/xshowtrace.c (file contents):
Revision 1.3 by greg, Mon Sep 24 12:21:06 1990 UTC vs.
Revision 1.6 by greg, Fri Jul 26 14:14:03 1991 UTC

# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ LBL";
14  
15   #define MAXDEPTH        32              /* ridiculous ray tree depth */
16  
17 < char    rtcom[] = "rtrace -h -otp -fa -x 1";
18 < char    xicom[] = "x11image -f";
17 > char    rtcom[] = "rtrace -h- -otp -fa -x 1";
18 > char    xicom[] = "ximage";
19  
20   VIEW    ourview = STDVIEW;              /* view for picture */
21   int     xres, yres;
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 */
# Line 43 | Line 45 | char   *argv[];
45   {
46          int     i;
47          char    combuf[256];
46        Cursor  curs;
48  
49          progname = argv[0];
50          for (i = 1; i < argc-2; i++)
# Line 53 | Line 54 | char   *argv[];
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]);
# Line 175 | Line 177 | double ipt[2];
177          XWindowAttributes       wa;
178          XColor  xc;
179          XGCValues       gcv;
180 <        int     pm, rx, ry, wx, wy, rw, cw;
180 >        int     rx, ry, wx, wy;
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,
185 <                        &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 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines