Exemplo n.º 1
0
void mircv::XKBMapper::set_rules(xkb_rule_names const& names)
{
    std::lock_guard<std::mutex> lg(guard);

    context = std::shared_ptr<xkb_context>(xkb_context_new(xkb_context_flags(0)), XKBContextDeleter());
    map = std::shared_ptr<xkb_keymap>(xkb_map_new_from_names(context.get(), &names, xkb_map_compile_flags(0)), XKBKeymapDeleter());
    state = std::shared_ptr<xkb_state>(xkb_state_new(map.get()), XKBStateDeleter());
}
Exemplo n.º 2
0
int main()
{
    xkb_rule_names names;
    names.rules = strdup("evdev");
    names.model = strdup("pc105");
    names.layout = strdup("us");
    names.variant = strdup("");
    names.options = strdup("");

    xkb_context *context = xkb_context_new(xkb_context_flags(0));
    if (context) {
        xkb_keymap * keymap = xkb_map_new_from_names(context, &names, xkb_map_compile_flags(0));
        if (keymap) {
            xkb_state *state = xkb_state_new(keymap);
            if (state)
                xkb_state_unref(state);
            xkb_map_unref(keymap);
        }
        xkb_context_unref(context);
    }

    return 0;
}