2019-12-29 01:54:02 -07:00
|
|
|
/* $XTermId: cachedGCs.c,v 1.79 2019/11/13 23:07:08 tom Exp $ */
|
2007-06-15 13:29:55 -06:00
|
|
|
|
2011-09-17 05:51:57 -06:00
|
|
|
/*
|
2019-12-29 01:54:02 -07:00
|
|
|
* Copyright 2007-2018,2019 by Thomas E. Dickey
|
2011-09-17 05:51:57 -06:00
|
|
|
*
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
* IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
|
|
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name(s) of the above copyright
|
|
|
|
* holders shall not be used in advertising or otherwise to promote the
|
|
|
|
* sale, use or other dealings in this Software without prior written
|
|
|
|
* authorization.
|
|
|
|
*/
|
2007-06-15 13:29:55 -06:00
|
|
|
|
|
|
|
#include <data.h>
|
|
|
|
#include <xstrings.h>
|
2017-07-15 13:20:51 -06:00
|
|
|
#include <fontutils.h>
|
2007-06-15 13:29:55 -06:00
|
|
|
|
|
|
|
#include <X11/Xmu/Drawing.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* hide (or eliminate) calls to
|
|
|
|
* XCreateGC()
|
|
|
|
* XFreeGC()
|
|
|
|
* XGetGCValues()
|
|
|
|
* XSetBackground()
|
|
|
|
* XSetFont()
|
|
|
|
* XSetForeground()
|
|
|
|
* XtGetGC()
|
|
|
|
* XtReleaseGC()
|
|
|
|
* by associating an integer with each GC, maintaining a cache which
|
|
|
|
* reflects frequency of use rather than most recent usage.
|
|
|
|
*
|
|
|
|
* FIXME: XTermFonts should hold gc, font, fs.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
GC gc;
|
|
|
|
unsigned used;
|
|
|
|
unsigned cset;
|
2008-02-16 02:34:45 -07:00
|
|
|
XTermFonts *font;
|
2007-06-15 13:29:55 -06:00
|
|
|
Pixel tile;
|
|
|
|
Pixel fg;
|
|
|
|
Pixel bg;
|
|
|
|
} CgsCacheData;
|
|
|
|
|
|
|
|
#define DEPTH 8
|
2010-05-08 06:20:46 -06:00
|
|
|
#define ITEM() (int) (me->data - me->list)
|
2007-06-15 13:29:55 -06:00
|
|
|
#define LIST(item) me->list[item]
|
|
|
|
#define LINK(item) me->data = (me->list + (item))
|
|
|
|
#define THIS(field) me->data->field
|
|
|
|
#define NEXT(field) me->next.field
|
|
|
|
|
2009-03-09 16:13:04 -06:00
|
|
|
#define HaveFont(font) (Boolean) ((font) != 0 && (font)->fs != 0)
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
#define GC_CSet GCFunction
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
CgsCacheData list[DEPTH];
|
|
|
|
CgsCacheData *data; /* points to current list[] entry */
|
|
|
|
XtGCMask mask; /* changes since the last getCgsGC() */
|
|
|
|
CgsCacheData next; /* updated values, apply in getCgsGC() */
|
|
|
|
} CgsCache;
|
|
|
|
|
|
|
|
#if OPT_TRACE
|
|
|
|
#define CASE(name) case gc##name: result = #name; break
|
2009-09-05 09:58:09 -06:00
|
|
|
static const char *
|
2007-06-15 13:29:55 -06:00
|
|
|
traceCgsEnum(CgsEnum value)
|
|
|
|
{
|
2009-09-05 09:58:09 -06:00
|
|
|
const char *result = "?";
|
2007-06-15 13:29:55 -06:00
|
|
|
switch (value) {
|
|
|
|
CASE(Norm);
|
|
|
|
CASE(Bold);
|
|
|
|
CASE(NormReverse);
|
|
|
|
CASE(BoldReverse);
|
2019-02-24 04:41:42 -07:00
|
|
|
CASE(Border);
|
|
|
|
CASE(Filler);
|
2007-06-15 13:29:55 -06:00
|
|
|
#if OPT_BOX_CHARS
|
|
|
|
CASE(Line);
|
|
|
|
CASE(Dots);
|
|
|
|
#endif
|
|
|
|
#if OPT_DEC_CHRSET
|
|
|
|
CASE(CNorm);
|
|
|
|
CASE(CBold);
|
|
|
|
#endif
|
|
|
|
#if OPT_WIDE_CHARS
|
|
|
|
CASE(Wide);
|
|
|
|
CASE(WBold);
|
|
|
|
CASE(WideReverse);
|
|
|
|
CASE(WBoldReverse);
|
|
|
|
#endif
|
|
|
|
CASE(VTcursNormal);
|
|
|
|
CASE(VTcursFilled);
|
|
|
|
CASE(VTcursReverse);
|
|
|
|
CASE(VTcursOutline);
|
|
|
|
#if OPT_TEK4014
|
|
|
|
CASE(TKcurs);
|
|
|
|
#endif
|
|
|
|
CASE(MAX);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef CASE
|
|
|
|
|
2009-09-05 09:58:09 -06:00
|
|
|
static const char *
|
2014-07-14 02:30:10 -06:00
|
|
|
traceVTwin(XtermWidget xw, VTwin *value)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
2009-09-05 09:58:09 -06:00
|
|
|
const char *result = "?";
|
2007-06-15 13:29:55 -06:00
|
|
|
if (value == 0)
|
|
|
|
result = "null";
|
2010-03-25 16:03:51 -06:00
|
|
|
else if (value == &(TScreenOf(xw)->fullVwin))
|
2007-06-15 13:29:55 -06:00
|
|
|
result = "fullVwin";
|
|
|
|
#ifndef NO_ACTIVE_ICON
|
2010-03-25 16:03:51 -06:00
|
|
|
else if (value == &(TScreenOf(xw)->iconVwin))
|
2007-06-15 13:29:55 -06:00
|
|
|
result = "iconVwin";
|
|
|
|
#endif
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if OPT_TRACE > 1
|
|
|
|
static String
|
|
|
|
traceCSet(unsigned cset)
|
|
|
|
{
|
|
|
|
static char result[80];
|
|
|
|
switch (cset) {
|
|
|
|
case CSET_SWL:
|
|
|
|
strcpy(result, "SWL");
|
|
|
|
break;
|
|
|
|
case CSET_DHL_TOP:
|
|
|
|
strcpy(result, "DHL_TOP");
|
|
|
|
break;
|
|
|
|
case CSET_DHL_BOT:
|
|
|
|
strcpy(result, "DHL_BOT");
|
|
|
|
break;
|
|
|
|
case CSET_DWL:
|
|
|
|
strcpy(result, "DWL");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(result, "%#x", cset);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static String
|
2008-02-16 02:34:45 -07:00
|
|
|
traceFont(XTermFonts * font)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
static char result[80];
|
2008-02-16 02:34:45 -07:00
|
|
|
|
2009-03-09 16:13:04 -06:00
|
|
|
if (HaveFont(font)) {
|
|
|
|
XFontStruct *fs = font->fs;
|
2007-06-15 13:29:55 -06:00
|
|
|
sprintf(result, "%p(%dx%d %d %#lx)",
|
2008-02-16 02:34:45 -07:00
|
|
|
fs,
|
|
|
|
fs->max_bounds.width,
|
|
|
|
fs->max_bounds.ascent + fs->max_bounds.descent,
|
|
|
|
fs->max_bounds.descent,
|
|
|
|
(unsigned long) (fs->fid));
|
2007-06-15 13:29:55 -06:00
|
|
|
} else {
|
|
|
|
strcpy(result, "null");
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static String
|
|
|
|
tracePixel(XtermWidget xw, Pixel value)
|
|
|
|
{
|
|
|
|
#define CASE(name) { name, #name }
|
|
|
|
static struct {
|
|
|
|
TermColors code;
|
|
|
|
String name;
|
|
|
|
} t_colors[] = {
|
|
|
|
CASE(TEXT_FG),
|
|
|
|
CASE(TEXT_BG),
|
|
|
|
CASE(TEXT_CURSOR),
|
|
|
|
CASE(MOUSE_FG),
|
|
|
|
CASE(MOUSE_BG),
|
|
|
|
#if OPT_TEK4014
|
|
|
|
CASE(TEK_FG),
|
|
|
|
CASE(TEK_BG),
|
|
|
|
#endif
|
|
|
|
#if OPT_HIGHLIGHT_COLOR
|
|
|
|
CASE(HIGHLIGHT_BG),
|
|
|
|
CASE(HIGHLIGHT_FG),
|
|
|
|
#endif
|
|
|
|
#if OPT_TEK4014
|
|
|
|
CASE(TEK_CURSOR),
|
|
|
|
#endif
|
|
|
|
};
|
2010-03-25 16:03:51 -06:00
|
|
|
TScreen *screen = TScreenOf(xw);
|
2007-06-15 13:29:55 -06:00
|
|
|
String result = 0;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
for (n = 0; n < NCOLORS; ++n) {
|
|
|
|
if (value == T_COLOR(screen, t_colors[n].code)) {
|
|
|
|
result = t_colors[n].name;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == 0) {
|
|
|
|
for (n = 0; n < MAXCOLORS; ++n) {
|
|
|
|
#if OPT_COLOR_RES
|
|
|
|
if (screen->Acolors[n].mode > 0
|
|
|
|
&& value == screen->Acolors[n].value) {
|
|
|
|
result = screen->Acolors[n].resource;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (value == screen->Acolors[n]) {
|
|
|
|
char temp[80];
|
|
|
|
sprintf(temp, "Acolors[%d]", n);
|
|
|
|
result = x_strdup(temp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == 0) {
|
|
|
|
char temp[80];
|
|
|
|
sprintf(temp, "%#lx", value);
|
|
|
|
result = x_strdup(temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef CASE
|
|
|
|
|
|
|
|
#endif /* OPT_TRACE > 1 */
|
|
|
|
#endif /* OPT_TRACE */
|
|
|
|
|
2007-08-25 12:53:27 -06:00
|
|
|
static CgsCache *
|
|
|
|
allocCache(void **cache_pointer)
|
|
|
|
{
|
|
|
|
if (*cache_pointer == 0) {
|
|
|
|
*cache_pointer = TypeCallocN(CgsCache, gcMAX);
|
2009-09-05 09:58:09 -06:00
|
|
|
TRACE(("allocCache %p\n", *cache_pointer));
|
2007-08-25 12:53:27 -06:00
|
|
|
}
|
|
|
|
return *((CgsCache **) cache_pointer);
|
|
|
|
}
|
|
|
|
|
2019-02-24 04:41:42 -07:00
|
|
|
#define ALLOC_CACHE(p) ((*(p) == 0) ? allocCache(p) : *(p))
|
|
|
|
|
2008-02-16 02:34:45 -07:00
|
|
|
static int
|
|
|
|
dataIndex(CgsCache * me)
|
|
|
|
{
|
|
|
|
return ITEM();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
relinkData(CgsCache * me, int item)
|
|
|
|
{
|
|
|
|
LINK(item);
|
|
|
|
}
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
/*
|
2007-08-25 12:53:27 -06:00
|
|
|
* Returns the appropriate cache pointer.
|
2007-06-15 13:29:55 -06:00
|
|
|
*/
|
|
|
|
static CgsCache *
|
2014-07-14 02:30:10 -06:00
|
|
|
myCache(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
CgsCache *result = 0;
|
|
|
|
|
|
|
|
if ((int) cgsId >= 0 && cgsId < gcMAX) {
|
2007-08-25 12:53:27 -06:00
|
|
|
#ifdef NO_ACTIVE_ICON
|
|
|
|
(void) xw;
|
|
|
|
(void) cgsWin;
|
|
|
|
#else
|
2010-03-25 16:03:51 -06:00
|
|
|
if (cgsWin == &(TScreenOf(xw)->iconVwin))
|
2019-02-24 04:41:42 -07:00
|
|
|
result = ALLOC_CACHE(&(TScreenOf(xw)->icon_cgs_cache));
|
2007-08-25 12:53:27 -06:00
|
|
|
else
|
2007-06-15 13:29:55 -06:00
|
|
|
#endif
|
2019-02-24 04:41:42 -07:00
|
|
|
result = ALLOC_CACHE(&(TScreenOf(xw)->main_cgs_cache));
|
2007-08-25 12:53:27 -06:00
|
|
|
|
|
|
|
result += cgsId;
|
2007-06-15 13:29:55 -06:00
|
|
|
if (result->data == 0) {
|
|
|
|
result->data = result->list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Display *
|
|
|
|
myDisplay(XtermWidget xw)
|
|
|
|
{
|
2010-03-25 16:03:51 -06:00
|
|
|
return TScreenOf(xw)->display;
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static Drawable
|
2014-07-14 02:30:10 -06:00
|
|
|
myDrawable(XtermWidget xw, VTwin *cgsWin)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
Drawable drawable = 0;
|
|
|
|
|
|
|
|
if (cgsWin != 0 && cgsWin->window != 0)
|
|
|
|
drawable = cgsWin->window;
|
|
|
|
if (drawable == 0)
|
|
|
|
drawable = RootWindowOfScreen(XtScreen(xw));
|
|
|
|
return drawable;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GC
|
2014-07-14 02:30:10 -06:00
|
|
|
newCache(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, CgsCache * me)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
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));
|
2008-02-16 02:34:45 -07:00
|
|
|
xgcv.font = NEXT(font)->fs->fid;
|
2007-06-15 13:29:55 -06:00
|
|
|
mask = (GCForeground | GCBackground | GCFont);
|
|
|
|
|
|
|
|
switch (cgsId) {
|
2019-02-24 04:41:42 -07:00
|
|
|
case gcFiller:
|
|
|
|
case gcBorder:
|
|
|
|
mask &= (XtGCMask) ~ GCFont;
|
|
|
|
/* FALLTHRU */
|
2007-06-15 13:29:55 -06:00
|
|
|
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",
|
2009-09-05 09:58:09 -06:00
|
|
|
traceCgsEnum(cgsId), (void *) THIS(gc), ITEM()));
|
2007-06-15 13:29:55 -06:00
|
|
|
|
|
|
|
THIS(used) = 0;
|
|
|
|
return THIS(gc);
|
|
|
|
}
|
|
|
|
|
2019-02-24 04:41:42 -07:00
|
|
|
#define SameFont(a, b) \
|
|
|
|
(Boolean) (HaveFont(a) \
|
|
|
|
&& HaveFont(b) \
|
|
|
|
&& (((a)->fs == (b)->fs) \
|
|
|
|
|| !memcmp((a)->fs, (b)->fs, sizeof(*((a)->fs)))))
|
2008-02-16 02:34:45 -07:00
|
|
|
|
|
|
|
#define SameColor(a,b) ((a) == (b))
|
|
|
|
#define SameCSet(a,b) ((a) == (b))
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
static GC
|
2009-03-09 16:13:04 -06:00
|
|
|
chgCache(XtermWidget xw, CgsEnum cgsId GCC_UNUSED, CgsCache * me, Bool both)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
XGCValues xgcv;
|
|
|
|
XtGCMask mask = (GCForeground | GCBackground | GCFont);
|
|
|
|
|
|
|
|
memset(&xgcv, 0, sizeof(xgcv));
|
|
|
|
|
2008-02-16 02:34:45 -07:00
|
|
|
TRACE2(("chgCache(%s) old data fg=%s, bg=%s, font=%s cset %s\n",
|
|
|
|
traceCgsEnum(cgsId),
|
2007-06-15 13:29:55 -06:00
|
|
|
tracePixel(xw, THIS(fg)),
|
|
|
|
tracePixel(xw, THIS(bg)),
|
|
|
|
traceFont(THIS(font)),
|
|
|
|
traceCSet(THIS(cset))));
|
2008-02-16 02:34:45 -07:00
|
|
|
#if OPT_TRACE > 1
|
|
|
|
if (!SameFont(THIS(font), NEXT(font)))
|
|
|
|
TRACE2(("...chgCache new font=%s\n", traceFont(NEXT(font))));
|
|
|
|
if (!SameCSet(THIS(cset), NEXT(cset)))
|
|
|
|
TRACE2(("...chgCache new cset=%s\n", traceCSet(NEXT(cset))));
|
|
|
|
if (!SameColor(THIS(fg), NEXT(fg)))
|
|
|
|
TRACE2(("...chgCache new fg=%s\n", tracePixel(xw, NEXT(fg))));
|
|
|
|
if (!SameColor(THIS(bg), NEXT(bg)))
|
|
|
|
TRACE2(("...chgCache new bg=%s\n", tracePixel(xw, NEXT(bg))));
|
|
|
|
#endif
|
2007-06-15 13:29:55 -06:00
|
|
|
|
2009-03-09 16:13:04 -06:00
|
|
|
if (both) {
|
|
|
|
THIS(font) = NEXT(font);
|
|
|
|
THIS(cset) = NEXT(cset);
|
|
|
|
}
|
2007-06-15 13:29:55 -06:00
|
|
|
THIS(fg) = NEXT(fg);
|
|
|
|
THIS(bg) = NEXT(bg);
|
|
|
|
|
2008-02-16 02:34:45 -07:00
|
|
|
xgcv.font = THIS(font)->fs->fid;
|
2007-06-15 13:29:55 -06:00
|
|
|
xgcv.foreground = THIS(fg);
|
|
|
|
xgcv.background = THIS(bg);
|
|
|
|
|
|
|
|
XChangeGC(myDisplay(xw), THIS(gc), mask, &xgcv);
|
2008-02-16 02:34:45 -07:00
|
|
|
TRACE2(("...chgCache(%s) updated gc %p(%d)\n",
|
|
|
|
traceCgsEnum(cgsId), THIS(gc), ITEM()));
|
2007-06-15 13:29:55 -06:00
|
|
|
|
|
|
|
THIS(used) = 0;
|
|
|
|
return THIS(gc);
|
|
|
|
}
|
2014-07-14 02:30:10 -06:00
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
/*
|
|
|
|
* Use the "setCgsXXXX()" calls to initialize parameters for a new GC.
|
|
|
|
*/
|
|
|
|
void
|
2014-07-14 02:30:10 -06:00
|
|
|
setCgsFore(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, Pixel fg)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, cgsId)) != 0) {
|
2009-09-05 09:58:09 -06:00
|
|
|
NEXT(fg) = fg;
|
|
|
|
me->mask |= GCForeground;
|
2019-12-29 01:54:02 -07:00
|
|
|
TRACE2(("setCgsFore(%s) %s\n",
|
|
|
|
traceCgsEnum(cgsId),
|
|
|
|
tracePixel(xw, NEXT(fg))));
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-07-14 02:30:10 -06:00
|
|
|
setCgsBack(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, Pixel bg)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, cgsId)) != 0) {
|
2009-09-05 09:58:09 -06:00
|
|
|
NEXT(bg) = bg;
|
|
|
|
me->mask |= GCBackground;
|
2019-12-29 01:54:02 -07:00
|
|
|
TRACE2(("setCgsBack(%s) %s\n",
|
|
|
|
traceCgsEnum(cgsId),
|
|
|
|
tracePixel(xw, NEXT(bg))));
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if OPT_DEC_CHRSET
|
|
|
|
void
|
2014-07-14 02:30:10 -06:00
|
|
|
setCgsCSet(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, unsigned cset)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, cgsId)) != 0) {
|
2009-09-05 09:58:09 -06:00
|
|
|
NEXT(cset) = cset;
|
|
|
|
me->mask |= GC_CSet;
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define setCgsCSet(xw, cgsWin, dstCgsId, cset) /* nothing */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
2019-12-29 01:54:02 -07:00
|
|
|
setCgsFont2(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, XTermFonts * font, unsigned which)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, cgsId)) != 0) {
|
2017-07-15 13:20:51 -06:00
|
|
|
TScreen *screen = TScreenOf(xw);
|
2008-02-16 02:34:45 -07:00
|
|
|
if (!HaveFont(font)) {
|
2007-06-15 13:29:55 -06:00
|
|
|
if (cgsId != gcNorm)
|
|
|
|
(void) getCgsGC(xw, cgsWin, gcNorm);
|
|
|
|
#ifndef NO_ACTIVE_ICON
|
2010-03-25 16:03:51 -06:00
|
|
|
if (cgsWin == &(TScreenOf(xw)->iconVwin))
|
2017-07-15 13:20:51 -06:00
|
|
|
font = getIconicFont(screen);
|
2007-06-15 13:29:55 -06:00
|
|
|
else
|
|
|
|
#endif
|
2019-12-29 01:54:02 -07:00
|
|
|
font = GetNormalFont(screen, which);
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
2009-09-05 09:58:09 -06:00
|
|
|
if (HaveFont(font) && okFont(font->fs)) {
|
2015-01-18 13:24:39 -07:00
|
|
|
TRACE2(("setCgsFont next: %s for %s slot %p, gc %p\n",
|
2014-07-14 02:30:10 -06:00
|
|
|
traceFont(font), traceCgsEnum(cgsId),
|
2015-01-18 13:24:39 -07:00
|
|
|
me, THIS(gc)));
|
2007-06-15 13:29:55 -06:00
|
|
|
TRACE2(("...next font was %s\n", traceFont(NEXT(font))));
|
|
|
|
NEXT(font) = font;
|
|
|
|
me->mask |= GCFont;
|
|
|
|
} else {
|
2011-03-07 13:41:27 -07:00
|
|
|
/* EMPTY */
|
2007-06-15 13:29:55 -06:00
|
|
|
TRACE2(("...NOT updated font for %s\n",
|
|
|
|
traceCgsEnum(cgsId)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-29 01:54:02 -07:00
|
|
|
void
|
|
|
|
setCgsFont(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, XTermFonts * font)
|
|
|
|
{
|
|
|
|
setCgsFont2(xw, cgsWin, cgsId, font, fNorm);
|
|
|
|
}
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
/*
|
|
|
|
* Discard all of the font information, e.g., we are resizing the font.
|
|
|
|
* Keep the GC's so we can simply change them rather than creating new ones.
|
|
|
|
*/
|
|
|
|
void
|
2014-07-14 02:30:10 -06:00
|
|
|
clrCgsFonts(XtermWidget xw, VTwin *cgsWin, XTermFonts * font)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
2008-02-16 02:34:45 -07:00
|
|
|
if (HaveFont(font)) {
|
2016-08-07 15:27:36 -06:00
|
|
|
int j;
|
2008-02-16 02:34:45 -07:00
|
|
|
for_each_gc(j) {
|
2016-08-07 15:27:36 -06:00
|
|
|
CgsCache *me;
|
2008-02-16 02:34:45 -07:00
|
|
|
if ((me = myCache(xw, cgsWin, (CgsEnum) j)) != 0) {
|
2016-08-07 15:27:36 -06:00
|
|
|
int k;
|
2008-02-16 02:34:45 -07:00
|
|
|
for (k = 0; k < DEPTH; ++k) {
|
|
|
|
if (SameFont(LIST(k).font, font)) {
|
|
|
|
TRACE2(("clrCgsFonts %s gc %p(%d) %s\n",
|
|
|
|
traceCgsEnum((CgsEnum) j),
|
|
|
|
LIST(k).gc,
|
|
|
|
k,
|
|
|
|
traceFont(font)));
|
|
|
|
LIST(k).font = 0;
|
|
|
|
LIST(k).cset = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (SameFont(NEXT(font), font)) {
|
|
|
|
TRACE2(("clrCgsFonts %s next %s\n",
|
2007-06-15 13:29:55 -06:00
|
|
|
traceCgsEnum((CgsEnum) j),
|
|
|
|
traceFont(font)));
|
2008-02-16 02:34:45 -07:00
|
|
|
NEXT(font) = 0;
|
|
|
|
NEXT(cset) = 0;
|
2010-05-08 06:20:46 -06:00
|
|
|
me->mask &= (unsigned) ~(GCFont | GC_CSet);
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return a GC associated with the given id, allocating if needed.
|
|
|
|
*/
|
|
|
|
GC
|
2014-07-14 02:30:10 -06:00
|
|
|
getCgsGC(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
CgsCache *me;
|
|
|
|
GC result = 0;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, cgsId)) != 0) {
|
|
|
|
TRACE2(("getCgsGC(%s, %s)\n",
|
|
|
|
traceVTwin(xw, cgsWin), traceCgsEnum(cgsId)));
|
|
|
|
if (me->mask != 0) {
|
2016-08-07 15:27:36 -06:00
|
|
|
int j;
|
|
|
|
unsigned used = 0;
|
2007-06-15 13:29:55 -06:00
|
|
|
|
|
|
|
/* fill in the unchanged fields */
|
|
|
|
if (!(me->mask & GC_CSet))
|
|
|
|
NEXT(cset) = 0; /* OPT_DEC_CHRSET */
|
|
|
|
if (!(me->mask & GCFont))
|
|
|
|
NEXT(font) = THIS(font);
|
|
|
|
if (!(me->mask & GCForeground))
|
|
|
|
NEXT(fg) = THIS(fg);
|
|
|
|
if (!(me->mask & GCBackground))
|
|
|
|
NEXT(bg) = THIS(bg);
|
|
|
|
|
|
|
|
if (NEXT(font) == 0) {
|
|
|
|
setCgsFont(xw, cgsWin, cgsId, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE2(("...Cgs new data fg=%s, bg=%s, font=%s cset %s\n",
|
|
|
|
tracePixel(xw, NEXT(fg)),
|
|
|
|
tracePixel(xw, NEXT(bg)),
|
|
|
|
traceFont(NEXT(font)),
|
|
|
|
traceCSet(NEXT(cset))));
|
|
|
|
|
|
|
|
/* try to find the given data in an already-created GC */
|
|
|
|
for (j = 0; j < DEPTH; ++j) {
|
|
|
|
if (LIST(j).gc != 0
|
|
|
|
&& SameFont(LIST(j).font, NEXT(font))
|
|
|
|
&& SameCSet(LIST(j).cset, NEXT(cset))
|
|
|
|
&& SameColor(LIST(j).fg, NEXT(fg))
|
|
|
|
&& SameColor(LIST(j).bg, NEXT(bg))) {
|
|
|
|
LINK(j);
|
|
|
|
result = THIS(gc);
|
|
|
|
TRACE2(("getCgsGC existing %p(%d)\n", result, ITEM()));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == 0) {
|
|
|
|
/* try to find an empty slot, to create a new GC */
|
|
|
|
used = 0;
|
|
|
|
for (j = 0; j < DEPTH; ++j) {
|
|
|
|
if (LIST(j).gc == 0) {
|
|
|
|
LINK(j);
|
|
|
|
result = newCache(xw, cgsWin, cgsId, me);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (used < LIST(j).used)
|
|
|
|
used = LIST(j).used;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == 0) {
|
2016-08-07 15:27:36 -06:00
|
|
|
int k;
|
2007-06-15 13:29:55 -06:00
|
|
|
/* if none were empty, pick the least-used slot, to modify */
|
|
|
|
for (j = 0, k = -1; j < DEPTH; ++j) {
|
|
|
|
if (used >= LIST(j).used) {
|
|
|
|
used = LIST(j).used;
|
|
|
|
k = j;
|
|
|
|
}
|
|
|
|
}
|
2019-12-29 01:54:02 -07:00
|
|
|
if (k >= 0) {
|
|
|
|
LINK(k);
|
|
|
|
TRACE2(("...getCgsGC least-used(%d) was %d\n", k, THIS(used)));
|
|
|
|
result = chgCache(xw, cgsId, me, True);
|
|
|
|
}
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
me->next = *(me->data);
|
|
|
|
} else {
|
|
|
|
result = THIS(gc);
|
|
|
|
}
|
|
|
|
me->mask = 0;
|
|
|
|
THIS(used) += 1;
|
|
|
|
TRACE2(("...getCgsGC(%s, %s) gc %p(%d), used %d\n",
|
|
|
|
traceVTwin(xw, cgsWin),
|
|
|
|
traceCgsEnum(cgsId), result, ITEM(), THIS(used)));
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the font for the given GC.
|
|
|
|
*/
|
|
|
|
CgsEnum
|
2014-07-14 02:30:10 -06:00
|
|
|
getCgsId(XtermWidget xw, VTwin *cgsWin, GC gc)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
CgsEnum result = gcNorm;
|
|
|
|
|
|
|
|
for_each_gc(n) {
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, (CgsEnum) n)) != 0) {
|
|
|
|
if (THIS(gc) == gc) {
|
|
|
|
result = (CgsEnum) n;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the font for the given GC.
|
|
|
|
*/
|
2008-02-16 02:34:45 -07:00
|
|
|
XTermFonts *
|
2014-07-14 02:30:10 -06:00
|
|
|
getCgsFont(XtermWidget xw, VTwin *cgsWin, GC gc)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
int n;
|
2008-02-16 02:34:45 -07:00
|
|
|
XTermFonts *result = 0;
|
2007-06-15 13:29:55 -06:00
|
|
|
|
|
|
|
for_each_gc(n) {
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, (CgsEnum) n)) != 0) {
|
|
|
|
if (THIS(gc) == gc) {
|
|
|
|
result = THIS(font);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the foreground color for the given GC.
|
|
|
|
*/
|
|
|
|
Pixel
|
2014-07-14 02:30:10 -06:00
|
|
|
getCgsFore(XtermWidget xw, VTwin *cgsWin, GC gc)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
Pixel result = 0;
|
|
|
|
|
|
|
|
for_each_gc(n) {
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, (CgsEnum) n)) != 0) {
|
|
|
|
if (THIS(gc) == gc) {
|
|
|
|
result = THIS(fg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the background color for the given GC.
|
|
|
|
*/
|
|
|
|
Pixel
|
2014-07-14 02:30:10 -06:00
|
|
|
getCgsBack(XtermWidget xw, VTwin *cgsWin, GC gc)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
Pixel result = 0;
|
|
|
|
|
|
|
|
for_each_gc(n) {
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, (CgsEnum) n)) != 0) {
|
|
|
|
if (THIS(gc) == gc) {
|
|
|
|
result = THIS(bg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy the parameters (except GC of course) from one cache record to another.
|
|
|
|
*/
|
|
|
|
void
|
2014-07-14 02:30:10 -06:00
|
|
|
copyCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
if (dstCgsId != srcCgsId) {
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, srcCgsId)) != 0) {
|
|
|
|
TRACE(("copyCgs from %s to %s\n",
|
|
|
|
traceCgsEnum(srcCgsId),
|
|
|
|
traceCgsEnum(dstCgsId)));
|
2009-09-05 09:58:09 -06:00
|
|
|
TRACE2(("copyCgs from %s (me %p, fg %s, bg %s, cset %s) to %s {{\n",
|
|
|
|
traceCgsEnum(srcCgsId),
|
|
|
|
me,
|
|
|
|
tracePixel(xw, THIS(fg)),
|
|
|
|
tracePixel(xw, THIS(bg)),
|
|
|
|
traceCSet(THIS(cset)),
|
|
|
|
traceCgsEnum(dstCgsId)));
|
2007-06-15 13:29:55 -06:00
|
|
|
setCgsCSet(xw, cgsWin, dstCgsId, THIS(cset));
|
|
|
|
setCgsFore(xw, cgsWin, dstCgsId, THIS(fg));
|
|
|
|
setCgsBack(xw, cgsWin, dstCgsId, THIS(bg));
|
2009-09-05 09:58:09 -06:00
|
|
|
setCgsFont(xw, cgsWin, dstCgsId, THIS(font));
|
|
|
|
TRACE2(("...copyCgs }}\n"));
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interchange colors in the cache, e.g., for reverse-video.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
redoCgs(XtermWidget xw, Pixel fg, Pixel bg, CgsEnum cgsId)
|
|
|
|
{
|
2010-03-25 16:03:51 -06:00
|
|
|
VTwin *cgsWin = WhichVWin(TScreenOf(xw));
|
2007-06-15 13:29:55 -06:00
|
|
|
CgsCache *me = myCache(xw, cgsWin, cgsId);
|
|
|
|
|
|
|
|
if (me != 0) {
|
|
|
|
CgsCacheData *save_data = me->data;
|
2016-08-07 15:27:36 -06:00
|
|
|
int n;
|
2007-06-15 13:29:55 -06:00
|
|
|
|
|
|
|
for (n = 0; n < DEPTH; ++n) {
|
2009-03-09 16:13:04 -06:00
|
|
|
if (LIST(n).gc != 0 && HaveFont(LIST(n).font)) {
|
2007-06-15 13:29:55 -06:00
|
|
|
LINK(n);
|
|
|
|
|
|
|
|
if (LIST(n).fg == fg
|
|
|
|
&& LIST(n).bg == bg) {
|
|
|
|
setCgsFore(xw, cgsWin, cgsId, bg);
|
|
|
|
setCgsBack(xw, cgsWin, cgsId, fg);
|
|
|
|
} else if (LIST(n).fg == bg
|
|
|
|
&& LIST(n).bg == fg) {
|
|
|
|
setCgsFore(xw, cgsWin, cgsId, fg);
|
|
|
|
setCgsBack(xw, cgsWin, cgsId, bg);
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-03-09 16:13:04 -06:00
|
|
|
(void) chgCache(xw, cgsId, me, False);
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
me->data = save_data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Swap the cache records, e.g., when doing reverse-video.
|
|
|
|
*/
|
|
|
|
void
|
2014-07-14 02:30:10 -06:00
|
|
|
swapCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
if (dstCgsId != srcCgsId) {
|
|
|
|
CgsCache *src;
|
|
|
|
|
|
|
|
if ((src = myCache(xw, cgsWin, srcCgsId)) != 0) {
|
2016-08-07 15:27:36 -06:00
|
|
|
CgsCache *dst;
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
if ((dst = myCache(xw, cgsWin, dstCgsId)) != 0) {
|
2016-08-07 15:27:36 -06:00
|
|
|
CgsCache tmp;
|
2008-02-16 02:34:45 -07:00
|
|
|
int srcIndex = dataIndex(src);
|
|
|
|
int dstIndex = dataIndex(dst);
|
|
|
|
|
2009-04-04 09:10:44 -06:00
|
|
|
EXCHANGE(*src, *dst, tmp);
|
2008-02-16 02:34:45 -07:00
|
|
|
|
|
|
|
relinkData(src, dstIndex);
|
|
|
|
relinkData(dst, srcIndex);
|
2007-06-15 13:29:55 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Free any GC associated with the given id.
|
|
|
|
*/
|
|
|
|
GC
|
2014-07-14 02:30:10 -06:00
|
|
|
freeCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId)
|
2007-06-15 13:29:55 -06:00
|
|
|
{
|
|
|
|
CgsCache *me;
|
|
|
|
|
|
|
|
if ((me = myCache(xw, cgsWin, cgsId)) != 0) {
|
2016-08-07 15:27:36 -06:00
|
|
|
int j;
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
for (j = 0; j < DEPTH; ++j) {
|
|
|
|
if (LIST(j).gc != 0) {
|
|
|
|
TRACE(("freeCgs(%s, %s) gc %p(%d)\n",
|
|
|
|
traceVTwin(xw, cgsWin),
|
2009-09-05 09:58:09 -06:00
|
|
|
traceCgsEnum(cgsId), (void *) LIST(j).gc, j));
|
2007-06-15 13:29:55 -06:00
|
|
|
clrCgsFonts(xw, cgsWin, LIST(j).font);
|
|
|
|
#if OPT_BOX_CHARS
|
|
|
|
if (cgsId == gcDots) {
|
|
|
|
XmuReleaseStippledPixmap(XtScreen((Widget) xw), LIST(j).tile);
|
|
|
|
}
|
|
|
|
#endif
|
2010-03-25 16:03:51 -06:00
|
|
|
XFreeGC(TScreenOf(xw)->display, LIST(j).gc);
|
2007-06-15 13:29:55 -06:00
|
|
|
memset(&LIST(j), 0, sizeof(LIST(j)));
|
|
|
|
}
|
|
|
|
LINK(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2007-08-25 12:53:27 -06:00
|
|
|
|
|
|
|
#ifdef NO_LEAKS
|
|
|
|
void
|
|
|
|
noleaks_cachedCgs(XtermWidget xw)
|
|
|
|
{
|
|
|
|
#ifndef NO_ACTIVE_ICON
|
2010-03-25 16:03:51 -06:00
|
|
|
free(TScreenOf(xw)->icon_cgs_cache);
|
2007-08-25 12:53:27 -06:00
|
|
|
#endif
|
2010-03-25 16:03:51 -06:00
|
|
|
free(TScreenOf(xw)->main_cgs_cache);
|
2007-08-25 12:53:27 -06:00
|
|
|
}
|
|
|
|
#endif
|