Skip to content

Commit

Permalink
kconfig/mconf.c: revision of curses initialization.
Browse files Browse the repository at this point in the history
Since commit d0e1e09 initscr() is called twice in mconf.

Do it only in init_dialog() in util.c and there also save the
cursor position for the signal handler in mconf.c.

Signed-off-by: Dirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>
Signed-off-by: Michal Marek <mmarek@suse.cz>
  • Loading branch information
Dirk Gouders authored and Michal Marek committed Aug 30, 2012
1 parent 0d7614f commit 3eb95c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions scripts/kconfig/lxdialog/dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ struct dialog_info {
*/
extern struct dialog_info dlg;
extern char dialog_input_result[];
extern int saved_x, saved_y; /* Needed in signal handler in mconf.c */

/*
* Function prototypes
Expand Down
7 changes: 7 additions & 0 deletions scripts/kconfig/lxdialog/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#include "dialog.h"

/* Needed in signal handler in mconf.c */
int saved_x, saved_y;

struct dialog_info dlg;

static void set_mono_theme(void)
Expand Down Expand Up @@ -273,6 +276,10 @@ int init_dialog(const char *backtitle)
int height, width;

initscr(); /* Init curses */

/* Get current cursor position for signal handler in mconf.c */
getyx(stdscr, saved_y, saved_x);

getmaxyx(stdscr, height, width);
if (height < 19 || width < 80) {
endwin();
Expand Down
4 changes: 0 additions & 4 deletions scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
static int show_all_options;
static int saved_x, saved_y;

static void conf(struct menu *menu);
static void conf_choice(struct menu *menu);
Expand Down Expand Up @@ -862,9 +861,6 @@ int main(int ac, char **av)
single_menu_mode = 1;
}

initscr();

getyx(stdscr, saved_y, saved_x);
if (init_dialog(NULL)) {
fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
Expand Down

0 comments on commit 3eb95c8

Please sign in to comment.