a11y: Add bounds change api

Add a way for GTK to pass bounds change information
to the AT context.
This commit is contained in:
Matthias Clasen 2020-10-19 11:33:38 -04:00
parent 8e4f8a45a9
commit d50ebd947c
4 changed files with 44 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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);