summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--src/actions.c22
-rw-r--r--src/actions.h1
-rw-r--r--src/main.c33
-rw-r--r--src/messages.h2
5 files changed, 67 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f3c36a8..63b4a37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2001-09-05 shawn <sabetts@diggin.lamenet.tmp>
+
+ * 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
+
2001-09-04 shawn <sabetts@diggin.lamenet.tmp>
* src/actions.h (cmd_unbind): new prototype
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; i<key_actions_last; i++)
+ {
+ if (!strcmp (key_actions[i].data, action))
+ {
+ return &key_actions[i];
+ }
+ }
+
+ return NULL;
+}
rp_action*
find_keybinding (KeySym keysym, int state)
diff --git a/src/actions.h b/src/actions.h
index 5410d5a..4c0f777 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -80,5 +80,6 @@ char * cmd_unbind (int interactive, void *data);
void initialize_default_keybindings (void);
rp_action* find_keybinding (KeySym keysym, int state);
+rp_action* find_keybinding_by_action (char *action);
#endif /* ! _RATPOISON_ACTIONS_H */
diff --git a/src/main.c b/src/main.c
index 7e2b7f7..af294d7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -308,6 +308,35 @@ read_startup_files ()
}
}
+static void
+show_welcome_message ()
+{
+ rp_action *help_action;
+ char *prefix, *help;
+
+ prefix = keysym_to_string (prefix_key.sym, prefix_key.state);
+
+ /* Find the help key binding. */
+ help_action = find_keybinding_by_action ("help");
+ if (help_action)
+ help = keysym_to_string (help_action->key, 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 */