compose: Reduce xkb_compose_state_get_utf8 buffer

`xkb_keysym_to_utf8` does not return a keysym name but its corresponding
character, if defined.
master
Pierre Le Marre 2023-12-05 18:43:41 +01:00 committed by Wismill
parent 8cca3a7bfb
commit 1034f272e4
1 changed files with 3 additions and 3 deletions

View File

@ -168,17 +168,17 @@ xkb_compose_state_get_utf8(struct xkb_compose_state *state,
/* If there's no string specified, but only a keysym, try to do the /* If there's no string specified, but only a keysym, try to do the
* most helpful thing. */ * most helpful thing. */
if (node->leaf.utf8 == 0 && node->leaf.keysym != XKB_KEY_NoSymbol) { if (node->leaf.utf8 == 0 && node->leaf.keysym != XKB_KEY_NoSymbol) {
char name[64]; char utf8[7];
int ret; int ret;
ret = xkb_keysym_to_utf8(node->leaf.keysym, name, sizeof(name)); ret = xkb_keysym_to_utf8(node->leaf.keysym, utf8, sizeof(utf8));
if (ret < 0 || ret == 0) { if (ret < 0 || ret == 0) {
/* ret < 0 is impossible. /* ret < 0 is impossible.
* ret == 0 means the keysym has no string representation. */ * ret == 0 means the keysym has no string representation. */
goto fail; goto fail;
} }
return snprintf(buffer, size, "%s", name); return snprintf(buffer, size, "%s", utf8);
} }
return snprintf(buffer, size, "%s", return snprintf(buffer, size, "%s",