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.


SVN revision: 6432
This commit is contained in:
Michael Jennings 2002-10-23 03:03:27 +00:00
parent 862a62b63c
commit d86a345768
10 changed files with 63 additions and 23 deletions

View File

@ -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 file, and I fixed some missing return statements in non-void
functions. 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.
----------------------------------------------------------------------

View File

@ -803,21 +803,24 @@ button_set_action(button_t *button, action_type_t type, char *action)
switch (type) { switch (type) {
case ACTION_MENU: case ACTION_MENU:
button->action.menu = find_menu_by_title(menu_list, action); button->action.menu = find_menu_by_title(menu_list, action);
return ((button->action.menu == NULL) ? (0) : (1));
break; break;
case ACTION_STRING: case ACTION_STRING:
case ACTION_ECHO: case ACTION_ECHO:
button->action.string = (char *) MALLOC(strlen(action) + 2); button->action.string = (char *) MALLOC(strlen(action) + 2);
strcpy(button->action.string, action); strcpy(button->action.string, action);
parse_escaped_string(button->action.string); parse_escaped_string(button->action.string);
return ((button->action.string == NULL) ? (0) : (1));
break; break;
case ACTION_SCRIPT: case ACTION_SCRIPT:
button->action.script = (char *) MALLOC(strlen(action) + 2); button->action.script = (char *) MALLOC(strlen(action) + 2);
strcpy(button->action.script, action); strcpy(button->action.script, action);
return ((button->action.script == NULL) ? (0) : (1));
break; break;
default: default:
break; break;
} }
return 1; return 0;
} }
void 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; int f = button->flags & ~NS_SCREAM_BUTTON;
if (f & NS_SCREAM_CURR) { if (f & NS_SCREAM_CURR) {
f = 1; f = ES_COLOR_CURRENT;
} else if (f & NS_SCREAM_ACT) { } else if (f & NS_SCREAM_ACT) {
f = 2; f = ES_COLOR_ACTIVE;
} else { } else {
f = 0; 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); gc = LIBAST_X_CREATE_GC(0, NULL);
XCopyGC(Xdisplay, bbar->gc, GCFont, gc); 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); draw_string(bbar, bbar->bg, gc, button->text_x, button->text_y, button->text, button->len);
LIBAST_X_FREE_GC(gc); LIBAST_X_FREE_GC(gc);

View File

@ -2888,9 +2888,10 @@ make_escreen_menu(buttonbar_t *bbar)
#endif #endif
if ((button = button_create(NS_MENU_TITLE))) { if ((button = button_create(NS_MENU_TITLE))) {
bbar_add_rbutton(bbar, button); if ((button_set_action(button, ACTION_MENU, NS_MENU_TITLE))) {
bbar_calc_button_sizes(bbar); bbar_add_rbutton(bbar, button);
button_set_action(button, ACTION_MENU, NS_MENU_TITLE); bbar_calc_button_sizes(bbar);
}
} }
return 1; return 1;

View File

@ -825,6 +825,14 @@ parse_color(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "pointer ")) { } else if (!BEG_STRCASECMP(buff, "pointer ")) {
RESET_AND_ASSIGN(rs_color[pointerColor], get_word(2, buff)); 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 ")) { } else if (!BEG_STRCASECMP(buff, "video ")) {
char *tmp = get_pword(2, buff); char *tmp = get_pword(2, buff);

View File

@ -82,13 +82,16 @@ char *def_colorName[] = {
#ifndef NO_CURSORCOLOR #ifndef NO_CURSORCOLOR
NULL, NULL, /* cursorColor, cursorColor2 */ NULL, NULL, /* cursorColor, cursorColor2 */
#endif /* NO_CURSORCOLOR */ #endif /* NO_CURSORCOLOR */
NULL, NULL /* pointerColor, borderColor */
#ifndef NO_BOLDUNDERLINE #ifndef NO_BOLDUNDERLINE
, NULL, NULL /* colorBD, colorUL */ NULL, NULL, /* colorBD, colorUL */
#endif /* NO_BOLDUNDERLINE */ #endif /* NO_BOLDUNDERLINE */
#ifdef ESCREEN
NULL, NULL, /* ES_COLOR_CURRENT, ES_COLOR_ACTIVE */
#endif
NULL, NULL /* pointerColor, borderColor */
}; };
char *rs_color[NRS_COLORS]; 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 MetaMask = 0, AltMask = 0, NumLockMask = 0;
unsigned int modmasks[] = { Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; unsigned int modmasks[] = { Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask };

View File

@ -109,12 +109,16 @@ enum color_list {
cursorColor, cursorColor,
cursorColor2, cursorColor2,
# endif # endif
pointerColor,
borderColor,
# ifndef NO_BOLDUNDERLINE # ifndef NO_BOLDUNDERLINE
colorBD, colorBD,
colorUL, colorUL,
# endif # endif
#ifdef ESCREEN
ES_COLOR_CURRENT,
ES_COLOR_ACTIVE,
#endif
pointerColor,
borderColor,
NRS_COLORS, /* */ NRS_COLORS, /* */
topShadowColor = NRS_COLORS, topShadowColor = NRS_COLORS,
bottomShadowColor, bottomShadowColor,
@ -127,7 +131,7 @@ enum color_list {
TOTAL_COLORS /* */ TOTAL_COLORS /* */
}; };
# define NSHADOWCOLORS (TOTAL_COLORS - NRS_COLORS) # define EXTRA_COLORS (TOTAL_COLORS - NRS_COLORS)
#ifdef HOTKEY_CTRL #ifdef HOTKEY_CTRL
# define HOTKEY ctrl # define HOTKEY ctrl
@ -152,7 +156,7 @@ extern unsigned long PrivateModes;
extern unsigned long SavedModes; extern unsigned long SavedModes;
extern char *def_colorName[]; extern char *def_colorName[];
extern char *rs_color[NRS_COLORS]; 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 MetaMask, AltMask, NumLockMask;
extern unsigned int modmasks[]; extern unsigned int modmasks[];

View File

@ -261,7 +261,7 @@ process_colors(void)
Pixel pixel; Pixel pixel;
for (i = 0; i < NRS_COLORS; i++) { 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) { switch (i) {
case fgColor: case fgColor:
pixel = WhitePixel(Xdisplay, Xscreen); pixel = WhitePixel(Xdisplay, Xscreen);
@ -277,12 +277,6 @@ process_colors(void)
pixel = PixColors[fgColor]; pixel = PixColors[fgColor];
break; break;
#endif /* NO_CURSORCOLOR */ #endif /* NO_CURSORCOLOR */
case pointerColor:
pixel = PixColors[fgColor];
break;
case borderColor:
pixel = PixColors[bgColor];
break;
#ifndef NO_BOLDUNDERLINE #ifndef NO_BOLDUNDERLINE
case colorBD: case colorBD:
pixel = PixColors[fgColor]; pixel = PixColors[fgColor];
@ -291,6 +285,20 @@ process_colors(void)
pixel = PixColors[fgColor]; pixel = PixColors[fgColor];
break; break;
#endif #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: default:
pixel = PixColors[fgColor]; /* None */ pixel = PixColors[fgColor]; /* None */
break; break;
@ -641,7 +649,7 @@ handle_move(int x, int y)
void void
stored_palette(char op) stored_palette(char op)
{ {
static Pixel default_colors[NRS_COLORS + NSHADOWCOLORS]; static Pixel default_colors[NRS_COLORS + EXTRA_COLORS];
static unsigned char stored = 0; static unsigned char stored = 0;
unsigned char i; unsigned char i;

View File

@ -31,7 +31,7 @@
/************ Variables ************/ /************ Variables ************/
extern char *rs_color[NRS_COLORS]; extern char *rs_color[NRS_COLORS];
extern Pixel PixColors[NRS_COLORS + NSHADOWCOLORS]; extern Pixel PixColors[NRS_COLORS + EXTRA_COLORS];
extern XSetWindowAttributes Attributes; extern XSetWindowAttributes Attributes;
extern XWindowAttributes attr; extern XWindowAttributes attr;
extern XSizeHints szHint; extern XSizeHints szHint;

2
themes/Escreen/menus.cfg Normal file
View File

@ -0,0 +1,2 @@
<Eterm-0.9.2>
# This file is intentionally blank. :-)

View File

@ -3,6 +3,11 @@
%include "../Eterm/menus.cfg" %include "../Eterm/menus.cfg"
%include "../Eterm/theme.cfg" %include "../Eterm/theme.cfg"
begin color
es_current "#ffff00"
es_active "#0000ff"
end color
begin attributes begin attributes
name "%appname() -- Escreen Session" name "%appname() -- Escreen Session"
end attributes end attributes