[gtk/a11y-fixes: 1/12] a11y: Report children of widgets
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y-fixes: 1/12] a11y: Report children of widgets
- Date: Thu, 6 Feb 2020 23:43:35 +0000 (UTC)
commit b3f5243aeb6a2b06d66b11b8cebcbb8770b2151e
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Feb 5 23:07:33 2020 -0500
a11y: Report children of widgets
We want children of composite accessibles to be
reported.
gtk/a11y/gtkwidgetaccessible.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c
index 0a07f47fe2..79c38a8f01 100644
--- a/gtk/a11y/gtkwidgetaccessible.c
+++ b/gtk/a11y/gtkwidgetaccessible.c
@@ -409,16 +409,26 @@ gtk_widget_accessible_get_index_in_parent (AtkObject *accessible)
}
}
- if (!GTK_IS_WIDGET (widget))
- return -1;
parent_widget = gtk_widget_get_parent (widget);
- if (!GTK_IS_CONTAINER (parent_widget))
- return -1;
+ if (GTK_IS_CONTAINER (parent_widget))
+ {
+ children = gtk_container_get_children (GTK_CONTAINER (parent_widget));
+ index = g_list_index (children, widget);
+ g_list_free (children);
+ }
+ else if (GTK_IS_WIDGET (parent_widget))
+ {
+ GtkWidget *child;
- children = gtk_container_get_children (GTK_CONTAINER (parent_widget));
+ for (child = gtk_widget_get_first_child (parent_widget), index = 0; child; child =
gtk_widget_get_next_sibling (child), index++)
+ {
+ if (child == widget)
+ break;
+ }
+ }
+ else
+ index = -1;
- index = g_list_index (children, widget);
- g_list_free (children);
return index;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]