Sun Mar 2 23:40:39 2003 Michael Jennings (mej)

Fixed a bug with foreground/background color change pointed out by
Thomas <arnognul@tiscali.se>.

Also added support for all the other OSC color change sequences (at
least those for the colors that Eterm uses).  The sequences are of
the form "\e];n;color[;color[...]]\a", where n is between 10 and 19.
You can specify up to (20 - n) semicolon-separated colors representing
the following attributes in order:  foreground, background, cursor,
mouse pointer, mouse pointer background (*), Tek foreground (*), Tek
background (*), highlight color (*), bold color, and underline color.
Attributes marked with a (*) are ignored by Eterm and may be left
empty, but their trailing semicolons must be present for xterm
compatibility.

For example, to set a white foreground, black background, yellow text
cursor, green mouse cursor, #ffaa00 for bold, and cyan for underline,
you could use either of the following:

echo -e "\e]10;white;black;yellow;green;;;;;#ffaa00;cyan\007"

 or

echo -e "\e]10;white\007"
echo -e "\e]11;black\007"
echo -e "\e]12;yellow\007"
echo -e "\e]13;green\007"
echo -e "\e]18;#ffaa00\007"
echo -e "\e]19;cyan\007"

Note that the setting of bold and underline colors using 18 and 19 are
Eterm extensions.


SVN revision: 6739
This commit is contained in:
Michael Jennings 2003-03-03 04:53:35 +00:00
parent 4b8a58d8a2
commit df078dd652
10 changed files with 224 additions and 83 deletions

View File

@ -4986,3 +4986,37 @@ Mon Feb 24 21:05:00 2003 Michael Jennings (mej)
Screw it. I don't see any way to "sanitize" these, as they put it, Screw it. I don't see any way to "sanitize" these, as they put it,
so we'll just disable that for now until someone can throw me a clue. so we'll just disable that for now until someone can throw me a clue.
---------------------------------------------------------------------- ----------------------------------------------------------------------
Sun Mar 2 23:40:39 2003 Michael Jennings (mej)
Fixed a bug with foreground/background color change pointed out by
Thomas <arnognul@tiscali.se>.
Also added support for all the other OSC color change sequences (at
least those for the colors that Eterm uses). The sequences are of
the form "\e];n;color[;color[...]]\a", where n is between 10 and 19.
You can specify up to (20 - n) semicolon-separated colors representing
the following attributes in order: foreground, background, cursor,
mouse pointer, mouse pointer background (*), Tek foreground (*), Tek
background (*), highlight color (*), bold color, and underline color.
Attributes marked with a (*) are ignored by Eterm and may be left
empty, but their trailing semicolons must be present for xterm
compatibility.
For example, to set a white foreground, black background, yellow text
cursor, green mouse cursor, #ffaa00 for bold, and cyan for underline,
you could use either of the following:
echo -e "\e]10;white;black;yellow;green;;;;;#ffaa00;cyan\007"
or
echo -e "\e]10;white\007"
echo -e "\e]11;black\007"
echo -e "\e]12;yellow\007"
echo -e "\e]13;green\007"
echo -e "\e]18;#ffaa00\007"
echo -e "\e]19;cyan\007"
Note that the setting of bold and underline colors using 18 and 19 are
Eterm extensions.
----------------------------------------------------------------------

View File

@ -460,8 +460,48 @@ Portions of this document were taken from the XTerm documentation.</P>
<A HREF="#eterm_esc">below</A>.) <A HREF="#eterm_esc">below</A>.)
<LI><I>n</I> == 6: Eterm-specific escape sequences (See <LI><I>n</I> == 6: Eterm-specific escape sequences (See
<A HREF="#eterm_esc">below</A>.) <A HREF="#eterm_esc">below</A>.)
<LI><I>n</I> == 10: Set foreground color to <I>string</I>.
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 11.
<LI><I>n</I> == 11: Set background color to <I>string</I>.
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 12.
<LI><I>n</I> == 12: Set cursor color to <I>string</I>.
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 13.
<LI><I>n</I> == 13: Set mouse pointer color to <I>string</I>.
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 14.
<LI><I>n</I> == 14: Ignore <I>string</I>.
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 15.
<LI><I>n</I> == 15: Ignore <I>string</I>.
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 16.
<LI><I>n</I> == 16: Ignore <I>string</I>.
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 17.
<LI><I>n</I> == 17: Ignore <I>string</I>.
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 18.
<LI><I>n</I> == 18: Set bold color to <I>string</I>.
Eterm extension (see <A HREF="#image">below</A>).
If additional semicolon-delimited
<I>string</I> values are specified,
continue with <I>n</I> == 19.
<LI><I>n</I> == 19: Set underline color to <I>string</I>.
Eterm extension (see <A HREF="#image">below</A>).
<LI><I>n</I> == 20: Image commands (see <A HREF="#image">below</A>) <LI><I>n</I> == 20: Image commands (see <A HREF="#image">below</A>)
<LI><I>n</I> == 30: Dump contents of scrollback to file <I>string</I> <LI><I>n</I> == 30: Dump contents of scrollback to file
<I>string</I>. (Disabled by default.)
<LI><I>n</I> == 39: Set the default foreground color to <I>string</I> <LI><I>n</I> == 39: Set the default foreground color to <I>string</I>
<LI><I>n</I> == 49: Set the default background color to <I>string</I> <LI><I>n</I> == 49: Set the default background color to <I>string</I>
<LI><I>n</I> == 50: Set font to <I>string</I>. rxvt/Eterm extensions: <LI><I>n</I> == 50: Set font to <I>string</I>. rxvt/Eterm extensions:
@ -1232,7 +1272,7 @@ are: <TT><B>1</B></TT>, <TT><B>on</B></TT>, <TT><B>yes</B></TT>, or (of course)
<TR> <TR>
<TD><TT>ESC <B>] 6 ; 50 ;</B> <I>desktop</I> BEL</TT></TD> <TD><TT>ESC <B>] 6 ; 50 ;</B> <I>desktop</I> BEL</TT></TD>
<TD>Move Eterm to desktop <I>desktop</I> and make it the current desktop. <TD>Move Eterm to desktop <I>desktop</I> and make it the current desktop.
This requires a GNOME-compliant Window Manager, such as This requires a compliant Window Manager, such as
<A HREF="http://www.enlightenment.org/" TARGET="_top">Enlightenment</A>. <A HREF="http://www.enlightenment.org/" TARGET="_top">Enlightenment</A>.
</TD> </TD>
</TR> </TR>
@ -1246,6 +1286,14 @@ are: <TT><B>1</B></TT>, <TT><B>on</B></TT>, <TT><B>yes</B></TT>, or (of course)
<TD><TT>ESC <B>] 6 ; 80 ;</B> <I>level</I> BEL</TT></TD> <TD><TT>ESC <B>] 6 ; 80 ;</B> <I>level</I> BEL</TT></TD>
<TD>Set the debugging level to <I>level</I>.</TD> <TD>Set the debugging level to <I>level</I>.</TD>
</TR> </TR>
<TR>
<TD><TT>ESC <B>] 18 ;</B> <I>string</I> BEL</TT></TD>
<TD>Set bold color to <I>string</I>.</TD>
</TR>
<TR>
<TD><TT>ESC <B>] 19 ;</B> <I>string</I> BEL</TT></TD>
<TD>Set underline color to <I>string</I>.</TD>
</TR>
</TABLE> </TABLE>
<H3><A NAME="trans">Transparency</A></H3> <H3><A NAME="trans">Transparency</A></H3>

View File

@ -3109,7 +3109,7 @@ check_pixmap_change(int sig)
imlib_context_set_image(images[image_bg].current->iml->im); imlib_context_set_image(images[image_bg].current->iml->im);
imlib_free_image_and_decache(); imlib_free_image_and_decache();
images[image_bg].current->iml->im = NULL; images[image_bg].current->iml->im = NULL;
xterm_seq(XTerm_Pixmap, rs_anim_pixmaps[image_idx++]); xterm_seq(ESCSEQ_XTERM_PIXMAP, rs_anim_pixmaps[image_idx++]);
last_update = now; last_update = now;
old_handler = signal(SIGALRM, check_pixmap_change); old_handler = signal(SIGALRM, check_pixmap_change);
alarm(rs_anim_delay); alarm(rs_anim_delay);

View File

@ -224,7 +224,7 @@ parse_escaped_string(char *str)
} }
char * char *
safe_print_string(char *str, unsigned long len) safe_print_string(const char *str, unsigned long len)
{ {
static char *ret_buff = NULL; static char *ret_buff = NULL;
static unsigned long rb_size = 0; static unsigned long rb_size = 0;

View File

@ -40,7 +40,7 @@ extern const char *my_basename(const char *str);
extern unsigned long str_leading_match(register const char *, register const char *); extern unsigned long str_leading_match(register const char *, register const char *);
extern char *str_trim(char *str); extern char *str_trim(char *str);
extern int parse_escaped_string(char *str); extern int parse_escaped_string(char *str);
extern char *safe_print_string(char *buff, unsigned long len); extern char *safe_print_string(const char *buff, unsigned long len);
extern unsigned long add_carriage_returns(unsigned char *buff, unsigned long cnt); extern unsigned long add_carriage_returns(unsigned char *buff, unsigned long cnt);
extern unsigned char mkdirhier(const char *); extern unsigned char mkdirhier(const char *);

View File

@ -256,7 +256,7 @@ set_pixmap_scale(const char *geom, pixmap_t *pmap)
D_PIXMAP(("scale_pixmap(\"%s\")\n", geom)); D_PIXMAP(("scale_pixmap(\"%s\")\n", geom));
if (!strcmp(geom, "?")) { if (!strcmp(geom, "?")) {
sprintf(str, "[%dx%d+%d+%d]", pmap->w, pmap->h, pmap->x, pmap->y); sprintf(str, "[%dx%d+%d+%d]", pmap->w, pmap->h, pmap->x, pmap->y);
xterm_seq(XTerm_title, str); xterm_seq(ESCSEQ_XTERM_TITLE, str);
return 0; return 0;
} }
if ((opstr = strchr(geom, ':')) != NULL) { if ((opstr = strchr(geom, ':')) != NULL) {

View File

@ -327,7 +327,7 @@ lookup_key(XEvent * ev)
LK_RET(); LK_RET();
break; break;
case SunXK_Front: case SunXK_Front:
xterm_seq(XTerm_Takeover, ""); xterm_seq(ESCSEQ_XTERM_TAKEOVER, "");
LK_RET(); LK_RET();
break; break;
default: default:
@ -412,10 +412,10 @@ lookup_key(XEvent * ev)
#ifdef GREEK_SUPPORT #ifdef GREEK_SUPPORT
greek_mode = !greek_mode; greek_mode = !greek_mode;
if (greek_mode) { if (greek_mode) {
xterm_seq(XTerm_title, (greek_getmode() == GREEK_ELOT928 ? "[Greek: iso]" : "[Greek: ibm]")); xterm_seq(ESCSEQ_XTERM_TITLE, (greek_getmode() == GREEK_ELOT928 ? "[Greek: iso]" : "[Greek: ibm]"));
greek_reset(); greek_reset();
} else } else
xterm_seq(XTerm_title, APL_NAME "-" VERSION); xterm_seq(ESCSEQ_XTERM_TITLE, APL_NAME "-" VERSION);
LK_RET(); LK_RET();
#endif #endif
break; break;
@ -1143,7 +1143,7 @@ process_csi_seq(void)
break; break;
#endif #endif
case 8: case 8:
xterm_seq(XTerm_title, APL_NAME "-" VERSION); xterm_seq(ESCSEQ_XTERM_TITLE, APL_NAME "-" VERSION);
break; break;
case 9: case 9:
#ifdef PIXMAP_OFFSET #ifdef PIXMAP_OFFSET
@ -1165,7 +1165,7 @@ process_csi_seq(void)
tint = (tint & 0xffff00) | (images[image_bg].current->iml->bmod->brightness & 0xff); tint = (tint & 0xffff00) | (images[image_bg].current->iml->bmod->brightness & 0xff);
} }
snprintf(tbuff, sizeof(tbuff), APL_NAME "-" VERSION ": Transparent - %d%% shading - 0x%06lx tint mask", shading, tint); snprintf(tbuff, sizeof(tbuff), APL_NAME "-" VERSION ": Transparent - %d%% shading - 0x%06lx tint mask", shading, tint);
xterm_seq(XTerm_title, tbuff); xterm_seq(ESCSEQ_XTERM_TITLE, tbuff);
} else } else
#endif #endif
#ifdef PIXMAP_SUPPORT #ifdef PIXMAP_SUPPORT
@ -1181,10 +1181,10 @@ process_csi_seq(void)
len = strlen(fname) + sizeof(APL_NAME) + sizeof(VERSION) + 5; len = strlen(fname) + sizeof(APL_NAME) + sizeof(VERSION) + 5;
tbuff = MALLOC(len); tbuff = MALLOC(len);
snprintf(tbuff, len, APL_NAME "-" VERSION ": %s", fname); snprintf(tbuff, len, APL_NAME "-" VERSION ": %s", fname);
xterm_seq(XTerm_title, tbuff); xterm_seq(ESCSEQ_XTERM_TITLE, tbuff);
FREE(tbuff); FREE(tbuff);
} else { } else {
xterm_seq(XTerm_title, APL_NAME "-" VERSION ": No Pixmap"); xterm_seq(ESCSEQ_XTERM_TITLE, APL_NAME "-" VERSION ": No Pixmap");
} }
} }
#endif /* PIXMAP_SUPPORT */ #endif /* PIXMAP_SUPPORT */
@ -1298,10 +1298,10 @@ process_xterm_seq(void)
} }
switch (arg) { switch (arg) {
case 'l': case 'l':
xterm_seq(XTerm_title, (char *) string); xterm_seq(ESCSEQ_XTERM_TITLE, (char *) string);
break; break;
case 'L': case 'L':
xterm_seq(XTerm_iconName, (char *) string); xterm_seq(ESCSEQ_XTERM_ICONNAME, (char *) string);
break; break;
case 'I': case 'I':
set_icon_pixmap((char *) string, NULL); set_icon_pixmap((char *) string, NULL);
@ -1377,7 +1377,8 @@ process_window_mode(unsigned int nargs, int args[])
BOUND(y, 1, scr->height / TermWin.fheight); BOUND(y, 1, scr->height / TermWin.fheight);
BOUND(x, 1, scr->width / TermWin.fwidth); BOUND(x, 1, scr->width / TermWin.fwidth);
XResizeWindow(Xdisplay, TermWin.parent, XResizeWindow(Xdisplay, TermWin.parent,
Width2Pixel(x) + 2 * TermWin.internalBorder + (scrollbar_is_visible()? scrollbar_trough_width() : 0), Height2Pixel(y) + 2 * TermWin.internalBorder); Width2Pixel(x) + 2 * TermWin.internalBorder + (scrollbar_is_visible()? scrollbar_trough_width() : 0),
Height2Pixel(y) + 2 * TermWin.internalBorder);
break; break;
case 11: case 11:
break; break;
@ -1397,20 +1398,16 @@ process_window_mode(unsigned int nargs, int args[])
tt_write((unsigned char *) buff, strlen(buff)); tt_write((unsigned char *) buff, strlen(buff));
break; break;
case 20: case 20:
#if FIXME_BLOCK
XGetIconName(Xdisplay, TermWin.parent, &name); XGetIconName(Xdisplay, TermWin.parent, &name);
snprintf(buff, sizeof(buff), "\033]L%s\033\\", name); snprintf(buff, sizeof(buff), "\033]L%s\033\\", name);
tt_write((unsigned char *) buff, strlen(buff)); tt_write((unsigned char *) buff, strlen(buff));
XFree(name); XFree(name);
#endif
break; break;
case 21: case 21:
#if FIXME_BLOCK
XFetchName(Xdisplay, TermWin.parent, &name); XFetchName(Xdisplay, TermWin.parent, &name);
snprintf(buff, sizeof(buff), "\033]l%s\033\\", name); snprintf(buff, sizeof(buff), "\033]l%s\033\\", name);
tt_write((unsigned char *) buff, strlen(buff)); tt_write((unsigned char *) buff, strlen(buff));
XFree(name); XFree(name);
#endif
break; break;
default: default:
break; break;
@ -1825,10 +1822,15 @@ xterm_seq(int op, const char *str)
#endif #endif
switch (op) { switch (op) {
case XTerm_title: case ESCSEQ_XTERM_NAME: /* 0 */
set_title(str); /* drop */
case ESCSEQ_XTERM_ICONNAME: /* 1 */
set_icon_name(str);
break;
case ESCSEQ_XTERM_TITLE: /* 2 */
set_title(str); set_title(str);
break; break;
case XTerm_prop: case ESCSEQ_XTERM_PROP: /* 3 */
if ((nstr = (char *) strsep(&tnstr, ";")) == NULL) { if ((nstr = (char *) strsep(&tnstr, ";")) == NULL) {
break; break;
} }
@ -1837,23 +1839,17 @@ xterm_seq(int op, const char *str)
} }
set_text_property(TermWin.parent, nstr, valptr); set_text_property(TermWin.parent, nstr, valptr);
break; break;
case XTerm_name: case ESCSEQ_XTERM_TAKEOVER: /* 5 */
set_title(str); /* drop */
case XTerm_iconName:
set_icon_name(str);
break;
case XTerm_Takeover:
XSetInputFocus(Xdisplay, TermWin.parent, RevertToParent, CurrentTime); XSetInputFocus(Xdisplay, TermWin.parent, RevertToParent, CurrentTime);
XRaiseWindow(Xdisplay, TermWin.parent); XRaiseWindow(Xdisplay, TermWin.parent);
break; break;
case XTerm_EtermSeq: case ESCSEQ_XTERM_ETERMSEQ: /* 6 */
/* Eterm proprietary escape sequences. See technical reference for details. */ /* Eterm proprietary escape sequences. See technical reference for details. */
D_CMD(("Got XTerm_EtermSeq sequence\n")); D_CMD(("Got ESCSEQ_XTERM_ETERMSEQ sequence\n"));
nstr = (char *) strsep(&tnstr, ";"); nstr = (char *) strsep(&tnstr, ";");
eterm_seq_op = (unsigned char) strtol(nstr, (char **) NULL, 10); eterm_seq_op = (unsigned char) strtol(nstr, (char **) NULL, 10);
D_CMD((" XTerm_EtermSeq operation is %d\n", eterm_seq_op)); D_CMD((" ESCSEQ_XTERM_ETERMSEQ operation is %d\n", eterm_seq_op));
/* Yes, there is order to the numbers for this stuff. And here it is: /* Yes, there is order to the numbers for this stuff. And here it is:
0-9 Image Class/Mode Configuration 0-9 Image Class/Mode Configuration
10-19 Scrollbar/Buttonbar/Menu Configuration 10-19 Scrollbar/Buttonbar/Menu Configuration
@ -2369,20 +2365,62 @@ xterm_seq(int op, const char *str)
} }
break; break;
case XTerm_ccolor: #ifdef XTERM_COLOR_CHANGE
/* Change cursor color */ case ESCSEQ_XTERM_FGCOLOR: /* 10 */
#ifndef NO_CURSORCOLOR if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
nstr = (char *) strsep(&tnstr, ";"); set_window_color(fgColor, nstr);
if (nstr) { }
if (XParseColor(Xdisplay, cmap, nstr, &xcol) && XAllocColor(Xdisplay, cmap, &xcol)) { /* drop */
PixColors[cursorColor] = xcol.pixel; case ESCSEQ_XTERM_BGCOLOR: /* 11 */
scr_refresh(DEFAULT_REFRESH); if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
} set_window_color(bgColor, nstr);
}
/* drop */
case ESCSEQ_XTERM_CURSOR_COLOR: /* 12 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
# ifndef NO_CURSORCOLOR
set_window_color(cursorColor, nstr);
# endif
}
/* drop */
case ESCSEQ_XTERM_PTR_FGCOLOR: /* 13 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
set_pointer_colors(nstr, NULL);
}
/* drop */
case ESCSEQ_XTERM_PTR_BGCOLOR: /* 14 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
/* UNSUPPORTED */
}
/* drop */
case ESCSEQ_XTERM_TEK_FGCOLOR: /* 15 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
/* UNSUPPORTED */
}
/* drop */
case ESCSEQ_XTERM_TEK_BGCOLOR: /* 16 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
/* UNSUPPORTED */
}
/* drop */
case ESCSEQ_XTERM_HILIGHT_COLOR: /* 17 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
/* UNSUPPORTED */
}
/* drop */
case ESCSEQ_XTERM_BOLD_COLOR: /* 18 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
set_window_color(colorBD, nstr);
}
/* drop */
case ESCSEQ_XTERM_ULINE_COLOR: /* 19 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
set_window_color(colorUL, nstr);
} }
#endif #endif
break; break;
case XTerm_Pixmap: case ESCSEQ_XTERM_PIXMAP: /* 20 */
#ifdef PIXMAP_SUPPORT #ifdef PIXMAP_SUPPORT
FOREACH_IMAGE(if (!image_mode_is(idx, MODE_IMAGE) && image_mode_is(idx, ALLOW_IMAGE)) { FOREACH_IMAGE(if (!image_mode_is(idx, MODE_IMAGE) && image_mode_is(idx, ALLOW_IMAGE)) {
image_set_mode(idx, MODE_IMAGE);} image_set_mode(idx, MODE_IMAGE);}
@ -2413,17 +2451,7 @@ xterm_seq(int op, const char *str)
#endif /* PIXMAP_SUPPORT */ #endif /* PIXMAP_SUPPORT */
break; break;
case XTerm_restoreFG: case ESCSEQ_XTERM_DUMPSCREEN: /* 30 */
#ifdef XTERM_COLOR_CHANGE
set_window_color(fgColor, str);
#endif
break;
case XTerm_restoreBG:
#ifdef XTERM_COLOR_CHANGE
set_window_color(bgColor, str);
#endif
break;
case XTerm_DumpScreen:
#if 0 #if 0
nstr = (char *) strsep(&tnstr, ";"); nstr = (char *) strsep(&tnstr, ";");
if (nstr && *nstr) { if (nstr && *nstr) {
@ -2431,7 +2459,17 @@ xterm_seq(int op, const char *str)
} }
break; break;
#endif #endif
case XTerm_logfile: case ESCSEQ_XTERM_RESTOREFG: /* 39 */
#ifdef XTERM_COLOR_CHANGE
set_window_color(fgColor, str);
#endif
break;
case ESCSEQ_XTERM_RESTOREBG: /* 40 */
#ifdef XTERM_COLOR_CHANGE
set_window_color(bgColor, str);
#endif
break;
case ESCSEQ_XTERM_LOGFILE: /* 46 */
nstr = (char *) strsep(&tnstr, ";"); nstr = (char *) strsep(&tnstr, ";");
if (nstr && *nstr && BOOL_OPT_ISTRUE(nstr)) { if (nstr && *nstr && BOOL_OPT_ISTRUE(nstr)) {
/* Logging on */ /* Logging on */
@ -2439,7 +2477,7 @@ xterm_seq(int op, const char *str)
/* Logging off */ /* Logging off */
} }
break; break;
case XTerm_font: case ESCSEQ_XTERM_FONT: /* 50 */
change_font(0, str); change_font(0, str);
break; break;
default: default:

View File

@ -59,24 +59,33 @@
} } while (0) } } while (0)
/* XTerm escape sequences: ESC ] Ps;Pt BEL */ /* XTerm escape sequences: ESC ] Ps;Pt BEL */
# define XTerm_name 0 # define ESCSEQ_XTERM_NAME 0
# define XTerm_iconName 1 # define ESCSEQ_XTERM_ICONNAME 1
# define XTerm_title 2 # define ESCSEQ_XTERM_TITLE 2
# define XTerm_prop 3 # define ESCSEQ_XTERM_PROP 3
# define XTerm_ccolor 12 # define ESCSEQ_XTERM_FGCOLOR 10
# define XTerm_logfile 46 # define ESCSEQ_XTERM_BGCOLOR 11
# define XTerm_font 50 # define ESCSEQ_XTERM_CURSOR_COLOR 12
# define ESCSEQ_XTERM_PTR_FGCOLOR 13
# define ESCSEQ_XTERM_PTR_BGCOLOR 14
# define ESCSEQ_XTERM_TEK_FGCOLOR 15
# define ESCSEQ_XTERM_TEK_BGCOLOR 16
# define ESCSEQ_XTERM_HILIGHT_COLOR 17
# define ESCSEQ_XTERM_BOLD_COLOR 18
# define ESCSEQ_XTERM_ULINE_COLOR 19
# define ESCSEQ_XTERM_LOGFILE 46
# define ESCSEQ_XTERM_FONT 50
/* rxvt/Eterm extensions of XTerm escape sequences: ESC ] Ps;Pt BEL */ /* rxvt/Eterm extensions of XTerm escape sequences: ESC ] Ps;Pt BEL */
# define XTerm_Takeover 5 /* Steal keyboard focus and raise window */ # define ESCSEQ_XTERM_TAKEOVER 5 /* Steal keyboard focus and raise window */
# define XTerm_EtermSeq 6 /* Eterm proprietary escape sequences */ # define ESCSEQ_XTERM_ETERMSEQ 6 /* Eterm proprietary escape sequences */
# define XTerm_Pixmap 20 /* new bg pixmap */ # define ESCSEQ_XTERM_PIXMAP 20 /* new bg pixmap */
# define XTerm_DumpScreen 30 /* Dump contents of scrollback to a file */ # define ESCSEQ_XTERM_DUMPSCREEN 30 /* Dump contents of scrollback to a file */
# define XTerm_restoreFG 39 /* change default fg color */ # define ESCSEQ_XTERM_RESTOREFG 39 /* change default fg color */
# define XTerm_restoreBG 49 /* change default bg color */ # define ESCSEQ_XTERM_RESTOREBG 49 /* change default bg color */
# define restoreFG 39 /* restore default fg color */ # define restoreFG 39 /* restore default fg color */
# define restoreBG 49 /* restore default bg color */ # define restoreBG 49 /* restore default bg color */
enum color_list { enum color_list {
fgColor, fgColor,

View File

@ -331,6 +331,26 @@ process_colors(void)
stored_palette(SAVE); stored_palette(SAVE);
} }
void
set_pointer_colors(const char *fg_name, const char *bg_name)
{
XColor fg, bg;
if (fg_name != NULL) {
fg.pixel = get_color_by_name(fg_name, COLOR_NAME(pointerColor));
} else {
fg.pixel = PixColors[pointerColor];
}
XQueryColor(Xdisplay, cmap, &fg);
if (bg_name != NULL) {
bg.pixel = get_color_by_name(bg_name, COLOR_NAME(bgColor));
} else {
bg.pixel = PixColors[bgColor];
}
XQueryColor(Xdisplay, cmap, &bg);
XRecolorCursor(Xdisplay, TermWin_cursor, &fg, &bg);
}
/* Create_Windows() - Open and map the window */ /* Create_Windows() - Open and map the window */
void void
Create_Windows(int argc, char *argv[]) Create_Windows(int argc, char *argv[])
@ -409,8 +429,8 @@ Create_Windows(int argc, char *argv[])
#endif #endif
CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect, &Attributes); CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect, &Attributes);
xterm_seq(XTerm_title, rs_title); xterm_seq(ESCSEQ_XTERM_TITLE, rs_title);
xterm_seq(XTerm_iconName, rs_iconName); xterm_seq(ESCSEQ_XTERM_ICONNAME, rs_iconName);
classHint.res_name = (char *) rs_name; classHint.res_name = (char *) rs_name;
classHint.res_class = APL_NAME; classHint.res_class = APL_NAME;
wmHint.window_group = TermWin.parent; wmHint.window_group = TermWin.parent;
@ -431,16 +451,7 @@ Create_Windows(int argc, char *argv[])
} }
/* vt cursor: Black-on-White is standard, but this is more popular */ /* vt cursor: Black-on-White is standard, but this is more popular */
TermWin_cursor = XCreateFontCursor(Xdisplay, XC_xterm); TermWin_cursor = XCreateFontCursor(Xdisplay, XC_xterm);
{ set_pointer_colors(NULL, NULL);
XColor fg, bg;
fg.pixel = PixColors[pointerColor];
XQueryColor(Xdisplay, cmap, &fg);
bg.pixel = PixColors[bgColor];
XQueryColor(Xdisplay, cmap, &bg);
XRecolorCursor(Xdisplay, TermWin_cursor, &fg, &bg);
}
/* cursor (menu/scrollbar): Black-on-White */ /* cursor (menu/scrollbar): Black-on-White */
cursor = XCreateFontCursor(Xdisplay, XC_left_ptr); cursor = XCreateFontCursor(Xdisplay, XC_left_ptr);
@ -704,10 +715,10 @@ set_window_color(int idx, const char *color)
print_warning("Unable to resolve \"%s\" as a color name.\n", color); print_warning("Unable to resolve \"%s\" as a color name.\n", color);
return; return;
} }
redraw_image(image_bg);
set_colorfgbg(); set_colorfgbg();
scr_touch(); scr_touch();
scr_refresh(DEFAULT_REFRESH); scr_refresh(DEFAULT_REFRESH);
redraw_image(image_bg);
} }
#endif /* XTERM_COLOR_CHANGE */ #endif /* XTERM_COLOR_CHANGE */

View File

@ -46,6 +46,7 @@ extern Pixel get_top_shadow_color(Pixel, const char *);
extern Pixel get_color_by_name(const char *, const char *); extern Pixel get_color_by_name(const char *, const char *);
extern Pixel get_color_by_pixel(Pixel, Pixel); extern Pixel get_color_by_pixel(Pixel, Pixel);
extern void process_colors(void); extern void process_colors(void);
extern void set_pointer_colors(const char *, const char *);
extern void Create_Windows(int, char * []); extern void Create_Windows(int, char * []);
extern void resize_parent(unsigned int, unsigned int); extern void resize_parent(unsigned int, unsigned int);
extern void set_width(unsigned short); extern void set_width(unsigned short);