[gtk/a11y/component: 179/183] a11y: Add a separate vfunc for platform changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y/component: 179/183] a11y: Add a separate vfunc for platform changes
- Date: Mon, 19 Oct 2020 16:09:48 +0000 (UTC)
commit 3ad03b170649da0f7c05380aaf8f860b4492b488
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 19 11:19:57 2020 -0400
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.
gtk/a11y/gtkatspicontext.c | 18 +++++++++++++++++-
gtk/gtkatcontext.c | 15 +++++++++------
gtk/gtkatcontextprivate.h | 4 +++-
gtk/gtktestatcontext.c | 1 -
4 files changed, 29 insertions(+), 9 deletions(-)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index 12775e94cd..bed789f048 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -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,
diff --git a/gtk/gtkatcontext.c b/gtk/gtkatcontext.c
index de9dc79275..70608a2cb4 100644
--- a/gtk/gtkatcontext.c
+++ b/gtk/gtkatcontext.c
@@ -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);
}
diff --git a/gtk/gtkatcontextprivate.h b/gtk/gtkatcontextprivate.h
index 4fec1444c8..872c91e698 100644
--- a/gtk/gtkatcontextprivate.h
+++ b/gtk/gtkatcontextprivate.h
@@ -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);
diff --git a/gtk/gtktestatcontext.c b/gtk/gtktestatcontext.c
index 6358c196ce..fdcd7fcc9e 100644
--- a/gtk/gtktestatcontext.c
+++ b/gtk/gtktestatcontext.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]