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.
This commit is contained in:
@@ -781,7 +781,6 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
|||||||
GtkAccessibleStateChange changed_states,
|
GtkAccessibleStateChange changed_states,
|
||||||
GtkAccessiblePropertyChange changed_properties,
|
GtkAccessiblePropertyChange changed_properties,
|
||||||
GtkAccessibleRelationChange changed_relations,
|
GtkAccessibleRelationChange changed_relations,
|
||||||
GtkAccessiblePlatformChange changed_platform,
|
|
||||||
GtkAccessibleAttributeSet *states,
|
GtkAccessibleAttributeSet *states,
|
||||||
GtkAccessibleAttributeSet *properties,
|
GtkAccessibleAttributeSet *properties,
|
||||||
GtkAccessibleAttributeSet *relations)
|
GtkAccessibleAttributeSet *relations)
|
||||||
@@ -939,6 +938,22 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
|||||||
GVariant *v = g_variant_new_take_string (label);
|
GVariant *v = g_variant_new_take_string (label);
|
||||||
emit_property_changed (self, "accessible-description", v);
|
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)
|
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;
|
gobject_class->dispose = gtk_at_spi_context_dispose;
|
||||||
|
|
||||||
context_class->state_change = gtk_at_spi_context_state_change;
|
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] =
|
obj_props[PROP_BUS_ADDRESS] =
|
||||||
g_param_spec_string ("bus-address", NULL, NULL,
|
g_param_spec_string ("bus-address", NULL, NULL,
|
||||||
|
|||||||
@@ -138,13 +138,18 @@ gtk_at_context_real_state_change (GtkATContext *self,
|
|||||||
GtkAccessibleStateChange changed_states,
|
GtkAccessibleStateChange changed_states,
|
||||||
GtkAccessiblePropertyChange changed_properties,
|
GtkAccessiblePropertyChange changed_properties,
|
||||||
GtkAccessibleRelationChange changed_relations,
|
GtkAccessibleRelationChange changed_relations,
|
||||||
GtkAccessiblePlatformChange changed_platform,
|
|
||||||
GtkAccessibleAttributeSet *states,
|
GtkAccessibleAttributeSet *states,
|
||||||
GtkAccessibleAttributeSet *properties,
|
GtkAccessibleAttributeSet *properties,
|
||||||
GtkAccessibleAttributeSet *relations)
|
GtkAccessibleAttributeSet *relations)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_at_context_real_platform_change (GtkATContext *self,
|
||||||
|
GtkAccessiblePlatformChange change)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_at_context_class_init (GtkATContextClass *klass)
|
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;
|
gobject_class->finalize = gtk_at_context_finalize;
|
||||||
|
|
||||||
klass->state_change = gtk_at_context_real_state_change;
|
klass->state_change = gtk_at_context_real_state_change;
|
||||||
|
klass->platform_change = gtk_at_context_real_platform_change;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkATContext:accessible-role:
|
* 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 */
|
/* There's no point in notifying of state changes if there weren't any */
|
||||||
if (self->updated_properties == 0 &&
|
if (self->updated_properties == 0 &&
|
||||||
self->updated_relations == 0 &&
|
self->updated_relations == 0 &&
|
||||||
self->updated_states == 0 &&
|
self->updated_states == 0)
|
||||||
self->updated_platform == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GtkAccessibleStateChange changed_states =
|
GtkAccessibleStateChange changed_states =
|
||||||
@@ -519,14 +524,12 @@ gtk_at_context_update (GtkATContext *self)
|
|||||||
|
|
||||||
GTK_AT_CONTEXT_GET_CLASS (self)->state_change (self,
|
GTK_AT_CONTEXT_GET_CLASS (self)->state_change (self,
|
||||||
changed_states, changed_properties, changed_relations,
|
changed_states, changed_properties, changed_relations,
|
||||||
self->updated_platform,
|
|
||||||
self->states, self->properties, self->relations);
|
self->states, self->properties, self->relations);
|
||||||
g_signal_emit (self, obj_signals[STATE_CHANGE], 0);
|
g_signal_emit (self, obj_signals[STATE_CHANGE], 0);
|
||||||
|
|
||||||
self->updated_properties = 0;
|
self->updated_properties = 0;
|
||||||
self->updated_relations = 0;
|
self->updated_relations = 0;
|
||||||
self->updated_states = 0;
|
self->updated_states = 0;
|
||||||
self->updated_platform = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
/*< private >
|
||||||
@@ -815,5 +818,5 @@ void
|
|||||||
gtk_at_context_platform_changed (GtkATContext *self,
|
gtk_at_context_platform_changed (GtkATContext *self,
|
||||||
GtkAccessiblePlatformChange change)
|
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,
|
GtkAccessibleStateChange changed_states,
|
||||||
GtkAccessiblePropertyChange changed_properties,
|
GtkAccessiblePropertyChange changed_properties,
|
||||||
GtkAccessibleRelationChange changed_relations,
|
GtkAccessibleRelationChange changed_relations,
|
||||||
GtkAccessiblePlatformChange changed_platform,
|
|
||||||
GtkAccessibleAttributeSet *states,
|
GtkAccessibleAttributeSet *states,
|
||||||
GtkAccessibleAttributeSet *properties,
|
GtkAccessibleAttributeSet *properties,
|
||||||
GtkAccessibleAttributeSet *relations);
|
GtkAccessibleAttributeSet *relations);
|
||||||
|
|
||||||
|
void (* platform_change) (GtkATContext *self,
|
||||||
|
GtkAccessiblePlatformChange changed_platform);
|
||||||
};
|
};
|
||||||
|
|
||||||
GdkDisplay * gtk_at_context_get_display (GtkATContext *self);
|
GdkDisplay * gtk_at_context_get_display (GtkATContext *self);
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ gtk_test_at_context_state_change (GtkATContext *self,
|
|||||||
GtkAccessibleStateChange changed_states,
|
GtkAccessibleStateChange changed_states,
|
||||||
GtkAccessiblePropertyChange changed_properties,
|
GtkAccessiblePropertyChange changed_properties,
|
||||||
GtkAccessibleRelationChange changed_relations,
|
GtkAccessibleRelationChange changed_relations,
|
||||||
GtkAccessiblePlatformChange changed_platform,
|
|
||||||
GtkAccessibleAttributeSet *states,
|
GtkAccessibleAttributeSet *states,
|
||||||
GtkAccessibleAttributeSet *properties,
|
GtkAccessibleAttributeSet *properties,
|
||||||
GtkAccessibleAttributeSet *relations)
|
GtkAccessibleAttributeSet *relations)
|
||||||
|
|||||||
Reference in New Issue
Block a user