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
11 define_keymap("global_overlay_keymap");
14 function global_overlay_keymap_handler (window, I, true_event) {
15 var binding = keymap_lookup([global_overlay_keymap], I.combo, I.event);
18 if (!binding.fallthrough)
19 event_kill(true_event);
22 co_call(call_interactively(I, binding.command));
27 define_global_mode("global_overlay_keymap_mode",
29 add_hook("keypress_hook", global_overlay_keymap_handler);
32 remove_hook("keypress_hook", global_overlay_keymap_handler);
36 function define_key_alias (typed_key, generated_key) {
37 var name = "generate-key-event:"+generated_key;
39 "Generate a fake key press event for the key: "+generated_key,
41 call_after_timeout(function () {
42 send_key_as_event(I.window,
43 I.buffer.focused_element,
47 define_key(global_overlay_keymap, typed_key, name);
48 global_overlay_keymap_mode(true);
50 ignore_function_for_get_caller_source_code_reference("define_key_alias");
53 function define_sticky_modifier (typed_key, modifiers) {
54 var name = "sticky-modifiers:"+modifiers;
55 interactive(name, "Set sticky modifiers: "+modifiers,
57 I.sticky_modifiers = modifiers;
59 define_key(global_overlay_keymap, typed_key, name);
60 global_overlay_keymap_mode(true);
62 ignore_function_for_get_caller_source_code_reference("define_sticky_modifier");
64 provide("global-overlay-keymap");