kconfig/lxdialog: refactor color support
PATCH 1/13 kconfig/lxdialog: refactor color support
From: Sam Ravnborg <[email protected]>
Clean up and refactor color support. All color support are now in util.c including color definitions.
In the process introduced a global variable named 'dlg' which is used all over to set color - thats the reason why all files are changed.
--- scripts/kconfig/lxdialog/checklist.c | 28 ++-- scripts/kconfig/lxdialog/colors.h | 154 -------------------- scripts/kconfig/lxdialog/dialog.h | 82 +++++------ scripts/kconfig/lxdialog/inputbox.c | 18 +- scripts/kconfig/lxdialog/lxdialog.c | 6 - scripts/kconfig/lxdialog/menubox.c | 28 ++-- scripts/kconfig/lxdialog/msgbox.c | 9 + scripts/kconfig/lxdialog/textbox.c | 19 +- scripts/kconfig/lxdialog/util.c | 259 +++++++++++++++++++--------------- scripts/kconfig/lxdialog/yesno.c | 9 + 10 files changed, 250 insertions(+), 362 deletions(-)
scripts/kconfig/lxdialog/checklist.c +15 -13
@@ -34,18 +34,19 @@ static void print_item(WINDOW * win, conint i;/* Clear 'residue' of last item */ -wattrset (win, menubox_attr); +wattrset (win, dlg.menubox.atr);wmove (win, choice,0 );for (i =0 ; i < list_width; i++)waddch (win,' ' );wmove (win, choice, check_x); -wattrset (win, selected ? check_selected_attr : check_attr); +wattrset (win, selected ? dlg.check_selected.atr + : dlg.check.atr);wprintw (win,"(%c)" , status ?'X' :' ' ); -wattrset (win, selected ? tag_selected_attr : tag_attr); +wattrset (win, selected ? dlg.tag_selected.atr : dlg.tag.atr);mvwaddch (win, choice, item_x, item[0 ]); -wattrset (win, selected ? item_selected_attr : item_attr); +wattrset (win, selected ? dlg.item_selected.atr : dlg.item.atr);waddstr (win, (char *)item +1 );if (selected) {wmove (win, choice, check_x +1 );
@@ -62,11 +63,11 @@ static void print_arrows(WINDOW * win, iwmove (win, y, x);if (scroll >0 ) { -wattrset (win, uarrow_attr); +wattrset (win, dlg.uarrow.atr);waddch (win,ACS_UARROW );waddstr (win,"(-)" ); }else { -wattrset (win, menubox_attr); +wattrset (win, dlg.menubox.atr);waddch (win,ACS_HLINE );waddch (win,ACS_HLINE );waddch (win,ACS_HLINE );
@@ -77,11 +78,11 @@ static void print_arrows(WINDOW * win, iwmove (win, y, x);if ((height < item_no) && (scroll + choice < item_no -1 )) { -wattrset (win, darrow_attr); +wattrset (win, dlg.darrow.atr);waddch (win,ACS_DARROW );waddstr (win,"(+)" ); }else { -wattrset (win, menubox_border_attr); +wattrset (win, dlg.menubox_border.atr);waddch (win,ACS_HLINE );waddch (win,ACS_HLINE );waddch (win,ACS_HLINE );
@@ -145,17 +146,18 @@ int dialog_checklist(const char *title, dialog =newwin (height, width, y, x);keypad (dialog, TRUE); -draw_box (dialog,0 ,0 , height, width, dialog_attr, border_attr); -wattrset (dialog, border_attr); +draw_box (dialog,0 ,0 , height, width, + dlg.dialog.atr, dlg.border.atr); +wattrset (dialog, dlg.border.atr);mvwaddch (dialog, height -3 ,0 ,ACS_LTEE );for (i =0 ; i < width -2 ; i++)waddch (dialog,ACS_HLINE ); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);waddch (dialog,ACS_RTEE );print_title (dialog, title, width); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);print_autowrap (dialog, prompt, width -2 ,1 ,3 ); list_width = width -6 ;
@@ -170,7 +172,7 @@ int dialog_checklist(const char *title,/* draw a box around the list items */ draw_box (dialog, box_y, box_x, list_height +2 , list_width +2 , - menubox_border_attr, menubox_attr); + dlg.menubox_border.atr, dlg.menubox.atr);/* Find length of longest item in order to center checklist */ check_x =0 ;
scripts/kconfig/lxdialog/colors.h deleted +0 -154
154 lines not on this page · raw message
scripts/kconfig/lxdialog/dialog.h +40 -42
102 lines not on this page · raw message
scripts/kconfig/lxdialog/inputbox.c +10 -8
@@ -58,17 +58,18 @@ int dialog_inputbox(const char *title, c dialog =newwin (height, width, y, x);keypad (dialog, TRUE); -draw_box (dialog,0 ,0 , height, width, dialog_attr, border_attr); -wattrset (dialog, border_attr); +draw_box (dialog,0 ,0 , height, width, + dlg.dialog.atr, dlg.border.atr); +wattrset (dialog, dlg.border.atr);mvwaddch (dialog, height -3 ,0 ,ACS_LTEE );for (i =0 ; i < width -2 ; i++)waddch (dialog,ACS_HLINE ); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);waddch (dialog,ACS_RTEE );print_title (dialog, title, width); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);print_autowrap (dialog, prompt, width -2 ,1 ,3 );/* Draw the input field box */
@@ -76,13 +77,14 @@ int dialog_inputbox(const char *title, cgetyx (dialog, y, x); box_y = y +2 ; box_x = (width - box_width) /2 ; -draw_box (dialog, y +1 , box_x -1 ,3 , box_width +2 , border_attr, dialog_attr); +draw_box (dialog, y +1 , box_x -1 ,3 , box_width +2 , + dlg.border.atr, dlg.dialog.atr);print_buttons (dialog, height, width,0 );/* Set up the initial value */ wmove (dialog, box_y, box_x); -wattrset (dialog, inputbox_attr); +wattrset (dialog, dlg.inputbox.atr);if (!init) instr[0 ] ='\0' ;
@@ -120,7 +122,7 @@ int dialog_inputbox(const char *title, ccase KEY_BACKSPACE :case 127 :if (input_x || scroll) { -wattrset (dialog, inputbox_attr); +wattrset (dialog, dlg.inputbox.atr);if (!input_x) { scroll = scroll < box_width -1 ?0 : scroll - (box_width -1 );wmove (dialog, box_y, box_x);
@@ -140,7 +142,7 @@ int dialog_inputbox(const char *title, cdefault :if (key <0x100 &&isprint (key)) {if (scroll + input_x <MAX_LEN ) { -wattrset (dialog, inputbox_attr); +wattrset (dialog, dlg.inputbox.atr); instr[scroll + input_x] = key; instr[scroll + input_x +1 ] ='\0' ;if (input_x == box_width -1 ) {
scripts/kconfig/lxdialog/lxdialog.c +3 -3
@@ -78,11 +78,11 @@ #endif offset +=2 ; } }else if (!strcmp (argv[offset +1 ],"--backtitle" )) { -if (backtitle !=NULL ) { +if (dlg.backtitle !=NULL ) {Usage (argv[0 ]);exit (-1 ); }else { - backtitle = argv[offset +2 ]; + dlg.backtitle = argv[offset +2 ]; offset +=2 ; } }else if (!strcmp (argv[offset +1 ],"--clear" )) {
@@ -123,7 +123,7 @@ #endif retval = (*(modePtr->jumper)) (title, argc - offset, argv + offset);if (opt_clear) {/* clear screen before exit */ -attr_clear (stdscr,LINES ,COLS , screen_attr); +attr_clear (stdscr,LINES ,COLS , dlg.screen.atr);refresh (); }end_dialog ();
scripts/kconfig/lxdialog/menubox.c +15 -13
@@ -74,7 +74,7 @@ static void do_print_item(WINDOW * win, j =first_alpha (menu_item,"YyNnMmHh" );/* Clear 'residue' of last item */ -wattrset (win, menubox_attr); +wattrset (win, dlg.menubox.atr);wmove (win, choice,0 );#if OLD_NCURSES {
@@ -85,10 +85,11 @@ #if OLD_NCURSES#else wclrtoeol (win);#endif -wattrset (win, selected ? item_selected_attr : item_attr); +wattrset (win, selected ? dlg.item_selected.atr : dlg.item.atr);mvwaddstr (win, choice, item_x, menu_item);if (hotkey) { -wattrset (win, selected ? tag_key_selected_attr : tag_key_attr); +wattrset (win, selected ? dlg.tag_key_selected.atr + : dlg.tag_key.atr);mvwaddch (win, choice, item_x + j, menu_item[j]); }if (selected) {
@@ -117,11 +118,11 @@ static void print_arrows(WINDOW * win, iwmove (win, y, x);if (scroll >0 ) { -wattrset (win, uarrow_attr); +wattrset (win, dlg.uarrow.atr);waddch (win,ACS_UARROW );waddstr (win,"(-)" ); }else { -wattrset (win, menubox_attr); +wattrset (win, dlg.menubox.atr);waddch (win,ACS_HLINE );waddch (win,ACS_HLINE );waddch (win,ACS_HLINE );
@@ -133,11 +134,11 @@ static void print_arrows(WINDOW * win, iwrefresh (win);if ((height < item_no) && (scroll + height < item_no)) { -wattrset (win, darrow_attr); +wattrset (win, dlg.darrow.atr);waddch (win,ACS_DARROW );waddstr (win,"(+)" ); }else { -wattrset (win, menubox_border_attr); +wattrset (win, dlg.menubox_border.atr);waddch (win,ACS_HLINE );waddch (win,ACS_HLINE );waddch (win,ACS_HLINE );
@@ -199,18 +200,19 @@ int dialog_menu(const char *title, const dialog =newwin (height, width, y, x);keypad (dialog, TRUE); -draw_box (dialog,0 ,0 , height, width, dialog_attr, border_attr); -wattrset (dialog, border_attr); +draw_box (dialog,0 ,0 , height, width, + dlg.dialog.atr, dlg.border.atr); +wattrset (dialog, dlg.border.atr);mvwaddch (dialog, height -3 ,0 ,ACS_LTEE );for (i =0 ; i < width -2 ; i++)waddch (dialog,ACS_HLINE ); -wattrset (dialog, dialog_attr); -wbkgdset (dialog, dialog_attr &A_COLOR ); +wattrset (dialog, dlg.dialog.atr); +wbkgdset (dialog, dlg.dialog.atr &A_COLOR );waddch (dialog,ACS_RTEE );print_title (dialog, title, width); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);print_autowrap (dialog, prompt, width -2 ,1 ,3 ); menu_width = width -6 ;
@@ -224,7 +226,7 @@ int dialog_menu(const char *title, const/* draw a box around the menu items */ draw_box (dialog, box_y, box_x, menu_height +2 , menu_width +2 , - menubox_border_attr, menubox_attr); + dlg.menubox_border.atr, dlg.menubox.atr); item_x = (menu_width -70 ) /2 ;
scripts/kconfig/lxdialog/msgbox.c +5 -4
@@ -40,19 +40,20 @@ int dialog_msgbox(const char *title, con dialog =newwin (height, width, y, x);keypad (dialog, TRUE); -draw_box (dialog,0 ,0 , height, width, dialog_attr, border_attr); +draw_box (dialog,0 ,0 , height, width, + dlg.dialog.atr, dlg.border.atr);print_title (dialog, title, width); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);print_autowrap (dialog, prompt, width -2 ,1 ,2 );if (pause) { -wattrset (dialog, border_attr); +wattrset (dialog, dlg.border.atr);mvwaddch (dialog, height -3 ,0 ,ACS_LTEE );for (i =0 ; i < width -2 ; i++)waddch (dialog,ACS_HLINE ); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);waddch (dialog,ACS_RTEE );print_button (dialog," Ok " , height -2 , width /2 -4 , TRUE);
scripts/kconfig/lxdialog/textbox.c +10 -9
@@ -87,20 +87,21 @@ int dialog_textbox(const char *title, co/* Create window for text region, used for scrolling text */ text =subwin (dialog, height -4 , width -2 , y +1 , x +1 ); -wattrset (text, dialog_attr); -wbkgdset (text, dialog_attr &A_COLOR ); +wattrset (text, dlg.dialog.atr); +wbkgdset (text, dlg.dialog.atr &A_COLOR );keypad (text, TRUE);/* register the new window, along with its borders */ -draw_box (dialog,0 ,0 , height, width, dialog_attr, border_attr); +draw_box (dialog,0 ,0 , height, width, + dlg.dialog.atr, dlg.border.atr); -wattrset (dialog, border_attr); +wattrset (dialog, dlg.border.atr);mvwaddch (dialog, height -3 ,0 ,ACS_LTEE );for (i =0 ; i < width -2 ; i++)waddch (dialog,ACS_HLINE ); -wattrset (dialog, dialog_attr); -wbkgdset (dialog, dialog_attr &A_COLOR ); +wattrset (dialog, dlg.dialog.atr); +wbkgdset (dialog, dlg.dialog.atr &A_COLOR );waddch (dialog,ACS_RTEE );print_title (dialog, title, width);
@@ -110,7 +111,7 @@ int dialog_textbox(const char *title, cogetyx (dialog, cur_y, cur_x);/* Save cursor position */ /* Print first page of text */ -attr_clear (text, height -4 , width -2 , dialog_attr); +attr_clear (text, height -4 , width -2 , dlg.dialog.atr);print_page (text, height -4 , width -2 );print_position (dialog, height, width);wmove (dialog, cur_y, cur_x);/* Restore cursor position */
@@ -524,8 +525,8 @@ static void print_position(WINDOW * win,fprintf (stderr,"\nError moving file pointer in print_position().\n" );exit (-1 ); } -wattrset (win, position_indicator_attr); -wbkgdset (win, position_indicator_attr &A_COLOR ); +wattrset (win, dlg.position_indicator.atr); +wbkgdset (win, dlg.position_indicator.atr &A_COLOR ); percent = !file_size ?100 : ((fpos - bytes_read + page - buf) *100 ) / file_size;wmove (win, height -3 , width -9 );
scripts/kconfig/lxdialog/util.c +147 -112
314 lines not on this page · raw message
scripts/kconfig/lxdialog/yesno.c +5 -4
@@ -53,17 +53,18 @@ int dialog_yesno(const char *title, cons dialog =newwin (height, width, y, x);keypad (dialog, TRUE); -draw_box (dialog,0 ,0 , height, width, dialog_attr, border_attr); -wattrset (dialog, border_attr); +draw_box (dialog,0 ,0 , height, width, + dlg.dialog.atr, dlg.border.atr); +wattrset (dialog, dlg.border.atr);mvwaddch (dialog, height -3 ,0 ,ACS_LTEE );for (i =0 ; i < width -2 ; i++)waddch (dialog,ACS_HLINE ); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);waddch (dialog,ACS_RTEE );print_title (dialog, title, width); -wattrset (dialog, dialog_attr); +wattrset (dialog, dlg.dialog.atr);print_autowrap (dialog, prompt, width -2 ,1 ,3 );print_buttons (dialog, height, width,0 );
Signature · 1 line
1.4.1
PATCH 2/13 kconfig/lxdialog: add support for color themes and add blackbg theme
From: Sam Ravnborg <[email protected]>
The blackbg theme was originally made by: Han Boetes
It was copied from a patch by "Randy.Dunlap" <[email protected]> which was also the inspiration source for the color theme support.
--- scripts/kconfig/lxdialog/util.c | 73 ++++++++++++++++++++++++++++++++++++--- scripts/kconfig/mconf.c | 15 +++++++- 2 files changed, 81 insertions(+), 7 deletions(-)
scripts/kconfig/lxdialog/util.c +67 -6
@@ -96,6 +96,66 @@ static void set_classic_theme(void)DLG_COLOR (darrow,COLOR_GREEN ,COLOR_WHITE , true); } +static void set_blackbg_theme (void ) +{ +DLG_COLOR (screen,COLOR_RED ,COLOR_BLACK , true); +DLG_COLOR (shadow,COLOR_BLACK ,COLOR_BLACK , false); +DLG_COLOR (dialog,COLOR_WHITE ,COLOR_BLACK , false); +DLG_COLOR (title,COLOR_RED ,COLOR_BLACK , false); +DLG_COLOR (border,COLOR_BLACK ,COLOR_BLACK , true); + +DLG_COLOR (button_active,COLOR_YELLOW ,COLOR_RED , false); +DLG_COLOR (button_inactive,COLOR_YELLOW ,COLOR_BLACK , false); +DLG_COLOR (button_key_active,COLOR_YELLOW ,COLOR_RED , true); +DLG_COLOR (button_key_inactive,COLOR_RED ,COLOR_BLACK , false); +DLG_COLOR (button_label_active,COLOR_WHITE ,COLOR_RED , false); +DLG_COLOR (button_label_inactive,COLOR_BLACK ,COLOR_BLACK , true); + +DLG_COLOR (inputbox,COLOR_YELLOW ,COLOR_BLACK , false); +DLG_COLOR (inputbox_border,COLOR_YELLOW ,COLOR_BLACK , false); + +DLG_COLOR (searchbox,COLOR_YELLOW ,COLOR_BLACK , false); +DLG_COLOR (searchbox_title,COLOR_YELLOW ,COLOR_BLACK , true); +DLG_COLOR (searchbox_border,COLOR_BLACK ,COLOR_BLACK , true); + +DLG_COLOR (position_indicator,COLOR_RED ,COLOR_BLACK , false); + +DLG_COLOR (menubox,COLOR_YELLOW ,COLOR_BLACK , false); +DLG_COLOR (menubox_border,COLOR_BLACK ,COLOR_BLACK , true); + +DLG_COLOR (item,COLOR_WHITE ,COLOR_BLACK , false); +DLG_COLOR (item_selected,COLOR_WHITE ,COLOR_RED , false); + +DLG_COLOR (tag,COLOR_RED ,COLOR_BLACK , false); +DLG_COLOR (tag_selected,COLOR_YELLOW ,COLOR_RED , true); +DLG_COLOR (tag_key,COLOR_RED ,COLOR_BLACK , false); +DLG_COLOR (tag_key_selected,COLOR_YELLOW ,COLOR_RED , true); + +DLG_COLOR (check,COLOR_YELLOW ,COLOR_BLACK , false); +DLG_COLOR (check_selected,COLOR_YELLOW ,COLOR_RED , true); + +DLG_COLOR (uarrow,COLOR_RED ,COLOR_BLACK , false); +DLG_COLOR (darrow,COLOR_RED ,COLOR_BLACK , false); +} + +/* +* Select color theme +*/ +static int set_theme (const char *theme) +{ +int use_color =1 ; +if (!theme) +set_classic_theme (); +else if (strcmp (theme,"classic" ) ==0 ) +set_classic_theme (); +else if (strcmp (theme,"blackbg" ) ==0 ) +set_blackbg_theme (); +else if (strcmp (theme,"mono" ) ==0 ) + use_color =0 ; + +return use_color; +} +static void init_one_color (struct dialog_color *color) {static int pair =0 ;
@@ -144,12 +204,13 @@ static void init_dialog_colors(void)/* * Setup for color display */ -static void color_setup (void ) +static void color_setup (const char *theme) { -if (has_colors ()) {/* Terminal supports color? */ -start_color (); -set_classic_theme (); -init_dialog_colors (); +if (set_theme (theme)) { +if (has_colors ()) {/* Terminal supports color? */ +start_color (); +init_dialog_colors (); + } }else {
@@ -198,7 +259,7 @@ void init_dialog(void)keypad (stdscr, TRUE);cbreak ();noecho (); -color_setup (); +color_setup (getenv ("MENUCONFIG_COLOR" ));dialog_clear (); }
scripts/kconfig/mconf.c +14 -1
@@ -159,7 +159,20 @@ static const char mconf_readme[] = N_("\n" "Note that this mode can eventually be a little more CPU expensive\n" "(especially with a larger number of unrolled categories) than the\n" -"default mode.\n"), +"default mode.\n" +"\n" +"Different color themes available\n" +"--------------------------------\n" +"It is possible to select different color themes using the variable\n" +"MENUCONFIG_COLOR. To select a theme use:\n" +"\n" +"make MENUCONFIG_COLOR=<theme> menuconfig\n" +"\n" +"Available themes are\n" +" mono => selects colors suitable for monochrome displays\n" +" blackbg => selects a color scheme with black background\n" +" classic => theme with blue background. The classic look. (default)\n" +"\n"), menu_instructions[] = N_("Arrow keys navigate the menu. " "<Enter> selects submenus --->. "
Signature · 1 line
1.4.1
PATCH 3/13 kconfig/lxdialog: add a new theme bluetitle which is now default
From: Sam Ravnborg <[email protected]>
The bluetitle theme is a slightly modified version of the colorscheme that -mm users has been used to. The bluetitle is more readable especially on some LCD screens so it is now default.
Anyone that really wants the old color selection can get it by selecting the classic color theme:
make MENUCONFIG_COLOR=classic menuconfig
The bluetitle theme was modified by Roman Zippel <[email protected]> to further improve readability on LCD screens.
--- scripts/kconfig/lxdialog/util.c | 17 ++++++++++++++++- scripts/kconfig/mconf.c | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-)
scripts/kconfig/lxdialog/util.c +16 -1
@@ -138,6 +138,19 @@ static void set_blackbg_theme(void)DLG_COLOR (darrow,COLOR_RED ,COLOR_BLACK , false); } +static void set_bluetitle_theme (void ) +{ +set_classic_theme (); +DLG_COLOR (title,COLOR_BLUE ,COLOR_WHITE , true); +DLG_COLOR (button_key_active,COLOR_YELLOW ,COLOR_BLUE , true); +DLG_COLOR (button_label_active,COLOR_WHITE ,COLOR_BLUE , true); +DLG_COLOR (searchbox_title,COLOR_BLUE ,COLOR_WHITE , true); +DLG_COLOR (position_indicator,COLOR_BLUE ,COLOR_WHITE , true); +DLG_COLOR (tag,COLOR_BLUE ,COLOR_WHITE , true); +DLG_COLOR (tag_key,COLOR_BLUE ,COLOR_WHITE , true); + +} +/* * Select color theme */
@@ -145,9 +158,11 @@ static int set_theme(const char *theme) {int use_color =1 ;if (!theme) -set_classic_theme (); +set_bluetitle_theme ();else if (strcmp (theme,"classic" ) ==0 )set_classic_theme (); +else if (strcmp (theme,"bluetitle" ) ==0 ) +set_bluetitle_theme ();else if (strcmp (theme,"blackbg" ) ==0 )set_blackbg_theme ();else if (strcmp (theme,"mono" ) ==0 )
scripts/kconfig/mconf.c +2 -1
@@ -171,7 +171,8 @@ static const char mconf_readme[] = N_("Available themes are\n" " mono => selects colors suitable for monochrome displays\n" " blackbg => selects a color scheme with black background\n" -" classic => theme with blue background. The classic look. (default)\n" +" classic => theme with blue background. The classic look\n" +" bluetitle => a LCD friendly version of classic. (default)\n" "\n"), menu_instructions[] = N_( "Arrow keys navigate the menu. "
Signature · 1 line
1.4.1
PATCH 4/13 kconfig/menuconfig: lxdialog is now built-in
From: Sam Ravnborg <[email protected]>
lxdialog was previously called as an external program causing screen to flicker when used. With this patch lxdialog is now built-in. It is loosly based om previous work by: Petr Baudis <[email protected]>
Following is a list of changes:
o Moved build of dialog routings to kconfig Makefile
o menubox + checklist uses a new item list to hold all menu items
o in util.c implmented helper function to deal with item list
o menubox now uses parameters to save scroll state (avoids temp file)
o textbox now get text to be displayed as parameter and not a file
o make sure to properly delete subwin's before main windows
o killed unused files: lxdialog.c msgbox.c
o modified return value for ESC to match direct calling
o in a few places the code has been adjusted to 80 char wide
o in textbox a small refactoring was made to make code remotely readable
o in mconf removed all unused stuff (functions/variables)
Following is a list of know short comings:
a) pressing ESC twice will be interpreted as two ESC presses
b) resize does not work. menuconfig needs to be restarted to be adjusted
--- scripts/kconfig/Makefile | 23 +- scripts/kconfig/lxdialog/Makefile | 21 - scripts/kconfig/lxdialog/checklist.c | 136 ++++------ scripts/kconfig/lxdialog/dialog.h | 52 +++- scripts/kconfig/lxdialog/inputbox.c | 2 scripts/kconfig/lxdialog/lxdialog.c | 204 -------------- scripts/kconfig/lxdialog/menubox.c | 95 +++---- scripts/kconfig/lxdialog/msgbox.c | 72 ----- scripts/kconfig/lxdialog/textbox.c | 298 +++++---------------- scripts/kconfig/lxdialog/util.c | 134 +++++++++ scripts/kconfig/lxdialog/yesno.c | 2 scripts/kconfig/mconf.c | 482 ++++++++++------------------------ 12 files changed, 502 insertions(+), 1019 deletions(-)
scripts/kconfig/Makefile +21 -2
@@ -11,7 +11,6 @@ gconfig: $(obj)/gconf $< arch/$(ARCH)/Kconfig menuconfig: $(obj)/mconf - $(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog $< arch/$(ARCH)/Kconfig config: $(obj)/conf
@@ -81,6 +80,23 @@ help: @echo ' allyesconfig - New config where all options are accepted with yes' @echo ' allnoconfig - New config where all options are answered with no' +# lxdialog stuff +check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh + +# Use reursively expanded variables so we do not call gcc unless +# we really need to do so. (Do not call gcc as part of make mrproper) +HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) +HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) + +HOST_EXTRACFLAGS += -DLOCALE + +PHONY += $(obj)/dochecklxdialog +$(obj)/dochecklxdialog: + $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES) + +always := dochecklxdialog + + # =========================================================================== # Shared Makefile for the various kconfig executables: # conf: Used for defconfig, oldconfig and related targets
@@ -92,9 +108,12 @@ # gconf: Used for the gconfig target # Based on GTK which needs to be installed to compile it # object files used by all kconfig flavours +lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o +lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o + hostprogs-y := conf mconf qconf gconf kxgettext conf-objs := conf.o zconf.tab.o -mconf-objs := mconf.o zconf.tab.o +mconf-objs := mconf.o zconf.tab.o $(lxdialog) kxgettext-objs := kxgettext.o zconf.tab.o ifeq ($(MAKECMDGOALS),xconfig)
scripts/kconfig/lxdialog/Makefile deleted +0 -21
@@ -1,21 +0,0 @@ -# Makefile to build lxdialog package -# - -check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh - -# Use reursively expanded variables so we do not call gcc unless -# we really need to do so. (Do not call gcc as part of make mrproper) -HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) -HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) - -HOST_EXTRACFLAGS += -DLOCALE - -PHONY += dochecklxdialog -$(obj)/dochecklxdialog: - $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES) - -hostprogs-y := lxdialog -always := $(hostprogs-y) dochecklxdialog - -lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ - util.o lxdialog.o msgbox.o
scripts/kconfig/lxdialog/checklist.c +55 -81
237 lines not on this page · raw message
scripts/kconfig/lxdialog/dialog.h +47 -5
69 lines not on this page · raw message
scripts/kconfig/lxdialog/inputbox.c +1 -1
@@ -222,5 +222,5 @@ int dialog_inputbox(const char *title, c }delwin (dialog); -return -1 ;/* ESC pressed */ +return 255 ;/* ESC pressed */ }
scripts/kconfig/lxdialog/lxdialog.c deleted +0 -204
204 lines not on this page · raw message
scripts/kconfig/lxdialog/menubox.c +40 -55
173 lines not on this page · raw message
scripts/kconfig/lxdialog/msgbox.c deleted +0 -72
72 lines not on this page · raw message
scripts/kconfig/lxdialog/textbox.c +64 -234
428 lines not on this page · raw message
scripts/kconfig/lxdialog/util.c +132 -2
148 lines not on this page · raw message
scripts/kconfig/lxdialog/yesno.c +1 -1
@@ -99,5 +99,5 @@ int dialog_yesno(const char *title, cons }delwin (dialog); -return -1 ;/* ESC pressed */ +return 255 ;/* ESC pressed */ }
scripts/kconfig/mconf.c +141 -341
728 lines not on this page · raw message
Signature · 1 line
1.4.1
PATCH 5/13 kconfig/lxdialog: let <ESC><ESC> behave as expected
From: Sam Ravnborg <[email protected]>
<ESC><ESC> is used to step one back in the dialogs.
When lxdialog became built-in pressing <ESC> once would cause one step back and pressing <ESC><ESC> would cause two steps back.
This patch - based on concept from Roman Zippel <[email protected]> - makes one <ESC> a noop and pressing <ESC><ESC> will cause one step backward.
In addition the final yes/no dialog now has the option to go back to the the kernel configuration. So if you get too far out you can now go back to configuring the kernel without saving and starting all over again.
--- scripts/kconfig/lxdialog/checklist.c | 10 ++++++---- scripts/kconfig/lxdialog/dialog.h | 4 +++- scripts/kconfig/lxdialog/inputbox.c | 10 ++++++---- scripts/kconfig/lxdialog/menubox.c | 10 ++++++---- scripts/kconfig/lxdialog/textbox.c | 7 ++++--- scripts/kconfig/lxdialog/util.c | 33 +++++++++++++++++++++++++++++++++ scripts/kconfig/lxdialog/yesno.c | 7 ++++--- scripts/kconfig/mconf.c | 25 ++++++++++++++----------- 8 files changed, 76 insertions(+), 30 deletions(-)
scripts/kconfig/lxdialog/checklist.c +6 -4
@@ -192,7 +192,7 @@ int dialog_checklist(const char *title,wnoutrefresh (list);doupdate (); -while (key !=ESC ) { +while (key !=KEY_ESC ) { key =wgetch (dialog);for (i =0 ; i < max_choice; i++) {
@@ -298,8 +298,10 @@ int dialog_checklist(const char *title,break ;case 'X' :case 'x' : - key =ESC ; -case ESC : + key =KEY_ESC ; +break ; +case KEY_ESC : + key =on_key_esc (dialog);break ; }
@@ -308,5 +310,5 @@ int dialog_checklist(const char *title, }delwin (list);delwin (dialog); -return 255 ;/* ESC pressed */ +return key;/* ESC pressed */ }
scripts/kconfig/lxdialog/dialog.h +3 -1
@@ -48,7 +48,7 @@ #endif#define TR (params) _tracef params -#define ESC 27 +#define KEY_ESC 27#define TAB 9#define MAX_LEN 2048#define BUF_SIZE (10*1024)
@@ -179,6 +179,8 @@ #define item_foreach() \for (item_cur = item_head ? item_head: item_cur; \ item_cur && (item_cur != &item_nil); item_cur = item_cur->next) +/* generic key handlers */ +int on_key_esc(WINDOW *win);void init_dialog (const char *backtitle);void reset_dialog (void );
scripts/kconfig/lxdialog/inputbox.c +6 -4
@@ -106,7 +106,7 @@ int dialog_inputbox(const char *title, cwrefresh (dialog); -while (key !=ESC ) { +while (key !=KEY_ESC ) { key =wgetch (dialog);if (button ==-1 ) {/* Input box selected */
@@ -215,12 +215,14 @@ int dialog_inputbox(const char *title, creturn (button ==-1 ?0 : button);case 'X' :case 'x' : - key =ESC ; -case ESC : + key =KEY_ESC ; +break ; +case KEY_ESC : + key =on_key_esc (dialog);break ; } }delwin (dialog); -return 255 ;/* ESC pressed */ +return KEY_ESC ;/* ESC pressed */ }
scripts/kconfig/lxdialog/menubox.c +6 -4
@@ -263,7 +263,7 @@ int dialog_menu(const char *title, constwmove (menu, choice, item_x +1 );wrefresh (menu); -while (key !=ESC ) { +while (key !=KEY_ESC ) { key =wgetch (menu);if (key <256 &&isalpha (key))
@@ -402,12 +402,14 @@ int dialog_menu(const char *title, constreturn button;case 'e' :case 'x' : - key =ESC ; -case ESC : + key =KEY_ESC ; +break ; +case KEY_ESC : + key =on_key_esc (menu);break ; } }delwin (menu);delwin (dialog); -return 255 ;/* ESC pressed */ +return key;/* ESC pressed */ }
scripts/kconfig/lxdialog/textbox.c +4 -3
@@ -92,7 +92,7 @@ int dialog_textbox(const char *title, cowmove (dialog, cur_y, cur_x);/* Restore cursor position */ wrefresh (dialog); -while ((key !=ESC ) && (key !='\n' )) { +while ((key !=KEY_ESC ) && (key !='\n' )) { key =wgetch (dialog);switch (key) {case 'E' :/* Exit */
@@ -228,13 +228,14 @@ int dialog_textbox(const char *title, cowmove (dialog, cur_y, cur_x);wrefresh (dialog);break ; -case ESC : +case KEY_ESC : + key =on_key_esc (dialog);break ; } }delwin (text);delwin (dialog); -return 255 ;/* ESC pressed */ +return key;/* ESC pressed */ }/*
scripts/kconfig/lxdialog/util.c +33 -0
@@ -477,6 +477,39 @@ int first_alpha(const char *string, consreturn 0 ; } +/* +* ncurses uses ESC to detect escaped char sequences. This resutl in +* a small timeout before ESC is actually delivered to the application. +* lxdialog suggest <ESC> <ESC> which is correctly translated to two +* times esc. But then we need to ignore the second esc to avoid stepping +* out one menu too much. Filter away all escaped key sequences since +* keypad(FALSE) turn off ncurses support for escape sequences - and thats +* needed to make notimeout() do as expected. +*/ +int on_key_esc (WINDOW *win) +{ +int key; +int key2; +int key3; + +nodelay (win, TRUE); +keypad (win, FALSE); + key =wgetch (win); + key2 =wgetch (win); +do { + key3 =wgetch (win); + }while (key3 !=ERR ); +nodelay (win, FALSE); +keypad (win, TRUE); +if (key ==KEY_ESC && key2 ==ERR ) +return KEY_ESC ; +else if (key !=ERR && key !=KEY_ESC && key2 ==ERR ) +ungetch (key); + +return -1 ; +} + +struct dialog_list *item_cur;struct dialog_list item_nil;struct dialog_list *item_head;
scripts/kconfig/lxdialog/yesno.c +4 -3
@@ -69,7 +69,7 @@ int dialog_yesno(const char *title, consprint_buttons (dialog, height, width,0 ); -while (key !=ESC ) { +while (key !=KEY_ESC ) { key =wgetch (dialog);switch (key) {case 'Y' :
@@ -93,11 +93,12 @@ int dialog_yesno(const char *title, conscase '\n' :delwin (dialog);return button; -case ESC : +case KEY_ESC : + key =on_key_esc (dialog);break ; } }delwin (dialog); -return 255 ;/* ESC pressed */ +return key;/* ESC pressed */ }
scripts/kconfig/mconf.c +14 -11
@@ -608,7 +608,7 @@ static void conf(struct menu *menu)_ (menu_instructions), rows, cols, rows -10 , active_menu, &s_scroll); -if (res ==1 || res ==255 ) +if (res ==1 || res ==KEY_ESC )break ;if (!item_activate_selected ())continue ;
@@ -754,7 +754,7 @@ static void conf_choice(struct menu *men }else show_help (menu);break ; -case 255 : +case KEY_ESC :return ; } }
@@ -794,7 +794,7 @@ static void conf_string(struct menu *mencase 1 :show_help (menu);break ; -case 255 : +case KEY_ESC :return ; } }
@@ -819,7 +819,7 @@ static void conf_load(void)case 1 :show_helptext (_ ("Load Alternate Configuration" ), load_config_help);break ; -case 255 : +case KEY_ESC :return ; } }
@@ -843,7 +843,7 @@ static void conf_save(void)case 1 :show_helptext (_ ("Save Alternate Configuration" ), save_config_help);break ; -case 255 : +case KEY_ESC :return ; } }
@@ -883,12 +883,15 @@ int main(int ac, char **av)init_wsize ();reset_dialog ();init_dialog (menu_backtitle); -conf (&rootmenu); -reset_dialog (); - res =dialog_yesno (NULL , -_ ("Do you wish to save your " -"new kernel configuration?" ), -5 ,60 ); +do { +conf (&rootmenu); +reset_dialog (); + res =dialog_yesno (NULL , +_ ("Do you wish to save your " +"new kernel configuration?\n" +"<ESC><ESC> to continue." ), +6 ,60 ); + }while (res ==KEY_ESC );end_dialog ();if (res ==0 ) {if (conf_write (NULL )) {
Signature · 1 line
1.4.1
PATCH 6/13 kconfig/lxdialog: support resize
From: Sam Ravnborg <[email protected]>
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.
--- scripts/kconfig/lxdialog/checklist.c | 11 +++ scripts/kconfig/lxdialog/dialog.h | 8 +- scripts/kconfig/lxdialog/inputbox.c | 20 ++++- scripts/kconfig/lxdialog/menubox.c | 25 +++++- scripts/kconfig/lxdialog/textbox.c | 140 ++++++++++++++++++++-------------- scripts/kconfig/lxdialog/util.c | 6 + scripts/kconfig/lxdialog/yesno.c | 10 ++ scripts/kconfig/mconf.c | 12 ++- 8 files changed, 161 insertions(+), 71 deletions(-)
scripts/kconfig/lxdialog/checklist.c +11 -0
@@ -125,6 +125,12 @@ int dialog_checklist(const char *title, } } +do_resize: +if (getmaxy (stdscr) < (height +6 )) +return -ERRDISPLAYTOOSMALL ; +if (getmaxx (stdscr) < (width +6 )) +return -ERRDISPLAYTOOSMALL ; + max_choice =MIN (list_height,item_count ());/* center dialog box on screen */
@@ -303,6 +309,11 @@ int dialog_checklist(const char *title,case KEY_ESC : key =on_key_esc (dialog);break ; +case KEY_RESIZE : +delwin (list); +delwin (dialog); +on_key_resize (); + goto do_resize; }/* Now, update everything... */
scripts/kconfig/lxdialog/dialog.h +6 -2
@@ -86,6 +86,9 @@ #ifndef ACS_DARROW#define ACS_DARROW 'v'#endif +/* error return codes */ +#define ERRDISPLAYTOOSMALL (KEY_MAX + 1) +/* * Color definitions */
@@ -181,6 +184,7 @@ #define item_foreach() \/* generic key handlers */ int on_key_esc (WINDOW *win); +int on_key_resize (void );void init_dialog (const char *backtitle);void reset_dialog (void );
@@ -199,8 +203,8 @@ int dialog_yesno(const char *title, consint dialog_msgbox (const char *title,const char *prompt,int height,int width,int pause);int dialog_textbox (const char *title,const char *file,int height,int width); -int dialog_menu (const char *title,const char *prompt,int height,int width, -int menu_height,const void *selected,int *s_scroll); +int dialog_menu (const char *title,const char *prompt, +const void *selected,int *s_scroll);int dialog_checklist (const char *title,const char *prompt,int height,int width,int list_height);extern char dialog_input_result[];
scripts/kconfig/lxdialog/inputbox.c +15 -5
@@ -49,6 +49,17 @@ int dialog_inputbox(const char *title, cchar *instr = dialog_input_result;WINDOW *dialog; +if (!init) + instr[0 ] ='\0' ; +else +strcpy (instr, init); + +do_resize: +if (getmaxy (stdscr) <= (height -2 )) +return -ERRDISPLAYTOOSMALL ; +if (getmaxx (stdscr) <= (width -2 )) +return -ERRDISPLAYTOOSMALL ; +/* center dialog box on screen */ x = (COLS - width) /2 ; y = (LINES - height) /2 ;
@@ -86,11 +97,6 @@ int dialog_inputbox(const char *title, cwmove (dialog, box_y, box_x);wattrset (dialog, dlg.inputbox.atr); -if (!init) - instr[0 ] ='\0' ; -else -strcpy (instr, init); - input_x =strlen (instr);if (input_x >= box_width) {
@@ -220,6 +226,10 @@ int dialog_inputbox(const char *title, ccase KEY_ESC : key =on_key_esc (dialog);break ; +case KEY_RESIZE : +delwin (dialog); +on_key_resize (); + goto do_resize; } }
scripts/kconfig/lxdialog/menubox.c +22 -3
@@ -179,14 +179,25 @@ static void do_scroll(WINDOW *win, int */* * Display a menu for choosing among a number of options */ -int dialog_menu (const char *title,const char *prompt,int height,int width, -int menu_height,const void *selected,int *s_scroll) +int dialog_menu (const char *title,const char *prompt, +const void *selected,int *s_scroll) {int i, j, x, y, box_x, box_y; +int height, width, menu_height;int key =0 , button =0 , scroll =0 , choice =0 ;int first_item =0 , max_choice;WINDOW *dialog, *menu; +do_resize: + height =getmaxy (stdscr); + width =getmaxx (stdscr); +if (height <15 || width <65 ) +return -ERRDISPLAYTOOSMALL ; + + height -=4 ; + width -=5 ; + menu_height = height -10 ; + max_choice =MIN (menu_height,item_count ());/* center dialog box on screen */
@@ -226,7 +237,10 @@ int dialog_menu(const char *title, constdraw_box (dialog, box_y, box_x, menu_height +2 , menu_width +2 , dlg.menubox_border.atr, dlg.menubox.atr); - item_x = (menu_width -70 ) /2 ; +if (menu_width >=80 ) + item_x = (menu_width -70 ) /2 ; +else + item_x =4 ;/* Set choice to default item */ item_foreach ()
@@ -407,6 +421,11 @@ int dialog_menu(const char *title, constcase KEY_ESC : key =on_key_esc (menu);break ; +case KEY_RESIZE : +on_key_resize (); +delwin (menu); +delwin (dialog); + goto do_resize; } }delwin (menu);
scripts/kconfig/lxdialog/textbox.c +83 -57
257 lines not on this page · raw message
scripts/kconfig/lxdialog/util.c +6 -0
@@ -509,6 +509,12 @@ int on_key_esc(WINDOW *win)return -1 ; } +/* redraw screen in new size */ +int on_key_resize (void ) +{ +dialog_clear (); +return KEY_RESIZE ; +}struct dialog_list *item_cur;struct dialog_list item_nil;
scripts/kconfig/lxdialog/yesno.c +10 -0
@@ -44,6 +44,12 @@ int dialog_yesno(const char *title, consint i, x, y, key =0 , button =0 ;WINDOW *dialog; +do_resize: +if (getmaxy (stdscr) < (height +4 )) +return -ERRDISPLAYTOOSMALL ; +if (getmaxx (stdscr) < (width +4 )) +return -ERRDISPLAYTOOSMALL ; +/* center dialog box on screen */ x = (COLS - width) /2 ; y = (LINES - height) /2 ;
@@ -96,6 +102,10 @@ int dialog_yesno(const char *title, conscase KEY_ESC : key =on_key_esc (dialog);break ; +case KEY_RESIZE : +delwin (dialog); +on_key_resize (); + goto do_resize; } }
scripts/kconfig/mconf.c +8 -4
@@ -606,9 +606,8 @@ static void conf(struct menu *menu)reset_dialog (); res =dialog_menu (prompt ? prompt :_ ("Main Menu" ),_ (menu_instructions), - rows, cols, rows -10 , active_menu, &s_scroll); -if (res ==1 || res ==KEY_ESC ) +if (res ==1 || res ==KEY_ESC || res == -ERRDISPLAYTOOSMALL )break ;if (!item_activate_selected ())continue ;
@@ -617,7 +616,10 @@ static void conf(struct menu *menu) submenu =item_data (); active_menu =item_data (); - sym = submenu->sym; +if (submenu) + sym = submenu->sym; +else + sym =NULL ;switch (res) {case 0 :
@@ -683,7 +685,7 @@ static void conf(struct menu *menu)static void show_textbox (const char *title,const char *text,int r,int c) {reset_dialog (); -dialog_textbox (title, text, r ? r : rows, c ? c : cols); +dialog_textbox (title, text, r, c); }static void show_helptext (const char *title,const char *text)
@@ -756,6 +758,8 @@ static void conf_choice(struct menu *menbreak ;case KEY_ESC :return ; +case -ERRDISPLAYTOOSMALL : +return ; } } }
Signature · 1 line
1.4.1
PATCH 7/13 kconfig/lxdialog: fix make mrproper
From: Sam Ravnborg <[email protected]>
No Makefile in scripts/kconfig/lxdialog anymore, so do not go there during make mrproper.
--- scripts/kconfig/Makefile | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
scripts/kconfig/Makefile +0 -1
@@ -135,7 +135,6 @@ endif clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c -subdir- += lxdialog # Needed for systems without gettext KBUILD_HAVE_NLS := $(shell \
Signature · 1 line
1.4.1
PATCH 8/13 kbuild: do not build mconf & lxdialog unless needed
From: Sam Ravnborg <[email protected]>
Due to a limitation in kbuild all objects referred by xxx-y or xxx-objs will be build when one of the targets needs to e build.
This caused lxdialog to be build pulling in ncurses that is not always available.
So avoid building mconf & lxdialog unless really needed.
--- scripts/kconfig/Makefile | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
scripts/kconfig/Makefile +6 -1
@@ -111,11 +111,16 @@ # object files used by all kconfig flavo lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o -hostprogs-y := conf mconf qconf gconf kxgettext conf-objs := conf.o zconf.tab.o mconf-objs := mconf.o zconf.tab.o $(lxdialog) kxgettext-objs := kxgettext.o zconf.tab.o +hostprogs-y := conf qconf gconf kxgettext + +ifeq ($(MAKECMDGOALS),menuconfig) + hostprogs-y += mconf +endif + ifeq ($(MAKECMDGOALS),xconfig) qconf-target := 1 endif
Signature · 1 line
1.4.1
PATCH 9/13 kconfig/lxdialog: clear long menu lines
From: Sam Ravnborg <[email protected]>
Menulines that were wider than the available
line width is now properly null terminated.
While at it renamed the variable choice => line_y so it better reflect the usage in do_print_item().
--- scripts/kconfig/lxdialog/menubox.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
scripts/kconfig/lxdialog/menubox.c +6 -6
@@ -63,19 +63,19 @@ static int menu_width, item_x;/* * Print menu item */ -static void do_print_item (WINDOW * win,const char *item,int choice, +static void do_print_item (WINDOW * win,const char *item,int line_y,int selected,int hotkey) {int j;char *menu_item =malloc (menu_width +1 );strncpy (menu_item, item, menu_width - item_x); - menu_item[menu_width] =0 ; + menu_item[menu_width - item_x] ='\0' ; j =first_alpha (menu_item,"YyNnMmHh" );/* Clear 'residue' of last item */ wattrset (win, dlg.menubox.atr); -wmove (win, choice,0 ); +wmove (win, line_y,0 );#if OLD_NCURSES {int i;
@@ -86,14 +86,14 @@ #elsewclrtoeol (win);#endif wattrset (win, selected ? dlg.item_selected.atr : dlg.item.atr); -mvwaddstr (win, choice, item_x, menu_item); +mvwaddstr (win, line_y, item_x, menu_item);if (hotkey) {wattrset (win, selected ? dlg.tag_key_selected.atr : dlg.tag_key.atr); -mvwaddch (win, choice, item_x + j, menu_item[j]); +mvwaddch (win, line_y, item_x + j, menu_item[j]); }if (selected) { -wmove (win, choice, item_x +1 ); +wmove (win, line_y, item_x +1 ); }free (menu_item);wrefresh (win);
Signature · 1 line
1.4.1
PATCH 10/13 kconfig/menuconfig: do not let ncurses clutter screen on exit
From: Sam Ravnborg <[email protected]>
Do not initialize ncurses twice - it causes unpredicable results. My display was sometimes weird after running make menuconfig and I had to execute 'reset' to properly restore my display.
--- scripts/kconfig/mconf.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
scripts/kconfig/mconf.c +8 -8
@@ -401,7 +401,7 @@ static void search_conf(void)struct gstr res;int dres; again: -reset_dialog (); +dialog_clear (); dres =dialog_inputbox (_ ("Search Configuration Parameter" ),_ ("Enter CONFIG_ (sub)string to search for (omit CONFIG_)" ),10 ,75 ,"" );
@@ -603,7 +603,7 @@ static void conf(struct menu *menu)item_make (_ (" Save an Alternate Configuration File" ));item_set_tag ('S' ); } -reset_dialog (); +dialog_clear (); res =dialog_menu (prompt ? prompt :_ ("Main Menu" ),_ (menu_instructions), active_menu, &s_scroll);
@@ -684,7 +684,7 @@ static void conf(struct menu *menu)static void show_textbox (const char *title,const char *text,int r,int c) { -reset_dialog (); +dialog_clear ();dialog_textbox (title, text, r, c); }
@@ -736,7 +736,7 @@ static void conf_choice(struct menu *menif (child->sym ==sym_get_choice_value (menu->sym))item_set_tag ('X' ); } -reset_dialog (); +dialog_clear (); res =dialog_checklist (prompt ? prompt :_ ("Main Menu" ),_ (radiolist_instructions),15 ,70 ,6 );
@@ -785,7 +785,7 @@ static void conf_string(struct menu *mendefault : heading ="Internal mconf error!" ; } -reset_dialog (); +dialog_clear (); res =dialog_inputbox (prompt ? prompt :_ ("Main Menu" ), heading,10 ,75 ,sym_get_string_value (menu->sym));
@@ -809,7 +809,7 @@ static void conf_load(void)while (1 ) {int res; -reset_dialog (); +dialog_clear (); res =dialog_inputbox (NULL , load_config_text,11 ,55 , filename);switch (res) {
@@ -833,7 +833,7 @@ static void conf_save(void) {while (1 ) {int res; -reset_dialog (); +dialog_clear (); res =dialog_inputbox (NULL , save_config_text,11 ,55 , filename);switch (res) {
@@ -889,7 +889,7 @@ int main(int ac, char **av)init_dialog (menu_backtitle); do { conf(&rootmenu); - reset_dialog(); + dialog_clear(); res = dialog_yesno(NULL, _("Do you wish to save your " "new kernel configuration?\n"
Signature · 1 line
1.4.1
PATCH 11/13 kbuild: make modpost processing configurable
From: Sam Ravnborg <[email protected]>
On request from Al Viro make modpost processing configurable.
KBUILD_MODPOST_WARN can be set to make modpost warn instead of error out in case on unresolved symbols in final module link.
KBUILD_MODPOST_NOFINAL can be set to avoid the final and timeconsuming .c file generation and link of .ko files. This is solely useful for speeding up when doing compile checks with for example allmodconfig
--- scripts/Makefile.modpost | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
scripts/Makefile.modpost +8 -3
@@ -32,6 +32,10 @@ # - See include/linux/module.h for m # Step 4 is solely used to allow module versioning in external modules, # where the CRC of each module is retrieved from the Module.symers file. +# KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined +# symbols in the final module linking stage +# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules. +# This is solely usefull to speed up test compiles PHONY := _modpost _modpost: __modpost
@@ -46,7 +50,8 @@ # Step 1), find all modules listed in $( __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) -_modpost: $(modules) +# Stop after building .o files if NOFINAL is set. Makes compile tests quicker +_modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules)) # Step 2), invoke modpost
@@ -58,7 +63,7 @@ quiet_cmd_modpost = MODPOST $(words $(fi $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ - $(if $(KBUILD_EXTMOD),-w) \ + $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ $(wildcard vmlinux) $(filter-out FORCE,$^) PHONY += __modpost
@@ -92,7 +97,7 @@ targets += $(modules:.ko=.mod.o) # Step 6), final link of the modules quiet_cmd_ld_ko_o = LD [M] $@ - cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \ + cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \ $(filter-out FORCE,$^) $(modules): %.ko :%.o %.mod.o FORCE
Signature · 1 line
1.4.1
PATCH 12/13 kconfig: fix saving alternate kconfig file in parent dir
From: Sam Ravnborg <[email protected]>
This fixes bugzilla entry: 7182
http://bugzilla.kernel.org/show_bug.cgi?id=7182
With this patch we no longer append the directory part twice before saving the config file.
This patch has been sent to Roman Zippel for review with no feedback. It is so obviously simple that this should be OK to apply it anyway.
--- scripts/kconfig/confdata.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/kconfig/confdata.c +1 -1
@@ -517,7 +517,7 @@ int conf_write(const char *name)fclose (out);if (*tmpname) { -strcat (dirname, name ? name :conf_get_configname ()); +strcat (dirname, basename);strcat (dirname,".old" );rename (newname, dirname);if (rename (tmpname, newname))
Signature · 1 line
1.4.1