Skip to content

add focus handling to gtkroot

Matthias Clasen requested to merge wip/matthiasc/focus2 into master

This branch does the following:

  • drop GtkContainer::set_focus_child
  • drop GtkWidget::focus
  • drop GtkWindow::set-focus
  • add GtkWidget::next-focus-child and gtk_widget_get_next_focus
  • add GtkRoot::focus-widget property, with getter and setter
  • use the root apis in widgets

The widget api for focus is ::next-focus-child, which is supposed to return the child where focus would end up next, when hitting Tab. Note that the api is only operating in terms of direct children, but the focus may well end up on a deeper descendant. gtk_widget_get_next_focus() will recursively use ::next-focus-child to find the next focusable location.

We do maintain a ::focus-child for each widget, so that the ::focus-child chain from the root will always lead to the focus-widget. We don't clean up focus-child when focus moves, so it can be used to find the last focus position inside a subtree after the focus left it (that is what notebooks, stacks and paneds try to do in different ways now).

Edited by Matthias Clasen

Merge request reports