a11y: Expose window type hint as attribute

This was an old request, maybe still useful.

https://bugzilla.gnome.org/show_bug.cgi?id=468122
This commit is contained in:
Matthias Clasen 2016-03-04 23:50:50 -05:00
parent 92662828ba
commit 2b1fc6166c

View File

@ -315,6 +315,40 @@ gtk_window_accessible_ref_child (AtkObject *object,
return g_object_ref (gtk_widget_get_accessible (ref_child));
}
static AtkAttributeSet *
gtk_widget_accessible_get_attributes (AtkObject *obj)
{
GtkWidget *window;
GdkWindowTypeHint hint;
AtkAttributeSet *attributes;
AtkAttribute *attr;
GEnumClass *class;
GEnumValue *value;
attributes = ATK_OBJECT_CLASS (gtk_window_accessible_parent_class)->get_attributes (obj);
attr = g_new (AtkAttribute, 1);
attr->name = g_strdup ("window-type");
window = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
hint = gtk_window_get_type_hint (GTK_WINDOW (window));
class = g_type_class_ref (GDK_TYPE_WINDOW_TYPE_HINT);
for (value = class->values; value->value_name; value++)
{
if (hint == value->value)
{
attr->value = g_strdup (value->value_nick);
break;
}
}
g_type_class_unref (class);
attributes = g_slist_append (attributes, attr);
return attributes;
}
static void
gtk_window_accessible_class_init (GtkWindowAccessibleClass *klass)
{
@ -331,6 +365,7 @@ gtk_window_accessible_class_init (GtkWindowAccessibleClass *klass)
class->focus_event = gtk_window_accessible_focus_event;
class->get_n_children = gtk_window_accessible_get_n_children;
class->ref_child = gtk_window_accessible_ref_child;
class->get_attributes = gtk_widget_accessible_get_attributes;
}
static void