[gtk/matthiasc/a11y] a11y: Pass on platform changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/a11y] a11y: Pass on platform changes
- Date: Mon, 12 Oct 2020 17:08:00 +0000 (UTC)
commit 113e4b9a80c7d69f2bcd14d98e0fbe6f11f36b27
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 12 13:05:43 2020 -0400
a11y: Pass on platform changes
Add an enum for 'platform changes' to the at context
change notification mechanism. This will let us pass
along things that ARIA considers 'platform state' such
as focus or editability. The difference between the
platform state and other ARIA states is that we don't
keep the platform state separately in the at context
- backends are expected to just query the widgets.
This is just about avoiding notify listeners for
change notification.
gtk/a11y/gtkatspicontext.c | 1 +
gtk/gtkaccessible.c | 13 +++++++++++++
gtk/gtkaccessibleattributesetprivate.h | 2 +-
gtk/gtkaccessibleprivate.h | 5 ++++-
gtk/gtkatcontext.c | 14 +++++++++++++-
gtk/gtkatcontextprivate.h | 10 ++++++++++
gtk/gtktestatcontext.c | 2 ++
7 files changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index a2d7b1079a..79d8e0b797 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -644,6 +644,7 @@ 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)
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c
index 2b828b2254..dd5890ca92 100644
--- a/gtk/gtkaccessible.c
+++ b/gtk/gtkaccessible.c
@@ -636,3 +636,16 @@ gtk_accessible_role_to_name (GtkAccessibleRole role,
return role_names[role];
}
+
+void
+gtk_accessible_platform_changed (GtkAccessible *self,
+ GtkAccessiblePlatformChange change)
+{
+ GtkATContext *context = gtk_accessible_get_at_context (self);
+ if (context == NULL)
+ return;
+
+ gtk_at_context_platform_changed (context, change);
+ gtk_at_context_update (context);
+}
+
diff --git a/gtk/gtkaccessibleattributesetprivate.h b/gtk/gtkaccessibleattributesetprivate.h
index 83694c7ede..bce94d6876 100644
--- a/gtk/gtkaccessibleattributesetprivate.h
+++ b/gtk/gtkaccessibleattributesetprivate.h
@@ -20,7 +20,7 @@
#pragma once
-#include "gtkaccessibleprivate.h"
+#include "gtkaccessible.h"
#include "gtkaccessiblevalueprivate.h"
G_BEGIN_DECLS
diff --git a/gtk/gtkaccessibleprivate.h b/gtk/gtkaccessibleprivate.h
index a118f6c150..05351d4526 100644
--- a/gtk/gtkaccessibleprivate.h
+++ b/gtk/gtkaccessibleprivate.h
@@ -21,7 +21,7 @@
#pragma once
#include "gtkaccessible.h"
-#include "gtkatcontext.h"
+#include "gtkatcontextprivate.h"
G_BEGIN_DECLS
@@ -37,4 +37,7 @@ GtkATContext * gtk_accessible_get_at_context (GtkAccessible *self);
const char * gtk_accessible_role_to_name (GtkAccessibleRole role,
const char *domain);
+void gtk_accessible_platform_changed (GtkAccessible *self,
+ GtkAccessiblePlatformChange change);
+
G_END_DECLS
diff --git a/gtk/gtkatcontext.c b/gtk/gtkatcontext.c
index 085bf989b2..121951ab9d 100644
--- a/gtk/gtkatcontext.c
+++ b/gtk/gtkatcontext.c
@@ -36,6 +36,7 @@
#include "gtkatcontextprivate.h"
#include "gtkaccessiblevalueprivate.h"
+#include "gtkaccessibleprivate.h"
#include "gtkdebug.h"
#include "gtktestatcontextprivate.h"
#include "gtktypebuiltins.h"
@@ -137,6 +138,7 @@ 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)
@@ -505,7 +507,8 @@ 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_states == 0 &&
+ self->updated_platform == 0)
return;
GtkAccessibleStateChange changed_states =
@@ -517,12 +520,14 @@ 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 >
@@ -806,3 +811,10 @@ gtk_at_context_get_label (GtkATContext *self)
return g_strdup ("widget");
}
+
+void
+gtk_at_context_platform_changed (GtkATContext *self,
+ GtkAccessiblePlatformChange change)
+{
+ self->updated_platform |= change;
+}
diff --git a/gtk/gtkatcontextprivate.h b/gtk/gtkatcontextprivate.h
index 15da90acfe..fb396c8ccc 100644
--- a/gtk/gtkatcontextprivate.h
+++ b/gtk/gtkatcontextprivate.h
@@ -80,6 +80,11 @@ typedef enum {
GTK_ACCESSIBLE_STATE_CHANGE_SELECTED = 1 << GTK_ACCESSIBLE_STATE_SELECTED
} GtkAccessibleStateChange;
+typedef enum {
+ GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSABLE = 1 << 0,
+ GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSED = 1 << 1,
+} GtkAccessiblePlatformChange;
+
struct _GtkATContext
{
GObject parent_instance;
@@ -95,6 +100,7 @@ struct _GtkATContext
GtkAccessibleStateChange updated_states;
GtkAccessiblePropertyChange updated_properties;
GtkAccessibleRelationChange updated_relations;
+ GtkAccessiblePlatformChange updated_platform;
};
struct _GtkATContextClass
@@ -105,6 +111,7 @@ struct _GtkATContextClass
GtkAccessibleStateChange changed_states,
GtkAccessiblePropertyChange changed_properties,
GtkAccessibleRelationChange changed_relations,
+ GtkAccessiblePlatformChange changed_platform,
GtkAccessibleAttributeSet *states,
GtkAccessibleAttributeSet *properties,
GtkAccessibleAttributeSet *relations);
@@ -138,6 +145,9 @@ GtkAccessibleValue * gtk_at_context_get_accessible_relation (GtkATContext
char * gtk_at_context_get_label (GtkATContext *self);
+void gtk_at_context_platform_changed (GtkATContext *self,
+ GtkAccessiblePlatformChange change);
+
const char * gtk_accessible_property_get_attribute_name (GtkAccessibleProperty property);
const char * gtk_accessible_relation_get_attribute_name (GtkAccessibleRelation relation);
const char * gtk_accessible_state_get_attribute_name (GtkAccessibleState state);
diff --git a/gtk/gtktestatcontext.c b/gtk/gtktestatcontext.c
index e1bf0f5d1d..6358c196ce 100644
--- a/gtk/gtktestatcontext.c
+++ b/gtk/gtktestatcontext.c
@@ -23,6 +23,7 @@
#include "gtktestatcontextprivate.h"
#include "gtkatcontextprivate.h"
+#include "gtkaccessibleprivate.h"
#include "gtkdebug.h"
#include "gtkenums.h"
#include "gtkprivate.h"
@@ -45,6 +46,7 @@ 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]