diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/events.c | 33 | ||||
-rw-r--r-- | src/input.c | 2 | ||||
-rw-r--r-- | src/input.h | 2 | ||||
-rw-r--r-- | src/main.c | 2 |
5 files changed, 44 insertions, 3 deletions
@@ -1,3 +1,11 @@ +2001-05-18 Shawn Betts <sabetts@van.gobasis.com> + + * src/input.c (update_modifier_map): rename from + init_modifier_map. all callers updated. prototype updated. + + * src/events.c (mapping_notify): new function + (delegate_event): handle MappingNotify events. + 2001-05-09 Gergely Nagy <8@free.bsd.hu> * ratpoison.spec: spec file for rpm-based systems diff --git a/src/events.c b/src/events.c index f2dc76d..b75f055 100644 --- a/src/events.c +++ b/src/events.c @@ -584,6 +584,38 @@ focus_change (XFocusChangeEvent *ev) } } +static void +mapping_notify (XMappingEvent *ev) +{ + rp_window *cur; + + /* Remove the grab on the current prefix key */ + for (cur = rp_mapped_window_sentinel->next; + cur != rp_mapped_window_sentinel; + cur = cur->next) + { + ungrab_prefix_key (cur->w); + } + + switch (ev->request) + { + case MappingModifier: + update_modifier_map(); + /* This is meant to fall through. */ + case MappingKeyboard: + XRefreshKeyboardMapping (ev); + break; + } + + /* Add the grab on the current prefix key */ + for (cur = rp_mapped_window_sentinel->next; + cur != rp_mapped_window_sentinel; + cur = cur->next) + { + grab_prefix_key (cur->w); + } +} + /* Given an event, call the correct function to handle it. */ void delegate_event (XEvent *ev) @@ -676,6 +708,7 @@ delegate_event (XEvent *ev) break; case MappingNotify: PRINT_DEBUG ("MappingNotify\n"); + mapping_notify( &ev->xmapping ); break; default: PRINT_DEBUG ("Unhandled event %d\n", ev->type); diff --git a/src/input.c b/src/input.c index 1818f5d..60f4624 100644 --- a/src/input.c +++ b/src/input.c @@ -30,7 +30,7 @@ /* Figure out what keysyms are attached to what modifiers */ void -init_modifier_map () +update_modifier_map () { unsigned int modmasks[] = { Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; diff --git a/src/input.h b/src/input.h index e26f46f..4a74ac3 100644 --- a/src/input.h +++ b/src/input.h @@ -27,6 +27,6 @@ int cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym char *get_input (char *prompt); char *get_more_input (char *prompt, char *preinput); int read_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len); -void init_modifier_map (); +void update_modifier_map (); #endif /* ! _RATPOISON_INPUT_H */ @@ -420,8 +420,8 @@ main (int argc, char *argv[]) init_numbers (); init_window_list (); init_frame_list (); + update_modifier_map (); initialize_default_keybindings (); - init_modifier_map (); font = XLoadQueryFont (dpy, FONT); if (font == NULL) |