static SkinKeyboard*
skin_keyboard_create_from_charmap_name(const char* charmap_name,
                                       int  use_raw_keys,
                                       SkinKeyCodeFlushFunc keycode_flush)
{
    SkinKeyboard*  kb;

    ANEW0(kb);

    kb->charmap = skin_charmap_get_by_name(charmap_name);
    if (!kb->charmap) {
        // Charmap name was not found. Default to "qwerty2" */
        kb->charmap = skin_charmap_get_by_name(DEFAULT_ANDROID_CHARMAP);
        fprintf(stderr, "### warning, skin requires unknown '%s' charmap, reverting to '%s'\n",
                charmap_name, kb->charmap->name );
    }
    kb->raw_keys = use_raw_keys;
    kb->enabled  = 0;

    /* add default keyset */
    if (skin_keyset_get_default()) {
        kb->kset = skin_keyset_get_default();
    } else {
        kb->kset = skin_keyset_new_from_text(
                skin_keyset_get_default_text());
    }
    skin_keycodes_buffer_init(kb->keycodes, keycode_flush);
    return kb;
}
Exemplo n.º 2
0
void skin_ui_reset_title(SkinUI* ui) {
    char  temp[128], *p=temp, *end = p + sizeof(temp);

    if (ui->window == NULL)
        return;

    if (ui->show_trackball) {
        SkinKeyBinding  bindings[SKIN_KEY_COMMAND_MAX_BINDINGS];

        int count = skin_keyset_get_bindings(skin_keyset_get_default(),
                                             SKIN_KEY_COMMAND_TOGGLE_TRACKBALL,
                                             bindings);
        if (count > 0) {
            int  nn;
            p = bufprint(p, end, "Press ");
            for (nn = 0; nn < count; nn++) {
                if (nn > 0) {
                    if (nn < count-1)
                        p = bufprint(p, end, ", ");
                    else
                        p = bufprint(p, end, " or ");
                }
                p = bufprint(p, end, "%s",
                             skin_key_pair_to_string(bindings[nn].sym,
                                                     bindings[nn].mod));
            }
            p = bufprint(p, end, " to leave trackball mode. ");
        }
    }

    p = bufprint(p, end, "%s", ui->ui_params.window_name);
    skin_window_set_title(ui->window, temp);
}
Exemplo n.º 3
0
static SkinKeyboard*
skin_keyboard_create_from_charmap_name(const char*  charmap_name,
                                       int  use_raw_keys)
{
    SkinKeyboard*  kb;

    ANEW0(kb);

    kb->charmap = android_get_charmap_by_name(charmap_name);
    if (!kb->charmap) {
        // Charmap name was not found. Default to the first charmap in the array.
        kb->charmap = android_get_charmap_by_index(0);
        fprintf(stderr, "### warning, skin requires unknown '%s' charmap, reverting to '%s'\n",
                charmap_name, kb->charmap->name );
    }
    kb->raw_keys = use_raw_keys;
    kb->enabled  = 0;

    /* add default keyset */
    if (android_keyset)
        kb->kset = android_keyset;
    else
        kb->kset = skin_keyset_new_from_text( skin_keyset_get_default() );

    return kb;
}
void
skin_keyboard_set_keyset( SkinKeyboard*  keyboard, SkinKeyset*  kset )
{
    if (kset == NULL)
        return;
    if (keyboard->kset && keyboard->kset != skin_keyset_get_default()) {
        skin_keyset_free(keyboard->kset);
    }
    keyboard->kset = kset;
}