* [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized"
@ 2014-11-06 12:03 Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Don't move focus when clicking on the search button Peter Kümmel
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Peter Kümmel @ 2014-11-06 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Peter Kümmel
Warning:
In file included from scripts/kconfig/zconf.tab.c:2537:0:
scripts/kconfig/menu.c: In function ‘get_symbol_str’:
scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
jump->offset = strlen(r->s);
Simplifies the test logic because (head && local) means (jump != 0)
and makes GCC happy when checking if the jump pointer was initialized.
Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
---
| 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index a26cc5d..72c9dba 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
{
int i, j;
struct menu *submenu[8], *menu, *location = NULL;
- struct jump_key *jump;
+ struct jump_key *jump = NULL;
str_printf(r, _("Prompt: %s\n"), _(prop->text));
menu = prop->menu->parent;
@@ -586,7 +586,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
str_printf(r, _(" Location:\n"));
for (j = 4; --i >= 0; j += 2) {
menu = submenu[i];
- if (head && location && menu == location)
+ if (jump && menu == location)
jump->offset = strlen(r->s);
str_printf(r, "%*c-> %s", j, ' ',
_(menu_get_prompt(menu)));
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH] xconfig: Don't move focus when clicking on the search button
2014-11-06 12:03 [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Peter Kümmel
@ 2014-11-06 12:03 ` Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Set configuration strings on focus lost Peter Kümmel
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Peter Kümmel @ 2014-11-06 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Peter Kümmel
When the search button is clicked the focus moves to the
search button. Changing the search text after such a button
press requires an additional click into the edit field.
With this patch this click is not necessary anymore because
the button is configured to not accept the focus.
Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
---
scripts/kconfig/qconf.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9d3b04b..750a5ff 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1198,6 +1198,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
layout2->addWidget(editField);
searchButton = new QPushButton(_("Search"), this);
searchButton->setAutoDefault(FALSE);
+ searchButton->setFocusPolicy(Qt::NoFocus);
connect(searchButton, SIGNAL(clicked()), SLOT(search()));
layout2->addWidget(searchButton);
layout1->addLayout(layout2);
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH] xconfig: Set configuration strings on focus lost
2014-11-06 12:03 [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Don't move focus when clicking on the search button Peter Kümmel
@ 2014-11-06 12:03 ` Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Set keyboard focus to line edit whenever the search dialog opens Peter Kümmel
2014-11-06 12:36 ` [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Paul Bolle
3 siblings, 0 replies; 6+ messages in thread
From: Peter Kümmel @ 2014-11-06 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Peter Kümmel
A change to a string configuration is currently only
recogniized by pressing enter/return. When you just
click to another entry after the string was edited
the change is not set. Additionally when you come
back to the string configuration your changes are lost.
With this patch the string changes are automatically set
when the focus leaves the edit field. There is still
the possibility to drop any changes by pressing ESC.
Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
---
scripts/kconfig/qconf.cc | 23 +++++++++++++++++++----
scripts/kconfig/qconf.h | 2 ++
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9d3b04b..f08472e 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -302,13 +302,18 @@ ConfigLineEdit::ConfigLineEdit(ConfigView* parent)
connect(this, SIGNAL(lostFocus()), SLOT(hide()));
}
-void ConfigLineEdit::show(ConfigItem* i)
+void ConfigLineEdit::updateLineEditText(ConfigItem* i)
{
- item = i;
- if (sym_get_string_value(item->menu->sym))
- setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym)));
+ if (sym_get_string_value(i->menu->sym))
+ setText(QString::fromLocal8Bit(sym_get_string_value(i->menu->sym)));
else
setText(QString::null);
+}
+
+void ConfigLineEdit::show(ConfigItem* i)
+{
+ item = i;
+ updateLineEditText(item);
Parent::show();
setFocus();
}
@@ -317,6 +322,7 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
{
switch (e->key()) {
case Qt::Key_Escape:
+ updateLineEditText(item);
break;
case Qt::Key_Return:
case Qt::Key_Enter:
@@ -332,6 +338,15 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
hide();
}
+void ConfigLineEdit::focusOutEvent(QFocusEvent *e)
+{
+ if (e->lostFocus()) {
+ sym_set_string_value(item->menu->sym, text().latin1());
+ parent()->updateList(item);
+ }
+ Parent::focusOutEvent(e);
+}
+
ConfigList::ConfigList(ConfigView* p, const char *name)
: Parent(p, name),
updateAll(false),
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index bde0c6b..11efb71 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -209,8 +209,10 @@ public:
{
return (ConfigView*)Parent::parent();
}
+ void updateLineEditText(ConfigItem *i);
void show(ConfigItem *i);
void keyPressEvent(QKeyEvent *e);
+ void focusOutEvent(QFocusEvent *e);
public:
ConfigItem *item;
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH] xconfig: Set keyboard focus to line edit whenever the search dialog opens
2014-11-06 12:03 [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Don't move focus when clicking on the search button Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Set configuration strings on focus lost Peter Kümmel
@ 2014-11-06 12:03 ` Peter Kümmel
2014-11-06 12:36 ` [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Paul Bolle
3 siblings, 0 replies; 6+ messages in thread
From: Peter Kümmel @ 2014-11-06 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Peter Kümmel
When after a search on a result is clicked the focus jumps to
the result list. So after closing and reopening the dialog the
field does not have the focus any more. This is annoying when
you press Ctrl-F and start typing for a new search because
the text shows not up in the edit field but gets lost. You
have to click additionally into the edit field to move the
focus to this field. With this patch the focus is always set
to the edit field when the dialog opens.
Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
---
scripts/kconfig/qconf.cc | 6 ++++++
scripts/kconfig/qconf.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9d3b04b..7ef498d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1235,6 +1235,11 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
}
}
+void ConfigSearchWindow::setFocusOnLineEdit()
+{
+ editField->setFocus(Qt::OtherFocusReason);
+}
+
void ConfigSearchWindow::saveSettings(void)
{
if (name()) {
@@ -1506,6 +1511,7 @@ void ConfigMainWindow::searchConfig(void)
if (!searchWindow)
searchWindow = new ConfigSearchWindow(this, "search");
searchWindow->show();
+ searchWindow->setFocusOnLineEdit();
}
void ConfigMainWindow::changeMenu(struct menu *menu)
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index bde0c6b..6f2c4d6 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -288,6 +288,7 @@ public:
public slots:
void saveSettings(void);
void search(void);
+ void setFocusOnLineEdit(void);
protected:
QLineEdit* editField;
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized"
2014-11-06 12:03 [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Peter Kümmel
` (2 preceding siblings ...)
2014-11-06 12:03 ` [PATCH] xconfig: Set keyboard focus to line edit whenever the search dialog opens Peter Kümmel
@ 2014-11-06 12:36 ` Paul Bolle
2014-11-06 14:13 ` Aw: " Peter Kuemmel
3 siblings, 1 reply; 6+ messages in thread
From: Paul Bolle @ 2014-11-06 12:36 UTC (permalink / raw)
To: Peter Kümmel; +Cc: linux-kernel
On Thu, 2014-11-06 at 13:03 +0100, Peter Kümmel wrote:
> Warning:
> In file included from scripts/kconfig/zconf.tab.c:2537:0:
> scripts/kconfig/menu.c: In function ‘get_symbol_str’:
> scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> jump->offset = strlen(r->s);
>
> Simplifies the test logic because (head && local) means (jump != 0)
> and makes GCC happy when checking if the jump pointer was initialized.
>
> Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
> ---
Is this patch and the three others patches you just sent identical (or
not) to the four patches you sent yesterday and the day before yesterday
to linux-kbuild and Yann Morin? Either way, why are you posting them to
lkml now?
> scripts/kconfig/menu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index a26cc5d..72c9dba 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
> {
> int i, j;
> struct menu *submenu[8], *menu, *location = NULL;
> - struct jump_key *jump;
> + struct jump_key *jump = NULL;
>
> str_printf(r, _("Prompt: %s\n"), _(prop->text));
> menu = prop->menu->parent;
> @@ -586,7 +586,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
> str_printf(r, _(" Location:\n"));
> for (j = 4; --i >= 0; j += 2) {
> menu = submenu[i];
> - if (head && location && menu == location)
> + if (jump && menu == location)
> jump->offset = strlen(r->s);
> str_printf(r, "%*c-> %s", j, ' ',
> _(menu_get_prompt(menu)));
^ permalink raw reply [flat|nested] 6+ messages in thread* Aw: Re: [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized"
2014-11-06 12:36 ` [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Paul Bolle
@ 2014-11-06 14:13 ` Peter Kuemmel
0 siblings, 0 replies; 6+ messages in thread
From: Peter Kuemmel @ 2014-11-06 14:13 UTC (permalink / raw)
To: Paul Bolle; +Cc: linux-kernel
They are identical.
lkml is also listed by ./scripts/get_maintainer.pl, so I thought patches should also be send to lkml.
Peter
> Gesendet: Donnerstag, 06. November 2014 um 13:36 Uhr
> Von: "Paul Bolle" <pebolle@tiscali.nl>
> An: "Peter Kümmel" <syntheticpp@gmx.net>
> Cc: linux-kernel@vger.kernel.org
> Betreff: Re: [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized"
>
> On Thu, 2014-11-06 at 13:03 +0100, Peter Kümmel wrote:
> > Warning:
> > In file included from scripts/kconfig/zconf.tab.c:2537:0:
> > scripts/kconfig/menu.c: In function ‘get_symbol_str’:
> > scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> > jump->offset = strlen(r->s);
> >
> > Simplifies the test logic because (head && local) means (jump != 0)
> > and makes GCC happy when checking if the jump pointer was initialized.
> >
> > Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
> > ---
>
> Is this patch and the three others patches you just sent identical (or
> not) to the four patches you sent yesterday and the day before yesterday
> to linux-kbuild and Yann Morin? Either way, why are you posting them to
> lkml now?
>
> > scripts/kconfig/menu.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> > index a26cc5d..72c9dba 100644
> > --- a/scripts/kconfig/menu.c
> > +++ b/scripts/kconfig/menu.c
> > @@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
> > {
> > int i, j;
> > struct menu *submenu[8], *menu, *location = NULL;
> > - struct jump_key *jump;
> > + struct jump_key *jump = NULL;
> >
> > str_printf(r, _("Prompt: %s\n"), _(prop->text));
> > menu = prop->menu->parent;
> > @@ -586,7 +586,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
> > str_printf(r, _(" Location:\n"));
> > for (j = 4; --i >= 0; j += 2) {
> > menu = submenu[i];
> > - if (head && location && menu == location)
> > + if (jump && menu == location)
> > jump->offset = strlen(r->s);
> > str_printf(r, "%*c-> %s", j, ' ',
> > _(menu_get_prompt(menu)));
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-11-06 14:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-06 12:03 [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Don't move focus when clicking on the search button Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Set configuration strings on focus lost Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Set keyboard focus to line edit whenever the search dialog opens Peter Kümmel
2014-11-06 12:36 ` [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Paul Bolle
2014-11-06 14:13 ` Aw: " Peter Kuemmel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®