/* returns 1 on match, 0 otherwise */ static int KEYSYM(pmap_key_cmp) (struct map_node *m1, struct map_node *m2) { struct KEYSYM(map_node) *n1 = KEYSYM(get_map_node)(m1); struct KEYSYM(map_node) *n2 = KEYSYM(get_map_node)(m2); if (KEY1_EQ_P(n1->key1, n2->key1) #if KEY_ARITY > 1 && KEY2_EQ_P(n1->key2, n2->key2) #if KEY_ARITY > 2 && KEY3_EQ_P(n1->key3, n2->key3) #if KEY_ARITY > 3 && KEY4_EQ_P(n1->key4, n2->key4) #if KEY_ARITY > 4 && KEY5_EQ_P(n1->key5, n2->key5) #if KEY_ARITY > 5 && KEY6_EQ_P(n1->key6, n2->key6) #if KEY_ARITY > 6 && KEY7_EQ_P(n1->key7, n2->key7) #if KEY_ARITY > 7 && KEY8_EQ_P(n1->key8, n2->key8) #if KEY_ARITY > 8 && KEY9_EQ_P(n1->key9, n2->key9) #endif #endif #endif #endif #endif #endif #endif #endif ) return 1; else return 0; }
/* update the keys and value of a map_node */ static void KEYSYM(pmap_update_node) (MAP m, struct map_node *m1, struct map_node *m2, int add) { struct KEYSYM(map_node) *src, * dst = KEYSYM(get_map_node)(m1); if (!m2) { MAP_COPY_VAL(m, dst, NULLRET, 0); return; } src = KEYSYM(get_map_node)(m2); if (!add) KEYSYM(pmap_copy_keys)(m1, m2); MAP_COPY_VAL(m, dst, MAP_GET_VAL(src), add); }
static void keymap_add_multiple(keymap_t *map, int range, char *func) { cmdentry_t *cmd; int ix; cmd = xkey_find_cmd_by_name(func); if (!cmd) { return; } /* ### both of these are non-ideal */ switch (range) { case range_Printable: for (ix = 32; ix <= 255; ix++) { if (ix >= 127 && ix < 160) continue; if (!map->keycmds[ix]) map->keycmds[ix] = cmd; } break; case range_Typable: for (ix = 0; ix <= 511; ix++) { if (ix == KEYSYM(XK_Tab)) continue; if (!map->keycmds[ix]) map->keycmds[ix] = cmd; } break; } }
{xgc_work_meta, op_Meta, 0, "meta"}, {xgc_work_meta, op_ExplainKey, 0, "explain-key"}, {xgc_noop, -1, 0, "no-op"}, {NULL, 0, 0, NULL} }; #define KEYSYM(ksym) (0x100 | ((ksym) & 0xff)) #define META(ksym) (0x200 | ((ksym) & 0xff)) static binding_t global_bindings[] = { {'\007' /* ctrl-G */, "cancel"}, {META('\007') /* ctrl-G */, "cancel"}, {KEYSYM(XK_Escape), "meta"}, {KEYSYM(XK_Help), "explain-key"}, {META('x'), "explain-key"}, {KEYSYM(XK_Tab), "focus-forward"}, {'\014' /* ctrl-L */, "redraw-all-windows"}, {0, NULL} }; static binding_t win_textbuffer_bindings[] = { {'\001' /* ctrl-A */, "beginning-of-line"}, {'\005' /* ctrl-E */, "end-of-line"}, {'\002' /* ctrl-B */, "backward-char"}, {KEYSYM(XK_Left), "backward-char"},
/* copy keys for m2 -> m1 */ static void KEYSYM(pmap_copy_keys) (struct map_node *m1, struct map_node *m2) { struct KEYSYM(map_node) *dst = KEYSYM(get_map_node)(m1); struct KEYSYM(map_node) *src = KEYSYM(get_map_node)(m2); #if KEY1_TYPE == STRING str_copy (dst->key1, src->key1); #else dst->key1 = src->key1; #endif #if KEY_ARITY > 1 #if KEY2_TYPE == STRING str_copy (dst->key2, src->key2); #else dst->key2 = src->key2; #endif #if KEY_ARITY > 2 #if KEY3_TYPE == STRING str_copy (dst->key3, src->key3); #else dst->key3 = src->key3; #endif #if KEY_ARITY > 3 #if KEY4_TYPE == STRING str_copy (dst->key4, src->key4); #else dst->key4 = src->key4; #endif #if KEY_ARITY > 4 #if KEY5_TYPE == STRING str_copy (dst->key5, src->key5); #else dst->key5 = src->key5; #endif #if KEY_ARITY > 5 #if KEY6_TYPE == STRING str_copy (dst->key6, src->key6); #else dst->key6 = src->key6; #endif #if KEY_ARITY > 6 #if KEY7_TYPE == STRING str_copy (dst->key7, src->key7); #else dst->key7 = src->key7; #endif #if KEY_ARITY > 7 #if KEY8_TYPE == STRING str_copy (dst->key8, src->key8); #else dst->key8 = src->key8; #endif #if KEY_ARITY > 8 #if KEY9_TYPE == STRING str_copy (dst->key9, src->key9); #else dst->key9 = src->key9; #endif #endif #endif #endif #endif #endif #endif #endif #endif }