| 1 | 
– | 
/* Copyright (c) 1991 Regents of the University of California */ | 
| 2 | 
– | 
 | 
| 1 | 
  | 
#ifndef lint | 
| 2 | 
< | 
static char SCCSid[] = "$SunId$ LBL"; | 
| 2 | 
> | 
static const char       RCSid[] = "$Id$"; | 
| 3 | 
  | 
#endif | 
| 6 | 
– | 
 | 
| 4 | 
  | 
/* | 
| 5 | 
  | 
 *  Circle sources in a displayed image. | 
| 6 | 
  | 
 * | 
| 9 | 
  | 
 | 
| 10 | 
  | 
#include "standard.h" | 
| 11 | 
  | 
#include "view.h" | 
| 12 | 
< | 
#include "resolu.h" | 
| 12 | 
> | 
#include "paths.h" | 
| 13 | 
  | 
#include <signal.h> | 
| 14 | 
  | 
#include <X11/Xlib.h> | 
| 15 | 
  | 
#include <X11/Xutil.h> | 
| 16 | 
  | 
 | 
| 20 | 
– | 
#ifndef BSD | 
| 21 | 
– | 
#define vfork   fork | 
| 22 | 
– | 
#endif | 
| 23 | 
– | 
 | 
| 17 | 
  | 
#define XIM             "ximage" | 
| 18 | 
  | 
 | 
| 19 | 
  | 
#define NSEG            30              /* number of segments per circle */ | 
| 40 | 
  | 
int     argc; | 
| 41 | 
  | 
char    *argv[]; | 
| 42 | 
  | 
{ | 
| 50 | 
– | 
        extern double   atof(); | 
| 43 | 
  | 
        char    *windowname = NULL; | 
| 44 | 
  | 
        FILE    *fp; | 
| 45 | 
  | 
 | 
| 84 | 
  | 
        XWindowAttributes       wa; | 
| 85 | 
  | 
        XColor  xc; | 
| 86 | 
  | 
        XGCValues       gcv; | 
| 87 | 
+ | 
        register int    i; | 
| 88 | 
  | 
                                        /* get the viewing parameters */ | 
| 89 | 
  | 
        if (viewfile(pname, &ourview, &pres) <= 0 || | 
| 90 | 
  | 
                        setview(&ourview) != NULL) { | 
| 100 | 
  | 
                exit(1); | 
| 101 | 
  | 
        } | 
| 102 | 
  | 
                                        /* find our window */ | 
| 103 | 
< | 
        if (wname == NULL) | 
| 104 | 
< | 
                wname = pname; | 
| 105 | 
< | 
        gwind = xfindwind(theDisplay, rwind, wname, 2); | 
| 103 | 
> | 
        if (wname == NULL) { | 
| 104 | 
> | 
                                /* remove directory prefix from name */ | 
| 105 | 
> | 
                for (i = strlen(pname); i-- > 0; ) | 
| 106 | 
> | 
                        if (pname[i] == '/') | 
| 107 | 
> | 
                                break; | 
| 108 | 
> | 
                wname = pname+i+1; | 
| 109 | 
> | 
                i = 0; | 
| 110 | 
> | 
        } else | 
| 111 | 
> | 
                i = 1; | 
| 112 | 
> | 
        gwind = xfindwind(theDisplay, rwind, wname, 4); | 
| 113 | 
  | 
        if (gwind == None) { | 
| 114 | 
< | 
                if (wname != pname) { | 
| 114 | 
> | 
                if (i) { | 
| 115 | 
  | 
                        fprintf(stderr, "%s: cannot find \"%s\" window\n", | 
| 116 | 
  | 
                                        progname, wname); | 
| 117 | 
  | 
                        exit(2); | 
| 118 | 
  | 
                } | 
| 119 | 
  | 
                                        /* start ximage */ | 
| 120 | 
  | 
                if (vfork() == 0) { | 
| 121 | 
< | 
                        execlp(XIM, XIM, pname, 0); | 
| 121 | 
> | 
                        execlp(XIM, XIM, "-c", "256", pname, 0); | 
| 122 | 
  | 
                        perror(XIM); | 
| 123 | 
  | 
                        fprintf(stderr, "%s: cannot start %s\n", | 
| 124 | 
  | 
                                        progname, XIM); | 
| 127 | 
  | 
                } | 
| 128 | 
  | 
                do | 
| 129 | 
  | 
                        sleep(8); | 
| 130 | 
< | 
                while ((gwind=xfindwind(theDisplay,rwind,pname,2)) == None); | 
| 130 | 
> | 
                while ((gwind=xfindwind(theDisplay,rwind,wname,4)) == None); | 
| 131 | 
  | 
        } else | 
| 132 | 
  | 
                XMapRaised(theDisplay, gwind); | 
| 133 | 
  | 
        do { | 
| 138 | 
  | 
                fprintf(stderr, | 
| 139 | 
  | 
                "%s: warning -- window seems to be the wrong size!\n", | 
| 140 | 
  | 
                                progname); | 
| 141 | 
< | 
                if (pres.or & YMAJOR) { | 
| 141 | 
> | 
                if (pres.rt & YMAJOR) { | 
| 142 | 
  | 
                        pres.xr = wa.width; | 
| 143 | 
  | 
                        pres.yr = wa.height; | 
| 144 | 
  | 
                } else { |