X-Git-Url: https://plomlompom.com/repos/test.html?a=blobdiff_plain;f=src%2Fwincontrol.c;h=ee547ebe1305e9e87098cb882d1a26c87ac6d9c1;hb=3f1efd2140c58164d692a107aa468048e756036c;hp=bbb4c5ccdc1b165a23422777ae97e283a9aacf58;hpb=dd466052b3ac24c72896fc08fc9d2a87bc4ea904;p=plomrogue diff --git a/src/wincontrol.c b/src/wincontrol.c index bbb4c5c..ee547eb 100644 --- a/src/wincontrol.c +++ b/src/wincontrol.c @@ -388,27 +388,25 @@ extern void sorted_wintoggle_and_activate() { char * f_name = "sorted_wintoggle_and_activate()"; + /* Read from file order of windows to be toggled + active win selection. */ char * path = "config/windows/toggle_order_and_active"; FILE * file = try_fopen(path, "r", f_name); uint16_t linemax = get_linemax(file, f_name); - char win_order[linemax + 1]; try_fgets(win_order, linemax + 1, file, f_name); - - uint8_t a = 0; + uint8_t a; exit_trouble(read_uint8(file, &a), f_name, "read_uint8()"); - try_fclose(file, f_name); + /* Toggle windows and set active window selection. */ uint8_t i = 0; - for (; i < linemax - 1; i++) + for (; i < strlen(win_order) - 1; i++) { if (NULL == strchr(world.winconf_ids, win_order[i])) { continue; } toggle_window(win_order[i]); - if (a == (uint8_t) win_order[i]) { world.wmeta->active = get_win_by_id(win_order[i]);