From 3c255ea736cdb1e3d0bf77f1160b6d495cb090db Mon Sep 17 00:00:00 2001 From: sabetts Date: Wed, 5 Sep 2001 07:48:49 +0000 Subject: * src/messages.h (MESSAGE_WELCOME): The help keystroke is not hardcoded. * src/main.c (show_welcome_message): new function (main): call show_welcome_message to show the welcome message. * src/actions.h (find_keybinding_by_action): new prototype * src/actions.c (key_actions): change to a static variable. (key_actions_last): likewise (key_actions_table_size): likewise (find_keybinding_by_action): new function --- src/actions.c | 22 +++++++++++++++++++--- src/actions.h | 1 + src/main.c | 33 +++++++++++++++++++++++++++++++-- src/messages.h | 2 +- 4 files changed, 52 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/actions.c b/src/actions.c index c68ae5e..74196d5 100644 --- a/src/actions.c +++ b/src/actions.c @@ -26,9 +26,25 @@ #include "ratpoison.h" -rp_action *key_actions; -int key_actions_last; -int key_actions_table_size; +static rp_action *key_actions; +static int key_actions_last; +static int key_actions_table_size; + +rp_action* +find_keybinding_by_action (char *action) +{ + int i; + + for (i=0; ikey, help_action->state); + else + help = NULL; + + + if (help) + { + marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, help); + free (help); + } + else + { + marked_message_printf (0, 0, MESSAGE_WELCOME, prefix, ":help"); + } + + free (prefix); +} + int main (int argc, char *argv[]) { @@ -429,8 +458,8 @@ main (int argc, char *argv[]) read_startup_files (); - /* Indicate to the user that ratpoison has booted */ - message (MESSAGE_WELCOME); + /* Indicate to the user that ratpoison has booted. */ + show_welcome_message(); handle_events (); diff --git a/src/messages.h b/src/messages.h index 4fea3b2..1d8a94b 100644 --- a/src/messages.h +++ b/src/messages.h @@ -42,6 +42,6 @@ #define MESSAGE_PROMPT_SWITCH_WM " Switch to wm: " #define MESSAGE_PROMPT_XTERM_COMMAND MESSAGE_PROMPT_SHELL_COMMAND TERM_PROG " -e " -#define MESSAGE_WELCOME " Welcome to ratpoison! Hit C-t ? for help. " +#define MESSAGE_WELCOME " Welcome to ratpoison! Hit `%s %s' for help. " #endif /* ! _RATPOISON_MESSAGES_H */ -- cgit v1.2.3