diff options
author | sabetts <sabetts> | 2006-11-19 03:30:36 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2006-11-19 03:30:36 +0000 |
commit | 59dd6a0795dd27192e5c9e63a1d2648bce559326 (patch) | |
tree | 9b3c9f1ea0262d83d1a0d191b525ad267b19f757 /src | |
parent | dbf36396207f43980270d5cdd6c9785c594958b9 (diff) | |
download | ratpoison-59dd6a0795dd27192e5c9e63a1d2648bce559326.zip |
(show_frame_message): handle the case when the frame
is empty.
Diffstat (limited to 'src')
-rw-r--r-- | src/messages.h | 2 | ||||
-rw-r--r-- | src/split.c | 23 |
2 files changed, 18 insertions, 7 deletions
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); |