diff options
author | sabetts <sabetts> | 2002-01-24 21:57:44 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2002-01-24 21:57:44 +0000 |
commit | 61432f3c09711bf6690af0d851a5fda92c009153 (patch) | |
tree | e5e2f378a8f6d19ebdb78ed7c15701c784495899 | |
parent | 66ef30a4b79636b748107e00be805d1885a88af8 (diff) | |
download | ratpoison-61432f3c09711bf6690af0d851a5fda92c009153.zip |
* 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.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | src/actions.c | 36 | ||||
-rw-r--r-- | src/actions.h | 3 | ||||
-rw-r--r-- | src/bar.c | 4 | ||||
-rw-r--r-- | src/data.h | 1 | ||||
-rw-r--r-- | src/main.c | 17 | ||||
-rw-r--r-- | src/messages.h | 2 |
7 files changed, 68 insertions, 11 deletions
@@ -1,5 +1,21 @@ 2002-01-24 shawn <sabetts@vcn.bc.ca> + * 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}, @@ -1885,6 +1886,41 @@ cmd_defborder (int interactive, void *data) } 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; i<num_screens; i++) + { + XSetWindowBorderWidth (dpy, screens[i].bar_window, defaults.bar_border_width); + XSetWindowBorderWidth (dpy, screens[i].frame_window, defaults.bar_border_width); + XSetWindowBorderWidth (dpy, screens[i].input_window, defaults.bar_border_width); + } + + return NULL; +} + +char * cmd_definputwidth (int interactive, void *data) { if (data == NULL && !interactive) diff --git a/src/actions.h b/src/actions.h index 685b00f..5f76206 100644 --- a/src/actions.h +++ b/src/actions.h @@ -107,8 +107,7 @@ char * cmd_link (int interactive, void *data); char * cmd_defbarpadding (int interactive, void *data); char * cmd_license (int interactive, void *data); char * cmd_alias (int interactive, void *data); - -/* void cmd_xterm (void *data); */ +char *cmd_defbarborder (int interactive, void *data); void initialize_default_keybindings (void); rp_action* find_keybinding (KeySym keysym, int state); @@ -84,7 +84,7 @@ bar_x (screen_info *s, int width) { if (defaults.bar_location == SouthEastGravity || defaults.bar_location == NorthEastGravity) - return s->root_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 @@ -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; @@ -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 */ |