diff options
author | B. Stack <bgstack15@gmail.com> | 2022-10-10 08:53:38 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-10-10 08:56:02 -0400 |
commit | 1137b0275966748072a78683d4f27e731925777a (patch) | |
tree | 6b013d8c82da1e74a8fa55299f5f2d7bfc7f6271 /fbxkb.c | |
parent | add variant support (diff) | |
download | fbxkb-1137b0275966748072a78683d4f27e731925777a.tar.gz fbxkb-1137b0275966748072a78683d4f27e731925777a.tar.bz2 fbxkb-1137b0275966748072a78683d4f27e731925777a.zip |
improve variant support, and add tooltip
Diffstat (limited to 'fbxkb.c')
-rw-r--r-- | fbxkb.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -343,7 +343,7 @@ read_kbd_description() // parse kbd info if (sym_name_atom != None) { - char *sym_name, *tmp, *tok, *tmp2; + char *sym_name, *tmp, *tok, *tmp2, *tmp3; int no; sym_name = XGetAtomName(dpy, sym_name_atom); @@ -354,6 +354,7 @@ read_kbd_description() * 150 pc/pc(pc101)+pc/us+pc/ru(phonetic):2+group(shift_toggle) * 470 pc(pc105)+us+ru(phonetic):2+il(phonetic):3+group(shifts_toggle)+group(switch) */ + tmp3 = malloc(30 * sizeof(char)); DBG("sym_name=%s\n", sym_name); for (tok = strtok(sym_name, "+"); tok; tok = strtok(NULL, "+")) { DBG("tok=%s\n", tok); @@ -383,13 +384,15 @@ read_kbd_description() if (group2info[no].sym != NULL) { ERR("xkb group #%d is already defined\n", no); } - group2info[no].sym = g_strdup(tok); - strcat(tok,","); + strcpy(tmp3, tok); + strcat(tmp3,","); // add variant to end of string for the png lookup - strcat(tok,tmp2); - group2info[no].flag = sym2flag(tok); + strcat(tmp3,tmp2); + group2info[no].sym = g_strdup(tmp3); + group2info[no].flag = sym2flag(tmp3); group2info[no].name = XGetAtomName(dpy, kbd_desc_ptr->names->groups[no]); *tmp2 = 0; + *tmp3 = 0; } XFree(sym_name); } @@ -424,6 +427,7 @@ static void update_flag(int no) g_assert(k != NULL); DBG("k->sym=%s\n", k->sym); gtk_image_set_from_pixbuf(GTK_IMAGE(image), k->flag); + gtk_widget_set_tooltip_text(docklet, k->name); RET(); } @@ -442,8 +446,9 @@ filter( XEvent *xev, GdkEvent *event, gpointer data) if (xkbev->any.xkb_type == XkbStateNotify) { DBG("XkbStateNotify: %d\n", xkbev->state.group); cur_group = xkbev->state.group; - if (cur_group < ngroups) + if (cur_group < ngroups) { update_flag(cur_group); + } } else if (xkbev->any.xkb_type == XkbNewKeyboardNotify) { DBG("XkbNewKeyboardNotify\n"); read_kbd_description(); |