diff --git a/src/config/kbdbind.c b/src/config/kbdbind.c index 0a3e8ebaf..2c150e5ac 100644 --- a/src/config/kbdbind.c +++ b/src/config/kbdbind.c @@ -16,6 +16,7 @@ #include "config/options.h" #include "intl/gettext/libintl.h" #include "main/event.h" +#include "main/module.h" #include "terminal/kbd.h" #include "util/memory.h" #include "util/string.h" @@ -515,8 +516,8 @@ static struct action_list action_table[KEYMAP_MAX] = { #undef ACTION_ -void -init_keymaps(void) +static void +init_keymaps(struct module *xxx) { enum keymap_id keymap_id; @@ -527,8 +528,8 @@ init_keymaps(void) add_default_keybindings(); } -void -free_keymaps(void) +static void +free_keymaps(struct module *xxx) { enum keymap_id keymap_id; @@ -948,3 +949,13 @@ bind_config_string(struct string *file) } } } + +struct module kbdbind_module = struct_module( + /* name: */ "Keyboard Bindings", + /* options: */ NULL, + /* hooks: */ NULL, + /* submodules: */ NULL, + /* data: */ NULL, + /* init: */ init_keymaps, + /* done: */ free_keymaps +); diff --git a/src/config/kbdbind.h b/src/config/kbdbind.h index 1a3c78097..39a6f9de4 100644 --- a/src/config/kbdbind.h +++ b/src/config/kbdbind.h @@ -8,6 +8,7 @@ #include "util/string.h" struct listbox_item; +struct module; /* Used for holding enum _action values. */ typedef long action_id_T; @@ -114,9 +115,6 @@ struct keybinding { }; -void init_keymaps(void); -void free_keymaps(void); - struct keybinding *add_keybinding(enum keymap_id keymap_id, action_id_T action_id, struct term_event_keyboard *kbd, int event); int keybinding_exists(enum keymap_id keymap_id, struct term_event_keyboard *kbd, action_id_T *action_id); void free_keybinding(struct keybinding *); @@ -207,4 +205,6 @@ unsigned char *get_keystroke(action_id_T action_id, enum keymap_id keymap_id); void add_actions_to_string(struct string *string, action_id_T actions[], enum keymap_id keymap_id, struct terminal *term); +extern struct module kbdbind_module; + #endif diff --git a/src/main/main.c b/src/main/main.c index 173e09331..22a2861ef 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -23,7 +23,6 @@ #include "config/cmdline.h" #include "config/conf.h" #include "config/home.h" -#include "config/kbdbind.h" #include "config/options.h" #include "dialogs/menu.h" #include "document/document.h" @@ -130,7 +129,6 @@ init(void) register_modules_options(builtin_modules); set_sigcld(); get_system_name(); - init_keymaps(); /* XXX: OS/2 has some stupid bug and the pipe must be created before * socket :-/. -- Mikulas */ @@ -298,7 +296,6 @@ terminate_all_subsystems(void) free_charsets_lookup(); free_colors_lookup(); done_modules(main_modules); - free_keymaps(); free_conv_table(); check_bottom_halves(); done_home(); diff --git a/src/main/module.c b/src/main/module.c index 4988bbd0b..cbaf60e1a 100644 --- a/src/main/module.c +++ b/src/main/module.c @@ -14,6 +14,7 @@ #include "bfu/dialog.h" #include "bookmarks/bookmarks.h" +#include "config/kbdbind.h" #include "config/timer.h" #include "config/urlhist.h" #include "cookies/cookies.h" @@ -33,6 +34,7 @@ struct module *main_modules[] = { &document_module, + &kbdbind_module, NULL /* XXX: Keep this */ };