aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-07-29 16:48:57 -0400
committerSam Ravnborg <sam@neptun.ravnborg.org>2006-09-30 05:19:20 -0400
commitc8dc68ad0fbd934e78e913b8a8d7b45945db4930 (patch)
tree62169927ce5ca83e3f280e6bbe06053989462968 /scripts/kconfig
parentf3cbcdc955d0d2c8b4c52d6b73fc536b01b68c64 (diff)
kconfig/lxdialog: support resize
In all dialogs now properly catch KEY_RESIZE and take proper action. In mconf try to behave sensibly when a dialog routine returns -ERRDISPLAYTOOSMALL. The original check for a screnn size of 80x19 is kept for now. It may make sense to remove it later, but thats anyway what much text is adjusted for. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/lxdialog/checklist.c11
-rw-r--r--scripts/kconfig/lxdialog/dialog.h8
-rw-r--r--scripts/kconfig/lxdialog/inputbox.c20
-rw-r--r--scripts/kconfig/lxdialog/menubox.c25
-rw-r--r--scripts/kconfig/lxdialog/textbox.c140
-rw-r--r--scripts/kconfig/lxdialog/util.c6
-rw-r--r--scripts/kconfig/lxdialog/yesno.c10
-rw-r--r--scripts/kconfig/mconf.c12
8 files changed, 161 insertions, 71 deletions
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index 39becb72444a..cf697080dddd 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -125,6 +125,12 @@ int dialog_checklist(const char *title, const char *prompt, int height,
125 } 125 }
126 } 126 }
127 127
128do_resize:
129 if (getmaxy(stdscr) < (height + 6))
130 return -ERRDISPLAYTOOSMALL;
131 if (getmaxx(stdscr) < (width + 6))
132 return -ERRDISPLAYTOOSMALL;
133
128 max_choice = MIN(list_height, item_count()); 134 max_choice = MIN(list_height, item_count());
129 135
130 /* center dialog box on screen */ 136 /* center dialog box on screen */
@@ -303,6 +309,11 @@ int dialog_checklist(const char *title, const char *prompt, int height,
303 case KEY_ESC: 309 case KEY_ESC:
304 key = on_key_esc(dialog); 310 key = on_key_esc(dialog);
305 break; 311 break;
312 case KEY_RESIZE:
313 delwin(list);
314 delwin(dialog);
315 on_key_resize();
316 goto do_resize;
306 } 317 }
307 318
308 /* Now, update everything... */ 319 /* Now, update everything... */
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index a7cfdecc2409..8dea47f9d3e4 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -86,6 +86,9 @@
86#define ACS_DARROW 'v' 86#define ACS_DARROW 'v'
87#endif 87#endif
88 88
89/* error return codes */
90#define ERRDISPLAYTOOSMALL (KEY_MAX + 1)
91
89/* 92/*
90 * Color definitions 93 * Color definitions
91 */ 94 */
@@ -181,6 +184,7 @@ int item_is_tag(char tag);
181 184
182/* generic key handlers */ 185/* generic key handlers */
183int on_key_esc(WINDOW *win); 186int on_key_esc(WINDOW *win);
187int on_key_resize(void);
184 188
185void init_dialog(const char *backtitle); 189void init_dialog(const char *backtitle);
186void reset_dialog(void); 190void reset_dialog(void);
@@ -199,8 +203,8 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width);
199int dialog_msgbox(const char *title, const char *prompt, int height, 203int dialog_msgbox(const char *title, const char *prompt, int height,
200 int width, int pause); 204 int width, int pause);
201int dialog_textbox(const char *title, const char *file, int height, int width); 205int dialog_textbox(const char *title, const char *file, int height, int width);
202int dialog_menu(const char *title, const char *prompt, int height, int width, 206int dialog_menu(const char *title, const char *prompt,
203 int menu_height, const void *selected, int *s_scroll); 207 const void *selected, int *s_scroll);
204int dialog_checklist(const char *title, const char *prompt, int height, 208int dialog_checklist(const char *title, const char *prompt, int height,
205 int width, int list_height); 209 int width, int list_height);
206extern char dialog_input_result[]; 210extern char dialog_input_result[];
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index edb7975dbaa2..05e72066b359 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -49,6 +49,17 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
49 char *instr = dialog_input_result; 49 char *instr = dialog_input_result;
50 WINDOW *dialog; 50 WINDOW *dialog;
51 51
52 if (!init)
53 instr[0] = '\0';
54 else
55 strcpy(instr, init);
56
57do_resize:
58 if (getmaxy(stdscr) <= (height - 2))
59 return -ERRDISPLAYTOOSMALL;
60 if (getmaxx(stdscr) <= (width - 2))
61 return -ERRDISPLAYTOOSMALL;
62
52 /* center dialog box on screen */ 63 /* center dialog box on screen */
53 x = (COLS - width) / 2; 64 x = (COLS - width) / 2;
54 y = (LINES - height) / 2; 65 y = (LINES - height) / 2;
@@ -86,11 +97,6 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
86 wmove(dialog, box_y, box_x); 97 wmove(dialog, box_y, box_x);
87 wattrset(dialog, dlg.inputbox.atr); 98 wattrset(dialog, dlg.inputbox.atr);
88 99
89 if (!init)
90 instr[0] = '\0';
91 else
92 strcpy(instr, init);
93
94 input_x = strlen(instr); 100 input_x = strlen(instr);
95 101
96 if (input_x >= box_width) { 102 if (input_x >= box_width) {
@@ -220,6 +226,10 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
220 case KEY_ESC: 226 case KEY_ESC:
221 key = on_key_esc(dialog); 227 key = on_key_esc(dialog);
222 break; 228 break;
229 case KEY_RESIZE:
230 delwin(dialog);
231 on_key_resize();
232 goto do_resize;
223 } 233 }
224 } 234 }
225 235
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index d3305bad15c7..fcd95a985328 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -179,14 +179,25 @@ static void do_scroll(WINDOW *win, int *scroll, int n)
179/* 179/*
180 * Display a menu for choosing among a number of options 180 * Display a menu for choosing among a number of options
181 */ 181 */
182int dialog_menu(const char *title, const char *prompt, int height, int width, 182int dialog_menu(const char *title, const char *prompt,
183 int menu_height, const void *selected, int *s_scroll) 183 const void *selected, int *s_scroll)
184{ 184{
185 int i, j, x, y, box_x, box_y; 185 int i, j, x, y, box_x, box_y;
186 int height, width, menu_height;
186 int key = 0, button = 0, scroll = 0, choice = 0; 187 int key = 0, button = 0, scroll = 0, choice = 0;
187 int first_item = 0, max_choice; 188 int first_item = 0, max_choice;
188 WINDOW *dialog, *menu; 189 WINDOW *dialog, *menu;
189 190
191do_resize:
192 height = getmaxy(stdscr);
193 width = getmaxx(stdscr);
194 if (height < 15 || width < 65)
195 return -ERRDISPLAYTOOSMALL;
196
197 height -= 4;
198 width -= 5;
199 menu_height = height - 10;
200
190 max_choice = MIN(menu_height, item_count()); 201 max_choice = MIN(menu_height, item_count());
191 202
192 /* center dialog box on screen */ 203 /* center dialog box on screen */
@@ -226,7 +237,10 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
226 draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2, 237 draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
227 dlg.menubox_border.atr, dlg.menubox.atr); 238 dlg.menubox_border.atr, dlg.menubox.atr);
228 239
229 item_x = (menu_width - 70) / 2; 240 if (menu_width >= 80)
241 item_x = (menu_width - 70) / 2;
242 else
243 item_x = 4;
230 244
231 /* Set choice to default item */ 245 /* Set choice to default item */
232 item_foreach() 246 item_foreach()
@@ -407,6 +421,11 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
407 case KEY_ESC: 421 case KEY_ESC:
408 key = on_key_esc(menu); 422 key = on_key_esc(menu);
409 break; 423 break;
424 case KEY_RESIZE:
425 on_key_resize();
426 delwin(menu);
427 delwin(dialog);
428 goto do_resize;
410 } 429 }
411 } 430 }
412 delwin(menu); 431 delwin(menu);
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index a99e1f497d67..fabfc1ad789d 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -25,7 +25,7 @@ static void back_lines(int n);
25static void print_page(WINDOW * win, int height, int width); 25static void print_page(WINDOW * win, int height, int width);
26static void print_line(WINDOW * win, int row, int width); 26static void print_line(WINDOW * win, int row, int width);
27static char *get_line(void); 27static char *get_line(void);
28static void print_position(WINDOW * win, int height, int width); 28static void print_position(WINDOW * win);
29 29
30static int hscroll; 30static int hscroll;
31static int begin_reached, end_reached, page_length; 31static int begin_reached, end_reached, page_length;
@@ -33,14 +33,28 @@ static const char *buf;
33static const char *page; 33static const char *page;
34 34
35/* 35/*
36 * refresh window content
37 */
38static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw,
39 int cur_y, int cur_x)
40{
41 print_page(box, boxh, boxw);
42 print_position(dialog);
43 wmove(dialog, cur_y, cur_x); /* Restore cursor position */
44 wrefresh(dialog);
45}
46
47
48/*
36 * Display text from a file in a dialog box. 49 * Display text from a file in a dialog box.
37 */ 50 */
38int dialog_textbox(const char *title, const char *tbuf, int height, int width) 51int dialog_textbox(const char *title, const char *tbuf,
52 int initial_height, int initial_width)
39{ 53{
40 int i, x, y, cur_x, cur_y, key = 0; 54 int i, x, y, cur_x, cur_y, key = 0;
41 int texth, textw; 55 int height, width, boxh, boxw;
42 int passed_end; 56 int passed_end;
43 WINDOW *dialog, *text; 57 WINDOW *dialog, *box;
44 58
45 begin_reached = 1; 59 begin_reached = 1;
46 end_reached = 0; 60 end_reached = 0;
@@ -49,6 +63,25 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
49 buf = tbuf; 63 buf = tbuf;
50 page = buf; /* page is pointer to start of page to be displayed */ 64 page = buf; /* page is pointer to start of page to be displayed */
51 65
66do_resize:
67 getmaxyx(stdscr, height, width);
68 if (height < 8 || width < 8)
69 return -ERRDISPLAYTOOSMALL;
70 if (initial_height != 0)
71 height = initial_height;
72 else
73 if (height > 4)
74 height -= 4;
75 else
76 height = 0;
77 if (initial_width != 0)
78 width = initial_width;
79 else
80 if (width > 5)
81 width -= 5;
82 else
83 width = 0;
84
52 /* center dialog box on screen */ 85 /* center dialog box on screen */
53 x = (COLS - width) / 2; 86 x = (COLS - width) / 2;
54 y = (LINES - height) / 2; 87 y = (LINES - height) / 2;
@@ -58,14 +91,14 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
58 dialog = newwin(height, width, y, x); 91 dialog = newwin(height, width, y, x);
59 keypad(dialog, TRUE); 92 keypad(dialog, TRUE);
60 93
61 /* Create window for text region, used for scrolling text */ 94 /* Create window for box region, used for scrolling text */
62 texth = height - 4; 95 boxh = height - 4;
63 textw = width - 2; 96 boxw = width - 2;
64 text = subwin(dialog, texth, textw, y + 1, x + 1); 97 box = subwin(dialog, boxh, boxw, y + 1, x + 1);
65 wattrset(text, dlg.dialog.atr); 98 wattrset(box, dlg.dialog.atr);
66 wbkgdset(text, dlg.dialog.atr & A_COLOR); 99 wbkgdset(box, dlg.dialog.atr & A_COLOR);
67 100
68 keypad(text, TRUE); 101 keypad(box, TRUE);
69 102
70 /* register the new window, along with its borders */ 103 /* register the new window, along with its borders */
71 draw_box(dialog, 0, 0, height, width, 104 draw_box(dialog, 0, 0, height, width,
@@ -86,11 +119,8 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
86 getyx(dialog, cur_y, cur_x); /* Save cursor position */ 119 getyx(dialog, cur_y, cur_x); /* Save cursor position */
87 120
88 /* Print first page of text */ 121 /* Print first page of text */
89 attr_clear(text, texth, textw, dlg.dialog.atr); 122 attr_clear(box, boxh, boxw, dlg.dialog.atr);
90 print_page(text, texth, textw); 123 refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x);
91 print_position(dialog, height, width);
92 wmove(dialog, cur_y, cur_x); /* Restore cursor position */
93 wrefresh(dialog);
94 124
95 while ((key != KEY_ESC) && (key != '\n')) { 125 while ((key != KEY_ESC) && (key != '\n')) {
96 key = wgetch(dialog); 126 key = wgetch(dialog);
@@ -99,7 +129,7 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
99 case 'e': 129 case 'e':
100 case 'X': 130 case 'X':
101 case 'x': 131 case 'x':
102 delwin(text); 132 delwin(box);
103 delwin(dialog); 133 delwin(dialog);
104 return 0; 134 return 0;
105 case 'g': /* First page */ 135 case 'g': /* First page */
@@ -107,10 +137,8 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
107 if (!begin_reached) { 137 if (!begin_reached) {
108 begin_reached = 1; 138 begin_reached = 1;
109 page = buf; 139 page = buf;
110 print_page(text, texth, textw); 140 refresh_text_box(dialog, box, boxh, boxw,
111 print_position(dialog, height, width); 141 cur_y, cur_x);
112 wmove(dialog, cur_y, cur_x); /* Restore cursor position */
113 wrefresh(dialog);
114 } 142 }
115 break; 143 break;
116 case 'G': /* Last page */ 144 case 'G': /* Last page */
@@ -119,11 +147,9 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
119 end_reached = 1; 147 end_reached = 1;
120 /* point to last char in buf */ 148 /* point to last char in buf */
121 page = buf + strlen(buf); 149 page = buf + strlen(buf);
122 back_lines(texth); 150 back_lines(boxh);
123 print_page(text, texth, textw); 151 refresh_text_box(dialog, box, boxh, boxw,
124 print_position(dialog, height, width); 152 cur_y, cur_x);
125 wmove(dialog, cur_y, cur_x); /* Restore cursor position */
126 wrefresh(dialog);
127 break; 153 break;
128 case 'K': /* Previous line */ 154 case 'K': /* Previous line */
129 case 'k': 155 case 'k':
@@ -138,16 +164,16 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
138 * point to start of next page. This is done 164 * point to start of next page. This is done
139 * by calling get_line() in the following 165 * by calling get_line() in the following
140 * 'for' loop. */ 166 * 'for' loop. */
141 scrollok(text, TRUE); 167 scrollok(box, TRUE);
142 wscrl(text, -1); /* Scroll text region down one line */ 168 wscrl(box, -1); /* Scroll box region down one line */
143 scrollok(text, FALSE); 169 scrollok(box, FALSE);
144 page_length = 0; 170 page_length = 0;
145 passed_end = 0; 171 passed_end = 0;
146 for (i = 0; i < texth; i++) { 172 for (i = 0; i < boxh; i++) {
147 if (!i) { 173 if (!i) {
148 /* print first line of page */ 174 /* print first line of page */
149 print_line(text, 0, textw); 175 print_line(box, 0, boxw);
150 wnoutrefresh(text); 176 wnoutrefresh(box);
151 } else 177 } else
152 /* Called to update 'end_reached' and 'page' */ 178 /* Called to update 'end_reached' and 'page' */
153 get_line(); 179 get_line();
@@ -157,7 +183,7 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
157 passed_end = 1; 183 passed_end = 1;
158 } 184 }
159 185
160 print_position(dialog, height, width); 186 print_position(dialog);
161 wmove(dialog, cur_y, cur_x); /* Restore cursor position */ 187 wmove(dialog, cur_y, cur_x); /* Restore cursor position */
162 wrefresh(dialog); 188 wrefresh(dialog);
163 } 189 }
@@ -167,23 +193,21 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
167 case KEY_PPAGE: 193 case KEY_PPAGE:
168 if (begin_reached) 194 if (begin_reached)
169 break; 195 break;
170 back_lines(page_length + texth); 196 back_lines(page_length + boxh);
171 print_page(text, texth, textw); 197 refresh_text_box(dialog, box, boxh, boxw,
172 print_position(dialog, height, width); 198 cur_y, cur_x);
173 wmove(dialog, cur_y, cur_x);
174 wrefresh(dialog);
175 break; 199 break;
176 case 'J': /* Next line */ 200 case 'J': /* Next line */
177 case 'j': 201 case 'j':
178 case KEY_DOWN: 202 case KEY_DOWN:
179 if (!end_reached) { 203 if (!end_reached) {
180 begin_reached = 0; 204 begin_reached = 0;
181 scrollok(text, TRUE); 205 scrollok(box, TRUE);
182 scroll(text); /* Scroll text region up one line */ 206 scroll(box); /* Scroll box region up one line */
183 scrollok(text, FALSE); 207 scrollok(box, FALSE);
184 print_line(text, texth - 1, textw); 208 print_line(box, boxh - 1, boxw);
185 wnoutrefresh(text); 209 wnoutrefresh(box);
186 print_position(dialog, height, width); 210 print_position(dialog);
187 wmove(dialog, cur_y, cur_x); /* Restore cursor position */ 211 wmove(dialog, cur_y, cur_x); /* Restore cursor position */
188 wrefresh(dialog); 212 wrefresh(dialog);
189 } 213 }
@@ -194,10 +218,8 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
194 break; 218 break;
195 219
196 begin_reached = 0; 220 begin_reached = 0;
197 print_page(text, texth, textw); 221 refresh_text_box(dialog, box, boxh, boxw,
198 print_position(dialog, height, width); 222 cur_y, cur_x);
199 wmove(dialog, cur_y, cur_x);
200 wrefresh(dialog);
201 break; 223 break;
202 case '0': /* Beginning of line */ 224 case '0': /* Beginning of line */
203 case 'H': /* Scroll left */ 225 case 'H': /* Scroll left */
@@ -212,9 +234,8 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
212 hscroll--; 234 hscroll--;
213 /* Reprint current page to scroll horizontally */ 235 /* Reprint current page to scroll horizontally */
214 back_lines(page_length); 236 back_lines(page_length);
215 print_page(text, texth, textw); 237 refresh_text_box(dialog, box, boxh, boxw,
216 wmove(dialog, cur_y, cur_x); 238 cur_y, cur_x);
217 wrefresh(dialog);
218 break; 239 break;
219 case 'L': /* Scroll right */ 240 case 'L': /* Scroll right */
220 case 'l': 241 case 'l':
@@ -224,16 +245,21 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
224 hscroll++; 245 hscroll++;
225 /* Reprint current page to scroll horizontally */ 246 /* Reprint current page to scroll horizontally */
226 back_lines(page_length); 247 back_lines(page_length);
227 print_page(text, texth, textw); 248 refresh_text_box(dialog, box, boxh, boxw,
228 wmove(dialog, cur_y, cur_x); 249 cur_y, cur_x);
229 wrefresh(dialog);
230 break; 250 break;
231 case KEY_ESC: 251 case KEY_ESC:
232 key = on_key_esc(dialog); 252 key = on_key_esc(dialog);
233 break; 253 break;
254 case KEY_RESIZE:
255 back_lines(height);
256 delwin(box);
257 delwin(dialog);
258 on_key_resize();
259 goto do_resize;
234 } 260 }
235 } 261 }
236 delwin(text); 262 delwin(box);
237 delwin(dialog); 263 delwin(dialog);
238 return key; /* ESC pressed */ 264 return key; /* ESC pressed */
239} 265}
@@ -353,13 +379,13 @@ static char *get_line(void)
353/* 379/*
354 * Print current position 380 * Print current position
355 */ 381 */
356static void print_position(WINDOW * win, int height, int width) 382static void print_position(WINDOW * win)
357{ 383{
358 int percent; 384 int percent;
359 385
360 wattrset(win, dlg.position_indicator.atr); 386 wattrset(win, dlg.position_indicator.atr);
361 wbkgdset(win, dlg.position_indicator.atr & A_COLOR); 387 wbkgdset(win, dlg.position_indicator.atr & A_COLOR);
362 percent = (page - buf) * 100 / strlen(buf); 388 percent = (page - buf) * 100 / strlen(buf);
363 wmove(win, height - 3, width - 9); 389 wmove(win, getmaxy(win) - 3, getmaxx(win) - 9);
364 wprintw(win, "(%3d%%)", percent); 390 wprintw(win, "(%3d%%)", percent);
365} 391}
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index cb21dc4dd9fc..ebc781b493d7 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -509,6 +509,12 @@ int on_key_esc(WINDOW *win)
509 return -1; 509 return -1;
510} 510}
511 511
512/* redraw screen in new size */
513int on_key_resize(void)
514{
515 dialog_clear();
516 return KEY_RESIZE;
517}
512 518
513struct dialog_list *item_cur; 519struct dialog_list *item_cur;
514struct dialog_list item_nil; 520struct dialog_list item_nil;
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c
index 8364f9dd01c3..ee0a04e3e012 100644
--- a/scripts/kconfig/lxdialog/yesno.c
+++ b/scripts/kconfig/lxdialog/yesno.c
@@ -44,6 +44,12 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width)
44 int i, x, y, key = 0, button = 0; 44 int i, x, y, key = 0, button = 0;
45 WINDOW *dialog; 45 WINDOW *dialog;
46 46
47do_resize:
48 if (getmaxy(stdscr) < (height + 4))
49 return -ERRDISPLAYTOOSMALL;
50 if (getmaxx(stdscr) < (width + 4))
51 return -ERRDISPLAYTOOSMALL;
52
47 /* center dialog box on screen */ 53 /* center dialog box on screen */
48 x = (COLS - width) / 2; 54 x = (COLS - width) / 2;
49 y = (LINES - height) / 2; 55 y = (LINES - height) / 2;
@@ -96,6 +102,10 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width)
96 case KEY_ESC: 102 case KEY_ESC:
97 key = on_key_esc(dialog); 103 key = on_key_esc(dialog);
98 break; 104 break;
105 case KEY_RESIZE:
106 delwin(dialog);
107 on_key_resize();
108 goto do_resize;
99 } 109 }
100 } 110 }
101 111
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index ef75d6c3d3e5..f7abca434829 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -606,9 +606,8 @@ static void conf(struct menu *menu)
606 reset_dialog(); 606 reset_dialog();
607 res = dialog_menu(prompt ? prompt : _("Main Menu"), 607 res = dialog_menu(prompt ? prompt : _("Main Menu"),
608 _(menu_instructions), 608 _(menu_instructions),
609 rows, cols, rows - 10,
610 active_menu, &s_scroll); 609 active_menu, &s_scroll);
611 if (res == 1 || res == KEY_ESC) 610 if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
612 break; 611 break;
613 if (!item_activate_selected()) 612 if (!item_activate_selected())
614 continue; 613 continue;
@@ -617,7 +616,10 @@ static void conf(struct menu *menu)
617 616
618 submenu = item_data(); 617 submenu = item_data();
619 active_menu = item_data(); 618 active_menu = item_data();
620 sym = submenu->sym; 619 if (submenu)
620 sym = submenu->sym;
621 else
622 sym = NULL;
621 623
622 switch (res) { 624 switch (res) {
623 case 0: 625 case 0:
@@ -683,7 +685,7 @@ static void conf(struct menu *menu)
683static void show_textbox(const char *title, const char *text, int r, int c) 685static void show_textbox(const char *title, const char *text, int r, int c)
684{ 686{
685 reset_dialog(); 687 reset_dialog();
686 dialog_textbox(title, text, r ? r : rows, c ? c : cols); 688 dialog_textbox(title, text, r, c);
687} 689}
688 690
689static void show_helptext(const char *title, const char *text) 691static void show_helptext(const char *title, const char *text)
@@ -756,6 +758,8 @@ static void conf_choice(struct menu *menu)
756 break; 758 break;
757 case KEY_ESC: 759 case KEY_ESC:
758 return; 760 return;
761 case -ERRDISPLAYTOOSMALL:
762 return;
759 } 763 }
760 } 764 }
761} 765}