From 0eb47346968f9b3852bbc56115f4feeecf23ea40 Mon Sep 17 00:00:00 2001 From: Cheah Kok Cheong Date: Mon, 28 Nov 2016 00:28:26 +0800 Subject: Scripts: kconfig: nconf: fix _GNU_SOURCE redefined warning Fix below warning when make nconfig is run initially or after make clean. HOSTCC scripts/kconfig/nconf.o scripts/kconfig/nconf.c:8:0: warning: "_GNU_SOURCE" redefined #define _GNU_SOURCE ^ :0:0: note: this is the location of the previous definition Signed-off-by: Cheah Kok Cheong Signed-off-by: Michal Marek --- scripts/kconfig/nconf.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index d42d534a66cd..a9bc5334a478 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -5,7 +5,9 @@ * Derived from menuconfig. * */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include -- cgit v1.2.3-59-g8ed1b From 79e51b5c2deea542b3bb8c66e0d502230b017dde Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 24 Nov 2016 22:10:23 +0000 Subject: kconfig/nconf: Fix hang when editing symbol with a long prompt Currently it is impossible to edit the value of a config symbol with a prompt longer than (terminal width - 2) characters. dialog_inputbox() calculates a negative x-offset for the input window and newwin() fails as this is invalid. It also doesn't check for this failure, so it busy-loops calling wgetch(NULL) which immediately returns -1. The additions in the offset calculations also don't match the intended size of the window. Limit the window size and calculate the offset similarly to show_scroll_win(). Cc: stable Fixes: 692d97c380c6 ("kconfig: new configuration interface (nconfig)") Signed-off-by: Ben Hutchings --- scripts/kconfig/nconf.gui.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c index 8275f0e55106..4b2f44c20caf 100644 --- a/scripts/kconfig/nconf.gui.c +++ b/scripts/kconfig/nconf.gui.c @@ -364,12 +364,14 @@ int dialog_inputbox(WINDOW *main_window, WINDOW *prompt_win; WINDOW *form_win; PANEL *panel; - int i, x, y; + int i, x, y, lines, columns, win_lines, win_cols; int res = -1; int cursor_position = strlen(init); int cursor_form_win; char *result = *resultp; + getmaxyx(stdscr, lines, columns); + if (strlen(init)+1 > *result_len) { *result_len = strlen(init)+1; *resultp = result = realloc(result, *result_len); @@ -386,14 +388,19 @@ int dialog_inputbox(WINDOW *main_window, if (title) prompt_width = max(prompt_width, strlen(title)); + win_lines = min(prompt_lines+6, lines-2); + win_cols = min(prompt_width+7, columns-2); + prompt_lines = max(win_lines-6, 0); + prompt_width = max(win_cols-7, 0); + /* place dialog in middle of screen */ - y = (getmaxy(stdscr)-(prompt_lines+4))/2; - x = (getmaxx(stdscr)-(prompt_width+4))/2; + y = (lines-win_lines)/2; + x = (columns-win_cols)/2; strncpy(result, init, *result_len); /* create the windows */ - win = newwin(prompt_lines+6, prompt_width+7, y, x); + win = newwin(win_lines, win_cols, y, x); prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2); form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2); keypad(form_win, TRUE); -- cgit v1.2.3-59-g8ed1b From e039303ff71a0fd89d009a24b1eab230ce907288 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Wed, 30 Nov 2016 14:57:52 -0800 Subject: xconfig: fix 'Show Debug' functionality xconfig - Fix missing 'Show Debug' functionality. xconfig Help mentions 'Show Debug Info' but it was missing from any menu. * Add 'Show debug' menu to the main menu. * Properly load showDebug settings. Reported-by: Jason Vas Dias Signed-off-by: Boris Barbulovski Signed-off-by: Randy Dunlap Tested-by: Randy Dunlap Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index fc5555992220..45e3169e8ee1 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1014,7 +1014,7 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) if (!objectName().isEmpty()) { configSettings->beginGroup(objectName()); - _showDebug = configSettings->value("/showDebug", false).toBool(); + setShowDebug(configSettings->value("/showDebug", false).toBool()); configSettings->endGroup(); connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); } @@ -1474,6 +1474,7 @@ ConfigMainWindow::ConfigMainWindow(void) optionMenu->addSeparator(); optionMenu->addActions(optGroup->actions()); optionMenu->addSeparator(); + optionMenu->addAction(showDebugAction); // create help menu menu->addSeparator(); -- cgit v1.2.3-59-g8ed1b From 83c3a1bad224189f22ca2c1955337c3478bd3ab2 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Wed, 30 Nov 2016 14:57:55 -0800 Subject: xconfig: fix missing suboption and help panels on first run qconfig initial slider sizes fix. On first `make xconfig`, suboption and help panels were hidden. Now we properly detect the first run, and show those panels. Reported-by: Jason Vas Dias Signed-off-by: Boris Barbulovski Signed-off-by: Randy Dunlap Tested-by: Randy Dunlap Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 45e3169e8ee1..ae6c72546411 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -65,11 +65,19 @@ ConfigSettings::ConfigSettings() QList ConfigSettings::readSizes(const QString& key, bool *ok) { QList result; - QStringList entryList = value(key).toStringList(); - QStringList::Iterator it; - for (it = entryList.begin(); it != entryList.end(); ++it) - result.push_back((*it).toInt()); + if (contains(key)) + { + QStringList entryList = value(key).toStringList(); + QStringList::Iterator it; + + for (it = entryList.begin(); it != entryList.end(); ++it) + result.push_back((*it).toInt()); + + *ok = true; + } + else + *ok = false; return result; } -- cgit v1.2.3-59-g8ed1b