summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2006-11-19 03:30:36 +0000
committersabetts <sabetts>2006-11-19 03:30:36 +0000
commit59dd6a0795dd27192e5c9e63a1d2648bce559326 (patch)
tree9b3c9f1ea0262d83d1a0d191b525ad267b19f757
parentdbf36396207f43980270d5cdd6c9785c594958b9 (diff)
downloadratpoison-59dd6a0795dd27192e5c9e63a1d2648bce559326.zip
(show_frame_message): handle the case when the frame
is empty.
-rw-r--r--ChangeLog5
-rw-r--r--src/messages.h2
-rw-r--r--src/split.c23
3 files changed, 23 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 90eadaa..2ca91b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-11-18 Shawn Betts <sabetts@vcn.bc.ca>
+
+ * src/split.c (show_frame_message): handle the case when the frame
+ is empty.
+
2006-11-17 Shawn Betts <sabetts@vcn.bc.ca>
* src/bar.c (bar_y): take into account screen padding
diff --git a/src/messages.h b/src/messages.h
index e85b5d4..47f2563 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -51,4 +51,6 @@
#define MESSAGE_WELCOME "Welcome to ratpoison! Hit `%s %s' for help."
+#define EMPTY_FRAME_MESSAGE "Current Frame"
+
#endif /* ! _RATPOISON_MESSAGES_H */
diff --git a/src/split.c b/src/split.c
index ba4cd3b..ce9bb35 100644
--- a/src/split.c
+++ b/src/split.c
@@ -971,18 +971,27 @@ show_frame_message (char *msg)
int width, height;
rp_frame *frame;
rp_window *win;
- rp_group *g;
- rp_window_elem *elem;
+ rp_window_elem *elem = NULL;
struct sbuf *msgbuf;
frame = current_frame();
-
win = current_window ();
- g = groups_find_group_by_window (win);
- elem = group_find_window (&g->mapped_windows, win);
- msgbuf = sbuf_new (0);
+ if (win)
+ {
+ rp_group *g;
+
+ g = groups_find_group_by_window (win);
+ elem = group_find_window (&g->mapped_windows, win);
+ }
- format_string (msg, elem, msgbuf);
+ /* A frame doesn't always contain a window. */
+ msgbuf = sbuf_new (0);
+ if (elem)
+ format_string (msg, elem, msgbuf);
+ else
+ {
+ sbuf_concat (msgbuf, EMPTY_FRAME_MESSAGE);
+ }
width = defaults.bar_x_padding * 2 + XmbTextEscapement (defaults.font, msgbuf->data,
msgbuf->len);