--- xterm/0.README Wed Dec 31 19:00:00 1969 +++ color-xterm/0.README Mon Oct 31 23:56:01 1994 @@ -0,0 +1,176 @@ +31-oct-94 +Matt Day writes: + +Hi, + +After installing your 9-jun-94 R6 color-xterm patch, I found that +standout (^[[7m in VT100 terms) wasn't working for me anymore (standout +text would show up blank in my window). It only seemed to do this when +"Enable Reverse Video" is enabled in the "VT Options" xterm menu. + +I tracked this bug down to a missing "break" statement in charproc.c, +caused by your patch. A patch to charproc.c (after applying the +color-xterm patch) which fixes the bug is appended below. + +Thanks for the color-xterm patch, by the way! + +Matt Day + +*** charproc.c- Mon Oct 31 17:45:43 1994 +--- charproc.c Mon Oct 31 19:41:32 1994 +*************** +*** 959,964 **** +--- 959,965 ---- + break; + case 7: + term->flags |= INVERSE; ++ break; + case 30: + case 31: + case 32: + +--------------------------------------------------- +7-jun-94 + +"Well, here it is, finally ... again" :-). + +This is a rework of the R4-R5 color xterm hack for X11R6. I started with +the X11R6 code, applied the colorR5-patch and then cleaned up the mess. I +also reworked the R6 man page by using the new diff features found in +GNU emacs-19. + +Enjoy. + +jsacco@ssl.com. + + +=============================================================================== +"Well, here it is, finally" :-). + +This is basically the MIT X11R5 xterm with color added. +Almost none of it is original work; I had the R4 color xterm, I ran +big diffs, and I did the ugly, nasty, brutish and all-too-long job +of porting the changes from one version to the other. + + Many instances of "2" needed to be changed to "4", which can be + hard to find when you're selectively applying diffs by hand. + +At the end of this file follows the explanation file from the R4 +version. Their item "1)" is irrelevant to the R5 version, and their +item "3)" I did not include in this version because blitting never +helped *me*. ;-) + + + +This is basically the MIT X11R5 xterm with color added, but I also +put in two tiny amounts of original code: + +I added a couple of new actions, to help with character-oriented +editors. I wanted to be able to move the cursor by pointing and +clicking, but none of the old mouseing stuff seemed right. These new +actions are not, by default, bound to anything at all. + + Their names are vi-button() and dired-button(). + example of binding: + ~Shift ~Ctrl ~Mod1 : dired-button() \n\ + + vi-button() only tries to go to the correct line, and may not + succeed if there are any long lines on the screen; they wrap to + the next screen line and are skipped over by the down-arrow + command, and can't be compensated for by vi-button. + My local vi users love it, though. + + If you run gnu emacs, no doubt you already have better ways to + do this... + +Also, I made a new slot in the font menu, to store the +previously-valid fontname provided from a selection. (The standard +xterm stores this in the menu slot used for fontnames provided by +escape sequence; which I don't like). + + +The file R4color.man is the manual page for the R4 color xterm. +I haven't fixed up the R5 manpage :-(. Sorry. + + +I take no further responsibility for this code, very little of which +originates with me. +It compiles and runs fine for me, and I use it constantly. +The standard MIT xterm ought to have color support, so you shouldn't +need this -- but alas! things aren't that way, so many people will +be happy to get this! + +======== README.new from the R4 color xterm: ============== + +Well, here it is, finally. This is basically an R4 xterm with lots of +changes. The major changes are listed below. I should emphasize that +no differences from the raw R4 xterm are in any way official MIT stuff. + +A lot of this was done in our spare time, and Silicon Graphics takes +absolutely no responsibility for any of this. The authors of the +major pieces of code are listed purely to give credit where credit +is due. Please don't bother anyone but me about this, as Erik and Paul +are both extremely busy guys. + +It is conceivable that I will continue to work on the color stuff now +that I'm going to be back at school, so if anyone wants to fix +something, or enhance something I'll be happy to take your patches. + +Here are the major changes we've made: + +1) Rearranged and rewrote most of main.c + + Paul Shupak (shupak@esd.sgi.com) did most of this. + +2) Added ISO 6429 support for color text. You can set the foreground + and background color for text using SGR. For example, to make the + foreground red, you do: "^[[31m". The values from 30 to 37 set + foreground, those from 40 to 47 set background. The default colors + are: + 0) black 1) red 2) green 3) yellow 4) blue 5) magenta + 6) cyan 7) white + + These are settable with the resources "color0" to "color1". + +3) Added a resource, menu option, and command line flag for selecting + between scrolling by bliting the window, and scrolling by redrawing + the whole window. On some servers (most notably SGI's ;-) redrawing + is faster than bliting. The command line flags are -blt/+blt, and + the resource is "bltScroll". + + Both 2) and 3) are the fault of me, Tom Weinstein. + (tomw@esd.sgi.com, tom@bears.ucsb.edu) + + NOTE: I'll be back at ucsb after Sept 19th, and my sgi + address will no longer be valid. + +4) Added escape sequences to set the primary rendition text foreground + color, background color, text cursor color, mouse foreground and + background colors and the Tektronix mode Foreground and Background + colors. These are done with a 'Set Text Parameters' control sequence + (^[]Ps^G) where Ps is 10-16 followed by a list of color names. For + more details, see the cltseqs document. This feature can be enabled + with the dynamicColor resource. One useful trick you can do with + this feature is to have different color backgrounds depending on what + machine you are logged onto. A simple escape sequence in your prompt + string ensures that the color is right, even when you rlogin to + another machine. + + This was designed and implemented by Erik Fortune (erik@esd.sgi.com). + + +One thing to note is that the ANSI color, and the dynamic color features +are totally orthogonal and use completely different color +representations. The ANSI color uses eight predefined colors, and the +dynamic color uses color names, include #NNN specifications. + +Tom Weinstein +Silicon Graphics, Inc., Entry Systems Division, Window Systems +tomw@orac.esd.sgi.com +Any opinions expressed above are mine, not sgi's. + +**************************************************************** +* * +* NOTE: After Sept 19th, my address will be tom@bears.ucsb.edu * +* * +**************************************************************** --- xterm/Tekproc.c Sun Apr 17 20:23:23 1994 +++ color-xterm/Tekproc.c Thu Jun 9 09:50:32 1994 @@ -1481,6 +1481,53 @@ if (!Ttoggled) TCursorToggle(TOGGLE); } +void +ChangeTekColors(screen,pNew) +register TScreen *screen; +ScrnColors *pNew; +{ + register int i; + XGCValues gcv; + + + if (COLOR_DEFINED(pNew,TEK_FG)) { + screen->Tforeground= COLOR_VALUE(pNew,TEK_FG); + XSetForeground(screen->display,screen->TnormalGC, + screen->Tforeground); + } + if (COLOR_DEFINED(pNew,TEK_BG)) { + screen->Tbackground= COLOR_VALUE(pNew,TEK_BG); + XSetBackground(screen->display,screen->TnormalGC, + screen->Tbackground); + } + + + if (tekWidget) { + if (tekWidget->core.border_pixel == screen->Tbackground) { + tekWidget->core.border_pixel = screen->Tforeground; + tekWidget->core.parent->core.border_pixel = + screen->Tforeground; + if (tekWidget->core.parent->core.window) + XSetWindowBorder (screen->display, + tekWidget->core.parent->core.window, + tekWidget->core.border_pixel); + } + } + + for(i = 0 ; i < TEKNUMLINES ; i++) { + XSetForeground(screen->display, screen->linepat[i], + screen->Tforeground); + } + + screen->Tcursorcolor = screen->Tforeground; + + gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ + screen->Tcursorcolor); + XChangeGC (screen->display, screen->TcursorGC, GCPlaneMask, &gcv); + TekBackground(screen); + return; +} + TekReverseVideo(screen) register TScreen *screen; { --- xterm/XTerm.ad Wed Feb 9 18:19:54 1994 +++ color-xterm/XTerm.ad Tue Jun 7 15:29:45 1994 @@ -78,3 +78,11 @@ *tek4014*font3: 6x13 *tek4014*fontSmall: 6x10 +*color0: Black +*color1: Red +*color2: Green +*color3: Yellow +*color4: Blue +*color5: Magenta +*color6: Cyan +*color7: White --- xterm/button.c Sat Apr 2 12:42:00 1994 +++ color-xterm/button.c Tue Jun 7 15:29:45 1994 @@ -164,6 +164,62 @@ #undef KeyModifiers } +void +DiredButton(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent */ +String *params; /* selections */ +Cardinal *num_params; +{ /* ^XM-G */ + register TScreen *screen = &term->screen; + int pty = screen->respond; + char Line[ 6 ]; + register unsigned line, col; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + strcpy( Line, "\030\033G " ); + + line = ( event->xbutton.y - screen->border ) / FontHeight( screen ); + col = (event->xbutton.x - screen->border - screen->scrollbar) + / FontWidth(screen); + Line[3] = ' ' + col; + Line[4] = ' ' + line; + v_write(pty, Line, 5 ); +} + +void +ViButton(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent */ +String *params; /* selections */ +Cardinal *num_params; +{ /* ^XM-G */ + register TScreen *screen = &term->screen; + int pty = screen->respond; + char Line[ 6 ]; + register int line, col; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + + line = screen->cur_row - + (( event->xbutton.y - screen->border ) / FontHeight( screen )); +/* fprintf( stderr, "xtdb line=%d\n", line ); */ + if ( ! line ) return; + Line[ 1 ] = 0; + Line[ 0 ] = 27; + v_write(pty, Line, 1 ); + + Line[ 0 ] = 'p' & 0x1f; + + if ( line < 0 ) + { line = -line; + Line[ 0 ] = 'n' & 0x1f; + } + while ( --line >= 0 ) v_write(pty, Line, 1 ); +} + /*ARGSUSED*/ void HandleSelectExtend(w, event, params, num_params) @@ -753,7 +809,7 @@ register Char *ch; for ( i = screen->max_col, - ch = screen->buf[2 * (row + screen->topline) + 1] + i ; + ch = screen->buf[4 * (row + screen->topline) + 1] + i ; i >= 0 && !(*ch & CHARDRAWN) ; ch--, i--) ; @@ -892,7 +948,7 @@ startSCol = 0; startSRow++; } else { - ptr = screen->buf[2*(startSRow+screen->topline)] + ptr = screen->buf[4*(startSRow+screen->topline)] + startSCol; class = charClass[*ptr]; do { @@ -907,7 +963,7 @@ endSRow++; } else { length = LastTextCol(endSRow); - ptr = screen->buf[2*(endSRow+screen->topline)] + ptr = screen->buf[4*(endSRow+screen->topline)] + endSCol; class = charClass[*ptr]; do { @@ -1334,7 +1390,7 @@ int *eol; { register int i = 0; - register Char *ch = screen->buf[2 * (row + screen->topline)]; + register Char *ch = screen->buf[4 * (row + screen->topline)]; Char attr; register int c; --- xterm/charproc.c Tue Aug 16 10:27:09 1994 +++ color-xterm/charproc.c Tue Nov 1 09:50:02 1994 @@ -157,6 +157,14 @@ #define XtNtiteInhibit "titeInhibit" #define XtNvisualBell "visualBell" #define XtNallowSendEvents "allowSendEvents" +#define XtNcolor0 "color0" +#define XtNcolor1 "color1" +#define XtNcolor2 "color2" +#define XtNcolor3 "color3" +#define XtNcolor4 "color4" +#define XtNcolor5 "color5" +#define XtNcolor6 "color6" +#define XtNcolor7 "color7" #define XtCAlwaysHighlight "AlwaysHighlight" #define XtCAppcursorDefault "AppcursorDefault" @@ -242,6 +250,7 @@ extern void HandleCreateMenu(), HandlePopupMenu(); extern void HandleSetFont(); extern void SetVTFont(); +extern void ViButton(), DiredButton(); extern Boolean SendMousePosition(); extern void ScrnSetAttributes(); @@ -350,6 +359,8 @@ { "tek-reset", HandleTekReset }, { "tek-copy", HandleTekCopy }, { "visual-bell", HandleVisualBell }, + { "dired-button", DiredButton }, + { "vi-button", ViButton }, }; static XtResource resources[] = { @@ -517,6 +528,36 @@ {"font6", "Font6", XtRString, sizeof(String), XtOffsetOf(XtermWidgetRec, screen.menu_font_names[fontMenu_font6]), XtRString, (XtPointer) NULL}, +{XtNcolor0, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(XtermWidget, screen.colors[COLOR_0]), + XtRString, "XtDefaultForeground"}, +{XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(XtermWidget, screen.colors[COLOR_1]), + XtRString, "XtDefaultForeground"}, +{XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(XtermWidget, screen.colors[COLOR_2]), + XtRString, "XtDefaultForeground"}, +{XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(XtermWidget, screen.colors[COLOR_3]), + XtRString, "XtDefaultForeground"}, +{XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(XtermWidget, screen.colors[COLOR_4]), + XtRString, "XtDefaultForeground"}, +{XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(XtermWidget, screen.colors[COLOR_5]), + XtRString, "XtDefaultForeground"}, +{XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(XtermWidget, screen.colors[COLOR_6]), + XtRString, "XtDefaultForeground"}, +{XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(XtermWidget, screen.colors[COLOR_7]), + XtRString, "XtDefaultForeground"}, +{"font7", "Font7", XtRString, sizeof(String), + XtOffset(XtermWidget, screen.menu_font_names[fontMenu_font7]), + XtRString, (caddr_t) NULL}, +{"dynamicColors", "DynamicColors", XtRBoolean, sizeof(Boolean), + XtOffset(XtermWidget, misc.dynamicColors), + XtRBoolean, (caddr_t) &defaultTRUE}, }; static void VTClassInit(); @@ -592,13 +633,17 @@ } if(screen->curss) { dotext(screen, term->flags, - screen->gsets[screen->curss], bptr, bptr + 1); + screen->gsets[screen->curss], bptr, bptr + 1, + term->cur_foreground, + term->cur_background ); screen->curss = 0; bptr++; } if(bptr < cp) dotext(screen, term->flags, - screen->gsets[screen->curgl], bptr, cp); + screen->gsets[screen->curgl], bptr, cp, + term->cur_foreground, + term->cur_background ); bptr = cp; break; @@ -892,7 +937,8 @@ switch (param[row]) { case DEFAULT: case 0: - term->flags &= ~(INVERSE|BOLD|UNDERLINE); + term->flags &= + ~(INVERSE|BOLD|UNDERLINE|FG_COLOR|BG_COLOR); break; case 1: case 5: /* Blink, really. */ @@ -903,6 +949,29 @@ break; case 7: term->flags |= INVERSE; + break; + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + term->flags |= FG_COLOR; + term->cur_foreground = param[row] - 30; + break; + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + term->flags |= BG_COLOR; + term->cur_background = param[row] - 40; + break; } } parsestate = groundtable; @@ -1001,9 +1070,9 @@ if(screen->cursor_state) HideCursor(); for(row = screen->max_row ; row >= 0 ; row--) { - bzero(screen->buf[2 * row + 1], + bzero(screen->buf[4 * row + 1], col = screen->max_col + 1); - for(cp = (unsigned char *)screen->buf[2 * row] ; col > 0 ; col--) + for(cp = (unsigned char *)screen->buf[4 * row] ; col > 0 ; col--) *cp++ = (unsigned char) 'E'; } ScrnRefresh(screen, 0, 0, screen->max_row + 1, @@ -1408,9 +1477,9 @@ * by charset. worry about end of line conditions (wraparound if selected). */ static void -dotext(screen, flags, charset, buf, ptr) +dotext(screen, flags, charset, buf, ptr, fg, bg ) register TScreen *screen; - unsigned flags; + unsigned flags, fg, bg; char charset; char *buf; /* start of characters to process */ char *ptr; /* end */ @@ -1459,7 +1528,7 @@ if (len < n) n = len; next_col = screen->cur_col + n; - WriteText(screen, ptr, n, flags); + WriteText(screen, ptr, n, flags, fg, bg ); /* * the call to WriteText updates screen->cur_col. * If screen->cur_col != next_col, we must have @@ -1476,16 +1545,21 @@ * the current cursor position. update cursor position. */ static void -WriteText(screen, str, len, flags) +WriteText(screen, str, len, flags, fg, bg ) register TScreen *screen; register char *str; register int len; - unsigned flags; + unsigned flags, fg, bg; { register int cx, cy; register unsigned fgs = flags; + register Pixel fg_pix, bg_pix; GC currentGC; + fg_pix = (fgs&FG_COLOR) ? screen->colors[fg] : screen->foreground; + bg_pix = (fgs&BG_COLOR) ? screen->colors[bg] : + term->core.background_pixel; + if(screen->cur_row - screen->topline <= screen->max_row) { /* if(screen->cur_row == screen->cursor_row && screen->cur_col <= @@ -1499,14 +1573,23 @@ * make sure that the correct GC is current */ - if (fgs & BOLD) if (fgs & INVERSE) + { + if (fgs & BOLD) currentGC = screen->reverseboldGC; - else currentGC = screen->normalboldGC; + else currentGC = screen->reverseGC; + + XSetForeground(screen->display, currentGC, bg_pix); + XSetBackground(screen->display, currentGC, fg_pix); + } else { + if (fgs & BOLD) + currentGC = screen->normalboldGC; else /* not bold */ - if (fgs & INVERSE) - currentGC = screen->reverseGC; - else currentGC = screen->normalGC; + currentGC = screen->normalGC; + + XSetForeground(screen->display, currentGC, fg_pix); + XSetBackground(screen->display, currentGC, bg_pix); + } if (fgs & INSERT) InsertChar(screen, len); @@ -1536,7 +1619,7 @@ ++ntotal; } } - ScreenWrite(screen, str, flags, len); + ScreenWrite(screen, str, flags, fg, bg, len); CursorForward(screen, len); } @@ -2077,12 +2160,12 @@ register TScreen *screen; { register int rows = screen->max_row + 1; - char *save [2 * MAX_ROWS]; + char *save [4 * MAX_ROWS]; - memmove( (char *)save, (char *)screen->buf, 2 * sizeof(char *) * rows); + memmove( (char *)save, (char *)screen->buf, 4 * sizeof(char *) * rows); memmove( (char *)screen->buf, (char *)screen->altbuf, - 2 * sizeof(char *) * rows); - memmove( (char *)screen->altbuf, (char *)save, 2 * sizeof(char *) * rows); + 4 * sizeof(char *) * rows); + memmove( (char *)screen->altbuf, (char *)save, 4 * sizeof(char *) * rows); } VTRun() @@ -2216,7 +2299,7 @@ screen->allbuf = Allocate (nrows, screen->max_col + 1, &screen->sbuf_address); if (screen->scrollWidget) - screen->buf = &screen->allbuf[2 * screen->savelines]; + screen->buf = &screen->allbuf[4 * screen->savelines]; else screen->buf = screen->allbuf; return; @@ -2286,6 +2369,10 @@ new->screen.menu_font_names[fontMenu_fontsel] = NULL; new->screen.menu_font_number = fontMenu_fontdefault; + for (i = 0; i < MAXCOLORS; i++) { + new->screen.colors[i] = request->screen.colors[i]; + } + /* * The definition of -rv now is that it changes the definition of * XtDefaultForeground and XtDefaultBackground. So, we no longer @@ -2587,7 +2674,7 @@ if (screen->cur_row - screen->topline > screen->max_row) return; - c = screen->buf[y = 2 * (screen->cursor_row = screen->cur_row)] + c = screen->buf[y = 4 * (screen->cursor_row = screen->cur_row)] [x = screen->cursor_col = screen->cur_col]; flags = screen->buf[y + 1][x]; if (c == 0) @@ -2627,6 +2714,26 @@ } } } +#if 0 + /*RFB*/ + if ( flags & BG_COLOR ) + XSetForeground( screen->display, currentGC, + screen->colors[ term->cur_background ]); + if ( flags & FG_COLOR ) + XSetBackground( screen->display, currentGC, + screen->colors[ term->cur_foreground ]); + /**********************************************************/ + /* */ + /* we test "flags and background" before calling */ + /* XSetForeground; */ + /* */ + /* it looks funny, but we're in reverse video and the */ + /* color we're setting it to is the current background */ + /* color! */ + /* */ + /**********************************************************/ + /*RFB*/ +#endif } else { /* not selected */ if (( (flags & INVERSE) && !in_selection) || (!(flags & INVERSE) && in_selection)) { @@ -2635,7 +2742,16 @@ } else { /* normal video */ currentGC = screen->normalGC; } - +#if 0 + /*RFB*/ + if ( flags & FG_COLOR ) + XSetForeground( screen->display, currentGC, + screen->colors[ term->cur_foreground ]); + if ( flags & BG_COLOR ) + XSetBackground( screen->display, currentGC, + screen->colors[ term->cur_background ]); + /*RFB*/ +#endif } x = CursorX (screen, screen->cur_col); @@ -2674,7 +2790,7 @@ if(screen->cursor_row - screen->topline > screen->max_row) return; - c = screen->buf[y = 2 * screen->cursor_row][x = screen->cursor_col]; + c = screen->buf[y = 4 * screen->cursor_row][x = screen->cursor_col]; flags = screen->buf[y + 1][x]; if (screen->cursor_row > screen->endHRow || @@ -3040,10 +3156,14 @@ fontnum = fontMenu_font5; break; case '6': fontnum = fontMenu_font6; break; + case '7': + fontnum = fontMenu_font7; break; case 'e': case 'E': fontnum = fontMenu_fontescape; maxparams = 3; break; case 's': case 'S': fontnum = fontMenu_fontsel; maxparams = 2; break; + case 'o': case 'O': + fontnum = fontMenu_fontold; break; default: Bell(); return; --- xterm/main.c Sun May 22 13:10:05 1994 +++ color-xterm/main.c Thu Jun 9 09:13:58 1994 @@ -564,6 +564,8 @@ {"-cr", "*cursorColor", XrmoptionSepArg, (caddr_t) NULL}, {"-cu", "*curses", XrmoptionNoArg, (caddr_t) "on"}, {"+cu", "*curses", XrmoptionNoArg, (caddr_t) "off"}, +{"-dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "off"}, +{"+dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "on"}, {"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, {"-fb", "*boldFont", XrmoptionSepArg, (caddr_t) NULL}, {"-j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "on"}, @@ -688,6 +690,7 @@ { "-C", "intercept console messages (not supported)" }, #endif { "-Sxxd", "slave mode on \"ttyxx\", file descriptor \"d\"" }, +{ "-/+dc", "turn off/on dynamic color selection" }, { NULL, NULL }}; static char *message[] = { @@ -3027,7 +3030,6 @@ s++; } } - int GetBytesAvailable (fd) int fd; --- xterm/menu.c Sun Apr 17 20:23:30 1994 +++ color-xterm/menu.c Tue Jun 7 15:29:48 1994 @@ -114,8 +114,10 @@ { "font4", do_vtfont, NULL }, /* 4 */ { "font5", do_vtfont, NULL }, /* 5 */ { "font6", do_vtfont, NULL }, /* 6 */ - { "fontescape", do_vtfont, NULL }, /* 7 */ - { "fontsel", do_vtfont, NULL }}; /* 8 */ + { "font7", do_vtfont, NULL }, /* 7 */ + { "fontescape", do_vtfont, NULL }, /* 8 */ + { "fontold", do_vtfont, NULL }, /* 9 */ + { "fontsel", do_vtfont, NULL }}; /* 10 */ /* this should match NMENUFONTS in ptyx.h */ MenuEntry tekMenuEntries[] = { @@ -220,6 +222,10 @@ set_sensitivity (screen->fontMenu, fontMenuEntries[fontMenu_fontescape].widget, (screen->menu_font_names[fontMenu_fontescape] + ? TRUE : FALSE)); + set_sensitivity (screen->fontMenu, + fontMenuEntries[fontMenu_fontold].widget, + (screen->menu_font_names[fontMenu_fontold] ? TRUE : FALSE)); } FindFontSelection (NULL, True); --- xterm/menu.h Sun Apr 17 20:23:31 1994 +++ color-xterm/menu.h Tue Jun 7 15:29:48 1994 @@ -134,9 +134,11 @@ #define fontMenu_font4 4 #define fontMenu_font5 5 #define fontMenu_font6 6 -#define fontMenu_lastBuiltin fontMenu_font6 -#define fontMenu_fontescape 7 -#define fontMenu_fontsel 8 +#define fontMenu_font7 7 +#define fontMenu_lastBuiltin fontMenu_font7 +#define fontMenu_fontescape 8 +#define fontMenu_fontold 9 +#define fontMenu_fontsel 10 /* number of non-line items should match NMENUFONTS in ptyx.h */ --- xterm/misc.c Mon Mar 28 18:27:03 1994 +++ color-xterm/misc.c Tue Nov 1 09:58:35 1994 @@ -64,7 +64,6 @@ { XEvent event; register TScreen *screen = &term->screen; - extern XtAppContext app_con; if(screen->scroll_amt) FlushScroll(screen); @@ -690,6 +689,15 @@ case 2: /* new title only */ Changetitle(buf); break; + case 10: case 11: case 12: + case 13: case 14: case 15: + case 16: + { + extern Boolean ChangeColorsRequest(); + if (term->misc.dynamicColors) + ChangeColorsRequest(term,mode-10,buf); + } + break; #ifdef ALLOWLOGGING case 46: /* new log file */ @@ -744,6 +752,185 @@ { ChangeGroup( XtNtitle, (XtArgVal)name ); } + +/***====================================================================***/ + +ScrnColors *pOldColors= NULL; + +Boolean +GetOldColors(pTerm) +XtermWidget pTerm; +{ +int i; + if (pOldColors==NULL) { + pOldColors= (ScrnColors *)XtMalloc(sizeof(ScrnColors)); + if (pOldColors==NULL) { + fprintf(stderr,"allocation failure in GetOldColors\n"); + return(FALSE); + } + pOldColors->which= 0; + for (i=0;icolors[i]= 0; + pOldColors->names[i]= NULL; + } + GetColors(pTerm,pOldColors); + } + return(TRUE); +} + +Boolean +UpdateOldColors(pTerm,pNew) +XtermWidget pTerm; +ScrnColors *pNew; +{ +int i; + + /* if we were going to free old colors, this would be the place to + * do it. I've decided not to (for now), because it seems likely + * that we'd have a small set of colors we use over and over, and that + * we could save some overhead this way. The only case in which this + * (clearly) fails is if someone is trying a boatload of colors, in + * which case they can restart xterm + */ + for (i=0;inames[i]!=NULL) { + XtFree(pOldColors->names[i]); + pOldColors->names[i]= NULL; + } + if (pNew->names[i]) { + pOldColors->names[i]= pNew->names[i]; + } + pOldColors->colors[i]= pNew->colors[i]; + } + } + return(TRUE); +} + +void +ReverseOldColors() +{ +register ScrnColors *pOld= pOldColors; +Pixel tmpPix; +char *tmpName; + + if (pOld) { + /* change text cursor, if necesary */ + if (pOld->colors[TEXT_CURSOR]==pOld->colors[TEXT_FG]) { + pOld->colors[TEXT_CURSOR]= pOld->colors[TEXT_BG]; + if (pOld->names[TEXT_CURSOR]) { + XtFree(pOldColors->names[TEXT_CURSOR]); + pOld->names[TEXT_CURSOR]= NULL; + } + if (pOld->names[TEXT_BG]) { + tmpName= XtMalloc(strlen(pOld->names[TEXT_BG])+1); + if (tmpName) { + strcpy(tmpName,pOld->names[TEXT_BG]); + pOld->names[TEXT_CURSOR]= tmpName; + } + } + } + + /* swap text FG and BG */ + tmpPix= pOld->colors[TEXT_FG]; + tmpName= pOld->names[TEXT_FG]; + pOld->colors[TEXT_FG]= pOld->colors[TEXT_BG]; + pOld->names[TEXT_FG]= pOld->names[TEXT_BG]; + pOld->colors[TEXT_BG]= tmpPix; + pOld->names[TEXT_BG]= tmpName; + + /* swap mouse FG and BG */ + tmpPix= pOld->colors[MOUSE_FG]; + tmpName= pOld->names[MOUSE_FG]; + pOld->colors[MOUSE_FG]= pOld->colors[MOUSE_BG]; + pOld->names[MOUSE_FG]= pOld->names[MOUSE_BG]; + pOld->colors[MOUSE_BG]= tmpPix; + pOld->names[MOUSE_BG]= tmpName; + + /* swap Tek FG and BG */ + tmpPix= pOld->colors[TEK_FG]; + tmpName= pOld->names[TEK_FG]; + pOld->colors[TEK_FG]= pOld->colors[TEK_BG]; + pOld->names[TEK_FG]= pOld->names[TEK_BG]; + pOld->colors[TEK_BG]= tmpPix; + pOld->names[TEK_BG]= tmpName; + } + return; +} + +Boolean +AllocateColor(pTerm,pNew,ndx,name) +XtermWidget pTerm; +ScrnColors *pNew; +int ndx; +char *name; +{ +XColor def; +register TScreen *screen= &pTerm->screen; +Colormap cmap= pTerm->core.colormap; +char *newName; + + if ((XParseColor(screen->display,cmap,name,&def))&& + (XAllocColor(screen->display,cmap,&def))) { + SET_COLOR_VALUE(pNew,ndx,def.pixel); + newName= XtMalloc(strlen(name)+1); + if (newName) { + strcpy(newName,name); + SET_COLOR_NAME(pNew,ndx,newName); + } + return(TRUE); + } + return(FALSE); +} + +Boolean +ChangeColorsRequest(pTerm,start,names) +XtermWidget pTerm; +int start; +register char *names; +{ +char *thisName; +ScrnColors newColors; +int i,ndx; + + if ((pOldColors==NULL)&&(!GetOldColors(pTerm))) { + return(FALSE); + } + newColors.which= 0; + for (i=0;imisc.re_verse) ndx= OPPOSITE_COLOR(i); + else ndx= i; + if ((names==NULL)||(names[0]=='\0')) { + newColors.names[ndx]= NULL; + } + else { + if (names[0]==';') + thisName= NULL; + else thisName= names; + names= index(names,';'); + if (names!=NULL) { + *names= '\0'; + names++; + } + if ((!pOldColors->names[ndx])|| + (thisName&&(strcmp(thisName,pOldColors->names[ndx])))) { + AllocateColor(pTerm,&newColors,ndx,thisName); + } + } + } + + if (newColors.which==0) + return(TRUE); + + ChangeColors(pTerm,&newColors); + UpdateOldColors(pTerm,&newColors); + return(TRUE); +} + +/***====================================================================***/ #ifndef DEBUG /* ARGSUSED */ --- xterm/ptyx.h Tue Aug 16 10:27:10 1994 +++ color-xterm/ptyx.h Tue Nov 1 10:01:30 1994 @@ -132,7 +132,7 @@ #define APC 0x9F #define RDEL 0xFF -#define NMENUFONTS 9 /* entries in fontMenu */ +#define NMENUFONTS 11 /* entries in fontMenu */ #define NBOX 5 /* Number of Points in box */ #define NPARAM 10 /* Max. parameters */ @@ -191,6 +191,52 @@ #define SAVELINES 64 /* default # lines to save */ #define SCROLLLINES 1 /* default # lines to scroll */ +/***====================================================================***/ + +#define TEXT_FG 0 +#define TEXT_BG 1 +#define TEXT_CURSOR 2 +#define MOUSE_FG 3 +#define MOUSE_BG 4 +#define TEK_FG 5 +#define TEK_BG 6 +#define NCOLORS 7 + +#define COLOR_DEFINED(s,w) ((s)->which&(1<<(w))) +#define COLOR_VALUE(s,w) ((s)->colors[w]) +#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w]=(v)),((s)->which|=(1<<(w)))) + +#define COLOR_NAME(s,w) ((s)->names[w]) +#define SET_COLOR_NAME(s,w,v) (((s)->names[w]=(v)),((s)->which|=(1<<(w)))) + +#define UNDEFINE_COLOR(s,w) ((s)->which&=(~((w)<<1))) +#define OPPOSITE_COLOR(n) (((n)==TEXT_FG?TEXT_BG:\ + ((n)==TEXT_BG?TEXT_FG:\ + ((n)==MOUSE_FG?MOUSE_BG:\ + ((n)==MOUSE_BG?MOUSE_FG:\ + ((n)==TEK_FG?TEK_BG:\ + ((n)==TEXT_BG?TEK_FG:(n)))))))) + +typedef struct { + unsigned which; + Pixel colors[NCOLORS]; + char *names[NCOLORS]; +} ScrnColors; + +/***====================================================================***/ + +#define MAXCOLORS 8 +#define COLOR_0 0 +#define COLOR_1 1 +#define COLOR_2 2 +#define COLOR_3 3 +#define COLOR_4 4 +#define COLOR_5 5 +#define COLOR_6 6 +#define COLOR_7 7 + + + typedef struct { /* These parameters apply to both windows */ Display *display; /* X display for screen */ @@ -210,6 +256,7 @@ Pixel cursorcolor; /* Cursor color */ Pixel mousecolor; /* Mouse color */ Pixel mousecolorback; /* Mouse color background */ + Pixel colors[MAXCOLORS]; /* ANSI color emulation */ int border; /* inner border */ Cursor arrow; /* arrow cursor */ unsigned short send_mouse_pos; /* user wants mouse transition */ @@ -399,6 +446,7 @@ Boolean tekSmall; /* start tek window in small size */ Boolean appcursorDefault; Boolean appkeypadDefault; + Boolean dynamicColors; } Misc; typedef struct {int foo;} XtermClassPart, TekClassPart; @@ -430,6 +478,8 @@ TKeyboard keyboard; /* terminal keyboard */ TScreen screen; /* terminal screen */ unsigned flags; /* mode flags */ + unsigned cur_foreground; /* current foreground color */ + unsigned cur_background; /* current background color */ unsigned initflags; /* initial mode flags */ Tabs tabs; /* tabstops of the terminal */ Misc misc; /* miscellaneous parameters */ @@ -451,7 +501,7 @@ * term->flags and screen->save_modes. This need only fit in an unsigned. */ -#define ATTRIBUTES 0x07 /* mask: user-visible attributes */ +#define ATTRIBUTES 0x67 /* mask: user-visible attributes */ /* global flags and character flags (visible character attributes) */ #define INVERSE 0x01 /* invert the characters to be output */ #define UNDERLINE 0x02 /* true if underlining */ @@ -469,6 +519,9 @@ screen. Used to distinguish blanks from empty parts of the screen when selecting */ /* global flags */ +#define BG_COLOR 0x20 /* true if background set */ +#define FG_COLOR 0x40 /* true if foreground set */ + #define WRAPAROUND 0x400 /* true if auto wraparound mode */ #define REVERSEWRAP 0x800 /* true if reverse wraparound mode */ #define REVERSE_VIDEO 0x1000 /* true if screen white on black */ --- xterm/screen.c Sat Apr 2 17:35:27 1994 +++ color-xterm/screen.c Tue Jun 7 17:41:16 1994 @@ -54,6 +54,9 @@ thereto each line is formed from a pair of char arrays. The first (even) one is the actual character array and the second (odd) one is the attributes. +> each line is formed from four char arrays. The first one is the actual +> character array, the second one is the attributes, the third is the +> foreground color, and the fourth is the background color. */ register int nrow, ncol; Char **addr; @@ -62,7 +65,7 @@ register Char *tmp; register int i; - if ((base = (ScrnBuf) calloc ((unsigned)(nrow *= 2), sizeof (char *))) == 0) + if ((base = (ScrnBuf) calloc ((unsigned)(nrow *= 4), sizeof (char *))) == 0) SysError (ERROR_SCALLOC); if ((tmp = calloc ((unsigned) (nrow * ncol), sizeof(char))) == 0) @@ -95,7 +98,7 @@ if (sbuf == NULL || *sbuf == NULL) return 0; - oldrow *= 2; + oldrow *= 4; oldbuf = *sbufaddr; /* @@ -110,11 +113,11 @@ * If the screen shrinks, remove lines off the top of the buffer * if resizeGravity resource says to do so. */ - nrow *= 2; + nrow *= 4; if (nrow < oldrow && term->misc.resizeGravity == SouthWestGravity) { /* Remove lines off the top of the buffer if necessary. */ move_up = oldrow-nrow - - 2*(term->screen.max_row - term->screen.cur_row); + - 4*(term->screen.max_row - term->screen.cur_row); if (move_up < 0) move_up = 0; /* Overlapping memmove here! */ @@ -138,7 +141,7 @@ mincols = (oldcol < ncol) ? oldcol : ncol; if (nrow > oldrow && term->misc.resizeGravity == SouthWestGravity) { /* move data down to bottom of expanded screen */ - move_down = Min(nrow-oldrow, 2*term->screen.savedlines); + move_down = Min(nrow-oldrow, 4*term->screen.savedlines); tmp += ncol*move_down; } for (i = 0; i < minrows; i++, tmp += ncol) { @@ -153,10 +156,10 @@ /* Now free the old buffer */ free(oldbuf); - return move_down ? move_down/2 : -move_up/2; /* convert to rows */ + return move_down ? move_down/4 : -move_up/4; /* convert to rows */ } -ScreenWrite (screen, str, flags, length) +ScreenWrite (screen, str, flags, cur_fg, cur_bg, length) /* Writes str into buf at row row and column col. Characters are set to match flags. @@ -164,9 +167,10 @@ TScreen *screen; char *str; register unsigned flags; +register unsigned cur_fg, cur_bg; register int length; /* length of string */ { - register Char *attrs, *attrs0; + register Char *attrs, *attrs0, *fgs, *bgs; register int avail = screen->max_col - screen->cur_col + 1; register Char *col; register int wrappedbit; @@ -176,14 +180,21 @@ if (length <= 0) return; - col = screen->buf[avail = 2 * screen->cur_row] + screen->cur_col; + col = screen->buf[avail = 4 * screen->cur_row] + screen->cur_col; attrs = attrs0 = screen->buf[avail + 1] + screen->cur_col; + fgs = screen->buf[avail + 2] + screen->cur_col; + bgs = screen->buf[avail + 3] + screen->cur_col; + wrappedbit = *attrs0&LINEWRAPPED; flags &= ATTRIBUTES; flags |= CHARDRAWN; memmove( col, str, length); while(length-- > 0) + { *attrs++ = flags; + *fgs++ = cur_fg; + *bgs++ = cur_bg; + } if (wrappedbit) *attrs0 |= LINEWRAPPED; } @@ -200,15 +211,15 @@ register int where, n, size; { register int i; - char *save [2 * MAX_ROWS]; + char *save [4 * MAX_ROWS]; /* save n lines at bottom */ - memmove( (char *) save, (char *) &sb [2 * (last -= n - 1)], - 2 * sizeof (char *) * n); + memmove( (char *) save, (char *) &sb [4 * (last -= n - 1)], + 4 * sizeof (char *) * n); /* clear contents of old rows */ - for (i = 2 * n - 1; i >= 0; i--) + for (i = 4 * n - 1; i >= 0; i--) bzero ((char *) save [i], size); /* @@ -220,11 +231,11 @@ * * +--------|---------|----+ */ - memmove( (char *) &sb [2 * (where + n)], (char *) &sb [2 * where], - 2 * sizeof (char *) * (last - where)); + memmove( (char *) &sb [4 * (where + n)], (char *) &sb [4 * where], + 4 * sizeof (char *) * (last - where)); /* reuse storage for new lines at where */ - memmove( (char *) &sb[2 * where], (char *)save, 2 * sizeof(char *) * n); + memmove( (char *) &sb[4 * where], (char *)save, 4 * sizeof(char *) * n); } @@ -240,22 +251,22 @@ int where; { register int i; - char *save [2 * MAX_ROWS]; + char *save [4 * MAX_ROWS]; /* save n lines at where */ - memmove( (char *)save, (char *) &sb[2 * where], 2 * sizeof(char *) * n); + memmove( (char *)save, (char *) &sb[4 * where], 4 * sizeof(char *) * n); /* clear contents of old rows */ - for (i = 2 * n - 1 ; i >= 0 ; i--) + for (i = 4 * n - 1 ; i >= 0 ; i--) bzero ((char *) save [i], size); /* move up lines */ - memmove( (char *) &sb[2 * where], (char *) &sb[2 * (where + n)], - 2 * sizeof (char *) * ((last -= n - 1) - where)); + memmove( (char *) &sb[4 * where], (char *) &sb[4 * (where + n)], + 4 * sizeof (char *) * ((last -= n - 1) - where)); /* reuse storage for new bottom lines */ - memmove( (char *) &sb[2 * last], (char *)save, - 2 * sizeof(char *) * n); + memmove( (char *) &sb[4 * last], (char *)save, + 4 * sizeof(char *) * n); } @@ -268,8 +279,8 @@ register int col, n; { register int i, j; - register Char *ptr = sb [2 * row]; - register Char *attrs = sb [2 * row + 1]; + register Char *ptr = sb [4 * row]; + register Char *attrs = sb [4 * row + 1]; int wrappedbit = attrs[0]&LINEWRAPPED; attrs[0] &= ~LINEWRAPPED; /* make sure the bit isn't moved */ @@ -296,8 +307,8 @@ register int row, size; register int n, col; { - register Char *ptr = sb[2 * row]; - register Char *attrs = sb[2 * row + 1]; + register Char *ptr = sb[4 * row]; + register Char *attrs = sb[4 * row + 1]; register nbytes = (size - n - col); int wrappedbit = attrs[0]&LINEWRAPPED; @@ -336,12 +347,15 @@ for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) { register Char *chars; register Char *attrs; + register Char *fgs, *bgs; register int col = leftcol; int maxcol = leftcol + ncols - 1; int lastind; int flags; + int fg, bg; int x, n; GC gc; + Pixel fg_pix, bg_pix; Boolean hilite; if (row < screen->top_marg || row > screen->bot_marg) @@ -352,8 +366,10 @@ if (lastind < 0 || lastind > max) continue; - chars = screen->buf [2 * (lastind + topline)]; - attrs = screen->buf [2 * (lastind + topline) + 1]; + chars = screen->buf [4 * (lastind + topline)]; + attrs = screen->buf [4 * (lastind + topline) + 1]; + fgs = screen->buf [4 * (lastind + topline) + 2]; + bgs = screen->buf [4 * (lastind + topline) + 3]; if (row < screen->startHRow || row > screen->endHRow || (row == screen->startHRow && maxcol < screen->startHCol) || @@ -390,20 +406,39 @@ if (col > maxcol) continue; flags = attrs[col]; + fg = fgs[col]; + bg = bgs[col]; + + fg_pix = (flags & FG_COLOR) ? screen->colors[fg] + : screen->foreground; + bg_pix = (flags & BG_COLOR) ? screen->colors[bg] + : term->core.background_pixel; if ( (!hilite && (flags & INVERSE) != 0) || - (hilite && (flags & INVERSE) == 0) ) + (hilite && (flags & INVERSE) == 0) ) { if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; - else + + XSetForeground(screen->display, gc, bg_pix); + XSetBackground(screen->display, gc, fg_pix); + + } else { if (flags & BOLD) gc = screen->normalboldGC; else gc = screen->normalGC; + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + } + + x = CursorX(screen, col); lastind = col; for (; col <= maxcol; col++) { - if (attrs[col] != flags) { + if (attrs[col] != flags || + (flags & FG_COLOR && fgs[col] != fg) || + (flags & BG_COLOR && bgs[col] != bg)) { + XDrawImageString(screen->display, TextWindow(screen), gc, x, y, (char *) &chars[lastind], n = col - lastind); if((flags & BOLD) && screen->enbolden) @@ -418,14 +453,30 @@ lastind = col; flags = attrs[col]; + fg = fgs[col]; + bg = bgs[col]; - if ((!hilite && (flags & INVERSE) != 0) || - (hilite && (flags & INVERSE) == 0) ) + fg_pix = (flags & FG_COLOR) ? screen->colors[fg] + : screen->foreground; + bg_pix = (flags & BG_COLOR) ? screen->colors[bg] + : term->core.background_pixel; + + if ( (!hilite && (flags & INVERSE) != 0) || + (hilite && (flags & INVERSE) == 0) ) { if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; - else + + XSetForeground(screen->display, gc, bg_pix); + XSetBackground(screen->display, gc, fg_pix); + + } else { if (flags & BOLD) gc = screen->normalboldGC; else gc = screen->normalGC; + + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + + } } if(chars[col] == 0) @@ -434,12 +485,22 @@ if ( (!hilite && (flags & INVERSE) != 0) || - (hilite && (flags & INVERSE) == 0) ) + (hilite && (flags & INVERSE) == 0) ) { if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; - else + + XSetForeground(screen->display, gc, bg_pix); + XSetBackground(screen->display, gc, fg_pix); + + } else { if (flags & BOLD) gc = screen->normalboldGC; else gc = screen->normalGC; + + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + + } + XDrawImageString(screen->display, TextWindow(screen), gc, x, y, (char *) &chars[lastind], n = col - lastind); if((flags & BOLD) && screen->enbolden) @@ -459,8 +520,8 @@ register TScreen *screen; register int first, last; { - first *= 2; - last = 2 * last + 1; + first *= 4; + last = 4 * last + 3; while (first <= last) bzero (screen->buf [first++], (screen->max_col + 1)); } @@ -540,7 +601,7 @@ rows + savelines, cols, screen->max_row + 1 + savelines, screen->max_col + 1); - screen->buf = &screen->allbuf[2 * savelines]; + screen->buf = &screen->allbuf[4 * savelines]; screen->max_row += delta_rows; screen->max_col = cols - 1; @@ -639,7 +700,7 @@ length = avail; if (length <= 0) return; - attrs = screen->buf[2 * row + 1] + col; + attrs = screen->buf[4 * row + 1] + col; value &= mask; /* make sure we only change the bits allowed by mask*/ while(length-- > 0) { *attrs &= ~mask; /* clear the bits */ @@ -670,7 +731,7 @@ if (length <= 0) return 0; ret = length; - attrs = screen->buf[2 * row + 1] + col; + attrs = screen->buf[4 * row + 1] + col; while(length-- > 0) { *str++ = *attrs++; } @@ -682,7 +743,7 @@ register int row, col, len; { register int i; - register Char *ptr = sb [2 * row]; + register Char *ptr = sb [4 * row]; for (i = col; i < len; i++) { if (ptr[i]) --- xterm/scrollbar.c Sat Apr 2 12:42:02 1994 +++ color-xterm/scrollbar.c Tue Jun 7 17:33:11 1994 @@ -337,15 +337,15 @@ if (doalloc && screen->allbuf) { if((screen->allbuf = (ScrnBuf) realloc((char *) screen->buf, - (unsigned) 2*(screen->max_row + 2 + + (unsigned) 4*(screen->max_row + 2 + screen->savelines) * sizeof(char *))) == NULL) Error (ERROR_SBRALLOC); - screen->buf = &screen->allbuf[2 * screen->savelines]; + screen->buf = &screen->allbuf[4 * screen->savelines]; memmove( (char *)screen->buf, (char *)screen->allbuf, - 2 * (screen->max_row + 2) * sizeof (char *)); - for(i = 2 * screen->savelines - 1 ; i >= 0 ; i--) + 4 * (screen->max_row + 2) * sizeof (char *)); + for(i = 4 * screen->savelines - 1 ; i >= 0 ; i--) if((screen->allbuf[i] = calloc((unsigned) screen->max_col + 1, sizeof(char))) == NULL) Common subdirectories: xterm/stuff and color-xterm/stuff Common subdirectories: xterm/tektests and color-xterm/tektests --- xterm/util.c Thu Jun 20 18:35:41 1991 +++ color-xterm/util.c Tue Jun 7 15:29:51 1994 @@ -616,12 +616,16 @@ FontHeight(screen)); } } - bzero(screen->buf [2 * screen->cur_row] + screen->cur_col, + bzero(screen->buf [4 * screen->cur_row] + screen->cur_col, (screen->max_col - screen->cur_col + 1)); - bzero(screen->buf [2 * screen->cur_row + 1] + screen->cur_col, + bzero(screen->buf [4 * screen->cur_row + 1] + screen->cur_col, + (screen->max_col - screen->cur_col + 1)); + bzero(screen->buf [4 * screen->cur_row + 2] + screen->cur_col, + (screen->max_col - screen->cur_col + 1)); + bzero(screen->buf [4 * screen->cur_row + 3] + screen->cur_col, (screen->max_col - screen->cur_col + 1)); /* with the right part cleared, we can't be wrapping */ - screen->buf [2 * screen->cur_row + 1] [0] &= ~LINEWRAPPED; + screen->buf [4 * screen->cur_row + 1] [0] &= ~LINEWRAPPED; } /* @@ -649,14 +653,17 @@ } } - for ( i=0, cp=screen->buf[2 * screen->cur_row]; + for ( i=0, cp=screen->buf[4 * screen->cur_row]; i < screen->cur_col + 1; i++, cp++) *cp = ' '; - for ( i=0, cp=screen->buf[2 * screen->cur_row + 1]; + for ( i=0, cp=screen->buf[4 * screen->cur_row + 1]; i < screen->cur_col + 1; i++, cp++) *cp = CHARDRAWN; + bzero (screen->buf [4 * screen->cur_row + 2], (screen->cur_col + 1)); + bzero (screen->buf [4 * screen->cur_row + 3], (screen->cur_col + 1)); + } /* @@ -679,8 +686,10 @@ Width(screen), FontHeight(screen)); } } - bzero (screen->buf [2 * screen->cur_row], (screen->max_col + 1)); - bzero (screen->buf [2 * screen->cur_row + 1], (screen->max_col + 1)); + bzero (screen->buf [4 * screen->cur_row], (screen->max_col + 1)); + bzero (screen->buf [4 * screen->cur_row + 1], (screen->max_col + 1)); + bzero (screen->buf [4 * screen->cur_row + 2], (screen->max_col + 1)); + bzero (screen->buf [4 * screen->cur_row + 3], (screen->max_col + 1)); } ClearScreen(screen) @@ -921,6 +930,108 @@ return (0); } +/***====================================================================***/ + +void +GetColors(term,pColors) + XtermWidget term; + ScrnColors *pColors; +{ + register TScreen *screen = &term->screen; + GC tmpGC; + Window tek = TWindow(screen); + unsigned long tmp; + + + pColors->which= 0; + SET_COLOR_VALUE(pColors,TEXT_FG, screen->foreground); + SET_COLOR_VALUE(pColors,TEXT_BG, term->core.background_pixel); + SET_COLOR_VALUE(pColors,TEXT_CURSOR, screen->cursorcolor); + SET_COLOR_VALUE(pColors,MOUSE_FG, screen->mousecolor); + SET_COLOR_VALUE(pColors,MOUSE_BG, screen->mousecolorback); + + + SET_COLOR_VALUE(pColors,TEK_FG, screen->Tforeground); + SET_COLOR_VALUE(pColors,TEK_BG, screen->Tbackground); +} + + +ChangeColors(term,pNew) + XtermWidget term; + ScrnColors *pNew; +{ + register TScreen *screen = &term->screen; + GC tmpGC; + Window tek = TWindow(screen); + unsigned long tmp; + Bool newCursor= TRUE; + + + if (COLOR_DEFINED(pNew,TEXT_BG)) { + term->core.background_pixel= COLOR_VALUE(pNew,TEXT_BG); + } + + if (COLOR_DEFINED(pNew,TEXT_CURSOR)) { + screen->cursorcolor= COLOR_VALUE(pNew,TEXT_CURSOR); + } + else if ((screen->cursorcolor == screen->foreground)&& + (COLOR_DEFINED(pNew,TEXT_FG))) { + screen->cursorcolor= COLOR_VALUE(pNew,TEXT_FG); + } + else newCursor= FALSE; + + if (COLOR_DEFINED(pNew,TEXT_FG)) { + Pixel fg= COLOR_VALUE(pNew,TEXT_FG); + screen->foreground= fg; + XSetForeground(screen->display,screen->normalGC,fg); + XSetBackground(screen->display,screen->reverseGC,fg); + XSetForeground(screen->display,screen->normalboldGC,fg); + XSetBackground(screen->display,screen->reverseboldGC,fg); + } + + if (COLOR_DEFINED(pNew,TEXT_BG)) { + Pixel bg= COLOR_VALUE(pNew,TEXT_BG); + term->core.background_pixel= bg; + XSetBackground(screen->display,screen->normalGC,bg); + XSetForeground(screen->display,screen->reverseGC,bg); + XSetBackground(screen->display,screen->normalboldGC,bg); + XSetForeground(screen->display,screen->reverseboldGC,bg); + XSetWindowBackground(screen->display, TextWindow(screen), + term->core.background_pixel); + } + + if (COLOR_DEFINED(pNew,MOUSE_FG)||(COLOR_DEFINED(pNew,MOUSE_BG))) { + if (COLOR_DEFINED(pNew,MOUSE_FG)) + screen->mousecolor= COLOR_VALUE(pNew,MOUSE_FG); + if (COLOR_DEFINED(pNew,MOUSE_BG)) + screen->mousecolorback= COLOR_VALUE(pNew,MOUSE_BG); + + recolor_cursor (screen->pointer_cursor, + screen->mousecolor, screen->mousecolorback); + recolor_cursor (screen->arrow, + screen->mousecolor, screen->mousecolorback); + XDefineCursor(screen->display, TextWindow(screen), + screen->pointer_cursor); + if(tek) + XDefineCursor(screen->display, tek, screen->arrow); + } + + if ((tek)&&(COLOR_DEFINED(pNew,TEK_FG)||COLOR_DEFINED(pNew,TEK_BG))) { + ChangeTekColors(screen,pNew); + } + set_cursor_gcs(screen); + XClearWindow(screen->display, TextWindow(screen)); + ScrnRefresh (screen, 0, 0, screen->max_row + 1, + screen->max_col + 1, False); + if(screen->Tshow) { + XClearWindow(screen->display, tek); + TekExpose((XExposeEvent *) NULL); + } +} + +/***====================================================================***/ + + ReverseVideo (termw) XtermWidget termw; { @@ -973,6 +1084,7 @@ XClearWindow(screen->display, tek); TekExpose((Widget)NULL, (XEvent *)NULL, (Region)NULL); } +ReverseOldColors(); update_reversevideo(); } --- xterm/xterm.man Sun Apr 17 19:01:07 1994 +++ color-xterm/xterm.man Tue Jun 7 18:12:25 1994 @@ -474,6 +474,17 @@ .B \-iconic This option indicates that \fIxterm\fP should ask the window manager to start it as an icon rather than as the normal window. +.TP 8 +.B \-dc +This option disables the escape sequence to change the vt100 foreground +and background colors, the text cursor color, the mouse cursor foreground +and background colors and the Tektronix emulator foreground and background +colors. +.TP 8 +.B \+dc +This option enables the escape sequence to change the vt100 foreground +and background colors, the text cursor color, the mouse cursor foreground +and background colors and the Tektronix emulator foreground and background .SH RESOURCES The program understands all of the core X Toolkit resource names and classes as well as: @@ -583,6 +594,24 @@ sets of characters should be treated the same when doing cut and paste. See the section on specifying character classes. .TP 8 +color0 (\fPclass\fB Foreground) +.TP 8 +color1 (\fPclass\fB Foreground) +.TP 8 +color2 (\fPclass\fB Foreground) +.TP 8 +color3 (\fPclass\fB Foreground) +.TP 8 +color4 (\fPclass\fB Foreground) +.TP 8 +color5 (\fPclass\fB Foreground) +.TP 8 +color6 (\fPclass\fB Foreground) +.TP 8 +.B "color7 (\fPclass\fB Foreground)" +These specify the colors for the ISO 6429 extension. The defaults are, +respectively, black, red, green, yellow, blue, magenta, cyan, and white. +.TP 8 .B "curses (\fPclass\fB Curses)" Specifies whether or not the last column bug in .IR more (1) @@ -681,6 +710,10 @@ .TP 8 .B "pointerShape (\fPclass\fB Cursor)" Specifies the name of the shape of the pointer. The default is ``xterm.'' +.TP 8 +.B "dynamicColors (\fPclass\fB DynamicColors)" +Specifies whether or not dynamic modification of colors using the escape +sequence is allowed. .TP 8 .B "resizeGravity (\fPclass\fB ResizeGravity)" Affects the behavior when the window is resized to be taller or