[gtk/a11y/atspi: 38/43] atspicontext: Implement GetIndexInParent
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y/atspi: 38/43] atspicontext: Implement GetIndexInParent
- Date: Mon, 12 Oct 2020 15:06:46 +0000 (UTC)
commit 023366bb60abe8a14af02a3b940d838b1880ad38
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 9 20:24:52 2020 -0400
atspicontext: Implement GetIndexInParent
This is needed for ATs to take our tree seriously.
gtk/a11y/gtkatspicontext.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index 4ed4f97f18..4d24f1a959 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -200,6 +200,30 @@ handle_accessible_method (GDBusConnection *connection,
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a(so))", &builder));
}
+ else if (g_strcmp0 (method_name, "GetIndexInParent") == 0)
+ {
+ GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
+ GtkWidget *widget = GTK_WIDGET (accessible);
+ GtkWidget *parent = gtk_widget_get_parent (widget);
+ GtkWidget *child;
+ int idx;
+
+ idx = 0;
+ for (child = gtk_widget_get_first_child (parent);
+ child;
+ child = gtk_widget_get_next_sibling (child))
+ {
+ if (!gtk_widget_get_visible (child))
+ continue;
+
+ if (child == widget)
+ break;
+
+ idx++;
+ }
+
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(i)", idx));
+ }
}
static GVariant *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]