static void event_mappingnotify(XEvent *e) { XMappingEvent *ev = &e->xmapping; XRefreshKeyboardMapping(ev); if(ev->request == MappingKeyboard) wmfs_grab_keys(); }
static void config_keybind(void) { int i, n; size_t j; struct conf_sec *sec, **ks; struct opt_type *opt; char *cmd; struct keybind *k; /* [keys] */ sec = fetch_section_first(NULL, "keys"); ks = fetch_section(sec, "key"); n = fetch_section_count(ks); SLIST_INIT(&W->h.keybind); /* [key] */ for(i = 0; i < n; ++i) { k = (struct keybind*)xcalloc(1, sizeof(struct keybind)); /* mod = {} */ opt = fetch_opt(ks[i], "", "mod"); for(j = k->mod = 0; j < fetch_opt_count(opt); ++j) k->mod |= modkey_keysym(opt[j].str); free(opt); /* key = */ k->keysym = XStringToKeysym(fetch_opt_first(ks[i], "None", "key").str); /* func = */ if(!(k->func = uicb_name_func(fetch_opt_first(ks[i], "", "func").str))) { warnxl("configuration: Unknown Function \"%s\".", fetch_opt_first(ks[i], "", "func").str); k->func = uicb_spawn; } /* cmd = */ if((cmd = fetch_opt_first(ks[i], "", "cmd").str)) k->cmd = xstrdup(cmd); SLIST_INSERT_HEAD(&W->h.keybind, k, next); } wmfs_grab_keys(); free(ks); }