Tue Dec 28 11:44:10 PST 1999 Michael Jennings <mej@eterm.org>

Thanks to a cl00 from raster, double buffering is much more efficient
	now. :-)


SVN revision: 1780
This commit is contained in:
Michael Jennings 1999-12-28 10:05:43 +00:00
parent d5373ead6a
commit cebe627ab6
7 changed files with 38 additions and 71 deletions

View File

@ -2952,3 +2952,9 @@ Tue Dec 21 16:04:39 PST 1999 Michael Jennings <mej@eterm.org>
the menu. the menu.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Tue Dec 28 11:44:10 PST 1999 Michael Jennings <mej@eterm.org>
Thanks to a cl00 from raster, double buffering is much more efficient
now. :-)
-------------------------------------------------------------------------------

View File

@ -222,10 +222,6 @@
*/ */
#define NO_VT100_ANS #define NO_VT100_ANS
/* Checks the current value of the window title and icon name before setting them.
Can save unnecessary screen refreshes */
#define SMART_WINDOW_TITLE
/* Allow changing of the foreground and background colors with "\E]39;color^G" */ /* Allow changing of the foreground and background colors with "\E]39;color^G" */
/* #define XTERM_COLOR_CHANGE */ /* #define XTERM_COLOR_CHANGE */

View File

@ -754,11 +754,6 @@ version(void)
#else #else
printf(" -NO_VT100_ANS"); printf(" -NO_VT100_ANS");
#endif #endif
#ifdef SMART_WINDOW_TITLE
printf(" +SMART_WINDOW_TITLE");
#else
printf(" -SMART_WINDOW_TITLE");
#endif
#ifdef XTERM_COLOR_CHANGE #ifdef XTERM_COLOR_CHANGE
printf(" +XTERM_COLOR_CHANGE"); printf(" +XTERM_COLOR_CHANGE");
#else #else

View File

@ -1763,17 +1763,14 @@ scr_refresh(int type)
Drawable draw_buffer; Drawable draw_buffer;
Pixmap pmap = images[image_bg].current->pmap->pixmap; Pixmap pmap = images[image_bg].current->pmap->pixmap;
int (*draw_string) (), (*draw_image_string) (); int (*draw_string) (), (*draw_image_string) ();
register int low_x = 99999, low_y = 99999, high_x = 0, high_y = 0;
#ifndef NO_BOLDFONT #ifndef NO_BOLDFONT
int bfont = 0; /* we've changed font to bold font */ int bfont = 0; /* we've changed font to bold font */
#endif #endif
#ifdef OPTIMIZE_HACKS #ifdef OPTIMIZE_HACKS
register int nrows = TermWin.nrow; register int nrows = TermWin.nrow;
register int ncols = TermWin.ncol; register int ncols = TermWin.ncol;
#endif #endif
#ifdef PROFILE_SCREEN #ifdef PROFILE_SCREEN
static long call_cnt = 0; static long call_cnt = 0;
static long long total_time = 0; static long long total_time = 0;
@ -2064,24 +2061,26 @@ scr_refresh(int type)
SWAP_IT(gcvalue.foreground, gcvalue.background, ltmp); SWAP_IT(gcvalue.foreground, gcvalue.background, ltmp);
gcmask |= (GCForeground | GCBackground); gcmask |= (GCForeground | GCBackground);
XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue); XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue);
XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, ypixel - TermWin.font->ascent, Width2Pixel(1), Height2Pixel(1));
xpixel, ypixel - TermWin.font->ascent,
Width2Pixel(1), Height2Pixel(1));
SWAP_IT(gcvalue.foreground, gcvalue.background, ltmp); SWAP_IT(gcvalue.foreground, gcvalue.background, ltmp);
XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue); XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue);
} else { } else {
CLEAR_CHARS(xpixel, ypixel - TermWin.font->ascent, 1); CLEAR_CHARS(xpixel, ypixel - TermWin.font->ascent, 1);
} }
DRAW_STRING(draw_string, xpixel, ypixel, buffer, 1); DRAW_STRING(draw_string, xpixel, ypixel, buffer, 1);
UPDATE_BOX(xpixel, ypixel - TermWin.font->ascent, xpixel + Width2Pixel(1), ypixel + Height2Pixel(1));
#ifndef NO_BOLDOVERSTRIKE #ifndef NO_BOLDOVERSTRIKE
if (MONO_BOLD(rend)) if (MONO_BOLD(rend)) {
DRAW_STRING(draw_string, xpixel + 1, ypixel, buffer, 1); DRAW_STRING(draw_string, xpixel + 1, ypixel, buffer, 1);
UPDATE_BOX(xpixel + 1, ypixel - TermWin.font->ascent, xpixel + 1 + Width2Pixel(1), ypixel + Height2Pixel(1));
}
#endif #endif
} else } else
#ifdef PIXMAP_SUPPORT #ifdef PIXMAP_SUPPORT
if (background_is_pixmap() && (back == bgColor)) { if (background_is_pixmap() && (back == bgColor)) {
CLEAR_CHARS(xpixel, ypixel - TermWin.font->ascent, len); CLEAR_CHARS(xpixel, ypixel - TermWin.font->ascent, len);
DRAW_STRING(draw_string, xpixel, ypixel, buffer, wlen); DRAW_STRING(draw_string, xpixel, ypixel, buffer, wlen);
UPDATE_BOX(xpixel, ypixel - TermWin.font->ascent, xpixel + Width2Pixel(len), ypixel + Height2Pixel(1));
} else } else
#endif #endif
{ {
@ -2089,18 +2088,21 @@ scr_refresh(int type)
CLEAR_CHARS(xpixel, ypixel - TermWin.font->ascent, len); CLEAR_CHARS(xpixel, ypixel - TermWin.font->ascent, len);
#endif #endif
DRAW_STRING(draw_image_string, xpixel, ypixel, buffer, wlen); DRAW_STRING(draw_image_string, xpixel, ypixel, buffer, wlen);
UPDATE_BOX(xpixel, ypixel - TermWin.font->ascent, xpixel + Width2Pixel(len), ypixel + Height2Pixel(1));
} }
/* do the convoluted bold overstrike */ /* do the convoluted bold overstrike */
#ifndef NO_BOLDOVERSTRIKE #ifndef NO_BOLDOVERSTRIKE
if (MONO_BOLD(rend)) if (MONO_BOLD(rend)) {
DRAW_STRING(draw_string, xpixel + 1, ypixel, buffer, wlen); DRAW_STRING(draw_string, xpixel + 1, ypixel, buffer, wlen);
UPDATE_BOX(xpixel + 1, ypixel - TermWin.font->ascent, xpixel + 1 + Width2Pixel(len), ypixel + Height2Pixel(1));
}
#endif #endif
if ((rend & RS_Uline) && (TermWin.font->descent > 1)) if ((rend & RS_Uline) && (TermWin.font->descent > 1)) {
XDrawLine(Xdisplay, draw_buffer, TermWin.gc, XDrawLine(Xdisplay, draw_buffer, TermWin.gc, xpixel, ypixel + 1, xpixel + Width2Pixel(len) - 1, ypixel + 1);
xpixel, ypixel + 1, UPDATE_BOX(xpixel, ypixel + 1, xpixel + Width2Pixel(len) - 1, ypixel + 1);
xpixel + Width2Pixel(len) - 1, ypixel + 1); }
if (is_cursor == 1) { if (is_cursor == 1) {
#ifndef NO_CURSORCOLOR #ifndef NO_CURSORCOLOR
if (PixColors[cursorColor] != PixColors[bgColor]) { if (PixColors[cursorColor] != PixColors[bgColor]) {
@ -2109,9 +2111,8 @@ scr_refresh(int type)
XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue); XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue);
} }
#endif #endif
XDrawRectangle(Xdisplay, draw_buffer, TermWin.gc, XDrawRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, ypixel - TermWin.font->ascent, Width2Pixel(1 + wbyte) - 1, Height2Pixel(1) - 1);
xpixel, ypixel - TermWin.font->ascent, UPDATE_BOX(xpixel, ypixel - TermWin.font->ascent, Width2Pixel(1 + wbyte) - 1, Height2Pixel(1) - 1);
Width2Pixel(1 + wbyte) - 1, Height2Pixel(1) - 1);
} }
if (gcmask) { /* restore normal colors */ if (gcmask) { /* restore normal colors */
gcvalue.foreground = PixColors[fgColor]; gcvalue.foreground = PixColors[fgColor];
@ -2142,7 +2143,7 @@ scr_refresh(int type)
#endif #endif
} }
if (buffer_pixmap) { if (buffer_pixmap) {
XClearWindow(Xdisplay, TermWin.vt); XClearArea(Xdisplay, TermWin.vt, low_x, low_y, high_x - low_x + 1, high_y - low_y + 1, False);
} else { } else {
if (boldlast) { if (boldlast) {
XClearArea(Xdisplay, TermWin.vt, TermWin_TotalWidth() - 2, 0, XClearArea(Xdisplay, TermWin.vt, TermWin_TotalWidth() - 2, 0,

View File

@ -49,6 +49,8 @@
#define CLEAR_CHARS(x, y, num) ((buffer_pixmap) \ #define CLEAR_CHARS(x, y, num) ((buffer_pixmap) \
? (XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, x, y, Width2Pixel(num), Height2Pixel(1), x, y)) \ ? (XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, x, y, Width2Pixel(num), Height2Pixel(1), x, y)) \
: (XClearArea(Xdisplay, TermWin.vt, x, y, Width2Pixel(num), Height2Pixel(1), 0))) : (XClearArea(Xdisplay, TermWin.vt, x, y, Width2Pixel(num), Height2Pixel(1), 0)))
#define UPDATE_BOX(x1, y1, x2, y2) do {if (buffer_pixmap) {if (x1 < low_x) low_x = x1; if (x2 > high_x) high_x = x2; \
if (y1 < low_y) low_y = y1; if (y2 > high_y) high_y = y2;}} while (0)
#define ERASE_ROWS(row, num) (XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, Col2Pixel(0), Row2Pixel(row), TermWin.width, Height2Pixel(num))) #define ERASE_ROWS(row, num) (XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, Col2Pixel(0), Row2Pixel(row), TermWin.width, Height2Pixel(num)))
#define DRAW_STRING(Func, x, y, str, len) Func(Xdisplay, draw_buffer, TermWin.gc, x, y, str, len) #define DRAW_STRING(Func, x, y, str, len) Func(Xdisplay, draw_buffer, TermWin.gc, x, y, str, len)
#ifndef NO_BRIGHTCOLOR #ifndef NO_BRIGHTCOLOR

View File

@ -1583,67 +1583,39 @@ set_colorfgbg(void)
} }
#endif /* NO_BRIGHTCOLOR */ #endif /* NO_BRIGHTCOLOR */
#ifdef SMART_WINDOW_TITLE
static void static void
set_title(const char *str) set_title(const char *str)
{ {
static char *name = NULL;
char *name; if (!str) {
str = APL_NAME "-" VERSION;
if (!str) str = APL_NAME "-" VERSION;
if (XFetchName(Xdisplay, TermWin.parent, &name) == 0) {
D_X11(("set_title(): XFetchName() failed.\n"));
name = NULL;
} }
if (name == NULL || strcmp(name, str)) { if (name == NULL || strcmp(name, str)) {
if (name != NULL) {
FREE(name);
}
D_X11(("set_title(): Setting window title to \"%s\"\n", str)); D_X11(("set_title(): Setting window title to \"%s\"\n", str));
XStoreName(Xdisplay, TermWin.parent, str); XStoreName(Xdisplay, TermWin.parent, str);
#if DEBUG >= DEBUG_X11 name = StrDup(str);
if (debug_level >= DEBUG_X11) {
if (name) XFree(name);
if (XFetchName(Xdisplay, TermWin.parent, &name) == 0) {
print_error("set_title(): Unable to set the window title to \"%s\"! What the heck is going on?!\n");
} else if (!name || strcmp(name, str)) {
print_error("set_title(): Window title still says \"%s\" after being set to \"%s\". I am a confused Eterm. :(\n", NONULL(name), str);
} else {
D_X11(("set_title(): Succeeded.\n"));
}
}
#endif
} }
if (name) XFree(name);
} }
static void static void
set_icon_name(const char *str) set_icon_name(const char *str)
{ {
static char *name = NULL;
char *name;
if (!str) str = APL_NAME "-" VERSION; if (!str) str = APL_NAME "-" VERSION;
if (XGetIconName(Xdisplay, TermWin.parent, &name) == 0) {
D_X11(("set_icon_name(): XGetIconName() failed.\n"));
name = NULL;
}
if (name == NULL || strcmp(name, str)) { if (name == NULL || strcmp(name, str)) {
if (name != NULL) {
FREE(name);
}
D_X11(("set_icon_name(): Setting window icon name to \"%s\"\n", str)); D_X11(("set_icon_name(): Setting window icon name to \"%s\"\n", str));
XSetIconName(Xdisplay, TermWin.parent, str); XSetIconName(Xdisplay, TermWin.parent, str);
#if DEBUG >= DEBUG_X11 name = StrDup(str);
if (debug_level >= DEBUG_X11) {
if (name) XFree(name);
if (XGetIconName(Xdisplay, TermWin.parent, &name) == 0) {
print_error("set_icon_name(): Unable to set the window icon name to \"%s\"! What the heck is going on?!\n");
} else if (!name || strcmp(name, str)) {
print_error("set_icon_name(): Window icon name still says \"%s\" after being set to \"%s\". I am a confused Eterm. :(\n", NONULL(name), str);
} else {
D_X11(("set_icon_name(): Succeeded.\n"));
}
}
#endif
} }
if (name) XFree(name);
} }
#endif
/* /*
* XTerm escape sequences: ESC ] Ps;Pt BEL * XTerm escape sequences: ESC ] Ps;Pt BEL

View File

@ -148,11 +148,6 @@ enum color_list {
default: PrivMode(state, bit); break; \ default: PrivMode(state, bit); break; \
}} while (0) }} while (0)
#ifndef SMART_WINDOW_TITLE
# define set_title(str) XStoreName(Xdisplay, TermWin.parent, ((str) ? (str) : (APL_NAME "-" VERSION)))
# define set_icon_name(str) XSetIconName(Xdisplay, TermWin.parent, ((str) ? (str) : (APL_NAME "-" VERSION)))
#endif
/************ Variables ************/ /************ Variables ************/
#ifdef META8_OPTION #ifdef META8_OPTION
extern unsigned char meta_char; /* Alt-key prefix */ extern unsigned char meta_char; /* Alt-key prefix */