[Window] Try to fix the autosizing of desktop name for non-i3 dekstop.

Issue: #1439
This commit is contained in:
Dave Davenport 2021-09-06 20:32:36 +02:00
parent 4d0eaf1463
commit c63e03fd49
1 changed files with 12 additions and 8 deletions

View File

@ -633,27 +633,31 @@ static void _window_mode_load_data(Mode *sw, unsigned int cd) {
g_free(output);
} else {
winclient->wmdesktopstr = g_strdup("Invalid name");
pd->wmdn_len = MAX(pd->wmdn_len,
g_utf8_strlen(winclient->wmdesktopstr, -1));
winclient->wmdesktopstr_len =
g_utf8_strlen(winclient->wmdesktopstr, -1);
pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
}
} else {
winclient->wmdesktopstr = g_markup_escape_text(
_window_name_list_entry(names.strings, names.strings_len,
winclient->wmdesktop),
-1);
pd->wmdn_len =
MAX(pd->wmdn_len, g_utf8_strlen(winclient->wmdesktopstr, -1));
winclient->wmdesktopstr_len =
g_utf8_strlen(winclient->wmdesktopstr, -1);
pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
}
} else {
winclient->wmdesktopstr =
g_strdup_printf("%u", (uint32_t)winclient->wmdesktop);
pd->wmdn_len =
MAX(pd->wmdn_len, g_utf8_strlen(winclient->wmdesktopstr, -1));
winclient->wmdesktopstr_len =
g_utf8_strlen(winclient->wmdesktopstr, -1);
pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
}
} else {
winclient->wmdesktopstr = g_strdup("");
pd->wmdn_len =
MAX(pd->wmdn_len, g_utf8_strlen(winclient->wmdesktopstr, -1));
winclient->wmdesktopstr_len =
g_utf8_strlen(winclient->wmdesktopstr, -1);
pd->wmdn_len = MAX(pd->wmdn_len, winclient->wmdesktopstr_len);
}
if (cd && winclient->wmdesktop != current_desktop) {
continue;