diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-10-12 16:22:52 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-10-12 21:43:17 -0400 |
commit | d9adc1b5aaf3399cad9adfabd1a5dbc6803dbbcd (patch) | |
tree | e2fcc8ce91989fa637695bb25e887e58c17858ce /gtk/gtkaccessible.c | |
parent | 3bfb32e699cb7b230382fec5e2058722d3a57515 (diff) | |
download | gtk+-d9adc1b5aaf3399cad9adfabd1a5dbc6803dbbcd.tar.gz |
accessible: Add a way to hide accessibles
Similar to gtk_widget_should_layout(), add a
gtk_accessible_should_present() function that backends can
use to determine whether an accessible should be presented
or not.
Ways to make a widget not presented in a11y:
- hide the widget
- set its role to NONE
- make it have a NULL AT context
We will use this in future to hide the GtkText inside
an entry, since the Text implementation will be done
by the wrapper.
Diffstat (limited to 'gtk/gtkaccessible.c')
-rw-r--r-- | gtk/gtkaccessible.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index dd5890ca92..49186ed0ff 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -47,6 +47,7 @@ #include "gtkatcontextprivate.h" #include "gtkenums.h" #include "gtktypebuiltins.h" +#include "gtkwidget.h" #include <glib/gi18n-lib.h> @@ -649,3 +650,15 @@ gtk_accessible_platform_changed (GtkAccessible *self, gtk_at_context_update (context); } +gboolean +gtk_accessible_should_present (GtkAccessible *self) +{ + if (GTK_IS_WIDGET (self) && + !gtk_widget_get_visible (GTK_WIDGET (self))) + return FALSE; + + if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE) + return FALSE; + + return TRUE; +} |