[gtk/a11y/component: 2/4] a11y: Add bounds change api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y/component: 2/4] a11y: Add bounds change api
- Date: Mon, 19 Oct 2020 16:20:10 +0000 (UTC)
commit d50ebd947ce33ec026a566bdbce5c7ee01457c98
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 19 11:33:38 2020 -0400
a11y: Add bounds change api
Add a way for GTK to pass bounds change information
to the AT context.
gtk/gtkaccessible.c | 27 +++++++++++++++++++++++++++
gtk/gtkaccessibleprivate.h | 2 ++
gtk/gtkatcontext.c | 12 ++++++++++++
gtk/gtkatcontextprivate.h | 3 +++
4 files changed, 44 insertions(+)
---
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c
index 582cdf08fd..bef2ced14e 100644
--- a/gtk/gtkaccessible.c
+++ b/gtk/gtkaccessible.c
@@ -699,6 +699,33 @@ gtk_accessible_get_platform_state (GtkAccessible *self,
return GTK_ACCESSIBLE_GET_IFACE (self)->get_platform_state (self, state);
}
+/*<private>
+ * gtk_accessible_bounds_changed:
+ * @self: a #GtkAccessible
+ *
+ * This function can be used to inform ATs that an
+ * accessibles bounds (ie its screen extents) have
+ * changed.
+ *
+ * Note that the bounds are not included in this API.
+ * AT backends should use widget API to obtain them.
+ */
+void
+gtk_accessible_bounds_changed (GtkAccessible *self)
+{
+ GtkATContext *context;
+
+ if (GTK_IS_WIDGET (self) &&
+ gtk_widget_get_root (GTK_WIDGET (self)) == NULL)
+ return;
+
+ context = gtk_accessible_get_at_context (self);
+ if (context == NULL)
+ return;
+
+ gtk_at_context_bounds_changed (context);
+}
+
/*<private>
* gtk_accessible_should_present:
* @self: a #GtkAccessible
diff --git a/gtk/gtkaccessibleprivate.h b/gtk/gtkaccessibleprivate.h
index b3984e3cbd..966efc3abb 100644
--- a/gtk/gtkaccessibleprivate.h
+++ b/gtk/gtkaccessibleprivate.h
@@ -47,4 +47,6 @@ void gtk_accessible_platform_changed (GtkAccessible *s
gboolean gtk_accessible_get_platform_state (GtkAccessible *self,
GtkAccessiblePlatformState state);
+void gtk_accessible_bounds_changed (GtkAccessible *self);
+
G_END_DECLS
diff --git a/gtk/gtkatcontext.c b/gtk/gtkatcontext.c
index 70608a2cb4..1925f5bf80 100644
--- a/gtk/gtkatcontext.c
+++ b/gtk/gtkatcontext.c
@@ -150,6 +150,11 @@ gtk_at_context_real_platform_change (GtkATContext *self,
{
}
+static void
+gtk_at_context_real_bounds_change (GtkATContext *self)
+{
+}
+
static void
gtk_at_context_class_init (GtkATContextClass *klass)
{
@@ -161,6 +166,7 @@ gtk_at_context_class_init (GtkATContextClass *klass)
klass->state_change = gtk_at_context_real_state_change;
klass->platform_change = gtk_at_context_real_platform_change;
+ klass->bounds_change = gtk_at_context_real_bounds_change;
/**
* GtkATContext:accessible-role:
@@ -820,3 +826,9 @@ gtk_at_context_platform_changed (GtkATContext *self,
{
GTK_AT_CONTEXT_GET_CLASS (self)->platform_change (self, change);
}
+
+void
+gtk_at_context_bounds_changed (GtkATContext *self)
+{
+ GTK_AT_CONTEXT_GET_CLASS (self)->bounds_change (self);
+}
diff --git a/gtk/gtkatcontextprivate.h b/gtk/gtkatcontextprivate.h
index 872c91e698..d1495538c1 100644
--- a/gtk/gtkatcontextprivate.h
+++ b/gtk/gtkatcontextprivate.h
@@ -122,6 +122,8 @@ struct _GtkATContextClass
void (* platform_change) (GtkATContext *self,
GtkAccessiblePlatformChange changed_platform);
+
+ void (* bounds_change) (GtkATContext *self);
};
GdkDisplay * gtk_at_context_get_display (GtkATContext *self);
@@ -154,6 +156,7 @@ char * gtk_at_context_get_label (GtkATContext
void gtk_at_context_platform_changed (GtkATContext *self,
GtkAccessiblePlatformChange change);
+void gtk_at_context_bounds_changed (GtkATContext *self);
const char * gtk_accessible_property_get_attribute_name (GtkAccessibleProperty property);
const char * gtk_accessible_relation_get_attribute_name (GtkAccessibleRelation relation);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]