/* * Implementation */ static void GetGCs(Widget w) { XGCValues values; ListWidget lw = (ListWidget)w; values.foreground = lw->list.foreground; values.font = lw->list.font->fid; if (lw->simple.international == True) lw->list.normgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0); else lw->list.normgc = XtGetGC(w, GCForeground | GCFont, &values); values.foreground = lw->core.background_pixel; if (lw->simple.international == True) lw->list.revgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0); else lw->list.revgc = XtGetGC(w, GCForeground | GCFont, &values); values.tile = XmuCreateStippledPixmap(XtScreen(w), lw->list.foreground, lw->core.background_pixel, lw->core.depth); values.fill_style = FillTiled; if (lw->simple.international == True) lw->list.graygc = XtAllocateGC(w, 0, GCTile | GCFillStyle, &values, GCFont, 0); else lw->list.graygc = XtGetGC(w, GCFont | GCTile | GCFillStyle, &values); }
static Bool ChangeSensitive(Widget w) { CommandWidget cbw = (CommandWidget)w; if (XtIsRealized(w)) { if (XtIsSensitive(w)) { if (w->core.border_pixmap != XtUnspecifiedPixmap) XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w), w->core.border_pixmap); else XSetWindowBorder(XtDisplay(w), XtWindow(w), w->core.border_pixel); } else { if (cbw->simple.insensitive_border == None) cbw->simple.insensitive_border = XmuCreateStippledPixmap(XtScreen(w), w->core.border_pixel, cbw->command.set ? cbw->label.foreground : w->core.background_pixel, w->core.depth); XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w), cbw->simple.insensitive_border); } } return (False); }
static void GetGrayGC(LabelWidget lw) { XGCValues values; values.foreground = lw->label.foreground; values.background = lw->core.background_pixel; values.font = lw->label.font->fid; values.fill_style = FillTiled; values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw), lw->label.foreground, lw->core.background_pixel, lw->core.depth); values.graphics_exposures = False; lw->label.stipple = values.tile; if (lw->simple.international == True) /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC */ lw->label.gray_GC = XtAllocateGC((Widget)lw, 0, GCForeground | GCBackground | GCTile | GCFillStyle | GCGraphicsExposures, &values, GCFont, 0); else lw->label.gray_GC = XtGetGC((Widget)lw, GCForeground | GCBackground | GCFont | GCTile | GCFillStyle | GCGraphicsExposures, &values); }
static Bool ChangeSensitive(Widget w) { if (XtIsRealized(w)) { if (XtIsSensitive(w)) if (w->core.border_pixmap != XtUnspecifiedPixmap) XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w), w->core.border_pixmap); else XSetWindowBorder(XtDisplay(w), XtWindow(w), w->core.border_pixel); else { if (((SimpleWidget)w)->simple.insensitive_border == None) ((SimpleWidget)w)->simple.insensitive_border = XmuCreateStippledPixmap(XtScreen(w), w->core.border_pixel, w->core.background_pixel, w->core.depth); XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w), ((SimpleWidget)w)->simple.insensitive_border); } } return (False); }
static void XawSimpleRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes) { #ifndef OLDXAW XawPixmap *pixmap; #endif Pixmap border_pixmap = CopyFromParent; if (!XtIsSensitive(w)) { /* change border to gray; have to remember the old one, * so XtDestroyWidget deletes the proper one */ if (((SimpleWidget)w)->simple.insensitive_border == None) ((SimpleWidget)w)->simple.insensitive_border = XmuCreateStippledPixmap(XtScreen(w), w->core.border_pixel, w->core.background_pixel, w->core.depth); border_pixmap = w->core.border_pixmap; attributes->border_pixmap = w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; *valueMask |= CWBorderPixmap; *valueMask &= ~CWBorderPixel; } ConvertCursor(w); if ((attributes->cursor = ((SimpleWidget)w)->simple.cursor) != None) *valueMask |= CWCursor; XtCreateWindow(w, InputOutput, (Visual *)CopyFromParent, *valueMask, attributes); if (!XtIsSensitive(w)) w->core.border_pixmap = border_pixmap; #ifndef OLDXAW if (w->core.background_pixmap > XtUnspecifiedPixmap) { pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w), w->core.colormap, w->core.depth); if (pixmap && pixmap->mask) XawReshapeWidget(w, pixmap); } if (((SimpleWidget)w)->simple.tip) XawTipEnable(w); #endif }
static void CreateGC (Widget w) { ScrollbarWidget sbw = (ScrollbarWidget) w; XGCValues gcValues; XtGCMask mask; unsigned int depth = 1; if (sbw->scrollbar.thumb == XtUnspecifiedPixmap) { sbw->scrollbar.thumb = XmuCreateStippledPixmap (XtScreen(w), (Pixel) 1, (Pixel) 0, depth); } else if (sbw->scrollbar.thumb != None) { Window root; int x, y; unsigned int width, height, bw; if (XGetGeometry (XtDisplay(w), sbw->scrollbar.thumb, &root, &x, &y, &width, &height, &bw, &depth) == 0) { XtAppError (XtWidgetToApplicationContext (w), "Scrollbar Widget: Could not get geometry of thumb pixmap."); } } gcValues.foreground = sbw->scrollbar.foreground; gcValues.background = sbw->core.background_pixel; mask = GCForeground | GCBackground; if (sbw->scrollbar.thumb != None) { if (depth == 1) { gcValues.fill_style = FillOpaqueStippled; gcValues.stipple = sbw->scrollbar.thumb; mask |= GCFillStyle | GCStipple; } else { gcValues.fill_style = FillTiled; gcValues.tile = sbw->scrollbar.thumb; mask |= GCFillStyle | GCTile; } } /* the creation should be non-caching, because */ /* we now set and clear clip masks on the gc returned */ sbw->scrollbar.gc = XtGetGC (w, mask, &gcValues); }
static void CreateGC(Widget w) { ScrollbarWidget sbw = (ScrollbarWidget)w; XGCValues gcValues; XtGCMask mask; unsigned int depth = 1; if (sbw->scrollbar.thumb == XtUnspecifiedPixmap) sbw->scrollbar.thumb = XmuCreateStippledPixmap(XtScreen(w), (Pixel)1, (Pixel)0, depth); else if (sbw->scrollbar.thumb != None) { Window root; int x, y; unsigned int width, height, bw; XGetGeometry(XtDisplay(w), sbw->scrollbar.thumb, &root, &x, &y, &width, &height, &bw, &depth); } gcValues.foreground = sbw->scrollbar.foreground; gcValues.background = sbw->core.background_pixel; mask = GCForeground | GCBackground; if (sbw->scrollbar.thumb != None) { if (depth == 1) { gcValues.fill_style = FillOpaqueStippled; gcValues.stipple = sbw->scrollbar.thumb; mask |= GCFillStyle | GCStipple; } else { gcValues.fill_style = FillTiled; gcValues.tile = sbw->scrollbar.thumb; mask |= GCFillStyle | GCTile; } } sbw->scrollbar.gc = XtGetGC(w, mask, &gcValues); }
static GC newCache(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, CgsCache * me) { XGCValues xgcv; XtGCMask mask; THIS(font) = NEXT(font); THIS(cset) = NEXT(cset); THIS(fg) = NEXT(fg); THIS(bg) = NEXT(bg); memset(&xgcv, 0, sizeof(xgcv)); xgcv.font = NEXT(font)->fs->fid; mask = (GCForeground | GCBackground | GCFont); switch (cgsId) { case gcNorm: case gcBold: case gcNormReverse: case gcBoldReverse: #if OPT_WIDE_CHARS case gcWide: case gcWBold: case gcWideReverse: case gcWBoldReverse: #endif mask |= (GCGraphicsExposures | GCFunction); xgcv.graphics_exposures = True; /* default */ xgcv.function = GXcopy; break; #if OPT_BOX_CHARS case gcLine: mask |= (GCGraphicsExposures | GCFunction); xgcv.graphics_exposures = True; /* default */ xgcv.function = GXcopy; break; case gcDots: xgcv.fill_style = FillTiled; xgcv.tile = XmuCreateStippledPixmap(XtScreen((Widget) xw), THIS(fg), THIS(bg), xw->core.depth); THIS(tile) = xgcv.tile; mask = (GCForeground | GCBackground); mask |= (GCGraphicsExposures | GCFunction | GCTile | GCFillStyle); xgcv.graphics_exposures = True; /* default */ xgcv.function = GXcopy; break; #endif #if OPT_DEC_CHRSET case gcCNorm: case gcCBold: break; #endif case gcVTcursNormal: /* FALLTHRU */ case gcVTcursFilled: /* FALLTHRU */ case gcVTcursReverse: /* FALLTHRU */ case gcVTcursOutline: /* FALLTHRU */ break; #if OPT_TEK4014 case gcTKcurs: /* FALLTHRU */ /* FIXME */ #endif case gcMAX: /* should not happen */ return 0; } xgcv.foreground = NEXT(fg); xgcv.background = NEXT(bg); THIS(gc) = XCreateGC(myDisplay(xw), myDrawable(xw, cgsWin), mask, &xgcv); TRACE(("getCgsGC(%s) created gc %p(%d)\n", traceCgsEnum(cgsId), (void *) THIS(gc), ITEM())); THIS(used) = 0; return THIS(gc); }