1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* X11 driver for holodeck display. |
6 |
|
* Based on rview driver. |
10 |
|
#include <X11/Xlib.h> |
11 |
|
#include <X11/cursorfont.h> |
12 |
|
#include <X11/Xutil.h> |
13 |
+ |
#include <time.h> |
14 |
|
#include "rhd_qtree.h" |
15 |
|
#include "x11icon.h" |
16 |
|
|
176 |
|
DisplayWidth(ourdisplay, ourscreen); |
177 |
|
pheight = (double)DisplayHeightMM(ourdisplay, ourscreen) / |
178 |
|
DisplayHeight(ourdisplay, ourscreen); |
179 |
< |
copystruct(&odev.v, &stdview); |
179 |
> |
odev.v = stdview; |
180 |
|
odev.v.type = VT_PER; |
181 |
|
/* map the window and get its size */ |
182 |
|
XMapWindow(ourdisplay, gwind); |
258 |
|
XResizeWindow(ourdisplay, gwind, odev.hres, odev.vres); |
259 |
|
dev_input(); /* wait for resize event */ |
260 |
|
} |
261 |
< |
copystruct(&odev.v, nv); |
261 |
> |
odev.v = *nv; |
262 |
|
} |
263 |
|
qtReplant(); |
264 |
|
return(1); |
375 |
|
return(ncolors = 0); |
376 |
|
if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,pixval,ncolors)) |
377 |
|
break; |
378 |
< |
free((char *)pixval); |
378 |
> |
free((void *)pixval); |
379 |
|
pixval = NULL; |
380 |
|
} |
381 |
|
if (pixval == NULL) { |
410 |
|
if (ncolors == 0) |
411 |
|
return; |
412 |
|
XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L); |
413 |
< |
free((char *)pixval); |
413 |
> |
free((void *)pixval); |
414 |
|
pixval = NULL; |
415 |
|
ncolors = 0; |
416 |
|
if (ourmap != DefaultColormap(ourdisplay,ourscreen)) |
546 |
|
double d; |
547 |
|
register int li; |
548 |
|
/* start with old view */ |
549 |
< |
copystruct(&nv, &odev.v); |
549 |
> |
nv = odev.v; |
550 |
|
/* change view direction */ |
551 |
|
if (mov | orb) { |
552 |
|
if ((li = qtFindLeaf(dx, dy)) < 0) |
609 |
|
|
610 |
|
|
611 |
|
static |
612 |
+ |
waitabit() /* pause a moment */ |
613 |
+ |
{ |
614 |
+ |
struct timespec ts; |
615 |
+ |
ts.tv_sec = 0; |
616 |
+ |
ts.tv_nsec = 50000000; |
617 |
+ |
nanosleep(&ts, NULL); |
618 |
+ |
} |
619 |
+ |
|
620 |
+ |
|
621 |
+ |
static |
622 |
|
getmove(ebut) /* get view change */ |
623 |
|
XButtonPressedEvent *ebut; |
624 |
|
{ |
634 |
|
|
635 |
|
while (!XCheckMaskEvent(ourdisplay, |
636 |
|
ButtonReleaseMask, levptr(XEvent))) { |
637 |
< |
|
637 |
> |
waitabit(); |
638 |
|
if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw, |
639 |
|
&rootx, &rooty, &wx, &wy, &statemask)) |
640 |
|
break; /* on another screen */ |