summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-04-06 00:53:32 +0000
committersabetts <sabetts>2003-04-06 00:53:32 +0000
commit7dad9dd35ea39dbe3faa727cc0c0d074a5ea1abe (patch)
tree1267064b648379f58939484267b2c63f6c78c9da /src
parent934c250042e1e5b9f51d0c8b401437057febfbe3 (diff)
downloadratpoison-7dad9dd35ea39dbe3faa727cc0c0d074a5ea1abe.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/actions.c25
-rw-r--r--src/actions.h2
-rw-r--r--src/bar.c2
-rw-r--r--src/data.h7
-rw-r--r--src/main.c2
-rw-r--r--src/window.c2
6 files changed, 28 insertions, 12 deletions
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;