[gtk+/wip/baedert/children] widget: Reset focus widget on all child widgets
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/children] widget: Reset focus widget on all child widgets
- Date: Wed, 23 Nov 2016 19:37:10 +0000 (UTC)
commit e5201da902b49a67077d6dd8a5f414fe4a2ddfd6
Author: Timm Bäder <mail baedert org>
Date: Wed Nov 23 20:38:22 2016 +0100
widget: Reset focus widget on all child widgets
gtk/gtkwidget.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 286a223..126a9d9 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7272,14 +7272,17 @@ gtk_widget_grab_focus (GtkWidget *widget)
}
static void
-reset_focus_recurse (GtkWidget *widget,
- gpointer data)
+reset_focus_recurse (GtkWidget *widget)
{
+ GtkWidget *child;
gtk_widget_set_focus_child (widget, NULL);
- gtk_container_foreach (GTK_CONTAINER (widget),
- reset_focus_recurse,
- NULL);
+ for (child = gtk_widget_get_first_child (widget);
+ child != NULL;
+ child = gtk_widget_get_next_sibling (child))
+ {
+ reset_focus_recurse (child);
+ }
}
static void
@@ -7329,13 +7332,16 @@ gtk_widget_real_grab_focus (GtkWidget *focus_widget)
}
else if (toplevel != focus_widget)
{
+ GtkWidget *child;
/* gtk_widget_grab_focus() operates on a tree without window...
* actually, this is very questionable behavior.
*/
-
- gtk_container_foreach (GTK_CONTAINER (toplevel),
- reset_focus_recurse,
- NULL);
+ for (child = gtk_widget_get_first_child (toplevel);
+ child != NULL;
+ child = gtk_widget_get_next_sibling (child))
+ {
+ reset_focus_recurse (child);
+ }
}
/* now propagate the new focus up the widget tree and finally
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]