aboutsummaryrefslogtreecommitdiff
path: root/fbxkb.c
diff options
context:
space:
mode:
Diffstat (limited to 'fbxkb.c')
-rw-r--r--fbxkb.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/fbxkb.c b/fbxkb.c
index 0f71b70..3890fbb 100644
--- a/fbxkb.c
+++ b/fbxkb.c
@@ -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();
bgstack15