i3
|
Go to the source code of this file.
Functions | |
Binding * | configure_binding (const char *bindtype, const char *modifiers, const char *input_code, const char *release, const char *command, const char *mode) |
Adds a binding from config parameters given as strings and returns a pointer to the binding structure. More... | |
void | grab_all_keys (xcb_connection_t *conn, bool bind_mode_switch) |
Grab the bound keys (tell X to send us keypress events for those keycodes) More... | |
Binding * | get_binding_from_xcb_event (xcb_generic_event_t *event) |
Returns a pointer to the Binding that matches the given xcb event or NULL if no such binding exists. More... | |
void | translate_keysyms (void) |
Translates keysymbols to keycodes for all bindings which use keysyms. More... | |
void | switch_mode (const char *new_mode) |
Switches the key bindings to the given mode, if the mode exists. More... | |
void | check_for_duplicate_bindings (struct context *context) |
Checks for duplicate key bindings (the same keycode or keysym is configured more than once). More... | |
CommandResult * | run_binding (Binding *bind) |
Runs the given binding and handles parse errors. More... | |
Variables | |
pid_t | command_error_nagbar_pid |
const char * | DEFAULT_BINDING_MODE |
The name of the default mode. More... | |
void check_for_duplicate_bindings | ( | struct context * | context | ) |
Checks for duplicate key bindings (the same keycode or keysym is configured more than once).
If a duplicate binding is found, a message is printed to stderr and the has_errors variable is set to true, which will start i3-nagbar.
Definition at line 335 of file bindings.c.
References bindings, Binding::command, ELOG, context::has_errors, Binding::input_type, Binding::keycode, Binding::mods, Binding::release, Binding::symbol, and TAILQ_FOREACH.
Referenced by parse_file().
Binding* configure_binding | ( | const char * | bindtype, |
const char * | modifiers, | ||
const char * | input_code, | ||
const char * | release, | ||
const char * | command, | ||
const char * | mode | ||
) |
Adds a binding from config parameters given as strings and returns a pointer to the binding structure.
Returns NULL if the input code could not be parsed.
Definition at line 49 of file bindings.c.
References B_KEYBOARD, B_MOUSE, Mode::bindings, bindings, Binding::command, DLOG, ELOG, FREE, Binding::input_type, Binding::keycode, mode_from_name(), modifiers_from_str(), Binding::mods, Binding::release, scalloc(), sstrdup(), Binding::symbol, and TAILQ_INSERT_TAIL.
Referenced by CFGFUN().
Binding* get_binding_from_xcb_event | ( | xcb_generic_event_t * | event | ) |
Returns a pointer to the Binding that matches the given xcb event or NULL if no such binding exists.
Definition at line 192 of file bindings.c.
References B_KEYBOARD, B_MOUSE, BIND_MODE_SWITCH, DLOG, get_binding(), xcb_numlock_mask, and xkb_current_group.
Referenced by handle_key_press().
void grab_all_keys | ( | xcb_connection_t * | conn, |
bool | bind_mode_switch | ||
) |
Grab the bound keys (tell X to send us keypress events for those keycodes)
Definition at line 105 of file bindings.c.
References B_KEYBOARD, BIND_MODE_SWITCH, bindings, grab_keycode_for_binding(), Binding::input_type, Binding::keycode, Binding::mods, Binding::number_keycodes, TAILQ_FOREACH, and Binding::translated_to.
Referenced by handle_mapping_notify(), load_configuration(), main(), switch_mode(), and xkb_got_event().
CommandResult* run_binding | ( | Binding * | bind | ) |
Runs the given binding and handles parse errors.
Returns a CommandResult for running the binding's command. Caller should render tree if needs_tree_render is true. Free with command_result_free().
Definition at line 387 of file bindings.c.
References Binding::command, command_error_nagbar_pid, config, errorfilename, Config::font, CommandResult::needs_tree_render, parse_command(), CommandResult::parse_error, Font::pattern, sasprintf(), sstrdup(), start_nagbar(), and tree_render().
Referenced by handle_key_press().
void switch_mode | ( | const char * | new_mode | ) |
Switches the key bindings to the given mode, if the mode exists.
Definition at line 302 of file bindings.c.
References bindings, Mode::bindings, conn, DLOG, ELOG, FREE, grab_all_keys(), ipc_send_event(), modes, Mode::name, sasprintf(), SLIST_FOREACH, translate_keysyms(), and ungrab_all_keys().
Referenced by cmd_mode().
void translate_keysyms | ( | void | ) |
Translates keysymbols to keycodes for all bindings which use keysyms.
Definition at line 242 of file bindings.c.
References B_MOUSE, BIND_MODE_SWITCH, bindings, conn, DLOG, ELOG, FREE, Binding::input_type, Binding::keycode, keysyms, Binding::mods, Binding::number_keycodes, srealloc(), Binding::symbol, TAILQ_FOREACH, and Binding::translated_to.
Referenced by handle_mapping_notify(), load_configuration(), main(), switch_mode(), and xkb_got_event().
pid_t command_error_nagbar_pid |
Definition at line 11 of file bindings.c.
Referenced by cmd_reload(), i3_restart(), and run_binding().
const char* DEFAULT_BINDING_MODE |
The name of the default mode.
Definition at line 18 of file bindings.h.