2 * (C) Copyright 2008 Jeremy Maitin-Shepard
3 * (C) Copyright 2008-2009 John J. Foerch
5 * Use, modification, and distribution are subject to the terms specified in the
13 define_keymap("global_overlay_keymap");
16 function global_overlay_keymap_handler (window, I, true_event) {
17 var binding = keymap_lookup([global_overlay_keymap], I.combo, I.event);
20 if (!binding.fallthrough)
21 event_kill(true_event);
24 co_call(call_interactively(I, binding.command));
29 define_global_mode("global_overlay_keymap_mode",
31 add_hook("keypress_hook", global_overlay_keymap_handler);
34 remove_hook("keypress_hook", global_overlay_keymap_handler);
38 function define_key_alias (typed_key, generated_key) {
39 var name = "generate-key-event:"+generated_key;
41 "Generate a fake key press event for the key: "+generated_key,
43 call_after_timeout(function () {
44 send_key_as_event(I.window,
45 I.buffer.focused_element,
49 define_key(global_overlay_keymap, typed_key, name);
50 global_overlay_keymap_mode(true);
52 ignore_function_for_get_caller_source_code_reference("define_key_alias");
55 function define_sticky_modifier (typed_key, modifiers) {
56 var name = "sticky-modifiers:"+modifiers;
57 interactive(name, "Set sticky modifiers: "+modifiers,
59 I.sticky_modifiers = modifiers;
61 define_key(global_overlay_keymap, typed_key, name);
62 global_overlay_keymap_mode(true);
64 ignore_function_for_get_caller_source_code_reference("define_sticky_modifier");
66 provide("global-overlay-keymap");