--- ray/src/rt/x11twind.c 1989/12/19 12:54:31 1.1 +++ ray/src/rt/x11twind.c 2003/02/25 02:47:23 2.6 @@ -1,9 +1,6 @@ #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: x11twind.c,v 2.6 2003/02/25 02:47:23 greg Exp $"; #endif - -/* Copyright (c) 1989 Regents of the University of California */ - /* * x11twind.c - routines for X11 text windows. * @@ -14,12 +11,20 @@ static char SCCSid[] = "$SunId$ LBL"; * 9/26/88 */ +#include "copyright.h" + #include +#include + #include #include "x11twind.h" +#ifndef BSD +#define bzero(d,n) (void)memset(d,0,n) +#endif + #define checkcurs(t) if ((t)->cursor) togglecurs(t) #define restorecurs checkcurs @@ -29,18 +34,18 @@ static char SCCSid[] = "$SunId$ LBL"; #define Height(f) ((f)->ascent + (f)->descent) #define YStart(f) ((f)->ascent) -extern char *calloc(), *malloc(); +static void togglecurs(); TEXTWIND * -xt_open(dpy, gc, parent, x, y, width, height, bw, fontname) -Display *dpy; -GC gc; -Window parent; -int x, y; -int width, height; -int bw; -char *fontname; +xt_open(dpy, parent, x, y, width, height, bw, fore, back, fontname) +Display *dpy; +Window parent; +int x, y; +int width, height; +int bw; +unsigned long fore, back; +char *fontname; { register int i; register TEXTWIND *t; @@ -49,14 +54,8 @@ char *fontname; return(NULL); t->dpy = dpy; - t->w = XCreateSimpleWindow(dpy, parent, x, y, width, height, bw, - BlackPixel(dpy,DefaultScreen(dpy)), - WhitePixel(dpy,DefaultScreen(dpy))); - /* - t->w = XCreateWindow(dpy, parent, x, y, width, height, bw, 0, - CopyFromParent, CopyFromParent, 0, 0); - */ - + t->w = XCreateSimpleWindow(dpy, parent, x, y, width, height, + bw, fore, back); if (t->w == 0) return(NULL); XMapWindow(dpy, t->w); @@ -66,12 +65,10 @@ char *fontname; /* if (!t->f.fixedwidth) check for fixedwidth later return(NULL); */ - t->gc = XCreateGC(dpy,t->w,0,NULL); - XCopyGC(dpy, gc, ~0L, t->gc); - + t->gc = XCreateGC(dpy,t->w,0,NULL); + XSetState(dpy, t->gc, fore, back, GXcopy, AllPlanes); XSetFont(dpy, t->gc, t->f->fid); - XSetFunction(dpy, t->gc, GXcopy); t->nc = (width - LEFTMAR) / Width(t->f); /* number of columns */ @@ -91,6 +88,7 @@ char *fontname; } +void xt_puts(s, t) /* output a string */ register char *s; TEXTWIND *t; @@ -104,6 +102,7 @@ TEXTWIND *t; } +void xt_putc(c, t) /* output a character */ char c; register TEXTWIND *t; @@ -137,6 +136,7 @@ register TEXTWIND *t; } +void xt_delete(t, r) /* delete a line */ register TEXTWIND *t; int r; @@ -164,6 +164,7 @@ int r; } +void xt_insert(t, r) /* insert a line */ register TEXTWIND *t; int r; @@ -190,6 +191,7 @@ int r; } +void xt_redraw(t) /* redraw text window */ register TEXTWIND *t; { @@ -205,6 +207,7 @@ register TEXTWIND *t; } +void xt_clear(t) /* clear text window */ register TEXTWIND *t; { @@ -218,6 +221,7 @@ register TEXTWIND *t; } +void xt_move(t, r, c) /* move to new position */ register TEXTWIND *t; int r, c; @@ -248,6 +252,7 @@ register int curs; } +void xt_close(t) /* close text window */ register TEXTWIND *t; { @@ -258,12 +263,12 @@ register TEXTWIND *t; XDestroyWindow(t->dpy, t->w); for (i = 0; i < t->nr; i++) free(t->lp[i]); - free((char *)t->lp); - free((char *)t); + free((void *)t->lp); + free((void *)t); } -static +static void togglecurs(t) register TEXTWIND *t; {