[gtk/matthiasc/atspi-child] a11y: Handle HIDDEN state changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/atspi-child] a11y: Handle HIDDEN state changes
- Date: Sat, 24 Oct 2020 15:18:16 +0000 (UTC)
commit b12992c1cbf96ed7b6c46caf0fc1de40a35b9c92
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 24 11:14:18 2020 -0400
a11y: Handle HIDDEN state changes
Hidden elements are not presented in the accessible
tree, so when then HIDDEN state changes, we should
emit child-added or -removed signals.
This commit does not yet handle all cases (HIDDEN
toplevels or hidden stack pages are not handled),
but it should cover the common case.
gtk/a11y/gtkatspicontext.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index be3cb128e6..18a1d7ff9c 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -34,7 +34,6 @@
#include "gtkatspiutilsprivate.h"
#include "gtkatspivalueprivate.h"
#include "gtkatspicomponentprivate.h"
-
#include "a11y/atspi/atspi-accessible.h"
#include "a11y/atspi/atspi-action.h"
#include "a11y/atspi/atspi-editabletext.h"
@@ -848,6 +847,29 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
if (!gtk_widget_get_realized (widget))
return;
+ if (changed_states & GTK_ACCESSIBLE_STATE_CHANGE_HIDDEN)
+ {
+ GtkWidget *parent;
+ gboolean hidden;
+
+ value = gtk_accessible_attribute_set_get_value (states, GTK_ACCESSIBLE_STATE_HIDDEN);
+ hidden = gtk_boolean_accessible_value_get (value);
+
+ parent = gtk_widget_get_parent (widget);
+ if (parent)
+ {
+ if (GTK_IS_STACK (parent))
+ g_warning ("Setting GTK_ACCESSIBLE_STATE_HIDDEN on stack children is not supported");
+ else
+ gtk_at_context_child_changed (gtk_accessible_get_at_context (GTK_ACCESSIBLE (parent)),
+ hidden ? GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED
+ : GTK_ACCESSIBLE_CHILD_CHANGE_ADDED,
+ GTK_ACCESSIBLE (widget));
+ }
+ else
+ g_warning ("Setting GTK_ACCESSIBLE_STATE_HIDDEN on toplevels is not supported");
+ }
+
if (changed_states & GTK_ACCESSIBLE_STATE_CHANGE_BUSY)
{
value = gtk_accessible_attribute_set_get_value (states, GTK_ACCESSIBLE_STATE_BUSY);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]