int GMmenudisplay (Gwidget_t *parent, Gwidget_t *widget) { Window rwin, cwin; Dimension width, height; int rx, ry, x, y; unsigned int mask; XQueryPointer ( Gdisplay, XtWindow (parent->w), &rwin, &cwin, &rx, &ry, &x, &y, &mask ); XtRealizeWidget (widget->w); RESETARGS; ADD2ARGS (XtNwidth, &width); ADD2ARGS (XtNheight, &height); XtGetValues (widget->w, argp, argn); if (rx + width > DisplayWidth (Gdisplay, Gscreenn)) rx = DisplayWidth (Gdisplay, Gscreenn) - width; if (ry + height > DisplayHeight (Gdisplay, Gscreenn)) ry = DisplayHeight (Gdisplay, Gscreenn) - height; if (rx < 0) rx = 0; if (ry < 0) ry = 0; RESETARGS; ADD2ARGS (XtNx, rx); ADD2ARGS (XtNy, ry); XtSetValues (widget->w, argp, argn); menupoped = TRUE; menuselected = -1; XtPopupSpringLoaded (widget->w); while (menupoped) Gprocessevents (TRUE, G_ONEEVENT); Gpopdownflag = TRUE; return menuselected; }
int GSgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) { Dimension width, height; Position x, y; Boolean tf; Gwidget_t *child; int ai, wi; child = NULL; for (ai = 0; ai < attrn; ai++) { RESETARGS; switch (attrp[ai].id) { case G_ATTRSIZE: ADD2ARGS (XtNwidth, &width); ADD2ARGS (XtNheight, &height); XtGetValues (widget->w, argp, argn); attrp[ai].u.s.x = width, attrp[ai].u.s.y = height; break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, &width); XtGetValues (widget->w, argp, argn); attrp[ai].u.i = width; break; case G_ATTRCHILDCENTER: for (wi = 0; wi < Gwidgetn; wi++) { child = &Gwidgets[wi]; if (child->inuse && child->pwi == widget - &Gwidgets[0]) break; } if (wi == Gwidgetn) { Gerr (POS, G_ERRNOCHILDWIDGET); return -1; } ADD2ARGS (XtNwidth, &width); ADD2ARGS (XtNheight, &height); XtGetValues (widget->w, argp, argn); RESETARGS; ADD2ARGS (XtNx, &x); ADD2ARGS (XtNy, &y); XtGetValues (child->w, argp, argn); attrp[ai].u.p.x = width / 2 - x, attrp[ai].u.p.y = height / 2 - y; break; case G_ATTRMODE: ADD2ARGS (XtNforceBars, &tf); attrp[ai].u.t = (tf == True) ? "forcebars" : ""; break; case G_ATTRWINDOWID: sprintf (&Gbufp[0], "0x%lx", XtWindow (widget->w)); attrp[ai].u.t = &Gbufp[0]; break; case G_ATTRUSERDATA: attrp[ai].u.u = widget->udata; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } return 0; }
int GLgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) { Dimension width, height; char *s; int ai; for (ai = 0; ai < attrn; ai++) { RESETARGS; switch (attrp[ai].id) { case G_ATTRSIZE: ADD2ARGS (XtNwidth, &width); ADD2ARGS (XtNheight, &height); XtGetValues (widget->w, argp, argn); attrp[ai].u.s.x = width, attrp[ai].u.s.y = height; break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, &width); XtGetValues (widget->w, argp, argn); attrp[ai].u.i = width; break; case G_ATTRTEXT: ADD2ARGS (XtNlabel, &s); XtGetValues (widget->w, argp, argn); attrp[ai].u.t = s; break; case G_ATTRWINDOWID: sprintf (&Gbufp[0], "0x%lx", XtWindow (widget->w)); attrp[ai].u.t = &Gbufp[0]; break; case G_ATTREVENTCB: attrp[ai].u.func = WLU->func; break; case G_ATTRUSERDATA: attrp[ai].u.u = widget->udata; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } return 0; }
int GLsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) { PIXsize_t ps; int ai; XColor c; int color; RESETARGS; for (ai = 0; ai < attrn; ai++) { switch (attrp[ai].id) { case G_ATTRSIZE: GETSIZE (attrp[ai].u.s, ps, MINLWSIZE); ADD2ARGS (XtNwidth, ps.x); ADD2ARGS (XtNheight, ps.y); break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, attrp[ai].u.i); break; case G_ATTRTEXT: ADD2ARGS (XtNlabel, attrp[ai].u.t); break; case G_ATTRCOLOR: color = attrp[ai].u.c.index; if (color != 0 && color != 1) { Gerr (POS, G_ERRBADCOLORINDEX, color); return -1; } c.red = attrp[ai].u.c.r * 257; c.green = attrp[ai].u.c.g * 257; c.blue = attrp[ai].u.c.b * 257; if (XAllocColor ( Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c )) { if (color == 0) ADD2ARGS (XtNbackground, c.pixel); else ADD2ARGS (XtNforeground, c.pixel); } break; case G_ATTRWINDOWID: Gerr (POS, G_ERRCANNOTSETATTR2, "windowid"); return -1; case G_ATTREVENTCB: WLU->func = (Glabelcb) attrp[ai].u.func; break; case G_ATTRUSERDATA: widget->udata = attrp[ai].u.u; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } XtSetValues (widget->w, argp, argn); return 0; }
int GScreatewidget ( Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp ) { PIXsize_t ps; #if XlibSpecificationRelease < 5 Widget w; #endif int ai; XColor c; int color; if (!parent) { Gerr (POS, G_ERRNOPARENTWIDGET); return -1; } ps.x = ps.y = MINSWSIZE; RESETARGS; for (ai = 0; ai < attrn; ai++) { switch (attrp[ai].id) { case G_ATTRSIZE: GETSIZE (attrp[ai].u.s, ps, MINSWSIZE); break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, attrp[ai].u.i); break; case G_ATTRCHILDCENTER: Gerr (POS, G_ERRCANNOTSETATTR1, "childcenter"); return -1; case G_ATTRMODE: if (strcmp ("forcebars", attrp[ai].u.t) == 0) ADD2ARGS (XtNforceBars, True); else { Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t); return -1; } break; case G_ATTRCOLOR: color = attrp[ai].u.c.index; if (color != 0 && color != 1) { Gerr (POS, G_ERRBADCOLORINDEX, color); return -1; } c.red = attrp[ai].u.c.r * 257; c.green = attrp[ai].u.c.g * 257; c.blue = attrp[ai].u.c.b * 257; if (XAllocColor ( Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c )) { if (color == 0) ADD2ARGS (XtNbackground, c.pixel); else ADD2ARGS (XtNforeground, c.pixel); } break; case G_ATTRWINDOWID: Gerr (POS, G_ERRCANNOTSETATTR1, "windowid"); return -1; case G_ATTRUSERDATA: widget->udata = attrp[ai].u.u; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } ADD2ARGS (XtNallowHoriz, True); ADD2ARGS (XtNallowVert, True); ADD2ARGS (XtNwidth, ps.x); ADD2ARGS (XtNheight, ps.y); if (!(widget->w = XtCreateWidget ( "scroll", viewportWidgetClass, parent->w, argp, argn ))) { Gerr (POS, G_ERRCANNOTCREATEWIDGET); return -1; } #if XlibSpecificationRelease < 5 RESETARGS; ADD2ARGS (XtNwidth, ps.x); ADD2ARGS (XtNheight, ps.y); if (!(w = XtCreateWidget ( "owsucks", formWidgetClass, widget->w, argp, argn ))) { Gerr (POS, G_ERRCANNOTCREATEWIDGET); return -1; } Glazymanage (w); Glazymanage (widget->w); XtDestroyWidget (w); #else Glazymanage (widget->w); #endif return 0; }
int GSsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) { PIXpoint_t po; PIXsize_t ps; Dimension width, height; int ai; XColor c; int color; RESETARGS; for (ai = 0; ai < attrn; ai++) { switch (attrp[ai].id) { case G_ATTRSIZE: GETSIZE (attrp[ai].u.s, ps, MINSWSIZE); ADD2ARGS (XtNwidth, ps.x); ADD2ARGS (XtNheight, ps.y); break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, attrp[ai].u.i); break; case G_ATTRCHILDCENTER: GETORIGIN (attrp[ai].u.p, po); ADD2ARGS (XtNwidth, &width); ADD2ARGS (XtNheight, &height); XtGetValues (widget->w, argp, argn); po.x -= width / 2, po.y -= height / 2; if (po.x < 0) po.x = 0; if (po.y < 0) po.y = 0; XawViewportSetCoordinates (widget->w, po.x, po.y); break; case G_ATTRMODE: if (strcmp ("forcebars", attrp[ai].u.t) == 0) ADD2ARGS (XtNforceBars, True); else { Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t); return -1; } break; case G_ATTRCOLOR: color = attrp[ai].u.c.index; if (color != 0 && color != 1) { Gerr (POS, G_ERRBADCOLORINDEX, color); return -1; } c.red = attrp[ai].u.c.r * 257; c.green = attrp[ai].u.c.g * 257; c.blue = attrp[ai].u.c.b * 257; if (XAllocColor ( Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c )) { if (color == 0) ADD2ARGS (XtNbackground, c.pixel); else ADD2ARGS (XtNforeground, c.pixel); } break; case G_ATTRWINDOWID: Gerr (POS, G_ERRCANNOTSETATTR2, "windowid"); return -1; case G_ATTRUSERDATA: widget->udata = attrp[ai].u.u; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } XtSetValues (widget->w, argp, argn); return 0; }
int GTgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) { Dimension width, height; XawTextEditType mode; XawTextBlock tb; Widget w; int rtn, ai; long fi, li; for (ai = 0; ai < attrn; ai++) { RESETARGS; switch (attrp[ai].id) { case G_ATTRSIZE: ADD2ARGS (XtNwidth, &width); ADD2ARGS (XtNheight, &height); XtGetValues (widget->w, argp, argn); attrp[ai].u.s.x = width, attrp[ai].u.s.y = height; break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, &width); XtGetValues (widget->w, argp, argn); attrp[ai].u.i = width; break; case G_ATTRTEXT: w = XawTextGetSource (widget->w); tb.firstPos = 0, tb.ptr = NULL, tb.format = FMT8BIT, tb.length = 0; rtn = XawTextSourceRead (w, 0, &tb, 30000); if (rtn > Gbufn + 1) { Gbufp = Marraygrow (Gbufp, (long) (rtn + 1) * BUFSIZE); Gbufn = rtn + 1; } for (Gbufi = 0; Gbufi < rtn; Gbufi++) Gbufp[Gbufi] = tb.ptr[Gbufi]; Gbufp[Gbufi++] = '\000'; attrp[ai].u.t = &Gbufp[0]; break; case G_ATTRAPPENDTEXT: Gerr (POS, G_ERRCANNOTGETATTR, "appendtext"); return -1; case G_ATTRSELECTION: w = XawTextGetSource (widget->w); XawTextGetSelectionPos (widget->w, &fi, &li); tb.firstPos = 0, tb.ptr = NULL, tb.format = FMT8BIT, tb.length = 0; rtn = XawTextSourceRead (w, fi, &tb, li - fi); if (li - fi > Gbufn + 1) { Gbufp = Marraygrow (Gbufp, (long) (rtn + 1) * BUFSIZE); Gbufn = rtn + 1; } for (Gbufi = 0; Gbufi < li - fi; Gbufi++) Gbufp[Gbufi] = tb.ptr[Gbufi]; Gbufp[Gbufi++] = '\000'; attrp[ai].u.t = &Gbufp[0]; break; case G_ATTRMODE: ADD2ARGS (XtNeditType, &mode); XtGetValues (widget->w, argp, argn); if (mode == XawtextAppend) attrp[ai].u.t = "oneline"; else if (mode == XawtextEdit) attrp[ai].u.t = "input"; else if (mode == XawtextRead) attrp[ai].u.t = "output"; else { panic (POS, "GTgetwidgetattr", "unexpected text mode"); return -1; } break; case G_ATTRWINDOWID: sprintf (&Gbufp[0], "0x%lx", XtWindow (widget->w)); attrp[ai].u.t = &Gbufp[0]; break; case G_ATTRNEWLINECB: attrp[ai].u.func = WTU->func; break; case G_ATTRUSERDATA: attrp[ai].u.u = widget->udata; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } return 0; }
int GTsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) { PIXsize_t ps; XawTextBlock tb; int ai, li; XColor c; int color; RESETARGS; for (ai = 0; ai < attrn; ai++) { switch (attrp[ai].id) { case G_ATTRSIZE: GETSIZE (attrp[ai].u.s, ps, MINTWSIZE); ADD2ARGS (XtNwidth, ps.x); ADD2ARGS (XtNheight, ps.y); break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, attrp[ai].u.i); break; case G_ATTRTEXT: ADD2ARGS (XtNstring, attrp[ai].u.t); break; case G_ATTRAPPENDTEXT: XawTextSetInsertionPoint (widget->w, 327670000); li = XawTextGetInsertionPoint (widget->w); tb.firstPos = 0, tb.length = strlen (attrp[ai].u.t); tb.ptr = attrp[ai].u.t, tb.format = FMT8BIT; XawTextReplace (widget->w, li, li, &tb); li = XawTextGetInsertionPoint (widget->w); tb.firstPos = 0, tb.length = 1; tb.ptr = "\n", tb.format = FMT8BIT; XawTextReplace (widget->w, li, li, &tb); break; case G_ATTRMODE: if (strcmp ("oneline", attrp[ai].u.t) == 0) ADD2ARGS (XtNeditType, XawtextAppend); else if (strcmp ("input", attrp[ai].u.t) == 0) ADD2ARGS (XtNeditType, XawtextEdit); else if (strcmp ("output", attrp[ai].u.t) == 0) ADD2ARGS (XtNeditType, XawtextRead); else { Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t); return -1; } break; case G_ATTRCOLOR: color = attrp[ai].u.c.index; if (color != 0 && color != 1) { Gerr (POS, G_ERRBADCOLORINDEX, color); return -1; } c.red = attrp[ai].u.c.r * 257; c.green = attrp[ai].u.c.g * 257; c.blue = attrp[ai].u.c.b * 257; if (XAllocColor ( Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c )) if (color == 0) ADD2ARGS (XtNbackground, c.pixel); else ADD2ARGS (XtNforeground, c.pixel); break; case G_ATTRWINDOWID: Gerr (POS, G_ERRCANNOTSETATTR2, "windowid"); return -1; case G_ATTRNEWLINECB: WTU->func = (Gtwnewlinecb) attrp[ai].u.func; break; case G_ATTRUSERDATA: widget->udata = attrp[ai].u.u; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } XtSetValues (widget->w, argp, argn); return 0; }
int GTcreatewidget ( Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp ) { PIXsize_t ps; char *s; int ai; XColor c; int color; static XawTextSelectType sarray[] = { XawselectLine, XawselectNull }; if (!parent) { Gerr (POS, G_ERRNOPARENTWIDGET); return -1; } WTU->func = NULL; ps.x = ps.y = MINTWSIZE; s = "oneline"; RESETARGS; for (ai = 0; ai < attrn; ai++) { switch (attrp[ai].id) { case G_ATTRSIZE: GETSIZE (attrp[ai].u.s, ps, MINTWSIZE); break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, attrp[ai].u.i); break; case G_ATTRTEXT: ADD2ARGS (XtNstring, attrp[ai].u.t); break; case G_ATTRAPPENDTEXT: Gerr (POS, G_ERRCANNOTSETATTR1, "appendtext"); return -1; case G_ATTRMODE: s = attrp[ai].u.t; break; case G_ATTRCOLOR: color = attrp[ai].u.c.index; if (color != 0 && color != 1) { Gerr (POS, G_ERRBADCOLORINDEX, color); return -1; } c.red = attrp[ai].u.c.r * 257; c.green = attrp[ai].u.c.g * 257; c.blue = attrp[ai].u.c.b * 257; if (XAllocColor ( Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c )) if (color == 0) ADD2ARGS (XtNbackground, c.pixel); else ADD2ARGS (XtNforeground, c.pixel); break; case G_ATTRWINDOWID: Gerr (POS, G_ERRCANNOTSETATTR1, "windowid"); return -1; case G_ATTRNEWLINECB: WTU->func = (Gtwnewlinecb) attrp[ai].u.func; break; case G_ATTRUSERDATA: widget->udata = attrp[ai].u.u; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } ADD2ARGS (XtNwidth, ps.x); ADD2ARGS (XtNheight, ps.y); if (strcmp ("oneline", s) == 0) ADD2ARGS (XtNeditType, XawtextAppend); else if (strcmp ("input", s) == 0 || strcmp ("select", s) == 0) ADD2ARGS (XtNeditType, XawtextEdit); else if (strcmp ("output", s) == 0) ADD2ARGS (XtNeditType, XawtextRead); else { Gerr (POS, G_ERRBADATTRVALUE, s); return -1; } ADD2ARGS (XtNscrollHorizontal, XawtextScrollWhenNeeded); ADD2ARGS (XtNscrollVertical, XawtextScrollWhenNeeded); if (!(widget->w = XtCreateWidget ( "ascii", asciiTextWidgetClass, parent->w, argp, argn ))) { Gerr (POS, G_ERRCANNOTCREATEWIDGET); return -1; } if (strcmp ("oneline", s) == 0 || strcmp ("input", s) == 0) XtOverrideTranslations (widget->w, Gtweoltable); else if (strcmp ("select", s) == 0) XawTextSetSelectionArray (widget->w, sarray); Glazymanage (widget->w); return 0; }
int GLcreatewidget ( Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp ) { PIXsize_t ps; int ai; XColor c; int color; if (!parent) { Gerr (POS, G_ERRNOPARENTWIDGET); return -1; } WLU->func = NULL; ps.x = ps.y = MINLWSIZE; RESETARGS; for (ai = 0; ai < attrn; ai++) { switch (attrp[ai].id) { case G_ATTRSIZE: GETSIZE (attrp[ai].u.s, ps, MINLWSIZE); break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, attrp[ai].u.i); break; case G_ATTRTEXT: ADD2ARGS (XtNlabel, attrp[ai].u.t); break; case G_ATTRCOLOR: color = attrp[ai].u.c.index; if (color != 0 && color != 1) { Gerr (POS, G_ERRBADCOLORINDEX, color); return -1; } c.red = attrp[ai].u.c.r * 257; c.green = attrp[ai].u.c.g * 257; c.blue = attrp[ai].u.c.b * 257; if (XAllocColor ( Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c )) { if (color == 0) ADD2ARGS (XtNbackground, c.pixel); else ADD2ARGS (XtNforeground, c.pixel); } break; case G_ATTRWINDOWID: Gerr (POS, G_ERRCANNOTSETATTR1, "windowid"); return -1; case G_ATTREVENTCB: WLU->func = (Glabelcb) attrp[ai].u.func; break; case G_ATTRUSERDATA: widget->udata = attrp[ai].u.u; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } ADD2ARGS (XtNwidth, ps.x); ADD2ARGS (XtNheight, ps.y); ADD2ARGS (XtNhighlightThickness, 0); ADD2ARGS (XtNinternalHeight, 0); ADD2ARGS (XtNinternalWidth, 0); ADD2ARGS (XtNjustify, XtJustifyLeft); if (!(widget->w = XtCreateWidget ( "label", labelWidgetClass, parent->w, argp, argn ))) { Gerr (POS, G_ERRCANNOTCREATEWIDGET); return -1; } XtOverrideTranslations (widget->w, Glwanytable); Glazymanage (widget->w); return 0; }
int GBcreatewidget (Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp) { PIXsize_t ps; char *s; int ai; XColor c; int color; if (!parent) { Gerr (POS, G_ERRNOPARENTWIDGET); return -1; } WBU->func = NULL; ps.x = ps.y = MINBWSIZE; s = NULL; RESETARGS; for (ai = 0; ai < attrn; ai++) { switch (attrp[ai].id) { case G_ATTRSIZE: GETSIZE (attrp[ai].u.s, ps, MINBWSIZE); break; case G_ATTRBORDERWIDTH: ADD2ARGS (XtNborderWidth, attrp[ai].u.i); break; case G_ATTRTEXT: s = attrp[ai].u.t; ADD2ARGS (XtNlabel, s); break; case G_ATTRCOLOR: color = attrp[ai].u.c.index; if (color != 0 && color != 1) { Gerr (POS, G_ERRBADCOLORINDEX, color); return -1; } c.red = attrp[ai].u.c.r * 257; c.green = attrp[ai].u.c.g * 257; c.blue = attrp[ai].u.c.b * 257; if (XAllocColor ( Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c )) { if (color == 0) ADD2ARGS (XtNbackground, c.pixel); else ADD2ARGS (XtNforeground, c.pixel); } break; case G_ATTRWINDOWID: Gerr (POS, G_ERRCANNOTSETATTR1, "windowid"); return -1; case G_ATTRBUTTONCB: WBU->func = (Gbuttoncb) attrp[ai].u.func; break; case G_ATTRUSERDATA: widget->udata = attrp[ai].u.u; break; default: Gerr (POS, G_ERRBADATTRID, attrp[ai].id); return -1; } } if (!s || s[0] == '\000') { ADD2ARGS (XtNwidth, ps.x); ADD2ARGS (XtNheight, ps.y); } else { if (ps.x > MINBWSIZE) ADD2ARGS (XtNwidth, ps.x); if (ps.y > MINBWSIZE) ADD2ARGS (XtNheight, ps.y); } ADD2ARGS (XtNhighlightThickness, 0); ADD2ARGS (XtNinternalHeight, 0); ADD2ARGS (XtNinternalWidth, 0); ADD2ARGS (XtNjustify, XtJustifyLeft); if (!(widget->w = XtCreateWidget ("command", commandWidgetClass, parent->w, argp, argn))) { Gerr (POS, G_ERRCANNOTCREATEWIDGET); return -1; } XtAddCallback (widget->w, XtNcallback, bwcallback, (XtPointer) widget->udata); Glazymanage (widget->w); return 0; }