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" |
15 |
– |
#include "resolu.h" |
16 |
– |
#include "vfork.h" |
12 |
|
#include <signal.h> |
13 |
|
#include <X11/Xlib.h> |
14 |
|
#include <X11/Xutil.h> |
83 |
|
XWindowAttributes wa; |
84 |
|
XColor xc; |
85 |
|
XGCValues gcv; |
86 |
+ |
register int i; |
87 |
|
/* get the viewing parameters */ |
88 |
|
if (viewfile(pname, &ourview, &pres) <= 0 || |
89 |
|
setview(&ourview) != NULL) { |
99 |
|
exit(1); |
100 |
|
} |
101 |
|
/* find our window */ |
102 |
< |
if (wname == NULL) |
103 |
< |
wname = pname; |
104 |
< |
gwind = xfindwind(theDisplay, rwind, wname, 2); |
102 |
> |
if (wname == NULL) { |
103 |
> |
/* remove directory prefix from name */ |
104 |
> |
for (i = strlen(pname); i-- > 0; ) |
105 |
> |
if (pname[i] == '/') |
106 |
> |
break; |
107 |
> |
wname = pname+i+1; |
108 |
> |
i = 0; |
109 |
> |
} else |
110 |
> |
i = 1; |
111 |
> |
gwind = xfindwind(theDisplay, rwind, wname, 4); |
112 |
|
if (gwind == None) { |
113 |
< |
if (wname != pname) { |
113 |
> |
if (i) { |
114 |
|
fprintf(stderr, "%s: cannot find \"%s\" window\n", |
115 |
|
progname, wname); |
116 |
|
exit(2); |
117 |
|
} |
118 |
|
/* start ximage */ |
119 |
< |
if (vfork() == 0) { |
120 |
< |
execlp(XIM, XIM, pname, 0); |
119 |
> |
if (fork() == 0) { |
120 |
> |
execlp(XIM, XIM, "-c", "256", pname, 0); |
121 |
|
perror(XIM); |
122 |
|
fprintf(stderr, "%s: cannot start %s\n", |
123 |
|
progname, XIM); |
126 |
|
} |
127 |
|
do |
128 |
|
sleep(8); |
129 |
< |
while ((gwind=xfindwind(theDisplay,rwind,pname,2)) == None); |
129 |
> |
while ((gwind=xfindwind(theDisplay,rwind,wname,4)) == None); |
130 |
|
} else |
131 |
|
XMapRaised(theDisplay, gwind); |
132 |
|
do { |
137 |
|
fprintf(stderr, |
138 |
|
"%s: warning -- window seems to be the wrong size!\n", |
139 |
|
progname); |
140 |
< |
if (pres.or & YMAJOR) { |
140 |
> |
if (pres.rt & YMAJOR) { |
141 |
|
pres.xr = wa.width; |
142 |
|
pres.yr = wa.height; |
143 |
|
} else { |