mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 04:10:13 +00:00
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.
This commit is contained in:
parent
578c8b5068
commit
b5ee73d299
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtkaccessibleprivate.h"
|
||||
#include "gtkaccessible.h"
|
||||
#include "gtkaccessiblevalueprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user