diff options
author | Ladislav Michl <ladis@linux-mips.org> | 2007-12-17 13:07:41 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2008-01-28 17:14:37 -0500 |
commit | 09af091f50409a60a72086c737b9a6224dde5ab8 (patch) | |
tree | 5a022543e70fffee0807d38076555f824d0549e6 /scripts/kconfig/lxdialog | |
parent | 0486bc9098f4556a0aa90d57f717d08164b7647e (diff) |
kconfig: make kconfig MinGW friendly
Kconfig is powerfull tool. So powerfull that more and more software
projects are using it for configuration. So instead of fixing some of
them one by one, lets fix it in kernel and wait for sync.
This work was originaly done for PTXdist - GPL licensed build system for
userlands and cross-compilers, but it will not hurt kernel kconfig
either. PTXdist menuconfig now works on Windows linked with PDCurses and
compiled using MinGW - there is no termios and signals.
* Do not include <sys/wait.h> and <signal.h> (comes from times when
lxdialog was separate process)
* Do not mess with termios directly and let curses tell screen size.
Comment to commit c8dc68ad0fbd934e78e913b8a8d7b45945db4930 says
check for screen size could be removed later, but because it didn't
happen for more than year I left it here as well.
* Save cursor position added by Sam
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Diffstat (limited to 'scripts/kconfig/lxdialog')
-rw-r--r-- | scripts/kconfig/lxdialog/dialog.h | 5 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/util.c | 32 |
2 files changed, 23 insertions, 14 deletions
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index 7e17eba75ae..c4ad37fd922 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h | |||
@@ -187,10 +187,9 @@ int item_is_tag(char tag); | |||
187 | int on_key_esc(WINDOW *win); | 187 | int on_key_esc(WINDOW *win); |
188 | int on_key_resize(void); | 188 | int on_key_resize(void); |
189 | 189 | ||
190 | void init_dialog(const char *backtitle); | 190 | int init_dialog(const char *backtitle); |
191 | void set_dialog_backtitle(const char *backtitle); | 191 | void set_dialog_backtitle(const char *backtitle); |
192 | void reset_dialog(void); | 192 | void end_dialog(int x, int y); |
193 | void end_dialog(void); | ||
194 | void attr_clear(WINDOW * win, int height, int width, chtype attr); | 193 | void attr_clear(WINDOW * win, int height, int width, chtype attr); |
195 | void dialog_clear(void); | 194 | void dialog_clear(void); |
196 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); | 195 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); |
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index a1bddefe73d..86d95cca46a 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c | |||
@@ -266,31 +266,41 @@ void dialog_clear(void) | |||
266 | /* | 266 | /* |
267 | * Do some initialization for dialog | 267 | * Do some initialization for dialog |
268 | */ | 268 | */ |
269 | void init_dialog(const char *backtitle) | 269 | int init_dialog(const char *backtitle) |
270 | { | 270 | { |
271 | dlg.backtitle = backtitle; | 271 | int height, width; |
272 | color_setup(getenv("MENUCONFIG_COLOR")); | 272 | |
273 | } | 273 | initscr(); /* Init curses */ |
274 | getmaxyx(stdscr, height, width); | ||
275 | if (height < 19 || width < 80) { | ||
276 | endwin(); | ||
277 | return -ERRDISPLAYTOOSMALL; | ||
278 | } | ||
274 | 279 | ||
275 | void set_dialog_backtitle(const char *backtitle) | ||
276 | { | ||
277 | dlg.backtitle = backtitle; | 280 | dlg.backtitle = backtitle; |
278 | } | 281 | color_setup(getenv("MENUCONFIG_COLOR")); |
279 | 282 | ||
280 | void reset_dialog(void) | ||
281 | { | ||
282 | initscr(); /* Init curses */ | ||
283 | keypad(stdscr, TRUE); | 283 | keypad(stdscr, TRUE); |
284 | cbreak(); | 284 | cbreak(); |
285 | noecho(); | 285 | noecho(); |
286 | dialog_clear(); | 286 | dialog_clear(); |
287 | |||
288 | return 0; | ||
289 | } | ||
290 | |||
291 | void set_dialog_backtitle(const char *backtitle) | ||
292 | { | ||
293 | dlg.backtitle = backtitle; | ||
287 | } | 294 | } |
288 | 295 | ||
289 | /* | 296 | /* |
290 | * End using dialog functions. | 297 | * End using dialog functions. |
291 | */ | 298 | */ |
292 | void end_dialog(void) | 299 | void end_dialog(int x, int y) |
293 | { | 300 | { |
301 | /* move cursor back to original position */ | ||
302 | move(y, x); | ||
303 | refresh(); | ||
294 | endwin(); | 304 | endwin(); |
295 | } | 305 | } |
296 | 306 | ||