From: Christian Heller Date: Thu, 29 Aug 2013 21:28:56 +0000 (+0200) Subject: Pass height=0 to init_win() to make window as wide as the terminal screen. Also did... X-Git-Tag: tce~1004 X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/balance?a=commitdiff_plain;h=cd36b7aea78655cccff83f554d3e6631212d66d0;p=plomrogue Pass height=0 to init_win() to make window as wide as the terminal screen. Also did some minor code re-structuring around the calls of init_win() in main(). --- diff --git a/src/main.c b/src/main.c index 06f53ab..50a14a9 100644 --- a/src/main.c +++ b/src/main.c @@ -200,25 +200,25 @@ int main(int argc, char *argv[]) init_keybindings(&world); set_cleanup_flag(CLEANUP_KEYBINDINGS); struct WinMeta win_meta; - char * err_winmem = "Trouble with init_win:meta() or draw_all_wins() in " + char * err_winmem = "Trouble with init_win_meta() or draw_all_wins() in " "main()."; exit_err(init_win_meta(screen, &win_meta), &world, err_winmem); world.wins.meta = &win_meta; struct Win win_keys = init_win(&win_meta, "Keys", 0, 29, &world, draw_keys_win); - world.wins.keys = &win_keys; struct Win win_info = init_win(&win_meta, "Info", 3, 20, &world, draw_info_win); - world.wins.info = &win_info; uint16_t height_logwin = win_meta.padframe.size.y - (2 + win_info.frame.size.y); struct Win win_log = init_win(&win_meta, "Log", height_logwin, 20, &world, draw_log_win); - world.wins.log = &win_log; uint16_t width_mapwin = win_meta.padframe.size.x - win_keys.frame.size.x - win_log.frame.size.x - 2; struct Win win_map = init_win(&win_meta, "Map", 0, width_mapwin, &world, draw_map_win); + world.wins.keys = &win_keys; + world.wins.log = &win_log; + world.wins.info = &win_info; world.wins.map = &win_map; sorted_wintoggle(&world); diff --git a/src/windows.c b/src/windows.c index 6257d4b..48d17f0 100644 --- a/src/windows.c +++ b/src/windows.c @@ -405,7 +405,7 @@ extern struct Win init_win(struct WinMeta * wmeta, char * title, } else { - w.frame.size.x = 1; + w.frame.size.x = wmeta->padframe.size.x; } if (height > 0 && height <= wmeta->padframe.size.y - 1) { diff --git a/src/windows.h b/src/windows.h index a8783fe..8cb5ec1 100644 --- a/src/windows.h +++ b/src/windows.h @@ -103,10 +103,9 @@ extern uint8_t init_win_meta(WINDOW * screen, struct WinMeta * wmeta); * and appointing "func"() to interpret and draw the content stored at "data" * if the window is visible. * - * A value for "width" <1 will trigger a fallback to width=1. A "height" < 1 or - * larger than the maximum window height possible within the virtual screen will - * trigger a fallback to the maximum height possible (i.e. pass a "height" of 0 - * to initialize the window to its largest possible height). + * Pass 0 for "width" to make the window as wide as the terminal screen. Pass + * for "height" 0 or a value larger than the maximum window height possible + * within the virtual screen to attain that maximum window height. * * Other members of the Win struct are initialized to 0. The window will stay * invisible until appended to the chain of visible windows via append_win().