]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - scripts/kconfig/lxdialog/checklist.c
Merge branches 'release' and 'gpe-ack' into release
[karo-tx-linux.git] / scripts / kconfig / lxdialog / checklist.c
index 282511020bcb64b9de9f5bf9d100acfce8065fa0..b2a878c936d63c793bca031b9b5d52f62b9e2e19 100644 (file)
@@ -97,8 +97,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
        int x = width / 2 - 11;
        int y = height - 2;
 
-       print_button(dialog, "Select", y, x, selected == 0);
-       print_button(dialog, " Help ", y, x + 14, selected == 1);
+       print_button(dialog, gettext("Select"), y, x, selected == 0);
+       print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
 
        wmove(dialog, y, x + 1 + 14 * selected);
        wrefresh(dialog);
@@ -125,6 +125,12 @@ int dialog_checklist(const char *title, const char *prompt, int height,
                }
        }
 
+do_resize:
+       if (getmaxy(stdscr) < (height + 6))
+               return -ERRDISPLAYTOOSMALL;
+       if (getmaxx(stdscr) < (width + 6))
+               return -ERRDISPLAYTOOSMALL;
+
        max_choice = MIN(list_height, item_count());
 
        /* center dialog box on screen */
@@ -192,7 +198,7 @@ int dialog_checklist(const char *title, const char *prompt, int height,
        wnoutrefresh(list);
        doupdate();
 
-       while (key != ESC) {
+       while (key != KEY_ESC) {
                key = wgetch(dialog);
 
                for (i = 0; i < max_choice; i++) {
@@ -298,9 +304,16 @@ int dialog_checklist(const char *title, const char *prompt, int height,
                        break;
                case 'X':
                case 'x':
-                       key = ESC;
-               case ESC:
+                       key = KEY_ESC;
+                       break;
+               case KEY_ESC:
+                       key = on_key_esc(dialog);
                        break;
+               case KEY_RESIZE:
+                       delwin(list);
+                       delwin(dialog);
+                       on_key_resize();
+                       goto do_resize;
                }
 
                /* Now, update everything... */
@@ -308,5 +321,5 @@ int dialog_checklist(const char *title, const char *prompt, int height,
        }
        delwin(list);
        delwin(dialog);
-       return 255;             /* ESC pressed */
+       return key;             /* ESC pressed */
 }