Commit 3ad03b17 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

a11y: Add a separate vfunc for platform changes

The state_change vfunc is becoming unwieldy. Lets move
the platform changes to their own vfunc, as a start.
parent dfe00c4a
......@@ -781,7 +781,6 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
GtkAccessibleStateChange changed_states,
GtkAccessiblePropertyChange changed_properties,
GtkAccessibleRelationChange changed_relations,
GtkAccessiblePlatformChange changed_platform,
GtkAccessibleAttributeSet *states,
GtkAccessibleAttributeSet *properties,
GtkAccessibleAttributeSet *relations)
......@@ -939,6 +938,22 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
GVariant *v = g_variant_new_take_string (label);
emit_property_changed (self, "accessible-description", v);
}
}
static void
gtk_at_spi_context_platform_change (GtkATContext *ctx,
GtkAccessiblePlatformChange changed_platform)
{
GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (ctx);
GtkAccessible *accessible = gtk_at_context_get_accessible (ctx);
GtkWidget *widget;
if (!GTK_IS_WIDGET (accessible))
return;
widget = GTK_WIDGET (accessible);
if (!gtk_widget_get_realized (widget))
return;
if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSABLE)
{
......@@ -1223,6 +1238,7 @@ gtk_at_spi_context_class_init (GtkAtSpiContextClass *klass)
gobject_class->dispose = gtk_at_spi_context_dispose;
context_class->state_change = gtk_at_spi_context_state_change;
context_class->platform_change = gtk_at_spi_context_platform_change;
obj_props[PROP_BUS_ADDRESS] =
g_param_spec_string ("bus-address", NULL, NULL,
......
......@@ -138,13 +138,18 @@ gtk_at_context_real_state_change (GtkATContext *self,
GtkAccessibleStateChange changed_states,
GtkAccessiblePropertyChange changed_properties,
GtkAccessibleRelationChange changed_relations,
GtkAccessiblePlatformChange changed_platform,
GtkAccessibleAttributeSet *states,
GtkAccessibleAttributeSet *properties,
GtkAccessibleAttributeSet *relations)
{
}
static void
gtk_at_context_real_platform_change (GtkATContext *self,
GtkAccessiblePlatformChange change)
{
}
static void
gtk_at_context_class_init (GtkATContextClass *klass)
{
......@@ -155,6 +160,7 @@ gtk_at_context_class_init (GtkATContextClass *klass)
gobject_class->finalize = gtk_at_context_finalize;
klass->state_change = gtk_at_context_real_state_change;
klass->platform_change = gtk_at_context_real_platform_change;
/**
* GtkATContext:accessible-role:
......@@ -506,8 +512,7 @@ gtk_at_context_update (GtkATContext *self)
/* There's no point in notifying of state changes if there weren't any */
if (self->updated_properties == 0 &&
self->updated_relations == 0 &&
self->updated_states == 0 &&
self->updated_platform == 0)
self->updated_states == 0)
return;
GtkAccessibleStateChange changed_states =
......@@ -519,14 +524,12 @@ gtk_at_context_update (GtkATContext *self)
GTK_AT_CONTEXT_GET_CLASS (self)->state_change (self,
changed_states, changed_properties, changed_relations,
self->updated_platform,
self->states, self->properties, self->relations);
g_signal_emit (self, obj_signals[STATE_CHANGE], 0);
self->updated_properties = 0;
self->updated_relations = 0;
self->updated_states = 0;
self->updated_platform = 0;
}
/*< private >
......@@ -815,5 +818,5 @@ void
gtk_at_context_platform_changed (GtkATContext *self,
GtkAccessiblePlatformChange change)
{
self->updated_platform |= change;
GTK_AT_CONTEXT_GET_CLASS (self)->platform_change (self, change);
}
......@@ -116,10 +116,12 @@ struct _GtkATContextClass
GtkAccessibleStateChange changed_states,
GtkAccessiblePropertyChange changed_properties,
GtkAccessibleRelationChange changed_relations,
GtkAccessiblePlatformChange changed_platform,
GtkAccessibleAttributeSet *states,
GtkAccessibleAttributeSet *properties,
GtkAccessibleAttributeSet *relations);
void (* platform_change) (GtkATContext *self,
GtkAccessiblePlatformChange changed_platform);
};
GdkDisplay * gtk_at_context_get_display (GtkATContext *self);
......
......@@ -46,7 +46,6 @@ gtk_test_at_context_state_change (GtkATContext *self,
GtkAccessibleStateChange changed_states,
GtkAccessiblePropertyChange changed_properties,
GtkAccessibleRelationChange changed_relations,
GtkAccessiblePlatformChange changed_platform,
GtkAccessibleAttributeSet *states,
GtkAccessibleAttributeSet *properties,
GtkAccessibleAttributeSet *relations)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment