Revision: 75332
http://sourceforge.net/p/brlcad/code/75332
Author: starseeker
Date: 2020-04-10 12:29:15 +0000 (Fri, 10 Apr 2020)
Log Message:
-----------
The tkfont vars never belonged in xvars to begin with - move to dm-tk.h
Modified Paths:
--------------
brlcad/trunk/include/dm/dm_xvars.h
brlcad/trunk/src/libdm/dm-tk.c
brlcad/trunk/src/libdm/dm-tk.h
Modified: brlcad/trunk/include/dm/dm_xvars.h
===================================================================
--- brlcad/trunk/include/dm/dm_xvars.h 2020-04-10 12:06:50 UTC (rev 75331)
+++ brlcad/trunk/include/dm/dm_xvars.h 2020-04-10 12:29:15 UTC (rev 75332)
@@ -74,10 +74,6 @@
XVisualInfo *vip;
XFontStruct *fontstruct;
#endif
-#ifdef DM_TK
- int tkfontset;
- Tk_Font tkfontstruct;
-#endif
int devmotionnotify;
int devbuttonpress;
int devbuttonrelease;
Modified: brlcad/trunk/src/libdm/dm-tk.c
===================================================================
--- brlcad/trunk/src/libdm/dm-tk.c 2020-04-10 12:06:50 UTC (rev 75331)
+++ brlcad/trunk/src/libdm/dm-tk.c 2020-04-10 12:29:15 UTC (rev 75332)
@@ -82,22 +82,22 @@
HIDDEN int
tk_close(struct dm_internal *dmp)
{
- if (((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy) {
- if (((struct x_vars *)dmp->dm_vars.priv_vars)->gc)
- Tk_FreeGC(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc);
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
- if (((struct x_vars *)dmp->dm_vars.priv_vars)->pix)
- Tk_FreePixmap(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix);
+ if (pubvars->dpy) {
+ if (privars->gc)
+ Tk_FreeGC(pubvars->dpy, privars->gc);
+ if (privars->pix)
+ Tk_FreePixmap(pubvars->dpy, privars->pix);
+
/*XXX Possibly need to free the colormap */
- if (((struct dm_xvars *)dmp->dm_vars.pub_vars)->cmap)
- Tk_FreeColormap(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->cmap);
+ if (pubvars->cmap)
+ Tk_FreeColormap(pubvars->dpy, pubvars->cmap);
- if (((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin)
- Tk_DestroyWindow(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin);
+ if (pubvars->xtkwin)
+ Tk_DestroyWindow(pubvars->xtkwin);
}
@@ -119,6 +119,9 @@
HIDDEN int
tk_drawBegin(struct dm_internal *dmp)
{
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
+
XGCValues gcv;
if (dmp->dm_debugLevel)
@@ -125,22 +128,20 @@
bu_log("tk_drawBegin()\n");
/* clear pixmap */
- gcv.foreground = ((struct x_vars *)dmp->dm_vars.priv_vars)->bg;
- XChangeGC(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc,
+ gcv.foreground = privars->bg;
+ XChangeGC(pubvars->dpy,
+ privars->gc,
GCForeground, &gcv);
- XFillRectangle(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc, 0,
+ XFillRectangle(pubvars->dpy,
+ privars->pix,
+ privars->gc, 0,
0, dmp->dm_width + 1,
dmp->dm_height + 1);
/* reset foreground */
- gcv.foreground = ((struct x_vars *)dmp->dm_vars.priv_vars)->fg;
- XChangeGC(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc,
- GCForeground, &gcv);
+ gcv.foreground = privars->fg;
+ XChangeGC(pubvars->dpy, privars->gc, GCForeground, &gcv);
return BRLCAD_OK;
}
@@ -153,13 +154,16 @@
HIDDEN int
tk_drawEnd(struct dm_internal *dmp)
{
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
+
if (dmp->dm_debugLevel)
bu_log("tk_drawEnd()\n");
- XCopyArea(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->win,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc,
+ XCopyArea(pubvars->dpy,
+ privars->pix,
+ pubvars->win,
+ privars->gc,
0, 0, dmp->dm_width,
dmp->dm_height, 0, 0);
@@ -181,6 +185,8 @@
HIDDEN int
tk_loadMatrix(struct dm_internal *dmp, fastf_t *mat, int which_eye)
{
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
+
if (dmp->dm_debugLevel) {
bu_log("tk_loadMatrix()\n");
@@ -193,7 +199,7 @@
bu_log("%g %g %g %g\n", mat[12], mat[13], mat[14], mat[15]);
}
- MAT_COPY(((struct x_vars *)dmp->dm_vars.priv_vars)->mod_mat, mat);
+ MAT_COPY(privars->mod_mat, mat);
return BRLCAD_OK;
}
@@ -217,7 +223,8 @@
fastf_t dist_prev=1.0;
static int nvectors = 0;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
if (dmp->dm_debugLevel) {
bu_log("tk_drawVList()\n");
@@ -421,9 +428,9 @@
VMOVE(lpnt, spnt);
if (nseg == 1024) {
- XDrawSegments(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars
*)dmp->dm_vars.priv_vars)->pix,
- ((struct x_vars
*)dmp->dm_vars.priv_vars)->gc, segbuf, nseg);
+ XDrawSegments(pubvars->dpy,
+ privars->pix,
+ privars->gc, segbuf, nseg);
nseg = 0;
segp = segbuf;
@@ -445,9 +452,9 @@
}
if (nseg) {
- XDrawSegments(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc, segbuf,
nseg);
+ XDrawSegments(pubvars->dpy,
+ privars->pix,
+ privars->gc, segbuf, nseg);
}
return BRLCAD_OK;
@@ -497,6 +504,8 @@
tk_drawString2D(struct dm_internal *dmp, const char *str, fastf_t x, fastf_t
y, int size, int use_aspect)
{
int sx, sy;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
if (dmp->dm_debugLevel) {
bu_log("tk_drawString2D():\n");
@@ -505,8 +514,8 @@
bu_log("\ty - %g\n", y);
bu_log("\tsize - %d\n", size);
- bu_log("color = %lu\n", ((struct x_vars *)dmp->dm_vars.priv_vars)->fg);
- /* bu_log("real_color = %d\n", ((struct x_vars
*)dmp->dm_vars.priv_vars)->gc->foreground); */
+ bu_log("color = %lu\n", privars->fg);
+ /* bu_log("real_color = %d\n", privars->gc->foreground); */
if (use_aspect) {
bu_log("\tuse_aspect - %d\t\taspect ratio - %g\n", use_aspect,
dmp->dm_aspect);
@@ -518,10 +527,10 @@
sy = dm_Normal2Xy(dmp, y, use_aspect);
- Tk_DrawChars(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc,
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->tkfontstruct,
+ Tk_DrawChars(pubvars->dpy,
+ privars->pix,
+ privars->gc,
+ privars->tkfontstruct,
str, strlen(str), sx, sy);
return BRLCAD_OK;
@@ -531,6 +540,8 @@
HIDDEN int
tk_drawLine2D(struct dm_internal *dmp, fastf_t xpos1, fastf_t ypos1, fastf_t
xpos2, fastf_t ypos2)
{
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
int sx1, sy1, sx2, sy2;
sx1 = dm_Normal2Xx(dmp, xpos1);
@@ -544,12 +555,12 @@
bu_log("x2 = %g, y2 = %g\n", xpos2, ypos2);
bu_log("sx1 = %d, sy1 = %d\n", sx1, sy1);
bu_log("sx2 = %d, sy2 = %d\n", sx2, sy2);
- bu_log("color = %lu\n", ((struct x_vars *)dmp->dm_vars.priv_vars)->fg);
+ bu_log("color = %lu\n", privars->fg);
}
- XDrawLine(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc,
+ XDrawLine(pubvars->dpy,
+ privars->pix,
+ privars->gc,
sx1, sy1, sx2, sy2);
return BRLCAD_OK;
@@ -579,6 +590,9 @@
HIDDEN int
tk_drawPoint2D(struct dm_internal *dmp, fastf_t x, fastf_t y)
{
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
+
int sx, sy;
sx = dm_Normal2Xx(dmp, x);
@@ -590,9 +604,9 @@
bu_log("sx = %d, sy = %d\n", sx, sy);
}
- XDrawPoint(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc, sx, sy);
+ XDrawPoint(pubvars->dpy,
+ privars->pix,
+ privars->gc, sx, sy);
return BRLCAD_OK;
}
@@ -601,6 +615,9 @@
HIDDEN int
tk_setFGColor(struct dm_internal *dmp, unsigned char r, unsigned char g,
unsigned char b, int strict, fastf_t transparency)
{
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
+
XColor color;
INIT_XCOLOR(&color);
@@ -621,12 +638,12 @@
color.green = g << 8;
color.blue = b << 8;
- ((struct x_vars *)dmp->dm_vars.priv_vars)->fg = Tk_GetColorByValue
- (((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin, &color)->pixel;
+ privars->fg = Tk_GetColorByValue
+ (pubvars->xtkwin, &color)->pixel;
- XSetForeground(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->fg);
+ XSetForeground(pubvars->dpy,
+ privars->gc,
+ privars->fg);
return BRLCAD_OK;
}
@@ -644,6 +661,9 @@
return BRLCAD_ERROR;
}
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
+
if (dmp->dm_debugLevel)
bu_log("tk_setBGColor()\n");
@@ -655,9 +675,9 @@
color.green = g << 8;
color.blue = b << 8;
- XSetBackground(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc,
- Tk_GetColorByValue(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin,
+ XSetBackground(pubvars->dpy,
+ privars->gc,
+ Tk_GetColorByValue(pubvars->xtkwin,
&color)->pixel);
return BRLCAD_OK;
@@ -667,6 +687,9 @@
HIDDEN int
tk_setLineAttr(struct dm_internal *dmp, int width, int style)
{
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
+
int linestyle;
if (dmp->dm_debugLevel)
@@ -683,8 +706,8 @@
else
linestyle = LineSolid;
- XSetLineAttributes(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc,
+ XSetLineAttributes(pubvars->dpy,
+ privars->gc,
width, linestyle, CapButt, JoinMiter);
return BRLCAD_OK;
@@ -733,9 +756,13 @@
int h, w;
Tcl_Interp *interp = (Tcl_Interp *)dmp->dm_interp;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
+
+
/* nothing to do */
- h = Tk_Height(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin);
- w = Tk_Width(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin);
+ h = Tk_Height(pubvars->xtkwin);
+ w = Tk_Width(pubvars->xtkwin);
if (!force && dmp->dm_width==w && dmp->dm_height == h)
return BRLCAD_OK;
@@ -750,33 +777,33 @@
bu_log("width = %d, height = %d\n", dmp->dm_width, dmp->dm_height);
}
- Tk_FreePixmap(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix);
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix =
- Tk_GetPixmap(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- DefaultRootWindow(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->dpy),
+ Tk_FreePixmap(pubvars->dpy,
+ privars->pix);
+ privars->pix =
+ Tk_GetPixmap(pubvars->dpy,
+ DefaultRootWindow(pubvars->dpy),
dmp->dm_width,
dmp->dm_height,
- Tk_Depth(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin));
+ Tk_Depth(pubvars->xtkwin));
/* First time through, load a font or quit */
- if (((struct dm_xvars *)dmp->dm_vars.pub_vars)->tkfontset == 0) {
+ if (privars->tkfontset == 0) {
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->tkfontstruct =
- Tk_GetFont(interp, ((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin, FONT9);
+ privars->tkfontstruct =
+ Tk_GetFont(interp, pubvars->xtkwin, FONT9);
- if (((struct dm_xvars *)dmp->dm_vars.pub_vars)->tkfontstruct == NULL) {
+ if (privars->tkfontstruct == NULL) {
/* Try hardcoded backup font */
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->tkfontstruct =
- Tk_GetFont(interp, ((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin, FONTBACK);
+ privars->tkfontstruct =
+ Tk_GetFont(interp, pubvars->xtkwin, FONTBACK);
- if (((struct dm_xvars *)dmp->dm_vars.pub_vars)->tkfontstruct ==
NULL) {
+ if (privars->tkfontstruct == NULL) {
bu_log("dm-Tk: Can't open font '%s' or '%s'\n", FONT9,
FONTBACK);
return BRLCAD_ERROR;
}
}
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->tkfontset = 1;
+ privars->tkfontset = 1;
}
/* XXX: I removed the font-sizing routine from dm-X from here. Something
@@ -942,7 +969,9 @@
dmp->dm_interp = interp;
BU_ALLOC(dmp->dm_vars.pub_vars, struct dm_xvars);
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
BU_ALLOC(dmp->dm_vars.priv_vars, struct tk_vars);
+ struct tk_vars *privars = (struct tk_vars *)dmp->dm_vars.priv_vars;
bu_vls_init(&dmp->dm_pathName);
bu_vls_init(&dmp->dm_tkName);
@@ -969,42 +998,40 @@
bu_vls_strcpy(&init_proc_vls, "bind_dm");
/* initialize dm specific variables */
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->devmotionnotify = LASTEvent;
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->devbuttonpress = LASTEvent;
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->devbuttonrelease = LASTEvent;
+ pubvars->devmotionnotify = LASTEvent;
+ pubvars->devbuttonpress = LASTEvent;
+ pubvars->devbuttonrelease = LASTEvent;
dmp->dm_aspect = 1.0;
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->tkfontset = 0;
+ privars->tkfontset = 0;
if (dmp->dm_top) {
/* Make xtkwin a toplevel window */
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin =
Tk_CreateWindowFromPath(interp, tkwin,
-
bu_vls_addr(&dmp->dm_pathName),
-
bu_vls_addr(&dmp->dm_dName));
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->top = ((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin;
+ pubvars->xtkwin = Tk_CreateWindowFromPath(interp,
+ tkwin, bu_vls_addr(&dmp->dm_pathName),
bu_vls_addr(&dmp->dm_dName));
+ pubvars->top = pubvars->xtkwin;
} else {
char *cp;
cp = strrchr(bu_vls_addr(&dmp->dm_pathName), (int)'.');
if (cp == bu_vls_addr(&dmp->dm_pathName)) {
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->top = tkwin;
+ pubvars->top = tkwin;
} else {
struct bu_vls top_vls = BU_VLS_INIT_ZERO;
bu_vls_strncpy(&top_vls, (const char
*)bu_vls_addr(&dmp->dm_pathName), cp - bu_vls_addr(&dmp->dm_pathName));
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->top =
- Tk_NameToWindow(interp, bu_vls_addr(&top_vls), tkwin);
+ pubvars->top = Tk_NameToWindow(interp, bu_vls_addr(&top_vls),
tkwin);
bu_vls_free(&top_vls);
}
/* Make xtkwin an embedded window */
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin =
- Tk_CreateWindow(interp, ((struct dm_xvars
*)dmp->dm_vars.pub_vars)->top,
+ pubvars->xtkwin =
+ Tk_CreateWindow(interp, pubvars->top,
cp + 1, (char *)NULL);
}
- if (((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin == NULL) {
+ if (pubvars->xtkwin == NULL) {
bu_log("tk_open: Failed to open %s\n", bu_vls_addr(&dmp->dm_pathName));
(void)tk_close(dmp);
return DM_NULL;
@@ -1011,7 +1038,7 @@
}
bu_vls_printf(&dmp->dm_tkName, "%s",
- (char *)Tk_Name(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin));
+ (char *)Tk_Name(pubvars->xtkwin));
bu_vls_printf(&str, "_init_dm %s %s\n",
bu_vls_addr(&init_proc_vls),
@@ -1020,7 +1047,6 @@
if (Tcl_Eval(interp, bu_vls_addr(&str)) == BRLCAD_ERROR) {
bu_vls_free(&str);
(void)tk_close(dmp);
-
return DM_NULL;
}
@@ -1027,9 +1053,8 @@
bu_vls_free(&init_proc_vls);
bu_vls_free(&str);
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy =
- Tk_Display(((struct dm_xvars *)dmp->dm_vars.pub_vars)->top);
- dpy = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy;
+ pubvars->dpy = Tk_Display(pubvars->top);
+ dpy = pubvars->dpy;
/* make sure there really is a display before proceeding. */
if (!dpy) {
@@ -1039,15 +1064,12 @@
if (dmp->dm_width == 0) {
dmp->dm_width =
- WidthOfScreen(Tk_Screen((
- (struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin)) - 30;
+ WidthOfScreen(Tk_Screen(pubvars->xtkwin)) - 30;
++make_square;
}
if (dmp->dm_height == 0) {
- dmp->dm_height =
- HeightOfScreen(Tk_Screen((
- (struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin)) - 30;
+ dmp->dm_height = HeightOfScreen(Tk_Screen(pubvars->xtkwin)) - 30;
++make_square;
}
@@ -1060,55 +1082,47 @@
dmp->dm_height = dmp->dm_width;
}
- Tk_GeometryRequest(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin,
+ Tk_GeometryRequest(pubvars->xtkwin,
dmp->dm_width,
dmp->dm_height);
- Tk_MakeWindowExist(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin);
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->win =
- Tk_WindowId(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin);
- dmp->dm_id = ((struct dm_xvars *)dmp->dm_vars.pub_vars)->win;
+ Tk_MakeWindowExist(pubvars->xtkwin);
+ pubvars->win = Tk_WindowId(pubvars->xtkwin);
+ dmp->dm_id = pubvars->win;
- ((struct x_vars *)dmp->dm_vars.priv_vars)->pix =
- Tk_GetPixmap(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- DefaultRootWindow(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->dpy),
+ privars->pix =
+ Tk_GetPixmap(pubvars->dpy,
+ DefaultRootWindow(pubvars->dpy),
dmp->dm_width,
dmp->dm_height,
- Tk_Depth(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin));
+ Tk_Depth(pubvars->xtkwin));
fg.red = 65535;
fg.green = fg.blue = 0;
- ((struct x_vars *)dmp->dm_vars.priv_vars)->fg =
- Tk_GetColorByValue(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin,
- &fg)->pixel;
+ privars->fg = Tk_GetColorByValue(pubvars->xtkwin, &fg)->pixel;
bg.red = bg.green = bg.blue = 3277;
- ((struct x_vars *)dmp->dm_vars.priv_vars)->bg =
- Tk_GetColorByValue(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin,
- &bg)->pixel;
+ privars->bg = Tk_GetColorByValue(pubvars->xtkwin, &bg)->pixel;
- gcv.background = ((struct x_vars *)dmp->dm_vars.priv_vars)->bg;
- gcv.foreground = ((struct x_vars *)dmp->dm_vars.priv_vars)->fg;
+ gcv.background = privars->bg;
+ gcv.foreground = privars->fg;
- ((struct x_vars *)dmp->dm_vars.priv_vars)->gc =
- Tk_GetGC(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin,
- (GCForeground|GCBackground), &gcv);
+ privars->gc = Tk_GetGC(pubvars->xtkwin, (GCForeground|GCBackground), &gcv);
(void)tk_configureWin_guts(dmp, 1);
/*
- Tk_SetWindowBackground(((struct dm_xvars
*)dmp->dm_vars.pub_vars)->xtkwin,
- ((struct x_vars *)dmp->dm_vars.priv_vars)->bg);
+ Tk_SetWindowBackground(pubvars->xtkwin,
+ privars->bg);
*/
- Tk_MapWindow(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin);
+ Tk_MapWindow(pubvars->xtkwin);
- MAT_IDN(((struct x_vars *)dmp->dm_vars.priv_vars)->mod_mat);
- MAT_IDN(((struct x_vars *)dmp->dm_vars.priv_vars)->disp_mat);
+ MAT_IDN(privars->mod_mat);
+ MAT_IDN(privars->disp_mat);
- ((struct x_vars *)dmp->dm_vars.priv_vars)->xmat =
- &(((struct x_vars *)dmp->dm_vars.priv_vars)->mod_mat[0]);
+ privars->xmat = &(privars->mod_mat[0]);
return dmp;
}
Modified: brlcad/trunk/src/libdm/dm-tk.h
===================================================================
--- brlcad/trunk/src/libdm/dm-tk.h 2020-04-10 12:06:50 UTC (rev 75331)
+++ brlcad/trunk/src/libdm/dm-tk.h 2020-04-10 12:29:15 UTC (rev 75332)
@@ -26,6 +26,8 @@
#ifndef DM_TK_H
#define DM_TK_H
+#include "tk.h"
+
#define CMAP_BASE 40
#define CUBE_DIMENSION 6
#define NUM_PIXELS 216 /* CUBE_DIMENSION * CUBE_DIMENSION * CUBE_DIMENSION
*/
@@ -40,6 +42,8 @@
int is_trueColor;
unsigned long bd, bg, fg; /* color of border, background, foreground */
unsigned long pixels[NUM_PIXELS];
+ int tkfontset;
+ Tk_Font tkfontstruct;
};
#endif /* DM_TK_H */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits