[2/2] kconfig: qconf: don't show goback button on splitMode
diff mbox series

Message ID 781cc3dc06dfe179f19c8aca8068c14890bace52.1593444492.git.mchehab+huawei@kernel.org
State New
Headers show
Series
  • Clean up goback logic
Related show

Commit Message

Mauro Carvalho Chehab June 29, 2020, 3:30 p.m. UTC
the goback button does nothing on splitMode. So, why display
it?

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/kconfig/qconf.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Masahiro Yamada June 30, 2020, 3:55 a.m. UTC | #1
On Tue, Jun 30, 2020 at 12:30 AM Mauro Carvalho Chehab
<mchehab+huawei@kernel.org> wrote:
>
> the goback button does nothing on splitMode. So, why display
> it?


Hmm, I still see the goback button
on all of the three modes...



> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
>  scripts/kconfig/qconf.cc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index d0bcc0b717f0..f49fbac91995 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -437,9 +437,10 @@ void ConfigList::updateList(ConfigItem* item)
>         if (rootEntry != &rootmenu && (mode == singleMode ||
>             (mode == symbolMode && rootEntry->parent != &rootmenu))) {
>                 item = (ConfigItem *)topLevelItem(0);
> -               if (!item)
> +               if (!item && mode != symbolMode) {
>                         item = new ConfigItem(this, 0, true);
> -               last = item;
> +                       last = item;
> +               }
>         }
>         if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
>             rootEntry->sym && rootEntry->prompt) {
> --
> 2.26.2
>
Mauro Carvalho Chehab June 30, 2020, 6:09 a.m. UTC | #2
Em Tue, 30 Jun 2020 12:55:05 +0900
Masahiro Yamada <masahiroy@kernel.org> escreveu:

> On Tue, Jun 30, 2020 at 12:30 AM Mauro Carvalho Chehab
> <mchehab+huawei@kernel.org> wrote:
> >
> > the goback button does nothing on splitMode. So, why display
> > it?  
> 
> 
> Hmm, I still see the goback button
> on all of the three modes...

Huh? 

Perhaps we're talking about a different thing here...

What I meant by goback button is this:

	◀ ..

Which is displayed as the first item is not the root config item.

This is implemented on this logic, within ConfigItem::updateMenu():

        if (goParent) {
                setPixmap(promptColIdx, list->menuBackPix);
                prompt = "..";
                goto set_prompt;
        }

and it displays this image:

	const char *xpm_menuback[] = {
	"12 12 2 1",
	"  c white",
	". c black",
	"            ",
	" .......... ",
	" .        . ",
	" .     .. . ",
	" .   .... . ",
	" . ...... . ",
	" . ...... . ",
	" .   .... . ",
	" .     .. . ",
	" .        . ",
	" .......... ",
	"            "};

This item is should never be shown on fullMode, because it never 
changes the root item. 

Looking within the code logic, the only place that passes
goParent = true to "new ConfigItem" (thus creating it) is here:

	if (rootEntry != &rootmenu && (mode == singleMode ||
	    (mode == symbolMode && rootEntry->parent != &rootmenu))) {
		item = (ConfigItem *)topLevelItem(0);
		if (!item && mode != symbolMode) {
			item = new ConfigItem(this, 0, true);
			last = item;
		}
	}

(Btw, I almost sent a patch making the "goParent" parameter explict
when creating ConfigItem)

So, even before this patch, the goback button is only displayed on
singleMode and symbolMode (with is one of the internal representations
for the split mode).

This patch should solve the split mode case.

> 
> 
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > ---
> >  scripts/kconfig/qconf.cc | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> > index d0bcc0b717f0..f49fbac91995 100644
> > --- a/scripts/kconfig/qconf.cc
> > +++ b/scripts/kconfig/qconf.cc
> > @@ -437,9 +437,10 @@ void ConfigList::updateList(ConfigItem* item)
> >         if (rootEntry != &rootmenu && (mode == singleMode ||
> >             (mode == symbolMode && rootEntry->parent != &rootmenu))) {
> >                 item = (ConfigItem *)topLevelItem(0);
> > -               if (!item)
> > +               if (!item && mode != symbolMode) {
> >                         item = new ConfigItem(this, 0, true);
> > -               last = item;
> > +                       last = item;
> > +               }
> >         }
> >         if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
> >             rootEntry->sym && rootEntry->prompt) {
> > --
> > 2.26.2
> >  
> 
> 



Thanks,
Mauro
Masahiro Yamada July 1, 2020, 3:17 p.m. UTC | #3
On Tue, Jun 30, 2020 at 3:09 PM Mauro Carvalho Chehab
<mchehab+huawei@kernel.org> wrote:
>
> Em Tue, 30 Jun 2020 12:55:05 +0900
> Masahiro Yamada <masahiroy@kernel.org> escreveu:
>
> > On Tue, Jun 30, 2020 at 12:30 AM Mauro Carvalho Chehab
> > <mchehab+huawei@kernel.org> wrote:
> > >
> > > the goback button does nothing on splitMode. So, why display
> > > it?
> >
> >
> > Hmm, I still see the goback button
> > on all of the three modes...
>
> Huh?
>
> Perhaps we're talking about a different thing here...
>
> What I meant by goback button is this:
>
>         ◀ ..


Sorry, I misunderstood the goback button.

This improvement is neat.

Thank you.





> Which is displayed as the first item is not the root config item.
>
> This is implemented on this logic, within ConfigItem::updateMenu():
>
>         if (goParent) {
>                 setPixmap(promptColIdx, list->menuBackPix);
>                 prompt = "..";
>                 goto set_prompt;
>         }
>
> and it displays this image:
>
>         const char *xpm_menuback[] = {
>         "12 12 2 1",
>         "  c white",
>         ". c black",
>         "            ",
>         " .......... ",
>         " .        . ",
>         " .     .. . ",
>         " .   .... . ",
>         " . ...... . ",
>         " . ...... . ",
>         " .   .... . ",
>         " .     .. . ",
>         " .        . ",
>         " .......... ",
>         "            "};
>
> This item is should never be shown on fullMode, because it never
> changes the root item.
>
> Looking within the code logic, the only place that passes
> goParent = true to "new ConfigItem" (thus creating it) is here:
>
>         if (rootEntry != &rootmenu && (mode == singleMode ||
>             (mode == symbolMode && rootEntry->parent != &rootmenu))) {
>                 item = (ConfigItem *)topLevelItem(0);
>                 if (!item && mode != symbolMode) {
>                         item = new ConfigItem(this, 0, true);
>                         last = item;
>                 }
>         }
>
> (Btw, I almost sent a patch making the "goParent" parameter explict
> when creating ConfigItem)
>
> So, even before this patch, the goback button is only displayed on
> singleMode and symbolMode (with is one of the internal representations
> for the split mode).
>
> This patch should solve the split mode case.
>
> >
> >
> > > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > > ---
> > >  scripts/kconfig/qconf.cc | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> > > index d0bcc0b717f0..f49fbac91995 100644
> > > --- a/scripts/kconfig/qconf.cc
> > > +++ b/scripts/kconfig/qconf.cc
> > > @@ -437,9 +437,10 @@ void ConfigList::updateList(ConfigItem* item)
> > >         if (rootEntry != &rootmenu && (mode == singleMode ||
> > >             (mode == symbolMode && rootEntry->parent != &rootmenu))) {
> > >                 item = (ConfigItem *)topLevelItem(0);
> > > -               if (!item)
> > > +               if (!item && mode != symbolMode) {
> > >                         item = new ConfigItem(this, 0, true);
> > > -               last = item;
> > > +                       last = item;
> > > +               }
> > >         }
> > >         if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
> > >             rootEntry->sym && rootEntry->prompt) {
> > > --
> > > 2.26.2
> > >
> >
> >
>
>
>
> Thanks,
> Mauro

Patch
diff mbox series

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index d0bcc0b717f0..f49fbac91995 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -437,9 +437,10 @@  void ConfigList::updateList(ConfigItem* item)
 	if (rootEntry != &rootmenu && (mode == singleMode ||
 	    (mode == symbolMode && rootEntry->parent != &rootmenu))) {
 		item = (ConfigItem *)topLevelItem(0);
-		if (!item)
+		if (!item && mode != symbolMode) {
 			item = new ConfigItem(this, 0, true);
-		last = item;
+			last = item;
+		}
 	}
 	if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
 	    rootEntry->sym && rootEntry->prompt) {