libi3: Rework predict_text_width
predict_text_width now takes an i3String as argument
This commit is contained in:
@ -116,10 +116,9 @@ static int workspaces_string_cb(void *params_, const unsigned char *val, unsigne
|
||||
/* Save the name */
|
||||
params->workspaces_walk->name = i3string_from_utf8_with_length((const char *)val, len);
|
||||
|
||||
/* Convert the name to ucs2, save its length in glyphs and calculate its rendered width */
|
||||
/* Save its rendered width */
|
||||
params->workspaces_walk->name_width =
|
||||
predict_text_width((char *)i3string_as_ucs2(params->workspaces_walk->name),
|
||||
i3string_get_num_glyphs(params->workspaces_walk->name), true);
|
||||
predict_text_width(params->workspaces_walk->name);
|
||||
|
||||
DLOG("Got Workspace %s, name_width: %d, glyphs: %zu\n",
|
||||
i3string_as_utf8(params->workspaces_walk->name),
|
||||
|
@ -119,7 +119,7 @@ void refresh_statusline() {
|
||||
if (i3string_get_num_bytes(block->full_text) == 0)
|
||||
continue;
|
||||
|
||||
block->width = predict_text_width((char *)i3string_as_ucs2(block->full_text), i3string_get_num_glyphs(block->full_text), true);
|
||||
block->width = predict_text_width(block->full_text);
|
||||
/* If this is not the last block, add some pixels for a separator. */
|
||||
if (TAILQ_NEXT(block, blocks) != NULL)
|
||||
block->width += 9;
|
||||
|
Reference in New Issue
Block a user