2001-09-14 Gergely Nagy * src/bar.c (last_message): new function (marked_message): store msg in a global variable * src/bar.h: prototype for last_message * src/actions.c (cmd_lastmsg): new command * src/actions.h: prototype for it diff -ur ratpoison.startup_message/src/actions.c ratpoison/src/actions.c --- ratpoison.startup_message/src/actions.c Fri Sep 14 11:18:02 2001 +++ ratpoison/src/actions.c Fri Sep 14 11:23:44 2001 @@ -70,6 +70,7 @@ {"link", cmd_link, arg_STRING}, {"chdir", cmd_chdir, arg_STRING}, {"startup_message", cmd_startup_message, arg_STRING}, + {"lastmsg", cmd_lastmsg, arg_VOID}, /* Commands to set default behavior. */ {"defbarloc", cmd_defbarloc, arg_STRING}, @@ -1897,5 +1898,12 @@ else defaults.startup_message = 0; + return NULL; +} + +char * +cmd_lastmsg (int interactive, void *data) +{ + message (last_message()); return NULL; } diff -ur ratpoison.startup_message/src/actions.h ratpoison/src/actions.h --- ratpoison.startup_message/src/actions.h Fri Sep 14 11:18:02 2001 +++ ratpoison/src/actions.h Fri Sep 14 11:22:18 2001 @@ -95,6 +95,7 @@ char * cmd_link (int interactive, void *data); char * cmd_chdir (int interactive, void *data); char * cmd_startup_message (int interactive, void *data); +char * cmd_lastmsg (int interactive, void *data); /* void cmd_xterm (void *data); */ diff -ur ratpoison.startup_message/src/bar.c ratpoison/src/bar.c --- ratpoison.startup_message/src/bar.c Sun Sep 9 22:32:17 2001 +++ ratpoison/src/bar.c Fri Sep 14 11:25:01 2001 @@ -39,6 +39,9 @@ #define BAR_IS_WINDOW_LIST 1 #define BAR_IS_MESSAGE 2 +/* global variable to store last message */ +static char *last_msg; + /* Hide the bar from sight. */ int hide_bar (screen_info *s) @@ -221,4 +224,14 @@ XFillRectangle (dpy, s->bar_window, lgc, start, 0, end, height); } + + if (last_msg) + free (last_msg); + last_msg = strdup (msg); +} + +char * +last_message (void) +{ + return last_msg; } diff -ur ratpoison.startup_message/src/bar.h ratpoison/src/bar.h --- ratpoison.startup_message/src/bar.h Thu Aug 23 20:51:12 2001 +++ ratpoison/src/bar.h Fri Sep 14 11:20:31 2001 @@ -31,5 +31,6 @@ #define message(msg) marked_message (msg, 0, 0) void marked_message (char *msg, int hl_start, int hl_end); void marked_message_printf (int mark_start, int mark_end, char *fmt, ...); +char *last_message (void); #endif /* ! _RATPOISON_BAR_H */