From 7dad9dd35ea39dbe3faa727cc0c0d074a5ea1abe Mon Sep 17 00:00:00 2001 From: sabetts Date: Sun, 6 Apr 2003 00:53:32 +0000 Subject: * src/window.c (get_window_list): if window_list_style is STYLE_COLUMN then the end of the mark is the length of the buffer minus the start of the mark. * src/main.c (init_defaults): init window_list_style to STYLE_ROW. * src/data.h (struct rp_defaults): new member, window_list_style. * src/bar.c (bar_y): new argument, height. All callers updated. (bar_y): use height in calculations. (update_window_names): print a column of windows if defaults.window_list_style is in column mode. (count_lines): new function (max_line_length): likewise (pos_in_line): likewise (line_beginning): likewise (marked_wrapped_message): likewise * src/actions.c (user_commands): new commands 'verbexec' and 'defwinliststyle'. Move @end take to after the def* commands. (cmd_verbexec): new function. Added prototype. (cmd_defwinliststyle): likewise --- ChangeLog | 12 ++++++------ doc/ratpoison.texi | 8 ++++++++ src/actions.c | 25 +++++++++++++++++++------ src/actions.h | 2 +- src/bar.c | 2 +- src/data.h | 7 +++++-- src/main.c | 2 +- src/window.c | 2 +- 8 files changed, 42 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8cfea5..8f896c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,15 @@ 2003-04-05 Shawn Betts - * src/window.c (get_window_list): if wrap_window_list is on then + * src/window.c (get_window_list): if window_list_style is STYLE_COLUMN then the end of the mark is the length of the buffer minus the start of the mark. - * src/main.c (init_defaults): init wrap_window_list to 0. + * src/main.c (init_defaults): init window_list_style to STYLE_ROW. * src/input.c (update_input_window): store the height in a variable. - * src/data.h (struct rp_defaults): new member, wrap_window_list. + * src/data.h (struct rp_defaults): new member, window_list_style. * src/bar.h [message]: wrap msg arg in parens. (marked_wrapped_message): new prototype @@ -17,7 +17,7 @@ * src/bar.c (bar_y): new argument, height. All callers updated. (bar_y): use height in calculations. (update_window_names): print a column of windows if - defaults.wrap_window_list is on. + defaults.window_list_style is in column mode. (count_lines): new function (max_line_length): likewise (pos_in_line): likewise @@ -25,9 +25,9 @@ (marked_wrapped_message): likewise * src/actions.c (user_commands): new commands 'verbexec' and - 'defwrapwinlist'. Move @end take to after the def* commands. + 'defwinliststyle'. Move @end take to after the def* commands. (cmd_verbexec): new function. Added prototype. - (cmd_defwrapwinlist): likewise + (cmd_defwinliststyle): likewise 2003-04-04 Shawn Betts diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi index 9580bf7..bfdcb49 100644 --- a/doc/ratpoison.texi +++ b/doc/ratpoison.texi @@ -515,6 +515,10 @@ Set the default gravity for normal windows. See the When called non-interactively with no arguments, the current setting is returned. +@item defwinliststyle @var{setting} +The window list can be displayed in a row or a column. @var{setting} +can be @samp{row} or @samp{column}. + @item defwinname @var{name} There are three resources ratpoison can get a window's name from: the WMNAME hint, the res_name from the WMCLASS hint, or the res_class from @@ -790,6 +794,10 @@ Unbind a keystroke. @item unsetenv @var{env} Clear the value of the environment variable, @var{env}. +@item verbexec @var{command} +Verbosely exec the shell command @var{command}. Raptoison displays a +message saying command was executed. + @item version Print ratpoison version. By default, this is bound to @kbd{C-t v}. diff --git a/src/actions.c b/src/actions.c index 456abc1..352818c 100644 --- a/src/actions.c +++ b/src/actions.c @@ -115,7 +115,7 @@ static user_command user_commands[] = {"defbgcolor", cmd_defbgcolor, arg_STRING}, {"defbarpadding", cmd_defbarpadding, arg_STRING}, {"defresizeunit", cmd_defresizeunit, arg_STRING}, - {"defwrapwinlist", cmd_defwrapwinlist, arg_STRING}, + {"defwinliststyle", cmd_defwinliststyle, arg_STRING}, /*@end (tag required for genrpbindings) */ /* Commands to help debug ratpoison. */ @@ -3119,16 +3119,29 @@ cmd_verbexec (int interactive, void *data) } char * -cmd_defwrapwinlist (int interactive, void *data) +cmd_defwinliststyle (int interactive, void *data) { if (data == NULL && !interactive) - return xsprintf ("%d", defaults.wrap_window_list); + return xsprintf ("%s", defaults.window_list_style ? "column":"row"); - if (data == NULL - || sscanf (data, "%d", &defaults.wrap_window_list) < 1) + if (data == NULL) { message (" defwrapwinlist: One argument required "); + return NULL; } - + + if (!strcmp ("column", data)) + { + defaults.window_list_style = STYLE_COLUMN; + } + else if (!strcmp ("row", data)) + { + defaults.window_list_style = STYLE_ROW; + } + else + { + message (" defwrapwinlist: Bad argument "); + } + return NULL; } diff --git a/src/actions.h b/src/actions.h index cc22f84..0b0972a 100644 --- a/src/actions.h +++ b/src/actions.h @@ -62,8 +62,8 @@ char *cmd_deftransgravity (int interactive, void *data); char *cmd_defwaitcursor (int interactive, void *data); char *cmd_defwinfmt (int interactive, void *data); char *cmd_defwingravity (int interactive, void *data); +char *cmd_defwinliststyle (int interactive, void *data); char *cmd_defwinname (int interactive, void *data); -char *cmd_defwrapwinlist (int interactive, void *data); char *cmd_delete (int interactive, void *data); char *cmd_echo (int interactive, void *data); char *cmd_escape (int interactive, void *data); diff --git a/src/bar.c b/src/bar.c index cf76fef..0f2fc64 100644 --- a/src/bar.c +++ b/src/bar.c @@ -146,7 +146,7 @@ update_window_names (screen_info *s) bar_buffer = sbuf_new (0); - if(!defaults.wrap_window_list) + if(defaults.window_list_style == STYLE_ROW) { get_window_list (defaults.window_fmt, NULL, bar_buffer, &mark_start, &mark_end); marked_message (sbuf_get (bar_buffer), mark_start, mark_end); diff --git a/src/data.h b/src/data.h index 6fea19a..b29b3e7 100644 --- a/src/data.h +++ b/src/data.h @@ -37,6 +37,8 @@ window/frame/screen/etc, Use EMPTY to denote a lack there of. */ #define EMPTY -1 +#define STYLE_ROW 0 +#define STYLE_COLUMN 1 typedef struct rp_window rp_window; typedef struct screen_info screen_info; @@ -175,8 +177,9 @@ struct rp_defaults int startup_message; - /* A toggle for wrapping the window list. */ - int wrap_window_list; + /* Decides whether the window list is displayed in a row or a + column. */ + int window_list_style; /* Pointer warping toggle. */ int warp; diff --git a/src/main.c b/src/main.c index bf47559..2e65b46 100644 --- a/src/main.c +++ b/src/main.c @@ -482,7 +482,7 @@ init_defaults () defaults.win_name = 0; defaults.startup_message = 1; defaults.warp = 1; - defaults.wrap_window_list = 0; + defaults.window_list_style = STYLE_ROW; } int diff --git a/src/window.c b/src/window.c index 0153704..8815b71 100644 --- a/src/window.c +++ b/src/window.c @@ -666,7 +666,7 @@ get_window_list (char *fmt, char *delim, struct sbuf *buffer, sbuf_concat (buffer, delim); if (w == current_window()) { - if(!defaults.wrap_window_list){ + if(defaults.window_list_style == STYLE_ROW){ *mark_end = strlen (sbuf_get (buffer)); } else { *mark_end = strlen (sbuf_get(buffer)) - *mark_start; -- cgit v1.2.3