Lines Matching refs:bd
95 key_bindings_free(struct key_binding *bd)
97 cmd_list_free(bd->cmdlist);
98 free(__UNCONST(bd->note));
99 free(bd);
138 struct key_binding *bd;
144 RB_FOREACH_SAFE(bd, key_bindings, &table->key_bindings, bd1) {
145 RB_REMOVE(key_bindings, &table->key_bindings, bd);
146 key_bindings_free(bd);
148 RB_FOREACH_SAFE(bd, key_bindings, &table->default_key_bindings, bd1) {
149 RB_REMOVE(key_bindings, &table->default_key_bindings, bd);
150 key_bindings_free(bd);
160 struct key_binding bd;
162 bd.key = key;
163 return (RB_FIND(key_bindings, &table->key_bindings, &bd));
169 struct key_binding bd;
171 bd.key = key;
172 return (RB_FIND(key_bindings, &table->default_key_bindings, &bd));
182 key_bindings_next(__unused struct key_table *table, struct key_binding *bd)
184 return (RB_NEXT(key_bindings, &table->key_bindings, bd));
192 struct key_binding *bd;
197 bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS);
199 if (bd != NULL) {
201 free(__UNCONST(bd->note));
202 bd->note = xstrdup(note);
205 bd->flags |= KEY_BINDING_REPEAT;
209 if (bd != NULL) {
210 RB_REMOVE(key_bindings, &table->key_bindings, bd);
211 key_bindings_free(bd);
214 bd = xcalloc(1, sizeof *bd);
215 bd->key = (key & ~KEYC_MASK_FLAGS);
217 bd->note = xstrdup(note);
218 RB_INSERT(key_bindings, &table->key_bindings, bd);
221 bd->flags |= KEY_BINDING_REPEAT;
222 bd->cmdlist = cmdlist;
224 s = cmd_list_print(bd->cmdlist, 0);
225 log_debug("%s: %#llx %s = %s", __func__, bd->key,
226 key_string_lookup_key(bd->key, 1), s);
234 struct key_binding *bd;
240 bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS);
241 if (bd == NULL)
244 log_debug("%s: %#llx %s", __func__, bd->key,
245 key_string_lookup_key(bd->key, 1));
247 RB_REMOVE(key_bindings, &table->key_bindings, bd);
248 key_bindings_free(bd);
261 struct key_binding *bd, *dd;
267 bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS);
268 if (bd == NULL)
271 dd = key_bindings_get_default(table, bd->key);
273 key_bindings_remove(name, bd->key);
277 cmd_list_free(bd->cmdlist);
278 bd->cmdlist = dd->cmdlist;
279 bd->cmdlist->references++;
281 free(__UNCONST(bd->note));
283 bd->note = xstrdup(dd->note);
285 bd->note = NULL;
286 bd->flags = dd->flags;
310 struct key_binding *bd, *bd1;
319 RB_FOREACH_SAFE(bd, key_bindings, &table->key_bindings, bd1)
320 key_bindings_reset(name, bd->key);
327 struct key_binding *bd, *new_bd;
330 RB_FOREACH(bd, key_bindings, &table->key_bindings) {
331 new_bd = xcalloc(1, sizeof *bd);
332 new_bd->key = bd->key;
333 if (bd->note != NULL)
334 new_bd->note = xstrdup(bd->note);
335 new_bd->flags = bd->flags;
336 new_bd->cmdlist = bd->cmdlist;
675 key_bindings_dispatch(struct key_binding *bd, struct cmdq_item *item,
685 readonly = cmd_list_all_have(bd->cmdlist, CMD_READONLY);
689 if (bd->flags & KEY_BINDING_REPEAT)
692 new_item = cmdq_get_command(bd->cmdlist, new_state);