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 input_handle_binding(I, true_event, binding);
23 define_global_mode("global_overlay_keymap_mode",
25 add_hook("keypress_hook", global_overlay_keymap_handler);
28 remove_hook("keypress_hook", global_overlay_keymap_handler);
32 function define_key_alias (typed_key, generated_key) {
33 var name = "generate-key-event:"+generated_key;
35 // This is not a prefix command, because we need finer-grained control over the input state.
37 "Generate a fake key press event for the key: "+generated_key,
39 // Effectively leave the input state almost exactly as it was prior to this key event
41 input_continue_with_state(I);
43 // Warning: event handler is called before send_key_as_event returns
44 send_key_as_event(I.window,
45 I.buffer.focused_element,
48 define_key(global_overlay_keymap, typed_key, name);
49 global_overlay_keymap_mode(true);
51 ignore_function_for_get_caller_source_code_reference("define_key_alias");
54 function define_sticky_modifier (typed_key, modifiers) {
55 var name = "sticky-modifiers:"+modifiers;
56 interactive(name, "Set sticky modifiers: "+modifiers,
58 I.sticky_modifiers = modifiers;
60 define_key(global_overlay_keymap, typed_key, name);
61 global_overlay_keymap_mode(true);
63 ignore_function_for_get_caller_source_code_reference("define_sticky_modifier");
65 provide("global-overlay-keymap");