diff --git a/ChangeLog b/ChangeLog index 7380ccf..a27f6a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4875,3 +4875,9 @@ Fixed a double-free in libscream.c. Also some cleanups to the spec file, and I fixed some missing return statements in non-void functions. ---------------------------------------------------------------------- +Tue Oct 22 23:02:28 2002 Michael Jennings (mej) + +Allow users to customize the Escreen current/active display colors. + +Don't display the Escreen button if there's no Escreen menu defined. +---------------------------------------------------------------------- diff --git a/src/buttons.c b/src/buttons.c index 76f7057..4d9ad6d 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -803,21 +803,24 @@ button_set_action(button_t *button, action_type_t type, char *action) switch (type) { case ACTION_MENU: button->action.menu = find_menu_by_title(menu_list, action); + return ((button->action.menu == NULL) ? (0) : (1)); break; case ACTION_STRING: case ACTION_ECHO: button->action.string = (char *) MALLOC(strlen(action) + 2); strcpy(button->action.string, action); parse_escaped_string(button->action.string); + return ((button->action.string == NULL) ? (0) : (1)); break; case ACTION_SCRIPT: button->action.script = (char *) MALLOC(strlen(action) + 2); strcpy(button->action.script, action); + return ((button->action.script == NULL) ? (0) : (1)); break; default: break; } - return 1; + return 0; } void @@ -1095,9 +1098,9 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode int f = button->flags & ~NS_SCREAM_BUTTON; if (f & NS_SCREAM_CURR) { - f = 1; + f = ES_COLOR_CURRENT; } else if (f & NS_SCREAM_ACT) { - f = 2; + f = ES_COLOR_ACTIVE; } else { f = 0; } @@ -1108,7 +1111,7 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode gc = LIBAST_X_CREATE_GC(0, NULL); XCopyGC(Xdisplay, bbar->gc, GCFont, gc); - XSetForeground(Xdisplay, gc, PixColors[minBright + f + 2]); + XSetForeground(Xdisplay, gc, PixColors[f]); draw_string(bbar, bbar->bg, gc, button->text_x, button->text_y, button->text, button->len); LIBAST_X_FREE_GC(gc); diff --git a/src/command.c b/src/command.c index e84f8d8..b7af909 100644 --- a/src/command.c +++ b/src/command.c @@ -2888,9 +2888,10 @@ make_escreen_menu(buttonbar_t *bbar) #endif if ((button = button_create(NS_MENU_TITLE))) { - bbar_add_rbutton(bbar, button); - bbar_calc_button_sizes(bbar); - button_set_action(button, ACTION_MENU, NS_MENU_TITLE); + if ((button_set_action(button, ACTION_MENU, NS_MENU_TITLE))) { + bbar_add_rbutton(bbar, button); + bbar_calc_button_sizes(bbar); + } } return 1; diff --git a/src/options.c b/src/options.c index 921ba0b..ebe6266 100644 --- a/src/options.c +++ b/src/options.c @@ -825,6 +825,14 @@ parse_color(char *buff, void *state) } else if (!BEG_STRCASECMP(buff, "pointer ")) { RESET_AND_ASSIGN(rs_color[pointerColor], get_word(2, buff)); +#ifdef ESCREEN + } else if (!BEG_STRCASECMP(buff, "es_current ")) { + RESET_AND_ASSIGN(rs_color[ES_COLOR_CURRENT], get_word(2, buff)); + + } else if (!BEG_STRCASECMP(buff, "es_active ")) { + RESET_AND_ASSIGN(rs_color[ES_COLOR_ACTIVE], get_word(2, buff)); +#endif + } else if (!BEG_STRCASECMP(buff, "video ")) { char *tmp = get_pword(2, buff); diff --git a/src/term.c b/src/term.c index 19a7852..e2e26b6 100644 --- a/src/term.c +++ b/src/term.c @@ -82,13 +82,16 @@ char *def_colorName[] = { #ifndef NO_CURSORCOLOR NULL, NULL, /* cursorColor, cursorColor2 */ #endif /* NO_CURSORCOLOR */ - NULL, NULL /* pointerColor, borderColor */ #ifndef NO_BOLDUNDERLINE - , NULL, NULL /* colorBD, colorUL */ + NULL, NULL, /* colorBD, colorUL */ #endif /* NO_BOLDUNDERLINE */ +#ifdef ESCREEN + NULL, NULL, /* ES_COLOR_CURRENT, ES_COLOR_ACTIVE */ +#endif + NULL, NULL /* pointerColor, borderColor */ }; char *rs_color[NRS_COLORS]; -Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; +Pixel PixColors[NRS_COLORS + EXTRA_COLORS]; unsigned int MetaMask = 0, AltMask = 0, NumLockMask = 0; unsigned int modmasks[] = { Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; diff --git a/src/term.h b/src/term.h index b8cd198..b4e6624 100644 --- a/src/term.h +++ b/src/term.h @@ -109,12 +109,16 @@ enum color_list { cursorColor, cursorColor2, # endif - pointerColor, - borderColor, # ifndef NO_BOLDUNDERLINE colorBD, colorUL, # endif +#ifdef ESCREEN + ES_COLOR_CURRENT, + ES_COLOR_ACTIVE, +#endif + pointerColor, + borderColor, NRS_COLORS, /* */ topShadowColor = NRS_COLORS, bottomShadowColor, @@ -127,7 +131,7 @@ enum color_list { TOTAL_COLORS /* */ }; -# define NSHADOWCOLORS (TOTAL_COLORS - NRS_COLORS) +# define EXTRA_COLORS (TOTAL_COLORS - NRS_COLORS) #ifdef HOTKEY_CTRL # define HOTKEY ctrl @@ -152,7 +156,7 @@ extern unsigned long PrivateModes; extern unsigned long SavedModes; extern char *def_colorName[]; extern char *rs_color[NRS_COLORS]; -extern Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; +extern Pixel PixColors[NRS_COLORS + EXTRA_COLORS]; extern unsigned int MetaMask, AltMask, NumLockMask; extern unsigned int modmasks[]; diff --git a/src/windows.c b/src/windows.c index 80f412f..f3feb63 100644 --- a/src/windows.c +++ b/src/windows.c @@ -261,7 +261,7 @@ process_colors(void) Pixel pixel; for (i = 0; i < NRS_COLORS; i++) { - if ((Xdepth <= 2) || ((pixel = get_color_by_name(rs_color[i], def_colorName[i])) == (Pixel) - 1)) { + if ((Xdepth <= 2) || ((pixel = get_color_by_name(rs_color[i], def_colorName[i])) == (Pixel) (-1))) { switch (i) { case fgColor: pixel = WhitePixel(Xdisplay, Xscreen); @@ -277,12 +277,6 @@ process_colors(void) pixel = PixColors[fgColor]; break; #endif /* NO_CURSORCOLOR */ - case pointerColor: - pixel = PixColors[fgColor]; - break; - case borderColor: - pixel = PixColors[bgColor]; - break; #ifndef NO_BOLDUNDERLINE case colorBD: pixel = PixColors[fgColor]; @@ -291,6 +285,20 @@ process_colors(void) pixel = PixColors[fgColor]; break; #endif +#ifdef ESCREEN + case ES_COLOR_CURRENT: + pixel = PixColors[YellowColor]; + break; + case ES_COLOR_ACTIVE: + pixel = PixColors[BlueColor]; + break; +#endif + case pointerColor: + pixel = PixColors[fgColor]; + break; + case borderColor: + pixel = PixColors[bgColor]; + break; default: pixel = PixColors[fgColor]; /* None */ break; @@ -641,7 +649,7 @@ handle_move(int x, int y) void stored_palette(char op) { - static Pixel default_colors[NRS_COLORS + NSHADOWCOLORS]; + static Pixel default_colors[NRS_COLORS + EXTRA_COLORS]; static unsigned char stored = 0; unsigned char i; diff --git a/src/windows.h b/src/windows.h index c02a355..e074d7b 100644 --- a/src/windows.h +++ b/src/windows.h @@ -31,7 +31,7 @@ /************ Variables ************/ extern char *rs_color[NRS_COLORS]; -extern Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; +extern Pixel PixColors[NRS_COLORS + EXTRA_COLORS]; extern XSetWindowAttributes Attributes; extern XWindowAttributes attr; extern XSizeHints szHint; diff --git a/themes/Escreen/menus.cfg b/themes/Escreen/menus.cfg new file mode 100644 index 0000000..45e8661 --- /dev/null +++ b/themes/Escreen/menus.cfg @@ -0,0 +1,2 @@ + +# This file is intentionally blank. :-) diff --git a/themes/Escreen/theme.cfg.in b/themes/Escreen/theme.cfg.in index 4201376..e65a2db 100644 --- a/themes/Escreen/theme.cfg.in +++ b/themes/Escreen/theme.cfg.in @@ -3,6 +3,11 @@ %include "../Eterm/menus.cfg" %include "../Eterm/theme.cfg" +begin color + es_current "#ffff00" + es_active "#0000ff" +end color + begin attributes name "%appname() -- Escreen Session" end attributes