Keynav on togglebuttons



Damon recently filed a couple of bugs he noticed porting the widget
palette in Glade to GTK+-2.0. (#65723, #65725)

The way the widget palette works is that it is _one_ radio group split
over three notebook pages. draw_indicator is FALSE for the radio
buttons so they look like normal toggle buttons.

The new radiobutton keynav code (arrow keys focus between all the
buttons in the group and activate them immediately, radio buttons 
look like a single <Tab> focus point) causes two problems:

 A) The immediately-switch-page behavior is not very intuitive
    when the radio buttons represent the current tool and 
    there are this many of them.

    I suspect that we should turn off the immediately-activate
    behavior for radio buttons that look like toggle buttons
    on the theory:
   
     "If it looks like toggle button, it should focus like
      a toggle button"
 
    We could do this by either just removing the activate code
    in gtk_radio_button_focus() in the draw_indicator case,
    or by skipping that code entirely and chaining up
    to the default focus implementation.

    The difference here would be:

      If we just turn off immediate activatation, the buttons
      are one focus point, and you need to use arrow keys
      to focus between them.

      If we go to the default focus code, then we will have
      one tab location per button, like any other group
      of buttons.

    I suspect the first one is more useable, for Glade
    at least, since there are a _lot_ of buttons, but 
    it might be suprising in other cases. (You could argue,
    if you don't want suprises, don't set draw_indicator to
    FALSE)

 B) The focus moves between not only the buttons on one page,
    but between buttons on all pages, probably with random
    intermixing. Clearly this is undesirable. Thoughts
    on fixing this:
 
     * gtk_widget_grab_focus() on a widget inside a notebook
       page should probably switch to that page. We don't
       do that currently, but it wouldn't be hard to do.
       This doesn't solve this particular problem.

     * if we just bypassed the radio button focus code for
       the draw_indicator = FALSE case, then the problem would 
       go away. But I'm leaning against doing that.

     * The solution is probably to make the radio button
       focus code only focus viewable (widget and all parents
       mapped) widgets, the same thing should probably be
       done in gtkcontainer.c.

So, my current plan of attack is:

 - Make the radio button code skip !viewable children.
   Cut and paste that into GtkContainer.c.

 - Skip the immediate activate if draw_indicator = FALSE.

 - File a bug about grab_focus() switching the notebook
   page or just do it. (It's a few lines in 
   gtk_notebook_set_focus_child())

I'd be interested in feedback about how other people think
the behavior should be and if this sounds reasonable.

Thanks,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]