diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2020-05-18 16:09:13 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2020-05-18 16:09:13 -0700 |
commit | 7f21fe8ec76c230504506bad442001481dd7faf3 (patch) | |
tree | 6c1c2a489c011023be6250926d54adfe69245ee5 | |
parent | 601e1b28f7f6f64582dbd0a479115f5755327494 (diff) |
-rw-r--r-- | Makefile | 21 | ||||
-rw-r--r-- | misc.c | 10 | ||||
-rw-r--r-- | ncurses-ui.c | 188 | ||||
-rw-r--r-- | user-interface.c | 8 | ||||
-rw-r--r-- | version.mk | 2 |
5 files changed, 142 insertions, 87 deletions
@@ -38,10 +38,13 @@ NCURSES_CFLAGS ?= NCURSES_LDFLAGS ?= NCURSES6_CFLAGS ?= NCURSES6_LDFLAGS ?= +NCURSESW6_CFLAGS ?= +NCURSESW6_LDFLAGS ?= PCI_CFLAGS ?= PCI_LDFLAGS ?= BUILD_NCURSES6 = $(if $(NCURSES6_CFLAGS)$(NCURSES6_LDFLAGS),1,) +BUILD_NCURSESW6 = $(if $(NCURSESW6_CFLAGS)$(NCURSESW6_LDFLAGS),1,) ############################################################################## # assign variables @@ -70,6 +73,9 @@ NCURSES_UI_SO_C = $(OUTPUTDIR)/g_$(notdir $(NCURSES_UI_SO:.so=.c)) NCURSES6_UI_O = $(OUTPUTDIR)/ncurses6-ui.o NCURSES6_UI_SO = $(OUTPUTDIR)/nvidia-installer-ncurses6-ui.so NCURSES6_UI_SO_C = $(OUTPUTDIR)/g_$(notdir $(NCURSES6_UI_SO:.so=.c)) +NCURSESW6_UI_O = $(OUTPUTDIR)/ncursesw6-ui.o +NCURSESW6_UI_SO = $(OUTPUTDIR)/nvidia-installer-ncursesw6-ui.so +NCURSESW6_UI_SO_C = $(OUTPUTDIR)/g_$(notdir $(NCURSESW6_UI_SO:.so=.c)) ifneq ($(NEED_TLS_TEST),) TLS_TEST_C = $(OUTPUTDIR)/g_tls_test.c @@ -143,7 +149,9 @@ SRC += $(addprefix $(COMMON_UTILS_DIR)/,$(COMMON_UTILS_SRC)) NCURSES_UI_SO_SRC = $(NCURSES_UI_SO_C) NCURSES_UI_SO_SRC += $(if $(BUILD_NCURSES6),$(NCURSES6_UI_SO_C),) +NCURSES_UI_SO_SRC += $(if $(BUILD_NCURSESW6),$(NCURSESW6_UI_SO_C),) CFLAGS += $(if $(BUILD_NCURSES6),-DNV_INSTALLER_NCURSES6,) +CFLAGS += $(if $(BUILD_NCURSESW6),-DNV_INSTALLER_NCURSESW6,) INSTALLER_SRC = $(SRC) $(NCURSES_UI_SO_SRC) $(TLS_TEST_C) $(TLS_TEST_DSO_C) \ $(RTLD_TEST_C) $(COMPAT_32_SRC) $(STAMP_C) @@ -240,12 +248,19 @@ $(NCURSES6_UI_SO): $(NCURSES6_UI_O) $(call quiet_cmd,LINK) -shared $(NCURSES6_LDFLAGS) \ $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) $< -o $@ -lncurses $(LIBS) +$(NCURSESW6_UI_SO): $(NCURSESW6_UI_O) + $(call quiet_cmd,LINK) -shared $(NCURSESW6_LDFLAGS) \ + $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) $< -o $@ -lncursesw $(LIBS) + $(NCURSES_UI_SO_C): $(GEN_UI_ARRAY) $(NCURSES_UI_SO) $(call quiet_cmd,GEN_UI_ARRAY) $(NCURSES_UI_SO) ncurses_ui_array > $@ $(NCURSES6_UI_SO_C): $(GEN_UI_ARRAY) $(NCURSES6_UI_SO) $(call quiet_cmd,GEN_UI_ARRAY) $(NCURSES6_UI_SO) ncurses6_ui_array > $@ +$(NCURSESW6_UI_SO_C): $(GEN_UI_ARRAY) $(NCURSESW6_UI_SO) + $(call quiet_cmd,GEN_UI_ARRAY) $(NCURSESW6_UI_SO) ncursesw6_ui_array > $@ + ifneq ($(NEED_TLS_TEST),) $(TLS_TEST_C): $(GEN_UI_ARRAY) $(TLS_TEST) $(call quiet_cmd,GEN_UI_ARRAY) $(TLS_TEST) tls_test_array > $@ @@ -274,13 +289,15 @@ $(call BUILD_OBJECT_LIST,misc.c): CFLAGS += $(PCI_CFLAGS) # ncurses-ui.c includes ncurses.h $(NCURSES_UI_O): CFLAGS += $(NCURSES_CFLAGS) $(NCURSES6_UI_O): CFLAGS += $(NCURSES6_CFLAGS) +$(NCURSESW6_UI_O): CFLAGS += $(NCURSESW6_CFLAGS) # build the ncurses ui DSO as position-indpendent code -$(NCURSES_UI_O) $(NCURSES6_UI_O): CFLAGS += -fPIC +$(NCURSES_UI_O) $(NCURSES6_UI_O) $(NCURSESW6_UI_O): CFLAGS += -fPIC # define the rule to build each object file $(foreach src,$(ALL_SRC),$(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src)))) $(eval $(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,TARGET,$(NCURSES_UI_C),$(NCURSES6_UI_O))) +$(eval $(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,TARGET,$(NCURSES_UI_C),$(NCURSESW6_UI_O))) # define a rule to build each makeself-help-script object file $(foreach src,$(MAKESELF_HELP_SCRIPT_SRC),\ @@ -300,7 +317,7 @@ $(CONFIG_H): $(VERSION_MK) @ $(ECHO) -n "#define PROGRAM_NAME " >> $@ @ $(ECHO) "\"$(NVIDIA_INSTALLER_PROGRAM_NAME)\"" >> $@ -$(call BUILD_OBJECT_LIST,$(ALL_SRC)) $(NCURSES6_UI_O): $(CONFIG_H) +$(call BUILD_OBJECT_LIST,$(ALL_SRC)) $(NCURSES6_UI_O) $(NCURSESW6_UI_O): $(CONFIG_H) $(call BUILD_MAKESELF_OBJECT_LIST,$(MAKESELF_HELP_SCRIPT_SRC)): $(CONFIG_H) clean clobber: @@ -288,6 +288,16 @@ int run_command(Options *op, const char *cmd, char **data, int output, } /* + * Clear LANG and LC_ALL before running the command, to make sure + * command output that might need to be parsed doesn't vary based + * on system locale settings. + */ + + unsetenv("LANG"); + unsetenv("LC_ALL"); + + + /* * Open a process by creating a pipe, forking, and invoking the * command. */ diff --git a/ncurses-ui.c b/ncurses-ui.c index 621846e..990ee79 100644 --- a/ncurses-ui.c +++ b/ncurses-ui.c @@ -263,6 +263,16 @@ InstallerUI ui_dispatch_table = { +/* internal variables */ + +/* Save the return value of initscr() here instead of using stdscr directly. + * This avoids problems if libncurses.so doesn't expose stdscr, as was the + * case in http://bugzilla.suse.com/show_bug.cgi?id=1132282 */ +static WINDOW *nv_stdscr; + + + + /* * nv_ncurses_detect() - initialize ncurses; return FALSE if * initialization fails @@ -272,14 +282,14 @@ static int nv_ncurses_detect(Options *op) { int x, y; - if (!initscr()) return FALSE; - + if (!(nv_stdscr = initscr())) return FALSE; + /* * query the current size of the window, and don't try to use the * ncurses ui if it's too small. */ - getmaxyx(stdscr, y, x); + getmaxyx(nv_stdscr, y, x); if ((x < NV_NCURSES_MIN_WIDTH) || (y < NV_NCURSES_MIN_HEIGHT)) { endwin(); @@ -328,13 +338,13 @@ static int nv_ncurses_init(Options *op, FormatTextRows format_text_rows) } } - clear(); /* clear the screen */ - noecho(); /* don't echo input to the screen */ - cbreak(); /* disable line buffering and control characters */ - curs_set(0); /* make the cursor invisible */ - keypad(stdscr, TRUE); /* enable keypad, function keys, arrow keys, etc */ + wclear(nv_stdscr); /* clear the screen */ + noecho(); /* don't echo input to the screen */ + cbreak(); /* disable line buffering and control characters */ + curs_set(0); /* make the cursor invisible */ + keypad(nv_stdscr, TRUE); /* enable keypad, function keys, arrow keys, etc */ - getmaxyx(stdscr, d->height, d->width); /* get current window dimensions */ + getmaxyx(nv_stdscr, d->height, d->width); /* get current window dimensions */ /* create the regions */ @@ -357,7 +367,7 @@ static int nv_ncurses_init(Options *op, FormatTextRows format_text_rows) nv_ncurses_set_footer(d, NV_NCURSES_DEFAULT_FOOTER_LEFT, NV_NCURSES_DEFAULT_FOOTER_RIGHT); - refresh(); + wrefresh(nv_stdscr); return TRUE; @@ -376,7 +386,7 @@ static void nv_ncurses_set_title(Options *op, const char *title) nv_ncurses_set_header(d, title); - refresh(); + wrefresh(nv_stdscr); } /* nv_ncurses_set_title() */ @@ -499,21 +509,26 @@ static char *nv_ncurses_get_input(Options *op, if (redraw) { for (i = 0; i < input_len; i++) { - mvaddch(input_y, input_x + i, BUF_CHAR(buf[i + x]) | color); + mvwaddch(nv_stdscr, input_y, input_x + i, + BUF_CHAR(buf[i + x]) | color); } /* if we're scrolling, display an arrow */ if (x > 0) { - mvaddch(input_y, input_x - 1, '<' | d->message->attr); + mvwaddch(nv_stdscr, input_y, input_x - 1, + '<' | d->message->attr); } else { - mvaddch(input_y, input_x - 1, ' ' | d->message->attr); + mvwaddch(nv_stdscr, input_y, input_x - 1, + ' ' | d->message->attr); } if (buf_len > (input_len - 1 + x)) { - mvaddch(input_y, input_x + input_len, '>' | d->message->attr); + mvwaddch(nv_stdscr, input_y, input_x + input_len, + '>' | d->message->attr); } else { - mvaddch(input_y, input_x + input_len, ' ' | d->message->attr); + mvwaddch(nv_stdscr, input_y, input_x + input_len, + ' ' | d->message->attr); } redraw = FALSE; @@ -521,13 +536,13 @@ static char *nv_ncurses_get_input(Options *op, /* position the cursor */ - move(input_y, input_x - x + c); - refresh(); + wmove(nv_stdscr, input_y, input_x - x + c); + wrefresh(nv_stdscr); /* wait for input */ if (nv_ncurses_check_resize(d, FALSE)) goto draw_get_input; - ch = getch(); + ch = wgetch(nv_stdscr); switch (ch) { @@ -597,7 +612,7 @@ static char *nv_ncurses_get_input(Options *op, if (op->debug) { mvprintw(d->message->y, d->message->x, "c: %3d ch: %04o (%d)", c, ch, ch); - clrtoeol(); + wclrtoeol(nv_stdscr); redraw = TRUE; } @@ -609,7 +624,7 @@ static char *nv_ncurses_get_input(Options *op, d->message = NULL; curs_set(0); /* make the cursor invisible */ - refresh(); + wrefresh(nv_stdscr); free(tmp); tmp = strdup(buf); @@ -709,7 +724,7 @@ static void nv_ncurses_message(Options *op, int level, const char *msg) nv_ncurses_draw_button(d, d->message, x, y, w, h, "OK", TRUE, FALSE); - refresh(); + wrefresh(nv_stdscr); /* wait for enter */ @@ -717,7 +732,7 @@ static void nv_ncurses_message(Options *op, int level, const char *msg) /* if a resize occurred, jump back to the top and redraw */ if (nv_ncurses_check_resize(d, FALSE)) goto draw_message; - ch = getch(); + ch = wgetch(nv_stdscr); switch (ch) { case NV_NCURSES_CTRL('L'): @@ -731,19 +746,19 @@ static void nv_ncurses_message(Options *op, int level, const char *msg) nv_ncurses_erase_button(d->message, x, y, w, h); nv_ncurses_draw_button(d, d->message, x, y, w, h, "OK", TRUE, TRUE); - refresh(); + wrefresh(nv_stdscr); usleep(NV_NCURSES_BUTTON_PRESS_TIME); nv_ncurses_erase_button(d->message, x, y, w, h); nv_ncurses_draw_button(d, d->message, x, y, w, h, "OK", TRUE, FALSE); - refresh(); + wrefresh(nv_stdscr); usleep(NV_NCURSES_BUTTON_PRESS_TIME); /* free the message region */ nv_ncurses_destroy_region(d->message); d->message = NULL; - refresh(); + wrefresh(nv_stdscr); } /* nv_ncurses_message() */ @@ -857,7 +872,7 @@ static void nv_ncurses_status_begin(Options *op, nv_ncurses_do_progress_bar_message(d, msg, d->message->h - 3, d->message->w); - refresh(); + wrefresh(nv_stdscr); } /* nv_ncurses_status_begin() */ @@ -888,9 +903,9 @@ static void nv_ncurses_status_update(Options *op, const float percent, /* temporarily set getch() to non-blocking mode */ - nodelay(stdscr, TRUE); + nodelay(nv_stdscr, TRUE); - while ((ch = getch()) != ERR) { + while ((ch = wgetch(nv_stdscr)) != ERR) { /* * if the user explicitely requested that the screen be * redrawn by pressing CTRL-L, then also redraw the entire @@ -905,7 +920,7 @@ static void nv_ncurses_status_update(Options *op, const float percent, /* set getch() back to blocking mode */ - nodelay(stdscr, FALSE); + nodelay(nv_stdscr, FALSE); /* compute the percentage */ @@ -925,32 +940,32 @@ static void nv_ncurses_status_update(Options *op, const float percent, if (d->use_color) { for (i = 1; i <= n; i++) { - mvaddch(d->message->y + h - 2, d->message->x + i, + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + i, choose_char(i, p, v,' ') | A_REVERSE | NV_NCURSES_INPUT_COLOR); } for (i = 0; i < 4; i++) { if (p[i] >= (n+1)) { - mvaddch(d->message->y + h - 2, d->message->x + p[i], + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + p[i], (v[i] ? v[i] : ' ') | NV_NCURSES_INPUT_COLOR); } } } else { for (i = 2; i < n; i++) { - mvaddch(d->message->y + h - 2, d->message->x + i, + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + i, choose_char(i, p, v, ' ') | A_REVERSE); } for (i = 0; i < 4; i++) { if (p[i] >= n) { - mvaddch(d->message->y + h - 2, d->message->x + p[i], + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + p[i], v[i] ? v[i] : '-'); } } } - refresh(); + wrefresh(nv_stdscr); } /* nv_ncurses_status_update() */ @@ -993,18 +1008,18 @@ static void nv_ncurses_status_end(Options *op, const char *msg) if (d->use_color) { for (i = 1; i < (n+1); i++) { - mvaddch(d->message->y + h - 2, d->message->x + i, + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + i, choose_char(i, p, v, ' ') | A_REVERSE | NV_NCURSES_INPUT_COLOR); } } else { for (i = 2; i < (n); i++) { - mvaddch(d->message->y + h - 2, d->message->x + i, + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + i, choose_char(i, p, v, ' ') | A_REVERSE); } } - refresh(); + wrefresh(nv_stdscr); free(d->progress_title); d->progress_title = NULL; @@ -1035,8 +1050,8 @@ static void nv_ncurses_close(Options *op) free(d); } - clear(); - refresh(); + wclear(nv_stdscr); + wrefresh(nv_stdscr); endwin(); /* End curses mode */ @@ -1072,11 +1087,11 @@ static void nv_ncurses_set_header(DataStruct *d, const char *title) x = (d->header->w - strlen(d->title)) / 2; y = 0; - attrset(d->header->attr); + wattrset(nv_stdscr, d->header->attr); nv_ncurses_clear_region(d->header); - mvaddstr(d->header->y + y, d->header->x + x, (char *) d->title); - attrset(A_NORMAL); + mvwaddstr(nv_stdscr, d->header->y + y, d->header->x + x, (char *) d->title); + wattrset(nv_stdscr, A_NORMAL); } /* nv_ncurses_set_header() */ @@ -1103,22 +1118,24 @@ static void nv_ncurses_set_footer(DataStruct *d, const char *left, d->footer_left = tmp0; d->footer_right = tmp1; - attrset(d->footer->attr); + wattrset(nv_stdscr, d->footer->attr); nv_ncurses_clear_region(d->footer); if (d->footer_left) { y = 0; x = 1; - mvaddstr(d->footer->y + y, d->footer->x + x, d->footer_left); + mvwaddstr(nv_stdscr, d->footer->y + y, d->footer->x + x, + d->footer_left); } if (d->footer_right) { y = 0; x = d->footer->w - strlen(d->footer_right) - 1; - mvaddstr(d->footer->y + y, d->footer->x + x, d->footer_right); + mvwaddstr(nv_stdscr, d->footer->y + y, d->footer->x + x, + d->footer_right); } - attrset(A_NORMAL); + wattrset(nv_stdscr, A_NORMAL); } /* nv_ncurses_set_footer() */ @@ -1163,9 +1180,9 @@ static RegionStruct *nv_ncurses_create_region(DataStruct *d, /* clear the region */ - attrset(region->attr); + wattrset(nv_stdscr, region->attr); nv_ncurses_clear_region(region); - attrset(A_NORMAL); + wattrset(nv_stdscr, A_NORMAL); return region; @@ -1185,7 +1202,7 @@ static void nv_ncurses_clear_region(RegionStruct *region) int i; for (i = region->y; i < (region->y + region->h); i++) { - mvaddstr(i, region->x, region->line); + mvwaddstr(nv_stdscr, i, region->x, region->line); } } /* nv_ncurses_clear_region() */ @@ -1201,7 +1218,7 @@ static void nv_ncurses_destroy_region(RegionStruct *region) { if (!region) return; - attrset(A_NORMAL); + wattrset(nv_stdscr, A_NORMAL); nv_ncurses_clear_region(region); free(region->line); free(region); @@ -1252,15 +1269,15 @@ static void nv_ncurses_draw_button(DataStruct *d, RegionStruct *region, for (j = y; j < (y + h); j++) { for (i = x; i < (x + w); i++) { - mvaddch(region->y + j, region->x + i, ' ' | attr); + mvwaddch(nv_stdscr, region->y + j, region->x + i, ' ' | attr); } } if (hilite) attr |= A_REVERSE; - attron(attr); - mvaddstr(region->y + y + h/2, region->x + x + n, str); - attroff(attr); + wattron(nv_stdscr, attr); + mvwaddstr(nv_stdscr, region->y + y + h/2, region->x + x + n, str); + wattroff(nv_stdscr, attr); } /* nv_ncurses_draw_button() */ @@ -1279,7 +1296,8 @@ static void nv_ncurses_erase_button(RegionStruct *region, for (j = y; j <= (y + h); j++) { for (i = x; i <= (x + w); i++) { - mvaddch(region->y + j, region->x + i, ' ' | region->attr); + mvwaddch(nv_stdscr, region->y + j, region->x + i, + ' ' | region->attr); } } @@ -1366,12 +1384,12 @@ static void nv_ncurses_do_progress_bar_region(DataStruct *d) n = d->message->w - 2; h = d->message->h; - attrset(d->message->attr); + wattrset(nv_stdscr, d->message->attr); /* draw the horizontal separator */ for (i = 1; i <= n; i++) { - mvaddch(d->message->y + h - 4, d->message->x + i, + mvwaddch(nv_stdscr, d->message->y + h - 4, d->message->x + i, NV_NCURSES_HLINE | d->message->attr); } @@ -1383,15 +1401,15 @@ static void nv_ncurses_do_progress_bar_region(DataStruct *d) if (d->use_color) { for (i = 1; i <= n; i++) { - mvaddch(d->message->y + h - 2, d->message->x + i, + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + i, choose_char(i, p, v, ' ') | NV_NCURSES_INPUT_COLOR); } } else { - mvaddch(d->message->y + h - 2, d->message->x + 1, '['); + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + 1, '['); for (i = 2; i < n; i++) - mvaddch(d->message->y + h - 2, d->message->x + i, + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + i, choose_char(i, p, v, '-')); - mvaddch(d->message->y + h - 2, d->message->x + n, ']'); + mvwaddch(nv_stdscr, d->message->y + h - 2, d->message->x + n, ']'); } } /* nv_ncurses_do_progress_bar_region() */ @@ -1411,8 +1429,8 @@ static void nv_ncurses_do_progress_bar_message(DataStruct *d, const char *str, /* clear the message line */ - attrset(d->message->attr); - mvaddstr(d->message->y + y, d->message->x, d->message->line); + wattrset(nv_stdscr, d->message->attr); + mvwaddstr(nv_stdscr, d->message->y + y, d->message->x, d->message->line); /* write the message string */ @@ -1420,7 +1438,7 @@ static void nv_ncurses_do_progress_bar_message(DataStruct *d, const char *str, tmp = malloc(w + 1); strncpy(tmp, str, w); tmp[w] = '\0'; - mvaddstr(d->message->y + y, d->message->x + 1, tmp); + mvwaddstr(nv_stdscr, d->message->y + y, d->message->x + 1, tmp); free(tmp); } @@ -1507,12 +1525,14 @@ static void nv_ncurses_pager_update(DataStruct *d, PagerStruct *p) /* draw the text */ - attrset(p->region->attr); + wattrset(nv_stdscr, p->region->attr); for (i = p->cur; i < maxy; i++) { - mvaddstr(p->region->y + i - p->cur, p->region->x, p->region->line); + mvwaddstr(nv_stdscr, p->region->y + i - p->cur, p->region->x, + p->region->line); if (p->t->t[i]) { - mvaddstr(p->region->y + i - p->cur, p->region->x, p->t->t[i]); + mvwaddstr(nv_stdscr, p->region->y + i - p->cur, p->region->x, + p->t->t[i]); } } @@ -1555,7 +1575,7 @@ static void nv_ncurses_pager_handle_events(DataStruct *d, if (p->cur > 0) { p->cur--; nv_ncurses_pager_update(d, p); - refresh(); + wrefresh(nv_stdscr); } break; @@ -1563,7 +1583,7 @@ static void nv_ncurses_pager_handle_events(DataStruct *d, if (p->cur < n) { p->cur++; nv_ncurses_pager_update(d, p); - refresh(); + wrefresh(nv_stdscr); } break; @@ -1572,7 +1592,7 @@ static void nv_ncurses_pager_handle_events(DataStruct *d, p->cur -= p->page; if (p->cur < 0) p->cur = 0; nv_ncurses_pager_update(d, p); - refresh(); + wrefresh(nv_stdscr); } break; @@ -1581,7 +1601,7 @@ static void nv_ncurses_pager_handle_events(DataStruct *d, p->cur += p->page; if (p->cur > n) p->cur = n; nv_ncurses_pager_update(d, p); - refresh(); + wrefresh(nv_stdscr); } break; } @@ -1684,7 +1704,7 @@ static int nv_ncurses_paged_prompt(Options *op, const char *question, pager_title, cur); } - refresh(); + wrefresh(nv_stdscr); /* process key strokes */ @@ -1697,7 +1717,7 @@ static int nv_ncurses_paged_prompt(Options *op, const char *question, goto print_message; } - ch = getch(); + ch = wgetch(nv_stdscr); switch (ch) { case NV_NCURSES_TAB: @@ -1705,14 +1725,14 @@ static int nv_ncurses_paged_prompt(Options *op, const char *question, button = (button + 1) % num_buttons; draw_buttons(d, buttons, num_buttons, button, button_w, buttons_x, button_y); - refresh(); + wrefresh(nv_stdscr); break; case KEY_LEFT: button = (button + num_buttons - 1) % num_buttons; draw_buttons(d, buttons, num_buttons, button, button_w, buttons_x, button_y); - refresh(); + wrefresh(nv_stdscr); break; case NV_NCURSES_CTRL('L'): @@ -1738,14 +1758,14 @@ static int nv_ncurses_paged_prompt(Options *op, const char *question, button_w, 1); nv_ncurses_draw_button(d, d->message, buttons_x[button], button_y, button_w, 1, buttons[button], TRUE, TRUE); - refresh(); + wrefresh(nv_stdscr); usleep(NV_NCURSES_BUTTON_PRESS_TIME); nv_ncurses_erase_button(d->message, buttons_x[button], button_y, button_w, 1); nv_ncurses_draw_button(d, d->message, buttons_x[button], button_y, button_w, 1, buttons[button], TRUE, FALSE); - refresh(); + wrefresh(nv_stdscr); usleep(NV_NCURSES_BUTTON_PRESS_TIME); /* restore the footer */ @@ -1764,7 +1784,7 @@ static int nv_ncurses_paged_prompt(Options *op, const char *question, nv_ncurses_destroy_region(d->message); d->message = NULL; - refresh(); + wrefresh(nv_stdscr); return button; } @@ -1978,13 +1998,13 @@ static int nv_ncurses_format_print(DataStruct *d, RegionStruct *region, n = NV_MIN(t->n, h); - attrset(region->attr); + wattrset(nv_stdscr, region->attr); for (i = 0; i < n; i++) { - mvaddstr(region->y + y + i, region->x + x, t->t[i]); + mvwaddstr(nv_stdscr, region->y + y + i, region->x + x, t->t[i]); } - attrset(A_NORMAL); + wattrset(nv_stdscr, A_NORMAL); return n; } /* nv_ncurses_format_printw() */ @@ -2006,7 +2026,7 @@ static int nv_ncurses_check_resize(DataStruct *d, bool force) { int x, y; - getmaxyx(stdscr, y, x); + getmaxyx(nv_stdscr, y, x); if (!force) { if ((x == d->width) && (y == d->height)) { @@ -2022,7 +2042,7 @@ static int nv_ncurses_check_resize(DataStruct *d, bool force) nv_ncurses_destroy_region(d->header); nv_ncurses_destroy_region(d->footer); - clear(); + wclear(nv_stdscr); /* update our cached copy of the dimensions */ diff --git a/user-interface.c b/user-interface.c index 0bd0540..50e9b17 100644 --- a/user-interface.c +++ b/user-interface.c @@ -63,6 +63,10 @@ extern const int ncurses_ui_array_size; extern const char ncurses6_ui_array[]; extern const int ncurses6_ui_array_size; #endif +#if defined(NV_INSTALLER_NCURSESW6) +extern const char ncursesw6_ui_array[]; +extern const int ncursesw6_ui_array_size; +#endif /* struct describing the ui data */ @@ -108,6 +112,10 @@ int ui_init(Options *op) #endif { "ncurses", "nvidia-installer ncurses user interface", NULL, ncurses_ui_array, ncurses_ui_array_size }, +#if defined(NV_INSTALLER_NCURSESW6) + { "ncursesw6", "nvidia-installer ncurses v6 user interface (widechar)", + NULL, ncursesw6_ui_array, ncursesw6_ui_array_size }, +#endif { "none", NULL, NULL, NULL, 0 } }; @@ -1 +1 @@ -NVIDIA_VERSION = 340.107 +NVIDIA_VERSION = 340.108 |