summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/actions.c19
-rw-r--r--src/bar.c22
-rw-r--r--src/bar.h4
4 files changed, 25 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 662ebe5..1463c1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,12 @@
2006-03-15 Shawn Betts <sabetts@vcn.bc.ca>
+ * src/bar.c (show_bar): accept a fmt argument. all callers and prototype updated.
+ (update_bar): just display the last message if bar isn't hidden.
+ (update_window_names): accept a fmt argument. all callers and prototype updated.
+
* src/actions.c (init_user_commands): add optional argument to "info"
(cmd_info): handle optional argument
+ (cmd_windows): when called interactively use the argument as the format string.
2006-03-14 Antti Nykänen <aon@iki.fi>
diff --git a/src/actions.c b/src/actions.c
index b756c41..d9cc00e 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1273,7 +1273,7 @@ cmd_select (int interactive, struct cmdarg **args)
goto_window (elem->win);
else
/* show the window list as feedback */
- show_bar (current_screen ());
+ show_bar (current_screen (), defaults.window_fmt);
}
else
/* try by name */
@@ -1306,7 +1306,7 @@ cmd_rename (int interactive, struct cmdarg **args)
current_window()->named = 1;
/* Update the program bar. */
- update_window_names (current_screen());
+ update_window_names (current_screen(), defaults.window_fmt);
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -2588,7 +2588,7 @@ cmd_number (int interactive, struct cmdarg **args)
group_resort_window (rp_current_group, win);
/* Update the window list. */
- update_window_names (win->win->scr);
+ update_window_names (win->win->scr, defaults.window_fmt);
}
return cmdret_new (RET_SUCCESS, NULL);
@@ -2602,6 +2602,12 @@ cmd_windows (int interactive, struct cmdarg **args)
char *tmp;
int dummy;
rp_screen *s;
+ char *fmt;
+
+ if (args[0] == NULL)
+ fmt = defaults.window_fmt;
+ else
+ fmt = ARG_STRING(0);
if (interactive)
{
@@ -2612,17 +2618,14 @@ cmd_windows (int interactive, struct cmdarg **args)
off. OR the timeout is >0 then show the bar. Which means,
always show the bar if msgwait is >0 which fixes the case
when a command in the prefix hook displays the bar. */
- if (!hide_bar (s) || defaults.bar_timeout > 0) show_bar (s);
+ if (!hide_bar (s) || defaults.bar_timeout > 0) show_bar (s, fmt);
return cmdret_new (RET_SUCCESS, NULL);
}
else
{
window_list = sbuf_new (0);
- if (args[0])
- get_window_list (ARG_STRING(0), "\n", window_list, &dummy, &dummy);
- else
- get_window_list (defaults.window_fmt, "\n", window_list, &dummy, &dummy);
+ get_window_list (fmt, "\n", window_list, &dummy, &dummy);
tmp = sbuf_get (window_list);
free (window_list);
diff --git a/src/bar.c b/src/bar.c
index 73e9516..5cd0432 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -68,13 +68,13 @@ hide_bar (rp_screen *s)
/* Show window listing in bar. */
int
-show_bar (rp_screen *s)
+show_bar (rp_screen *s, char *fmt)
{
if (!s->bar_is_raised)
{
s->bar_is_raised = BAR_IS_WINDOW_LIST;
XMapRaised (dpy, s->bar_window);
- update_window_names (s);
+ update_window_names (s, fmt);
reset_alarm();
return 1;
@@ -82,7 +82,7 @@ show_bar (rp_screen *s)
/* If the bar is raised we still need to display the window
names. */
- update_window_names (s);
+ update_window_names (s, fmt);
return 0;
}
@@ -148,19 +148,11 @@ update_bar (rp_screen *s)
if (s->bar_is_raised == BAR_IS_HIDDEN)
return;
- if (s->bar_is_raised == BAR_IS_MESSAGE)
- {
- show_last_message();
- }
- else
- {
- /* bar is showing a window list. */
- update_window_names (s);
- }
+ show_last_message();
}
void
-update_window_names (rp_screen *s)
+update_window_names (rp_screen *s, char *fmt)
{
struct sbuf *bar_buffer;
int mark_start = 0;
@@ -172,12 +164,12 @@ update_window_names (rp_screen *s)
if(defaults.window_list_style == STYLE_ROW)
{
- get_window_list (defaults.window_fmt, NULL, bar_buffer, &mark_start, &mark_end);
+ get_window_list (fmt, NULL, bar_buffer, &mark_start, &mark_end);
marked_message (sbuf_get (bar_buffer), mark_start, mark_end);
}
else
{
- get_window_list (defaults.window_fmt, "\n", bar_buffer, &mark_start, &mark_end);
+ get_window_list (fmt, "\n", bar_buffer, &mark_start, &mark_end);
marked_message (sbuf_get (bar_buffer), mark_start, mark_end);
}
diff --git a/src/bar.h b/src/bar.h
index 3c0f3ce..4991f76 100644
--- a/src/bar.h
+++ b/src/bar.h
@@ -22,9 +22,9 @@
#ifndef _RATPOISON_BAR_H
#define _RATPOISON_BAR_H 1
-void update_window_names (rp_screen *s);
+void update_window_names (rp_screen *s, char *fmt);
void update_bar (rp_screen *s);
-int show_bar (rp_screen *s);
+int show_bar (rp_screen *s, char *fmt);
int hide_bar (rp_screen *s);
int bar_y (rp_screen *s, int height);
int bar_x (rp_screen *s, int width);