From 021ec86685b4f9c12ccebfda2e0b82ad1a309b00 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@llnl.gov> Date: Tue, 5 Oct 2004 22:21:14 +0000 Subject: [PATCH] Resize works again with new window parameters --- src/smap/job_functions.c | 16 ++++++++-------- src/smap/partition_functions.c | 5 ++--- src/smap/smap.c | 26 ++++++++++++++------------ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/smap/job_functions.c b/src/smap/job_functions.c index 3052c199e45..fc3e6c27aa7 100644 --- a/src/smap/job_functions.c +++ b/src/smap/job_functions.c @@ -173,18 +173,18 @@ int print_text_job(job_info_t * job_ptr) mvwprintw(smap_info_ptr->text_win, smap_info_ptr->ycord, smap_info_ptr->xcord, "%5d", job_ptr->num_nodes); - smap_info_ptr->xcord += 6; + smap_info_ptr->xcord += 6; + tempxcord = smap_info_ptr->xcord; - width = smap_info_ptr->text_win->_maxx - smap_info_ptr->xcord; + //width = smap_info_ptr->text_win->_maxx - smap_info_ptr->xcord; + while (job_ptr->nodes[i] != '\0') { - if ((printed = - mvwaddch(smap_info_ptr->text_win, - smap_info_ptr->ycord, smap_info_ptr->xcord, - job_ptr->nodes[i])) < 0) + if ((printed = mvwaddch(smap_info_ptr->text_win, + smap_info_ptr->ycord, smap_info_ptr->xcord, + job_ptr->nodes[i])) < 0) return printed; smap_info_ptr->xcord++; - width = - smap_info_ptr->text_win->_maxx - smap_info_ptr->xcord; + width = smap_info_ptr->text_win->_maxx - smap_info_ptr->xcord; if (job_ptr->nodes[i] == '[') prefixlen = i + 1; else if (job_ptr->nodes[i] == ',' && (width - 9) <= 0) { diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index debcd7d50a8..15a0648d831 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -207,15 +207,14 @@ int print_text_part(partition_info_t * part_ptr) smap_info_ptr->xcord += 7; tempxcord = smap_info_ptr->xcord; - width = smap_info_ptr->text_win->_maxx - smap_info_ptr->xcord; + //width = smap_info_ptr->text_win->_maxx - smap_info_ptr->xcord; if (params.display == BGLPART) nodes = part_ptr->allow_groups; else nodes = part_ptr->nodes; prefixlen = i; while (nodes[i] != '\0') { - width = - smap_info_ptr->text_win->_maxx - smap_info_ptr->xcord; + width = smap_info_ptr->text_win->_maxx - smap_info_ptr->xcord; if (!prefixlen && nodes[i] == '[' && nodes[i - 1] == ',') prefixlen = i + 1; diff --git a/src/smap/smap.c b/src/smap/smap.c index bbb4b7c39e2..148c346d302 100644 --- a/src/smap/smap.c +++ b/src/smap/smap.c @@ -147,7 +147,6 @@ int main(int argc, char *argv[]) _get_option(); redraw: - init_grid(node_info_ptr); wclear(smap_info_ptr->text_win); //wclear(smap_info_ptr->grid_win); @@ -271,23 +270,26 @@ void *_resize_handler(int sig) { int height = smap_info_ptr->Y * smap_info_ptr->Z + smap_info_ptr->Y + 3; int width = smap_info_ptr->X + smap_info_ptr->Z + 3; - + int tempwidth = width; smap_info_ptr->ycord = 1; - wclear(smap_info_ptr->grid_win); - wclear(smap_info_ptr->text_win); - + + delwin(smap_info_ptr->grid_win); + delwin(smap_info_ptr->text_win); + endwin(); initscr(); - - getmaxyx(stdscr, LINES, COLS); - - delwin(smap_info_ptr->grid_win); + if (COLS < (75 + width) || LINES < height) { + endwin(); + printf + ("Screen is too small make sure the screen is at least %dx%d\nRight now it is %dx%d\n", + 75 + width, height, COLS, LINES); + exit(0); + } + smap_info_ptr->grid_win = newwin(height, width, 0, 0); width = COLS - width; - delwin(smap_info_ptr->text_win); - smap_info_ptr->text_win = - newwin(LINES, width, 0, smap_info_ptr->X * 2); + smap_info_ptr->text_win = newwin(LINES, width, 0, tempwidth); print_date(); switch (params.display) { -- GitLab