From 61432f3c09711bf6690af0d851a5fda92c009153 Mon Sep 17 00:00:00 2001 From: sabetts Date: Thu, 24 Jan 2002 21:57:44 +0000 Subject: * src/messages.h (MESSAGE_FRAME_STRING): Pad the string with spaces on both sides. * src/main.c (init_screen): Create the frame, input, and bar windows with a border width of defaults.bar_border_width. (init_defaults): initialize defaults.bar_border_width * src/bar.c (bar_x): Incorporate defaults.bar_border_width into calculations. (bar_y): likewise * src/actions.h (cmd_defbarborder): new prototype * src/actions.c (user_commands): new command "defbarborder" (cmd_defbarborder): new function * src/main.c (init_screen): create the help window with a 0 border width. --- ChangeLog | 16 ++++++++++++++++ src/actions.c | 36 ++++++++++++++++++++++++++++++++++++ src/actions.h | 3 +-- src/bar.c | 4 ++-- src/data.h | 1 + src/main.c | 17 +++++++++++------ src/messages.h | 2 +- 7 files changed, 68 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92ac26b..a3462da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2002-01-24 shawn + * src/messages.h (MESSAGE_FRAME_STRING): Pad the string with + spaces on both sides. + + * src/main.c (init_screen): Create the frame, input, and bar + windows with a border width of defaults.bar_border_width. + (init_defaults): initialize defaults.bar_border_width + + * src/bar.c (bar_x): Incorporate defaults.bar_border_width into + calculations. + (bar_y): likewise + + * src/actions.h (cmd_defbarborder): new prototype + + * src/actions.c (user_commands): new command "defbarborder" + (cmd_defbarborder): new function + * src/main.c (init_screen): create the help window with a 0 border width. diff --git a/src/actions.c b/src/actions.c index c62faef..b790557 100644 --- a/src/actions.c +++ b/src/actions.c @@ -92,6 +92,7 @@ static user_command user_commands[] = {"definputwidth", cmd_definputwidth, arg_STRING}, {"defmaxsizegravity", cmd_defmaxsizegravity, arg_STRING}, {"defpadding", cmd_defpadding, arg_STRING}, + {"defbarborder", cmd_defbarborder, arg_STRING}, {"deftransgravity", cmd_deftransgravity, arg_STRING}, {"defwaitcursor", cmd_defwaitcursor, arg_STRING}, {"defwinfmt", cmd_defwinfmt, arg_STRING}, @@ -1884,6 +1885,41 @@ cmd_defborder (int interactive, void *data) return NULL; } +char * +cmd_defbarborder (int interactive, void *data) +{ + int tmp; + int i; + + if (data == NULL && !interactive) + return xsprintf ("%d", defaults.window_border_width); + + if (data == NULL + || sscanf (data, "%d", &tmp) < 1) + { + message (" defbarborder: One argument required "); + return NULL; + } + + if (tmp >= 0) + defaults.bar_border_width = tmp; + else + { + message (" defbarborder: Bad argument "); + return NULL; + } + + /* Update the frame and bar windows. */ + for (i=0; iroot_attr.width - width - 2; + return s->root_attr.width - width - defaults.bar_border_width * 2; else return 0; } @@ -96,7 +96,7 @@ bar_y (screen_info *s) || defaults.bar_location == NorthEastGravity ) return 0; else - return s->root_attr.height - (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2) - 2; + return s->root_attr.height - (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2) - defaults.bar_border_width * 2; } void diff --git a/src/data.h b/src/data.h index fed8992..c3dc796 100644 --- a/src/data.h +++ b/src/data.h @@ -140,6 +140,7 @@ struct rp_defaults int bar_y_padding; int bar_location; int bar_timeout; + int bar_border_width; int frame_indicator_timeout; diff --git a/src/main.c b/src/main.c index 5a761da..2ba8ecf 100644 --- a/src/main.c +++ b/src/main.c @@ -412,6 +412,7 @@ init_defaults () defaults.bar_y_padding = 0; defaults.bar_location = NorthEastGravity; defaults.bar_timeout = 5; + defaults.bar_border_width = 1; defaults.frame_indicator_timeout = 1; @@ -618,22 +619,26 @@ init_screen (screen_info *s, int screen_num) /* Create the program bar window. */ s->bar_is_raised = 0; - s->bar_window = XCreateSimpleWindow (dpy, s->root, 0, 0, - 1, 1, 1, s->fg_color, s->bg_color); + s->bar_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, + defaults.bar_border_width, + s->fg_color, s->bg_color); /* Setup the window that will recieve all keystrokes once the prefix key has been pressed. */ - s->key_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, 0, WhitePixel (dpy, s->screen_num), BlackPixel (dpy, s->screen_num)); + s->key_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, 0, + WhitePixel (dpy, s->screen_num), + BlackPixel (dpy, s->screen_num)); XSelectInput (dpy, s->key_window, KeyPressMask ); XMapWindow (dpy, s->key_window); /* Create the input window. */ - s->input_window = XCreateSimpleWindow (dpy, s->root, 0, 0, - 1, 1, 1, s->fg_color, s->bg_color); + s->input_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, + defaults.bar_border_width, + s->fg_color, s->bg_color); XSelectInput (dpy, s->input_window, KeyPressMask ); /* Create the frame indicator window */ - s->frame_window = XCreateSimpleWindow (dpy, s->root, 1, 1, 1, 1, 1, + s->frame_window = XCreateSimpleWindow (dpy, s->root, 1, 1, 1, 1, defaults.bar_border_width, s->fg_color, s->bg_color); /* Create the help window */ diff --git a/src/messages.h b/src/messages.h index fd56dc4..2da2734 100644 --- a/src/messages.h +++ b/src/messages.h @@ -43,6 +43,6 @@ #define MESSAGE_PROMPT_XTERM_COMMAND MESSAGE_PROMPT_SHELL_COMMAND TERM_PROG " -e " #define MESSAGE_WELCOME " Welcome to ratpoison! Hit `%s %s' for help. " -#define MESSAGE_FRAME_STRING "Current Frame" +#define MESSAGE_FRAME_STRING " Current Frame " #endif /* ! _RATPOISON_MESSAGES_H */ -- cgit v1.2.3