diff options
author | sabetts <sabetts> | 2003-09-02 17:33:58 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2003-09-02 17:33:58 +0000 |
commit | 2a16e44fccc006966c0e282ce0ba4a808e15e776 (patch) | |
tree | 9f8017f42396d028466851c76f6eb72a7cc305b9 /src/events.c | |
parent | 8122f90155b54a948bc062d496de373f891a43f6 (diff) | |
download | ratpoison-2a16e44fccc006966c0e282ce0ba4a808e15e776.zip |
* src/main.c (show_welcome_message): search the root keymap for
the help binding.
(clean_up): call free_keymaps and not free_keybindings.
* src/events.c (handle_key): call cmd_readkey to hand actually
reading a key from the keyboard.
* src/data.h (typedef rp_keymap): new typedef
(struct rp_keymap): new struct
* src/conf.h (ROOT_KEYMAP): new define
* src/actions.h (cmd_readkey): new prototype
(cmd_newkmap): likewise
(cmd_delkmap): likewise
(cmd_definekey): likewise
(find_keymap): likewise
(keymap_free): likewise
(free_keymaps): likewise
* src/actions.c (rp_keymaps): new global. remove globals
key_actions, key_actions_last, and key_actions_table_size.
(user_commands): remove bind and unbind. New commands readkey,
newkmap, delkmap, and definekey.
(find_keybinding_by_action): take a rp_keymap argument and operate
on it. All callers updated.
(find_keybinding): likewise
(find_command_by_keydesc): likewise
(resolve_command_from_keydesc): likewise
(add_keybinding): likewise
(remove_keybinding): likewise
(cmd_definekey): new function
(cmd_newkmap): likewise
(cmd_delkmap): likewise
(keymap_new): likewise
(keymap_free): likewise
(find_keymap): likewise
(free_keymaps): likewise
(cmd_bind): remove function. Prototype removed.
(cmd_unbind): likewise
(initialize_default_keybindings): add aliases for unbind and bind.
(ungrab_rat): moved from events.c
(grab_rat): likewise
Diffstat (limited to 'src/events.c')
-rw-r--r-- | src/events.c | 55 |
1 files changed, 3 insertions, 52 deletions
diff --git a/src/events.c b/src/events.c index 0d69095..6a6d868 100644 --- a/src/events.c +++ b/src/events.c @@ -349,28 +349,8 @@ client_msg (XClientMessageEvent *ev) } static void -grab_rat () -{ - XGrabPointer (dpy, current_screen()->root, True, 0, - GrabModeAsync, GrabModeAsync, - None, current_screen()->rat, CurrentTime); -} - -static void -ungrab_rat () -{ - XUngrabPointer (dpy, CurrentTime); -} - -static void handle_key (rp_screen *s) { - char *keysym_name; - rp_action *key_action; - KeySym keysym; /* Key pressed */ - unsigned int mod; /* Modifiers */ - int rat_grabbed = 0; - PRINT_DEBUG (("handling key...\n")); /* All functions hide the program bar and the frame indicator. */ @@ -381,41 +361,12 @@ handle_key (rp_screen *s) alarm (0); alarm_signalled = 0; - XGrabKeyboard (dpy, s->key_window, False, GrabModeSync, GrabModeAsync, CurrentTime); - - /* Change the mouse icon to indicate to the user we are waiting for - more keystrokes */ - if (defaults.wait_for_key_cursor) - { - grab_rat(); - rat_grabbed = 1; - } - /* Call the prefix hook. */ hook_run (&rp_prefix_hook); - read_key (&keysym, &mod, NULL, 0); - XUngrabKeyboard (dpy, CurrentTime); - - if (rat_grabbed) - ungrab_rat(); - - if ((key_action = find_keybinding (keysym, x11_mask_to_rp_mask (mod)))) - { - char *result; - result = command (1, key_action->data); - - /* Gobble the result. */ - if (result) - free (result); - } - else - { - /* No key match, notify user. */ - keysym_name = keysym_to_string (keysym, x11_mask_to_rp_mask (mod)); - marked_message_printf (0, 0, " %s unbound key ", keysym_name); - free (keysym_name); - } + /* Read a key and execute the command associated with it on the + default keymap. */ + cmd_readkey (1, ROOT_KEYMAP); } static void |