Mon Dec 20 18:51:10 PST 1999 Michael Jennings <mej@eterm.org>

Son of a Gnea.  How did I ever get away with having *these* frikkin'
	bugs in there?! =P


SVN revision: 1704
This commit is contained in:
Michael Jennings 1999-12-20 19:08:00 +00:00
parent 6aec83e79c
commit 1b605f362f
5 changed files with 39 additions and 12 deletions

View File

@ -2927,3 +2927,9 @@ Mon Dec 13 10:00:40 PST 1999 Michael Jennings <mej@eterm.org>
fonts.
-------------------------------------------------------------------------------
Mon Dec 20 18:51:10 PST 1999 Michael Jennings <mej@eterm.org>
Son of a Gnea. How did I ever get away with having *these* frikkin'
bugs in there?! =P
-------------------------------------------------------------------------------

View File

@ -437,13 +437,16 @@ handle_configure_notify(event_t * ev)
D_EVENTS((" -> TermWin.parent is %ldx%ld at (%d, %d). Internal cache data shows %dx%d at (%hd, %hd)\n",
width, height, x, y, szHint.width, szHint.height, TermWin.x, TermWin.y));
#if 0
/* If the font change count is non-zero, this event is telling us we resized ourselves. */
if (font_change_count > 0) {
font_change_count--;
if (font_chg > 0) {
font_chg--;
}
#endif
if ((width != (unsigned int) szHint.width) || (height != (unsigned int) szHint.height)) {
Window win;
int unused;
XGetGeometry(Xdisplay, TermWin.parent, &win, &unused, &unused, &width, &height, &unused, &unused);
D_EVENTS((" -> XGetGeometry says I'm %ldx%ld\n", width, height));
/* We were resized externally. Handle the resize. */
D_EVENTS((" -> External resize detected.\n"));
handle_resize(width, height);

View File

@ -54,6 +54,7 @@ char **etmfonts = NULL;
const char *def_mfontName[] = {MFONT0, MFONT1, MFONT2, MFONT3, MFONT4};
#endif
const char *def_fontName[] = {FONT0, FONT1, FONT2, FONT3, FONT4};
unsigned char font_chg = 0;
static cachefont_t *font_cache = NULL, *cur_font = NULL;
static void font_cache_add(const char *name, unsigned char type, void *info);
@ -134,19 +135,24 @@ font_cache_add(const char *name, unsigned char type, void *info) {
font->type = type;
font->ref_cnt = 1;
switch (type) {
case FONT_TYPE_X: font->fontinfo.xfontinfo = (XFontStruct *) info; break;
case FONT_TYPE_TTF: break;
case FONT_TYPE_FNLIB: break;
default: break;
case FONT_TYPE_X: font->fontinfo.xfontinfo = (XFontStruct *) info; break;
case FONT_TYPE_TTF: break;
case FONT_TYPE_FNLIB: break;
default: break;
}
D_FONT((" -> Created new cachefont_t struct at %p: \"%s\", %d, %p\n", font, font->name, font->type, font->fontinfo.xfontinfo));
if (font_cache == NULL) {
font_cache = cur_font = font;
font->next = NULL;
D_FONT((" -> Stored as first font in cache. font_cache == cur_font == font == %p\n", font_cache));
D_FONT((" -> font_cache->next == cur_font->next == font->next == %p\n", font_cache->next));
} else {
D_FONT((" -> font_cache->next == %p, cur_font->next == %p\n", font_cache->next, cur_font->next));
cur_font->next = font;
font->next = NULL;
cur_font = font;
D_FONT((" -> Stored font in cache. font_cache == %p, cur_font == %p\n", font_cache, cur_font));
D_FONT((" -> font_cache->next == %p, cur_font->next == %p\n", font_cache->next, cur_font->next));
}
}
@ -184,6 +190,9 @@ font_cache_del(const void *info) {
tmp = current->next;
current->next = current->next->next;
XFreeFont(Xdisplay, (XFontStruct *) info);
if (cur_font == tmp) {
cur_font = current; /* If we're nuking the last entry in the cache, point cur_font to the *new* last entry. */
}
FREE(tmp->name);
FREE(tmp);
} else {
@ -316,7 +325,7 @@ change_font(int init, const char *fontname)
#ifndef NO_BOLDFONT
static XFontStruct *boldFont = NULL;
#endif
short idx = 0;
short idx = 0, old_idx = font_idx;
int fh, fw = 0;
register unsigned long i;
register int cw;
@ -374,6 +383,9 @@ change_font(int init, const char *fontname)
}
if (fontname != NULL) {
eterm_font_add(&etfonts, fontname, font_idx);
} else if (font_idx == old_idx) {
D_FONT((" -> Change to the same font index (%d) we had before? I don't think so.\n", font_idx));
return;
}
}
D_FONT((" -> Changing to font index %u (\"%s\")\n", (unsigned int) font_idx, NONULL(etfonts[font_idx])));
@ -465,6 +477,7 @@ change_font(int init, const char *fontname)
TermWin.width = TermWin.ncol * TermWin.fwidth;
TermWin.height = TermWin.nrow * TermWin.fheight;
D_FONT((" -> New font width/height = %ldx%ld, making the terminal size %ldx%ld\n", TermWin.fwidth, TermWin.fheight, TermWin.width, TermWin.height));
if (init) {
szHint.width_inc = TermWin.fwidth;
@ -479,6 +492,7 @@ change_font(int init, const char *fontname)
szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
} else {
parent_resize();
font_chg++;
}
return;
}

View File

@ -61,7 +61,7 @@ typedef struct cachefont_struct {
} cachefont_t;
/************ Variables ************/
extern unsigned char font_idx, def_font_idx, font_cnt;
extern unsigned char font_idx, def_font_idx, font_cnt, font_chg;
extern const char *def_fontName[];
extern char *rs_font[NFONTS];
extern char **etfonts, **etmfonts;

View File

@ -483,7 +483,11 @@ update_size_hints(void)
szHint.base_width = (2 * TermWin.internalBorder);
szHint.base_height = (2 * TermWin.internalBorder);
szHint.base_width += ((scrollbar_is_visible()) ? (scrollbar_trough_width()) : (0));
D_X11(("Size Hints: base width/height == %lux%lu\n", szHint.base_width, szHint.base_height));
szHint.width_inc = TermWin.fwidth;
szHint.height_inc = TermWin.fheight;
D_X11(("Size Hints: base width/height == %lux%lu, width/height increment == %lux%lu\n", szHint.base_width, szHint.base_height, szHint.width_inc, szHint.height_inc));
szHint.min_width = szHint.base_width + szHint.width_inc;
szHint.min_height = szHint.base_height + szHint.height_inc;