Re: Hiding the widget with the focus/default
- From: Owen Taylor <otaylor redhat com>
- To: Soeren Sandmann <sandmann daimi au dk>
- Cc: gtk-devel-list gnome org, timj gtk org
- Subject: Re: Hiding the widget with the focus/default
- Date: Tue, 12 Nov 2002 12:18:46 -0500 (EST)
Soeren Sandmann <sandmann daimi au dk> writes:
> Owen Taylor <otaylor redhat com> writes:
>
> > But it strikes me as wrong to have the focus on a hidden window,
> > so I came up with the following patch which unsets the focus
> > from within widgets when they are hidden.
>
> Would it be possible to automatically focus some other widget when the
> focus widget is hidden, perhaps by programmatically tabbing into the
> parent container?
Right now I just copied the behavior when the focus widget is
removed from the toplevel or destroyed.
Doing something more sophisticated is conceivable, but is
certainly going to be hacky.
I'm not really sure what the user would expect, and
it isn't clear that we can implement what they would
expect. Possibilities:
- Focus on the next visible widget in the tab chain...
Hard to implement, because in the middle of a complex
sequence ... say the toplevel being destroyed, it isn't
a) Clear what's going to end up visible
b) Clear if it's safe to simulate a tab key press
The algorithm would have to be something like -
"while the focus is in the widget being hidden/destroyed,
simulate a tab keypress on the toplevel".
- Focus on the first newly visible widget in the toplevel.
A bit easier to implement ... we already handle doing this
on initial map of a window without a focus widget, but still has
some of the implementation problems in a).
- Focus nowhere (what happens currently... a state we generally
try to avoid, but hopefully something that screen readers
can handle.)
> > So, it's just a special-case hack. But it's probably a useful hack?
> >
> > I'd appreciate it if anyone wanted to review this patch ... it's
> > actually smaller than it looks since most of it is just code
> > movement.
>
> The patch looks fine to me, except that I would call the new
> unset_focus_and_default(), not just unset_focus_default(). "Unsetting
> default focus" confused me a bit.
Done.
> Maybe I would also add an assertion
> that gtk_widget_get_toplevel (widget) == window.
Not a bad idea, but get_toplevel() is a bit expensive, so for an
internal function, I think I'd rather avoid it.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]