linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] kconfig/mconf.c: revision of curses initialization.
@ 2012-08-06 15:19 Dirk Gouders
  2012-08-30 12:59 ` Michal Marek
  0 siblings, 1 reply; 2+ messages in thread
From: Dirk Gouders @ 2012-08-06 15:19 UTC (permalink / raw)
  To: Michal Marek, Arnaud Lacombe; +Cc: linux-kernel, linux-kbuild

Hello,

I noticed that in mconf, initscr() is called twice -- as far as I found
out since commit d0e1e09568.

In case you see a need to fix that:

I first thought about simply removing the call in init_dialog() in
util.c but then had the feeling that saving of initial cursor positions
also perhaps is better done in that function...

Dirk

------------------------------------------------------------------------
>From 1a4022eedbee6032dea16f67bbe4028a8d3d07a0 Mon Sep 17 00:00:00 2001
From: Dirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>
Date: Mon, 6 Aug 2012 16:48:23 +0200
Subject: [PATCH] kconfig/mconf.c: revision of curses initialization.

Since commit d0e1e09568 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>
---
 scripts/kconfig/lxdialog/dialog.h |    1 +
 scripts/kconfig/lxdialog/util.c   |    7 +++++++
 scripts/kconfig/mconf.c           |    4 ----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index b5211fc..43a58ec 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -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
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index f2375ad..109d531 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -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)
@@ -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();
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index f584a28..d856d40 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -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);
@@ -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"));
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC] kconfig/mconf.c: revision of curses initialization.
  2012-08-06 15:19 [RFC] kconfig/mconf.c: revision of curses initialization Dirk Gouders
@ 2012-08-30 12:59 ` Michal Marek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Marek @ 2012-08-30 12:59 UTC (permalink / raw)
  To: Dirk Gouders; +Cc: Arnaud Lacombe, linux-kernel, linux-kbuild

On Mon, Aug 06, 2012 at 05:19:43PM +0200, Dirk Gouders wrote:
> Hello,
> 
> I noticed that in mconf, initscr() is called twice -- as far as I found
> out since commit d0e1e09568.
> 
> In case you see a need to fix that:
> 
> I first thought about simply removing the call in init_dialog() in
> util.c but then had the feeling that saving of initial cursor positions
> also perhaps is better done in that function...
> 
> Dirk
> 
> ------------------------------------------------------------------------
> From 1a4022eedbee6032dea16f67bbe4028a8d3d07a0 Mon Sep 17 00:00:00 2001
> From: Dirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>
> Date: Mon, 6 Aug 2012 16:48:23 +0200
> Subject: [PATCH] kconfig/mconf.c: revision of curses initialization.
> 
> Since commit d0e1e09568 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>

Applied to kbuild.git#kconfig, thanks.

Michal

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-30 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-06 15:19 [RFC] kconfig/mconf.c: revision of curses initialization Dirk Gouders
2012-08-30 12:59 ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).