From 29fc0a0b61524c858128dd5cc25d797182dd8a36 Mon Sep 17 00:00:00 2001 From: sabetts Date: Sun, 9 Sep 2001 19:54:35 +0000 Subject: * src/bar.c (marked_message): use the screen_info fg_color and bg_color to create the inverse GC. * src/actions.h (cmd_deffgcolor): new prototype (cmd_defbgcolor): new prototype * src/actions.c (cmd_defbartimeout): merge the 2 ifs. (cmd_defbartimeout): verify that the number is positive. (cmd_defborder): likewise (cmd_defwinname): gobble leading whitespace. Use strings as arguments, not numbers. (cmd_windows): Use the argument as a window format string in non-interactive mode. (cmd_windows): if data is NULL use the default format string. (user_commands): new commands deffgcolor, defbgcolor. (update_gc): new function (cmd_deffgcolor): likewise (cmd_defbgcolor): likewise --- src/actions.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'src/actions.c') diff --git a/src/actions.c b/src/actions.c index 2f748aa..91efce0 100644 --- a/src/actions.c +++ b/src/actions.c @@ -79,6 +79,8 @@ static user_command user_commands[] = {"defwinfmt", cmd_defwinfmt, arg_STRING}, {"defwinname", cmd_defwinname, arg_STRING}, {"defwinpos", cmd_defwinpos, arg_STRING}, + {"deffgcolor", cmd_deffgcolor, arg_STRING}, + {"defbgcolor", cmd_defbgcolor, arg_STRING}, /* Commands to help debug ratpoison. */ #ifdef DEBUG @@ -1682,3 +1684,85 @@ cmd_defwinname (int interactive, void *data) return NULL; } + +static void +update_gc (screen_info *s) +{ + XGCValues gv; + + gv.foreground = s->fg_color; + gv.background = s->bg_color; + gv.function = GXcopy; + gv.line_width = 1; + gv.subwindow_mode = IncludeInferiors; + gv.font = defaults.font->fid; + XFreeGC (dpy, s->normal_gc); + s->normal_gc = XCreateGC(dpy, s->root, + GCForeground | GCBackground + | GCFunction | GCLineWidth + | GCSubwindowMode | GCFont, &gv); +} + +char * +cmd_deffgcolor (int interactive, void *data) +{ + int i; + XColor color, junk; + + if (data == NULL) + { + message (" deffgcolor: One argument required "); + return NULL; + } + + for (i=0; i