2023-03-11 11:43:19

by Alexey Dobriyan

[permalink] [raw]
Subject: [PATCH 1/3] menuconfig: delete shadows, prepare for vertical space reclaim

Shadows consumes precious vertical lines, simply delete them.

Signed-off-by: Alexey Dobriyan <[email protected]>
---
scripts/kconfig/lxdialog/checklist.c | 2 --
scripts/kconfig/lxdialog/dialog.h | 1 -
scripts/kconfig/lxdialog/inputbox.c | 2 --
scripts/kconfig/lxdialog/menubox.c | 2 --
scripts/kconfig/lxdialog/textbox.c | 2 --
scripts/kconfig/lxdialog/util.c | 22 ----------------------
scripts/kconfig/lxdialog/yesno.c | 2 --
7 files changed, 33 deletions(-)

diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index fd161cfff121..7ce5233afaca 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -130,8 +130,6 @@ int dialog_checklist(const char *title, const char *prompt, int height,
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);

diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index 68b565e3c495..50b2674b734d 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -206,7 +206,6 @@ void print_button(WINDOW * win, const char *label, int y, int x, int selected);
void print_title(WINDOW *dialog, const char *title, int width);
void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box,
chtype border);
-void draw_shadow(WINDOW * win, int y, int x, int height, int width);

int first_alpha(const char *string, const char *exempt);
int dialog_yesno(const char *title, const char *prompt, int height, int width);
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 1dcfb288ee63..0bda6186a599 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -52,8 +52,6 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);

diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 58c2f8afe59b..5c3addad89b0 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -193,8 +193,6 @@ int dialog_menu(const char *title, const char *prompt,
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);

diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index 4e339b12664e..de965d0770e2 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -88,8 +88,6 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height,
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);

diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index 3f78fb265136..72dc30e3322d 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -491,28 +491,6 @@ draw_box(WINDOW * win, int y, int x, int height, int width,
}
}

-/*
- * Draw shadows along the right and bottom edge to give a more 3D look
- * to the boxes
- */
-void draw_shadow(WINDOW * win, int y, int x, int height, int width)
-{
- int i;
-
- if (has_colors()) { /* Whether terminal supports color? */
- wattrset(win, dlg.shadow.atr);
- wmove(win, y + height, x + 2);
- for (i = 0; i < width; i++)
- waddch(win, winch(win) & A_CHARTEXT);
- for (i = y + 1; i < y + height + 1; i++) {
- wmove(win, i, x + width);
- waddch(win, winch(win) & A_CHARTEXT);
- waddch(win, winch(win) & A_CHARTEXT);
- }
- wnoutrefresh(win);
- }
-}
-
/*
* Return the position of the first alphabetic character in a string.
*/
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c
index bcaac9b7bab2..25e4f10e0e6a 100644
--- a/scripts/kconfig/lxdialog/yesno.c
+++ b/scripts/kconfig/lxdialog/yesno.c
@@ -41,8 +41,6 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width)
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);

--
2.39.2



2023-03-11 11:43:24

by Alexey Dobriyan

[permalink] [raw]
Subject: [PATCH 2/3] menuconfig: reclaim horizontal space

Draw the menu box from position (0, 2) so that there is less unused
space available. Horizontal is not _really_ important but on small
terminals maybe it is.

Signed-off-by: Alexey Dobriyan <[email protected]>
---
scripts/kconfig/lxdialog/menubox.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 5c3addad89b0..5eb67c04821f 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -184,7 +184,6 @@ int dialog_menu(const char *title, const char *prompt,
return -ERRDISPLAYTOOSMALL;

height -= 4;
- width -= 5;
menu_height = height - 10;

max_choice = MIN(menu_height, item_count());
--
2.39.2


2023-03-11 11:43:28

by Alexey Dobriyan

[permalink] [raw]
Subject: [PATCH 3/3] menuconfig: reclaim vertical space

Menuconfig has lots of vertical space wasted: on my system there are
17 lines of useful information about config options and 14 lines of
useless fluff: legend, horizontal separators and shadows.

Sitation is even worse on smaller terminals because fixed vertical
lines do not go away, but config option lines do, further decreasing
informational density. Minimum reasonable 80×24 text console has only
10(!) lines of menus presented which is less than half of the screen.

Signed-off-by: Alexey Dobriyan <[email protected]>
---
scripts/kconfig/lxdialog/menubox.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 5eb67c04821f..dc608914c636 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -183,14 +183,14 @@ int dialog_menu(const char *title, const char *prompt,
if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN)
return -ERRDISPLAYTOOSMALL;

- height -= 4;
+ height -= 2;
menu_height = height - 10;

max_choice = MIN(menu_height, item_count());

/* center dialog box on screen */
- x = (getmaxx(stdscr) - width) / 2;
- y = (getmaxy(stdscr) - height) / 2;
+ x = 0;
+ y = 2;

dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);
--
2.39.2


2023-03-13 00:29:25

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 1/3] menuconfig: delete shadows, prepare for vertical space reclaim



On 3/11/23 03:42, Alexey Dobriyan wrote:
> Shadows consumes precious vertical lines, simply delete them.
>
> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
> scripts/kconfig/lxdialog/checklist.c | 2 --
> scripts/kconfig/lxdialog/dialog.h | 1 -
> scripts/kconfig/lxdialog/inputbox.c | 2 --
> scripts/kconfig/lxdialog/menubox.c | 2 --
> scripts/kconfig/lxdialog/textbox.c | 2 --
> scripts/kconfig/lxdialog/util.c | 22 ----------------------
> scripts/kconfig/lxdialog/yesno.c | 2 --
> 7 files changed, 33 deletions(-)
>


Acked-by: Randy Dunlap <[email protected]>
Tested-by: Randy Dunlap <[email protected]>

Thanks.
--
~Randy

2023-03-13 00:29:35

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 2/3] menuconfig: reclaim horizontal space

Hi,

On 3/11/23 03:42, Alexey Dobriyan wrote:
> Draw the menu box from position (0, 2) so that there is less unused
> space available. Horizontal is not _really_ important but on small
> terminals maybe it is.

ISTM that the first sentence goes with patch 3/3. ??

> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
> scripts/kconfig/lxdialog/menubox.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
> index 5c3addad89b0..5eb67c04821f 100644
> --- a/scripts/kconfig/lxdialog/menubox.c
> +++ b/scripts/kconfig/lxdialog/menubox.c
> @@ -184,7 +184,6 @@ int dialog_menu(const char *title, const char *prompt,
> return -ERRDISPLAYTOOSMALL;
>
> height -= 4;
> - width -= 5;

How does this work? In my test patch, I changed 5 to 4 to recover/reclaim the
shadow line. To my surprise, I don't see any negative issue with this change,
but I am perplexed by it.

Anyway, it worked in my testing.

Tested-by: Randy Dunlap <[email protected]>

> menu_height = height - 10;
>
> max_choice = MIN(menu_height, item_count());

Thanks.
--
~Randy

2023-03-13 00:29:37

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 3/3] menuconfig: reclaim vertical space



On 3/11/23 03:42, Alexey Dobriyan wrote:
> Menuconfig has lots of vertical space wasted: on my system there are
> 17 lines of useful information about config options and 14 lines of
> useless fluff: legend, horizontal separators and shadows.
>
> Sitation is even worse on smaller terminals because fixed vertical

Situation

> lines do not go away, but config option lines do, further decreasing
> informational density. Minimum reasonable 80×24 text console has only
> 10(!) lines of menus presented which is less than half of the screen.
>
> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
> scripts/kconfig/lxdialog/menubox.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>


Acked-by: Randy Dunlap <[email protected]>
Tested-by: Randy Dunlap <[email protected]>

Thanks.
--
~Randy

2023-03-13 19:27:10

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH 2/3] menuconfig: reclaim horizontal space

On Sun, Mar 12, 2023 at 05:29:24PM -0700, Randy Dunlap wrote:
> On 3/11/23 03:42, Alexey Dobriyan wrote:
> > Draw the menu box from position (0, 2) so that there is less unused
> > space available. Horizontal is not _really_ important but on small
> > terminals maybe it is.
>
> ISTM that the first sentence goes with patch 3/3. ??
>
> > Signed-off-by: Alexey Dobriyan <[email protected]>
> > ---
> > scripts/kconfig/lxdialog/menubox.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
> > index 5c3addad89b0..5eb67c04821f 100644
> > --- a/scripts/kconfig/lxdialog/menubox.c
> > +++ b/scripts/kconfig/lxdialog/menubox.c
> > @@ -184,7 +184,6 @@ int dialog_menu(const char *title, const char *prompt,
> > return -ERRDISPLAYTOOSMALL;
> >
> > height -= 4;
> > - width -= 5;
>
> How does this work? In my test patch, I changed 5 to 4 to recover/reclaim the
> shadow line. To my surprise, I don't see any negative issue with this change,
> but I am perplexed by it.

Ehh? It is calculated as (getmaxx - width) / 2, so both 5 or 4 do
the same thing.

> Anyway, it worked in my testing.
>
> Tested-by: Randy Dunlap <[email protected]>
>
> > menu_height = height - 10;
> >
> > max_choice = MIN(menu_height, item_count());
>
> Thanks.
> --
> ~Randy

2023-03-21 05:36:39

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH 1/3] menuconfig: delete shadows, prepare for vertical space reclaim

On Sat, Mar 11, 2023 at 8:43 PM Alexey Dobriyan <[email protected]> wrote:
>
> Shadows consumes precious vertical lines, simply delete them.
>
> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
> scripts/kconfig/lxdialog/checklist.c | 2 --
> scripts/kconfig/lxdialog/dialog.h | 1 -
> scripts/kconfig/lxdialog/inputbox.c | 2 --
> scripts/kconfig/lxdialog/menubox.c | 2 --
> scripts/kconfig/lxdialog/textbox.c | 2 --
> scripts/kconfig/lxdialog/util.c | 22 ----------------------
> scripts/kconfig/lxdialog/yesno.c | 2 --
> 7 files changed, 33 deletions(-)


I do not have a strong opinion about the shadow.

If you do this, please remove
dialog_info::shadow as well.








--
Best Regards
Masahiro Yamada

2023-03-21 06:02:44

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH 3/3] menuconfig: reclaim vertical space

On Sat, Mar 11, 2023 at 8:43 PM Alexey Dobriyan <[email protected]> wrote:
>
> Menuconfig has lots of vertical space wasted: on my system there are
> 17 lines of useful information about config options and 14 lines of
> useless fluff: legend, horizontal separators and shadows.
>
> Sitation is even worse on smaller terminals because fixed vertical
> lines do not go away, but config option lines do, further decreasing
> informational density. Minimum reasonable 80×24 text console has only
> 10(!) lines of menus presented which is less than half of the screen.



I think nconfig is a better fit for your system.


In my understanding, the concept of menuconfig
is to use a similar appearance to the 'dialog' tool
although we have largely modified the code.




>
> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
> scripts/kconfig/lxdialog/menubox.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
> index 5eb67c04821f..dc608914c636 100644
> --- a/scripts/kconfig/lxdialog/menubox.c
> +++ b/scripts/kconfig/lxdialog/menubox.c
> @@ -183,14 +183,14 @@ int dialog_menu(const char *title, const char *prompt,
> if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN)
> return -ERRDISPLAYTOOSMALL;
>
> - height -= 4;
> + height -= 2;
> menu_height = height - 10;
>
> max_choice = MIN(menu_height, item_count());
>
> /* center dialog box on screen */
> - x = (getmaxx(stdscr) - width) / 2;
> - y = (getmaxy(stdscr) - height) / 2;
> + x = 0;
> + y = 2;
>
> dialog = newwin(height, width, y, x);
> keypad(dialog, TRUE);
> --
> 2.39.2
>


You missed to adjust dialog_textbox().


(1) Run 'make menuconfig'
(2) Press < Help > button to show help message
(3) Press < Exit > button to get back


When you do (2) and (3), please make sure
the size of the grey window is not changed.

This is how the current menuconfig works.



I want to leave the blue frame.
My personal preference is

height -= 3;
width -= 2;



--
Best Regards
Masahiro Yamada