diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-10-19 11:33:38 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-10-19 12:19:55 -0400 |
commit | d50ebd947ce33ec026a566bdbce5c7ee01457c98 (patch) | |
tree | b0e14a5aa7ab37919c3da1c5fb3173a59d5f2d5c /gtk | |
parent | 8e4f8a45a9b8cda3bc3d12fb50d805897b1902e2 (diff) | |
download | gtk+-d50ebd947ce33ec026a566bdbce5c7ee01457c98.tar.gz |
a11y: Add bounds change api
Add a way for GTK to pass bounds change information
to the AT context.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkaccessible.c | 27 | ||||
-rw-r--r-- | gtk/gtkaccessibleprivate.h | 2 | ||||
-rw-r--r-- | gtk/gtkatcontext.c | 12 | ||||
-rw-r--r-- | gtk/gtkatcontextprivate.h | 3 |
4 files changed, 44 insertions, 0 deletions
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index 582cdf08fd..bef2ced14e 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -700,6 +700,33 @@ gtk_accessible_get_platform_state (GtkAccessible *self, } /*<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 @@ -151,6 +151,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) { GObjectClass *gobject_class = G_OBJECT_CLASS (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); |