--- ray/src/hd/rhd_x11.c 2005/01/07 20:33:02 3.38 +++ ray/src/hd/rhd_x11.c 2011/05/20 02:06:39 3.43 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rhd_x11.c,v 3.38 2005/01/07 20:33:02 greg Exp $"; +static const char RCSid[] = "$Id: rhd_x11.c,v 3.43 2011/05/20 02:06:39 greg Exp $"; #endif /* * X11 driver for holodeck display. @@ -82,7 +82,7 @@ static int mytmflags(void); static void xnewcolr(int ndx, int r, int g, int b); static int getpixels(void); static void freepixels(void); -static unsigned long true_pixel(register BYTE rgb[3]); +static unsigned long true_pixel(register uby8 rgb[3]); static void getevent(void); static int ilclip(int dp[2][2], FVECT wp[2]); static void draw3dline(FVECT wp[2]); @@ -190,8 +190,8 @@ dev_open( /* initialize X11 driver */ /* set window manager hints */ ourxwmhints.flags = InputHint|IconPixmapHint; ourxwmhints.input = True; - ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, - gwind, x11icon_bits, x11icon_width, x11icon_height); + ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, gwind, + (char *)x11icon_bits, x11icon_width, x11icon_height); XSetWMHints(ourdisplay, gwind, &ourxwmhints); oursizhints.min_width = MINWIDTH; oursizhints.min_height = MINHEIGHT; @@ -295,7 +295,8 @@ dev_view( /* assign new driver view */ extern void dev_section( /* add octree for geometry rendering */ - char *ofn + char *gfn, + char *pfn ) { /* unimplemented */ @@ -344,7 +345,7 @@ dev_input(void) /* get X11 input */ extern void dev_paintr( /* fill a rectangle */ - BYTE rgb[3], + uby8 rgb[3], int xmin, int ymin, int xmax, @@ -463,7 +464,7 @@ freepixels(void) /* free our pixels */ static unsigned long true_pixel( /* return true pixel value for color */ - register BYTE rgb[3] + register uby8 rgb[3] ) { register unsigned long rval; @@ -569,7 +570,7 @@ draw3dline( /* draw 3d line in world coordinates */ static void draw_grids(void) /* draw holodeck section grids */ { - static BYTE gridrgb[3] = {0x0, 0xff, 0xff}; + static uby8 gridrgb[3] = {0x0, 0xff, 0xff}; unsigned long pixel; if (ncolors > 0) @@ -640,15 +641,23 @@ getframe( /* get focus frame */ ) { int startx = ebut->x, starty = ebut->y; - int endx, endy; - + int endx, endy, midx, midy; + FVECT v1; + int li; + /* get mouse drag */ XMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent)); endx = levptr(XButtonReleasedEvent)->x; endy = levptr(XButtonReleasedEvent)->y; - if ((endx == startx) | (endy == starty)) { - XBell(ourdisplay, 0); + midx = (startx + endx) >> 1; + midy = (starty + endy) >> 1; + /* set focus distance */ + if ((li = qtFindLeaf(midx, midy)) < 0) + return; /* not on window */ + VCOPY(v1, qtL.wp[li]); + odev.v.vdist = sqrt(dist2(odev.v.vp, v1)); + /* set frame for rendering */ + if ((endx == startx) | (endy == starty)) return; - } if (endx < startx) {register int c = endx; endx = startx; startx = c;} if (endy < starty) {register int c = endy; endy = starty; starty = c;} sprintf(odev_args, "%.3f %.3f %.3f %.3f",