summaryrefslogtreecommitdiff
path: root/src/manage.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2004-04-18 21:48:42 +0000
committersabetts <sabetts>2004-04-18 21:48:42 +0000
commitc9635a8c9e89c3900a210175f0d3f3cb3723931b (patch)
tree6dc9f91a58cd7df7f3cf0156e92f07b11cfcfd29 /src/manage.c
parent996b6ae9e981fbafc10f59427f6a6f9057b2273c (diff)
downloadratpoison-c9635a8c9e89c3900a210175f0d3f3cb3723931b.zip
* src/manage.h (ungrab_keys_all_wins): new prototype
(grab_keys_all_wins): likewise * src/manage.c (grab_top_level_keys): renamed from grab_prefix_key (all callers updated). Grab all keys in the top level keymap. (ungrab_top_level_keys): renamed from ungrab_prefix_key (all callers updated). ungrab all keys in the top level keymap. (ungrab_keys_all_wins): new function (grab_keys_all_wins): likewise * src/globals.c: (rp_key_hook): rename from rp_prefix_hook. Dependant code updated. (set_rp_window_focus): change 'prefix' hook to 'key' hook. * src/events.c (handle_key): handle a top level key press. (handle_key): new arguments ks, and mod. (key_press): pass the keysym and modifier to handle_key * src/conf.h (TOP_KEYMAP): new define * src/actions.c (cmd_v_split, cmd_h_split): swap names. (user_commands): bind split to cmd_v_split. (initialize_default_keybindings): initialize the top level keymap (cmd_definekey): update the keys grabbed when changing a key on the top level keymap. (cmd_escape): update the escape key in the top level map. (cmd_delkmap): don't allow the deletion of the top level keymap.
Diffstat (limited to 'src/manage.c')
-rw-r--r--src/manage.c61
1 files changed, 56 insertions, 5 deletions
diff --git a/src/manage.c b/src/manage.c
index d7ed545..46e174e 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -103,25 +103,76 @@ add_unmanaged_window (char *name)
extern Atom wm_state;
void
-grab_prefix_key (Window w)
+grab_top_level_keys (Window w)
{
#ifdef HIDE_MOUSE
XGrabKey(dpy, AnyKey, AnyModifier, w, True,
GrabModeAsync, GrabModeAsync);
#else
- grab_key (XKeysymToKeycode (dpy, prefix_key.sym), prefix_key.state, w);
+ rp_keymap *map = find_keymap (TOP_KEYMAP);
+ int i;
+
+ if (map == NULL)
+ {
+ PRINT_ERROR (("Unable to find " TOP_KEYMAP " keymap\n"));
+ return;
+ }
+
+ PRINT_DEBUG(("grabbing top level key\n"));
+ for (i=0; i<map->actions_last; i++)
+ {
+ PRINT_DEBUG(("%d\n", i));
+ grab_key (XKeysymToKeycode (dpy, map->actions[i].key), map->actions[i].state, w);
+ }
#endif
}
void
-ungrab_prefix_key (Window w)
+ungrab_top_level_keys (Window w)
{
#ifdef HIDE_MOUSE
#else
- XUngrabKey(dpy, XKeysymToKeycode (dpy, prefix_key.sym), AnyModifier, w);
+ rp_keymap *map = find_keymap (TOP_KEYMAP);
+ int i;
+
+ if (map == NULL)
+ {
+ PRINT_ERROR (("Unable to find " TOP_KEYMAP " keymap\n"));
+ return;
+ }
+
+ for (i=0; i<map->actions_last; i++)
+ {
+ PRINT_DEBUG(("%d\n", i));
+ XUngrabKey(dpy, XKeysymToKeycode (dpy, map->actions[i].key), AnyModifier, w);
+ }
#endif
}
+void
+ungrab_keys_all_wins ()
+{
+ rp_window *cur;
+
+ /* Remove the grab on the current prefix key */
+ list_for_each_entry (cur, &rp_mapped_window, node)
+ {
+ ungrab_top_level_keys (cur->w);
+ }
+}
+
+void
+grab_keys_all_wins ()
+{
+ rp_window *cur;
+
+ /* Remove the grab on the current prefix key */
+ list_for_each_entry (cur, &rp_mapped_window, node)
+ {
+ grab_top_level_keys (cur->w);
+ }
+}
+
rp_screen*
current_screen ()
{
@@ -735,7 +786,7 @@ map_window (rp_window *win)
/* Fill in the necessary data about the window */
update_window_information (win);
win->number = numset_request (rp_window_numset);
- grab_prefix_key (win->w);
+ grab_top_level_keys (win->w);
/* Put win in the mapped window list */
list_del (&win->node);