1.1 --- a/kconfig/lxdialog/util.c Sat Feb 24 11:00:05 2007 +0000
1.2 +++ b/kconfig/lxdialog/util.c Mon Oct 27 17:03:01 2008 +0000
1.3 @@ -221,16 +221,14 @@
1.4 */
1.5 static void color_setup(const char *theme)
1.6 {
1.7 - if (set_theme(theme)) {
1.8 - if (has_colors()) { /* Terminal supports color? */
1.9 - start_color();
1.10 - init_dialog_colors();
1.11 - }
1.12 - }
1.13 - else
1.14 - {
1.15 + int use_color;
1.16 +
1.17 + use_color = set_theme(theme);
1.18 + if (use_color && has_colors()) {
1.19 + start_color();
1.20 + init_dialog_colors();
1.21 + } else
1.22 set_mono_theme();
1.23 - }
1.24 }
1.25
1.26 /*
1.27 @@ -268,26 +266,41 @@
1.28 /*
1.29 * Do some initialization for dialog
1.30 */
1.31 -void init_dialog(const char *backtitle)
1.32 +int init_dialog(const char *backtitle)
1.33 {
1.34 + int height, width;
1.35 +
1.36 + initscr(); /* Init curses */
1.37 + getmaxyx(stdscr, height, width);
1.38 + if (height < 19 || width < 80) {
1.39 + endwin();
1.40 + return -ERRDISPLAYTOOSMALL;
1.41 + }
1.42 +
1.43 dlg.backtitle = backtitle;
1.44 color_setup(getenv("MENUCONFIG_COLOR"));
1.45 -}
1.46
1.47 -void reset_dialog(void)
1.48 -{
1.49 - initscr(); /* Init curses */
1.50 keypad(stdscr, TRUE);
1.51 cbreak();
1.52 noecho();
1.53 dialog_clear();
1.54 +
1.55 + return 0;
1.56 +}
1.57 +
1.58 +void set_dialog_backtitle(const char *backtitle)
1.59 +{
1.60 + dlg.backtitle = backtitle;
1.61 }
1.62
1.63 /*
1.64 * End using dialog functions.
1.65 */
1.66 -void end_dialog(void)
1.67 +void end_dialog(int x, int y)
1.68 {
1.69 + /* move cursor back to original position */
1.70 + move(y, x);
1.71 + refresh();
1.72 endwin();
1.73 }
1.74
1.75 @@ -338,7 +351,7 @@
1.76 newl = 1;
1.77 word = tempstr;
1.78 while (word && *word) {
1.79 - sp = index(word, ' ');
1.80 + sp = strchr(word, ' ');
1.81 if (sp)
1.82 *sp++ = 0;
1.83
1.84 @@ -350,7 +363,7 @@
1.85 if (wlen > room ||
1.86 (newl && wlen < 4 && sp
1.87 && wlen + 1 + strlen(sp) > room
1.88 - && (!(sp2 = index(sp, ' '))
1.89 + && (!(sp2 = strchr(sp, ' '))
1.90 || wlen + 1 + (sp2 - sp) > room))) {
1.91 cur_y++;
1.92 cur_x = x;