forked from AuroraMiddleware/gtk
a11y: Handle all cases for state change
Make state_change handle state changes for non-widgets, and handle the cases for HIDDEN involving stack pages.
This commit is contained in:
parent
9a943e21d3
commit
8ffb398517
@ -837,41 +837,38 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
||||
{
|
||||
GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (ctx);
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (ctx);
|
||||
GtkWidget *widget;
|
||||
GtkAccessibleValue *value;
|
||||
|
||||
if (!GTK_IS_WIDGET (accessible))
|
||||
return;
|
||||
|
||||
widget = GTK_WIDGET (accessible);
|
||||
if (!gtk_widget_get_realized (widget))
|
||||
if (GTK_IS_WIDGET (accessible) && !gtk_widget_get_realized (GTK_WIDGET (accessible)))
|
||||
return;
|
||||
|
||||
if (changed_states & GTK_ACCESSIBLE_STATE_CHANGE_HIDDEN)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
gboolean hidden;
|
||||
GtkATContext *context;
|
||||
GtkAccessibleChildChange change;
|
||||
|
||||
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");
|
||||
if (gtk_boolean_accessible_value_get (value))
|
||||
change = GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED;
|
||||
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));
|
||||
change = GTK_ACCESSIBLE_CHILD_CHANGE_ADDED;
|
||||
|
||||
if (GTK_IS_ROOT (accessible))
|
||||
{
|
||||
gtk_at_spi_root_child_changed (self->root, change, accessible);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_at_spi_root_child_changed (self->root,
|
||||
hidden ? GTK_ACCESSIBLE_CHILD_STATE_REMOVED
|
||||
: GTK_ACCESSIBLE_CHILD_STATE_ADDED,
|
||||
widget);
|
||||
if (GTK_IS_WIDGET (accessible))
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (accessible));
|
||||
else if (GTK_IS_STACK_PAGE (accessible))
|
||||
parent = gtk_widget_get_parent (gtk_stack_page_get_child (GTK_STACK_PAGE (accessible)));
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (parent));
|
||||
gtk_at_context_child_changed (context, change, accessible);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1097,15 +1094,12 @@ gtk_at_spi_context_child_change (GtkATContext *ctx,
|
||||
GtkWidget *child_widget;
|
||||
int idx = 0;
|
||||
|
||||
if (!GTK_IS_WIDGET (accessible) || !GTK_IS_WIDGET (child))
|
||||
if (!GTK_IS_WIDGET (accessible))
|
||||
return;
|
||||
|
||||
if (child_context == NULL)
|
||||
return;
|
||||
|
||||
parent_widget = GTK_WIDGET (accessible);
|
||||
child_widget = GTK_WIDGET (child);
|
||||
|
||||
/* handle the stack page special case */
|
||||
if (GTK_IS_WIDGET (child) &&
|
||||
GTK_IS_STACK (gtk_widget_get_parent (GTK_WIDGET (child))))
|
||||
@ -1163,6 +1157,13 @@ gtk_at_spi_context_child_change (GtkATContext *ctx,
|
||||
return;
|
||||
}
|
||||
|
||||
parent_widget = GTK_WIDGET (accessible);
|
||||
|
||||
if (GTK_IS_STACK_PAGE (child))
|
||||
child_widget = gtk_stack_page_get_child (GTK_STACK_PAGE (child));
|
||||
else
|
||||
child_widget = GTK_WIDGET (child);
|
||||
|
||||
if (gtk_widget_get_parent (child_widget) != parent_widget)
|
||||
{
|
||||
idx = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user