| 11 |
|
#include <X11/extensions/SGIStereo.h> |
| 12 |
|
#endif |
| 13 |
|
#include <ctype.h> |
| 14 |
+ |
#include <string.h> |
| 15 |
|
#include <time.h> |
| 16 |
+ |
|
| 17 |
|
#include "radogl.h" |
| 18 |
|
#include "view.h" |
| 19 |
|
#include "paths.h" |
| 20 |
|
#include "glradicon.h" |
| 21 |
+ |
#include "rtprocess.h" |
| 22 |
|
|
| 23 |
|
#ifndef MAXVIEW |
| 24 |
|
#define MAXVIEW 63 /* maximum number of standard views */ |
| 75 |
|
int nscenef = 0; /* number of scene files */ |
| 76 |
|
char *octree; /* octree name (NULL if unnec.) */ |
| 77 |
|
|
| 78 |
< |
int rtpd[3]; /* rtrace process descriptors */ |
| 78 |
> |
SUBPROC rtpd; /* rtrace process descriptors */ |
| 79 |
|
|
| 80 |
|
int silent = 0; /* run rad silently? */ |
| 81 |
|
int backvis = 1; /* back faces visible? */ |
| 82 |
|
int stereo = 0; /* do stereo? */ |
| 83 |
|
|
| 84 |
|
#ifdef NOSTEREO |
| 85 |
< |
#define setstereobuf(bid) 0 |
| 85 |
> |
#define setstereobuf(bid) |
| 86 |
|
#else |
| 87 |
|
#define setstereobuf(bid) (glXWaitGL(), \ |
| 88 |
|
XSGISetStereoBuffer(ourdisplay, gwind, bid), \ |
| 93 |
|
|
| 94 |
|
int no_render = 0; /* don't rerender */ |
| 95 |
|
|
| 93 |
– |
#ifdef BSD |
| 94 |
– |
#define strchr index |
| 95 |
– |
#endif |
| 96 |
– |
|
| 97 |
– |
extern char *strchr(), *fgets(), *fgetline(), *atos(), *scan4var(); |
| 96 |
|
extern int nowarn; /* turn warnings off? */ |
| 99 |
– |
extern time_t time(); |
| 97 |
|
|
| 98 |
+ |
static void startrtrace(char *octname); |
| 99 |
+ |
static void runrad(int ac, char **av); |
| 100 |
+ |
static int findvw(register char *nm); |
| 101 |
+ |
static int varmatch(register char *s, register char *vn); |
| 102 |
+ |
static char * scan4var(char *buf, int buflen, char *vname, FILE *fp); |
| 103 |
+ |
static void dev_open(char *id); |
| 104 |
+ |
static void dev_close(void); |
| 105 |
+ |
static int dev_view(register VIEW *nv); |
| 106 |
+ |
static int dev_input(int nsecs); |
| 107 |
+ |
static void render(void); |
| 108 |
+ |
static int moveview(int dx, int dy, int mov, int orb); |
| 109 |
+ |
static void waitabit(void); |
| 110 |
+ |
static void getmove(XButtonPressedEvent *ebut); |
| 111 |
+ |
static int getintersect(FVECT wp, FVECT org, FVECT dir, double md); |
| 112 |
+ |
static void setglpersp(register VIEW *vp); |
| 113 |
+ |
static int getkey(register XKeyPressedEvent *ekey); |
| 114 |
+ |
static void zoomview(int pct, int dx, int dy); |
| 115 |
+ |
static void gotoview(int vwnum); |
| 116 |
+ |
static void appendview(char *nm, VIEW *vp); |
| 117 |
+ |
static void copylastv(char *cause); |
| 118 |
+ |
static void fixwindow(register XExposeEvent *eexp); |
| 119 |
+ |
static void resizewindow(register XConfigureEvent *ersz); |
| 120 |
|
|
| 121 |
< |
main(argc, argv) |
| 122 |
< |
int argc; |
| 123 |
< |
char *argv[]; |
| 121 |
> |
|
| 122 |
> |
int |
| 123 |
> |
main( |
| 124 |
> |
int argc, |
| 125 |
> |
char *argv[] |
| 126 |
> |
) |
| 127 |
|
{ |
| 128 |
|
char *viewsel = NULL; |
| 129 |
|
long vwintvl = 0; |
| 162 |
|
/* run rad and get views */ |
| 163 |
|
runrad(argc-i, argv+i); |
| 164 |
|
/* check view */ |
| 165 |
< |
if (viewsel != NULL) |
| 165 |
> |
if (viewsel != NULL) { |
| 166 |
|
if (viewsel[0] == '-') { |
| 167 |
|
char *ve = viewsel; |
| 168 |
|
if (!sscanview(&thisview, viewsel) || |
| 177 |
|
progname, viewsel); |
| 178 |
|
quit(1); |
| 179 |
|
} |
| 180 |
+ |
} |
| 181 |
|
/* open GL */ |
| 182 |
|
dev_open(radfile = argv[i]); |
| 183 |
|
/* load octree or scene files */ |
| 198 |
|
"Usage: %s [-w][-s][-b][-S][-v view] rfile [VAR=value]..\n", |
| 199 |
|
argv[0]); |
| 200 |
|
quit(1); |
| 201 |
+ |
return 1; /* pro forma return */ |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
|
| 205 |
|
void |
| 206 |
< |
quit(code) /* exit gracefully */ |
| 207 |
< |
int code; |
| 206 |
> |
quit( /* exit gracefully */ |
| 207 |
> |
int code |
| 208 |
> |
) |
| 209 |
|
{ |
| 210 |
|
if (ourdisplay != NULL) |
| 211 |
|
dev_close(); |
| 212 |
< |
if (rtpd[2] > 0) { |
| 213 |
< |
if (close_process(rtpd) > 0) |
| 212 |
> |
/* if (rtpd.pid > 0) { */ |
| 213 |
> |
if (rtpd.running) { |
| 214 |
> |
if (close_process(&rtpd) > 0) |
| 215 |
|
wputs("bad exit status from rtrace\n"); |
| 216 |
< |
rtpd[2] = 0; |
| 216 |
> |
/* rtpd.pid = 0; */ |
| 217 |
|
} |
| 218 |
|
exit(code); |
| 219 |
|
} |
| 220 |
|
|
| 221 |
|
|
| 222 |
< |
startrtrace(octname) /* start rtrace on octname */ |
| 223 |
< |
char *octname; |
| 222 |
> |
static void |
| 223 |
> |
startrtrace( /* start rtrace on octname */ |
| 224 |
> |
char *octname |
| 225 |
> |
) |
| 226 |
|
{ |
| 227 |
|
static char *av[12] = {"rtrace", "-h", "-fff", "-ld+", |
| 228 |
|
"-opL", "-x", "1"}; |
| 231 |
|
if (nowarn) av[ac++] = "-w-"; |
| 232 |
|
av[ac++] = octname; |
| 233 |
|
av[ac] = NULL; |
| 234 |
< |
if (open_process(rtpd, av) <= 0) |
| 234 |
> |
if (open_process(&rtpd, av) <= 0) |
| 235 |
|
error(SYSTEM, "cannot start rtrace process"); |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
|
| 239 |
< |
runrad(ac, av) /* run rad and load variables */ |
| 240 |
< |
int ac; |
| 241 |
< |
char **av; |
| 239 |
> |
static void |
| 240 |
> |
runrad( /* run rad and load variables */ |
| 241 |
> |
int ac, |
| 242 |
> |
char **av |
| 243 |
> |
) |
| 244 |
|
{ |
| 245 |
|
static char optfile[] = TEMPLATE; |
| 246 |
|
int nvn = 0, nvv = 0; |
| 247 |
|
FILE *fp; |
| 218 |
– |
int cval; |
| 248 |
|
register char *cp; |
| 249 |
|
char radcomm[256], buf[128], nam[32]; |
| 250 |
|
/* set rad commmand */ |
| 272 |
|
/* get exposure */ |
| 273 |
|
if ((cp = scan4var(buf, sizeof(buf), "EXPOSURE", fp)) != NULL) { |
| 274 |
|
expval = atof(cp); |
| 275 |
< |
if (*cp == '-' | *cp == '+') |
| 275 |
> |
if ((*cp == '-') | (*cp == '+')) |
| 276 |
|
expval = pow(2., expval); |
| 277 |
|
expval *= 0.5; /* compensate for local shading */ |
| 278 |
|
} |
| 304 |
|
do |
| 305 |
|
if (isview(buf)) { |
| 306 |
|
vwl[nvv].v = (VIEW *)bmalloc(sizeof(VIEW)); |
| 307 |
< |
copystruct(vwl[nvv].v, &stdview); |
| 307 |
> |
*(vwl[nvv].v) = stdview; |
| 308 |
|
sscanview(vwl[nvv].v, buf); |
| 309 |
|
if ((cp = setview(vwl[nvv++].v)) != NULL) { |
| 310 |
|
fprintf(stderr, "%s: bad view %d - %s\n", |
| 333 |
|
} |
| 334 |
|
|
| 335 |
|
|
| 336 |
< |
int |
| 337 |
< |
findvw(nm) /* find named view */ |
| 338 |
< |
register char *nm; |
| 336 |
> |
static int |
| 337 |
> |
findvw( /* find named view */ |
| 338 |
> |
register char *nm |
| 339 |
> |
) |
| 340 |
|
{ |
| 341 |
|
register int n; |
| 342 |
|
|
| 343 |
< |
if (*nm >= '1' & *nm <= '9' && |
| 343 |
> |
if ((*nm >= '1') & (*nm <= '9') && |
| 344 |
|
(n = atoi(nm)-1) <= MAXVIEW && vwl[n].v != NULL) |
| 345 |
|
return(n); |
| 346 |
|
for (n = 0; vwl[n].v != NULL; n++) |
| 350 |
|
} |
| 351 |
|
|
| 352 |
|
|
| 353 |
< |
int |
| 354 |
< |
varmatch(s, vn) /* match line to variable */ |
| 355 |
< |
register char *s, *vn; |
| 353 |
> |
static int |
| 354 |
> |
varmatch( /* match line to variable */ |
| 355 |
> |
register char *s, |
| 356 |
> |
register char *vn |
| 357 |
> |
) |
| 358 |
|
{ |
| 359 |
|
register int c; |
| 360 |
|
|
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
|
| 373 |
< |
char * |
| 374 |
< |
scan4var(buf, buflen, vname, fp) /* scan for variable from fp */ |
| 375 |
< |
char *buf; |
| 376 |
< |
int buflen; |
| 377 |
< |
char *vname; |
| 378 |
< |
FILE *fp; |
| 373 |
> |
static char * |
| 374 |
> |
scan4var( /* scan for variable from fp */ |
| 375 |
> |
char *buf, |
| 376 |
> |
int buflen, |
| 377 |
> |
char *vname, |
| 378 |
> |
FILE *fp |
| 379 |
> |
) |
| 380 |
|
{ |
| 381 |
|
int cval; |
| 382 |
|
register char *cp; |
| 396 |
|
} |
| 397 |
|
|
| 398 |
|
|
| 399 |
< |
dev_open(id) /* initialize GLX driver */ |
| 400 |
< |
char *id; |
| 399 |
> |
static void |
| 400 |
> |
dev_open( /* initialize GLX driver */ |
| 401 |
> |
char *id |
| 402 |
> |
) |
| 403 |
|
{ |
| 404 |
|
static int atlBest[] = {GLX_RGBA, GLX_RED_SIZE,4, |
| 405 |
|
GLX_GREEN_SIZE,4, GLX_BLUE_SIZE,4, |
| 449 |
|
/* set window manager hints */ |
| 450 |
|
ourxwmhints.flags = InputHint|IconPixmapHint; |
| 451 |
|
ourxwmhints.input = True; |
| 452 |
< |
ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, |
| 453 |
< |
gwind, glradicon_bits, glradicon_width, glradicon_height); |
| 452 |
> |
ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, gwind, |
| 453 |
> |
(char *)glradicon_bits, glradicon_width, glradicon_height); |
| 454 |
|
XSetWMHints(ourdisplay, gwind, &ourxwmhints); |
| 455 |
|
/* set GLX context */ |
| 456 |
|
glXMakeCurrent(ourdisplay, gwind, gctx); |
| 481 |
|
no_render++; |
| 482 |
|
do |
| 483 |
|
dev_input(0); /* get resize event */ |
| 484 |
< |
while (hres == 0 & vres == 0); |
| 484 |
> |
while ((hres == 0) & (vres == 0)); |
| 485 |
|
no_render--; |
| 486 |
|
rgl_checkerr("initializing GLX"); |
| 487 |
|
} |
| 488 |
|
|
| 489 |
|
|
| 490 |
< |
dev_close() /* close our display and free resources */ |
| 490 |
> |
static void |
| 491 |
> |
dev_close(void) /* close our display and free resources */ |
| 492 |
|
{ |
| 493 |
|
glXMakeCurrent(ourdisplay, None, NULL); |
| 494 |
|
glXDestroyContext(ourdisplay, gctx); |
| 499 |
|
} |
| 500 |
|
|
| 501 |
|
|
| 502 |
< |
int |
| 503 |
< |
dev_view(nv) /* assign new driver view */ |
| 504 |
< |
register VIEW *nv; |
| 502 |
> |
static int |
| 503 |
> |
dev_view( /* assign new driver view */ |
| 504 |
> |
register VIEW *nv |
| 505 |
> |
) |
| 506 |
|
{ |
| 507 |
|
int newhres = hres, newvres = vres; |
| 508 |
|
double wa, va; |
| 511 |
|
error(COMMAND, "illegal view type"); |
| 512 |
|
nv->type = VT_PER; |
| 513 |
|
} |
| 514 |
< |
if (nv->horiz > 160. | nv->vert > 160.) { |
| 514 |
> |
if ((nv->horiz > 160.) | (nv->vert > 160.)) { |
| 515 |
|
error(COMMAND, "illegal view angle"); |
| 516 |
|
if (nv->horiz > 160.) |
| 517 |
|
nv->horiz = 160.; |
| 518 |
|
if (nv->vert > 160.) |
| 519 |
|
nv->vert = 160.; |
| 520 |
|
} |
| 521 |
< |
if (hres != 0 & vres != 0) { |
| 521 |
> |
if ((hres != 0) & (vres != 0)) { |
| 522 |
|
wa = (vres*pheight)/(hres*pwidth); |
| 523 |
|
va = viewaspect(nv); |
| 524 |
|
if (va > wa+.05) { |
| 534 |
|
newvres = (pwidth/pheight)*va*newhres + .5; |
| 535 |
|
} |
| 536 |
|
} |
| 537 |
< |
if (newhres != hres | newvres != vres) { |
| 537 |
> |
if ((newhres != hres) | (newvres != vres)) { |
| 538 |
|
no_render++; |
| 539 |
|
XResizeWindow(ourdisplay, gwind, newhres, newvres); |
| 540 |
|
do |
| 541 |
|
dev_input(0); /* get resize event */ |
| 542 |
< |
while (newhres != hres | newvres != vres); |
| 542 |
> |
while ((newhres != hres) | (newvres != vres)); |
| 543 |
|
no_render--; |
| 544 |
|
} |
| 545 |
|
} |
| 546 |
< |
copystruct(&thisview, nv); |
| 546 |
> |
thisview = *nv; |
| 547 |
|
setglpersp(&thisview); |
| 548 |
|
render(); |
| 549 |
|
return(1); |
| 550 |
|
} |
| 551 |
|
|
| 552 |
|
|
| 553 |
< |
int |
| 554 |
< |
dev_input(nsecs) /* get next input event */ |
| 555 |
< |
int nsecs; |
| 553 |
> |
static int |
| 554 |
> |
dev_input( /* get next input event */ |
| 555 |
> |
int nsecs |
| 556 |
> |
) |
| 557 |
|
{ |
| 558 |
|
#if 0 |
| 559 |
|
static time_t lasttime = 0; |
| 591 |
|
} |
| 592 |
|
|
| 593 |
|
|
| 594 |
< |
render() /* render our display list and swap buffers */ |
| 594 |
> |
static void |
| 595 |
> |
render(void) /* render our display list and swap buffers */ |
| 596 |
|
{ |
| 597 |
|
double d; |
| 598 |
|
|
| 618 |
|
} |
| 619 |
|
|
| 620 |
|
|
| 621 |
< |
moveview(dx, dy, mov, orb) /* move our view */ |
| 622 |
< |
int dx, dy, mov, orb; |
| 621 |
> |
static int |
| 622 |
> |
moveview( /* move our view */ |
| 623 |
> |
int dx, |
| 624 |
> |
int dy, |
| 625 |
> |
int mov, |
| 626 |
> |
int orb |
| 627 |
> |
) |
| 628 |
|
{ |
| 629 |
|
VIEW nv; |
| 630 |
|
FVECT odir, v1, wp; |
| 631 |
|
double d; |
| 588 |
– |
register int li; |
| 632 |
|
/* start with old view */ |
| 633 |
< |
copystruct(&nv, &thisview); |
| 633 |
> |
nv = thisview; |
| 634 |
|
/* change view direction */ |
| 635 |
|
if ((d = viewray(v1, odir, &thisview, |
| 636 |
|
(dx+.5)/hres, (dy+.5)/vres)) < -FTINY) |
| 668 |
|
} |
| 669 |
|
|
| 670 |
|
|
| 671 |
< |
static |
| 672 |
< |
waitabit() /* pause a moment */ |
| 671 |
> |
static void |
| 672 |
> |
waitabit(void) /* pause a moment */ |
| 673 |
|
{ |
| 674 |
|
struct timespec ts; |
| 675 |
|
ts.tv_sec = 0; |
| 676 |
< |
ts.tv_nsec = 5000000; |
| 676 |
> |
ts.tv_nsec = 50000000; |
| 677 |
|
nanosleep(&ts, NULL); |
| 678 |
|
} |
| 679 |
|
|
| 680 |
|
|
| 681 |
< |
getmove(ebut) /* get view change */ |
| 682 |
< |
XButtonPressedEvent *ebut; |
| 681 |
> |
static void |
| 682 |
> |
getmove( /* get view change */ |
| 683 |
> |
XButtonPressedEvent *ebut |
| 684 |
> |
) |
| 685 |
|
{ |
| 686 |
|
int movdir = MOVDIR(ebut->button); |
| 687 |
|
int movorb = MOVORB(ebut->state); |
| 718 |
|
} |
| 719 |
|
|
| 720 |
|
|
| 721 |
< |
getintersect(wp, org, dir, md) /* intersect ray with scene geometry */ |
| 722 |
< |
FVECT wp; /* returned world intersection point */ |
| 723 |
< |
FVECT org, dir; |
| 724 |
< |
double md; |
| 721 |
> |
static int |
| 722 |
> |
getintersect( /* intersect ray with scene geometry */ |
| 723 |
> |
FVECT wp, /* returned world intersection point */ |
| 724 |
> |
FVECT org, |
| 725 |
> |
FVECT dir, |
| 726 |
> |
double md |
| 727 |
> |
) |
| 728 |
|
{ |
| 729 |
|
float fbuf[6]; |
| 730 |
|
/* check to see if rtrace is running */ |
| 731 |
< |
if (rtpd[2] <= 0) |
| 731 |
> |
/* if (rtpd.pid <= 0) */ |
| 732 |
> |
if (!rtpd.running) |
| 733 |
|
return(0); |
| 734 |
|
/* assign origin */ |
| 735 |
|
fbuf[0] = org[0]; fbuf[1] = org[1]; fbuf[2] = org[2]; |
| 737 |
|
if (md <= FTINY) md = FHUGE; |
| 738 |
|
fbuf[3] = dir[0]*md; fbuf[4] = dir[1]*md; fbuf[5] = dir[2]*md; |
| 739 |
|
/* trace that ray */ |
| 740 |
< |
if (process(rtpd, (char *)fbuf, (char *)fbuf, |
| 740 |
> |
if (process(&rtpd, (char *)fbuf, (char *)fbuf, |
| 741 |
|
4*sizeof(float), 6*sizeof(float)) != 4*sizeof(float)) |
| 742 |
|
error(INTERNAL, "error getting data back from rtrace process"); |
| 743 |
|
if (fbuf[3] >= .99*FHUGE) |
| 747 |
|
} |
| 748 |
|
|
| 749 |
|
|
| 750 |
< |
setglpersp(vp) /* set perspective view in GL */ |
| 751 |
< |
register VIEW *vp; |
| 750 |
> |
static void |
| 751 |
> |
setglpersp( /* set perspective view in GL */ |
| 752 |
> |
register VIEW *vp |
| 753 |
> |
) |
| 754 |
|
{ |
| 755 |
|
double d, xmin, xmax, ymin, ymax, zmin, zmax; |
| 756 |
|
|
| 781 |
|
} |
| 782 |
|
|
| 783 |
|
|
| 784 |
< |
int |
| 785 |
< |
getkey(ekey) /* get input key */ |
| 786 |
< |
register XKeyPressedEvent *ekey; |
| 784 |
> |
static int |
| 785 |
> |
getkey( /* get input key */ |
| 786 |
> |
register XKeyPressedEvent *ekey |
| 787 |
> |
) |
| 788 |
|
{ |
| 789 |
|
int n; |
| 790 |
|
char buf[8]; |
| 802 |
|
case 'l': /* retrieve last (premouse) view */ |
| 803 |
|
if (lastview.type) { |
| 804 |
|
VIEW vtmp; |
| 805 |
< |
copystruct(&vtmp, &thisview); |
| 805 |
> |
vtmp = thisview; |
| 806 |
|
dev_view(&lastview); |
| 807 |
< |
copystruct(&lastview, &vtmp); |
| 807 |
> |
lastview = vtmp; |
| 808 |
|
} else |
| 809 |
|
XBell(ourdisplay, 0); |
| 810 |
|
break; |
| 838 |
|
} |
| 839 |
|
|
| 840 |
|
|
| 841 |
< |
zoomview(pct, dx, dy) /* zoom in or out around (dx,dy) */ |
| 842 |
< |
int pct; |
| 843 |
< |
int dx, dy; |
| 841 |
> |
static void |
| 842 |
> |
zoomview( /* zoom in or out around (dx,dy) */ |
| 843 |
> |
int pct, |
| 844 |
> |
int dx, |
| 845 |
> |
int dy |
| 846 |
> |
) |
| 847 |
|
{ |
| 848 |
|
double h, v; |
| 794 |
– |
FVECT direc; |
| 849 |
|
|
| 850 |
< |
if (pct == 100 | pct <= 0) |
| 850 |
> |
if ((pct == 100) | (pct <= 0)) |
| 851 |
|
return; |
| 852 |
|
copylastv("zooming"); |
| 853 |
|
h = (dx+.5)/hres - 0.5; |
| 866 |
|
} |
| 867 |
|
|
| 868 |
|
|
| 869 |
< |
gotoview(vwnum) /* go to specified view number */ |
| 870 |
< |
int vwnum; |
| 869 |
> |
static void |
| 870 |
> |
gotoview( /* go to specified view number */ |
| 871 |
> |
int vwnum |
| 872 |
> |
) |
| 873 |
|
{ |
| 874 |
|
if (vwnum < 0) |
| 875 |
|
for (vwnum = currentview; vwl[vwnum+1].v != NULL; vwnum++) |
| 881 |
|
} |
| 882 |
|
|
| 883 |
|
|
| 884 |
< |
appendview(nm, vp) /* append standard view */ |
| 885 |
< |
char *nm; |
| 886 |
< |
VIEW *vp; |
| 884 |
> |
static void |
| 885 |
> |
appendview( /* append standard view */ |
| 886 |
> |
char *nm, |
| 887 |
> |
VIEW *vp |
| 888 |
> |
) |
| 889 |
|
{ |
| 890 |
|
FILE *fp; |
| 891 |
|
/* check if already in there */ |
| 892 |
< |
if (!bcmp(&thisview, vwl[currentview].v, sizeof(VIEW))) { |
| 892 |
> |
if (!memcmp(&thisview, vwl[currentview].v, sizeof(VIEW))) { |
| 893 |
|
error(COMMAND, "view already in standard list"); |
| 894 |
|
return; |
| 895 |
|
} |
| 910 |
|
if (currentview >= MAXVIEW) |
| 911 |
|
error(INTERNAL, "too many views in appendview"); |
| 912 |
|
vwl[currentview].v = (VIEW *)bmalloc(sizeof(VIEW)); |
| 913 |
< |
copystruct(vwl[currentview].v, &thisview); |
| 913 |
> |
*(vwl[currentview].v) = thisview; |
| 914 |
|
if (nm != NULL) |
| 915 |
|
vwl[currentview].nam = savqstr(nm); |
| 916 |
|
} |
| 917 |
|
|
| 918 |
|
|
| 919 |
< |
copylastv(cause) /* copy last view position */ |
| 920 |
< |
char *cause; |
| 919 |
> |
static void |
| 920 |
> |
copylastv( /* copy last view position */ |
| 921 |
> |
char *cause |
| 922 |
> |
) |
| 923 |
|
{ |
| 924 |
|
static char *lastvc; |
| 925 |
|
|
| 926 |
|
if (cause == lastvc) |
| 927 |
|
return; /* only record one view per cause */ |
| 928 |
|
lastvc = cause; |
| 929 |
< |
copystruct(&lastview, &thisview); |
| 929 |
> |
lastview = thisview; |
| 930 |
|
} |
| 931 |
|
|
| 932 |
|
|
| 933 |
< |
fixwindow(eexp) /* repair damage to window */ |
| 934 |
< |
register XExposeEvent *eexp; |
| 933 |
> |
static void |
| 934 |
> |
fixwindow( /* repair damage to window */ |
| 935 |
> |
register XExposeEvent *eexp |
| 936 |
> |
) |
| 937 |
|
{ |
| 938 |
< |
if (hres == 0 | vres == 0) { /* first exposure */ |
| 938 |
> |
if ((hres == 0) | (vres == 0)) { /* first exposure */ |
| 939 |
|
resizewindow((XConfigureEvent *)eexp); |
| 940 |
|
return; |
| 941 |
|
} |
| 946 |
|
} |
| 947 |
|
|
| 948 |
|
|
| 949 |
< |
resizewindow(ersz) /* resize window */ |
| 950 |
< |
register XConfigureEvent *ersz; |
| 949 |
> |
static void |
| 950 |
> |
resizewindow( /* resize window */ |
| 951 |
> |
register XConfigureEvent *ersz |
| 952 |
> |
) |
| 953 |
|
{ |
| 954 |
|
static char resizing[] = "resizing window"; |
| 955 |
|
double wa, va; |