[gtk+] a11y: Expose window type hint as attribute



commit 2b1fc6166c626601c07e2e2e19235c74b0174672
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Mar 4 23:50:50 2016 -0500

    a11y: Expose window type hint as attribute
    
    This was an old request, maybe still useful.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=468122

 gtk/a11y/gtkwindowaccessible.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gtk/a11y/gtkwindowaccessible.c b/gtk/a11y/gtkwindowaccessible.c
index 83bb05b..017f130 100644
--- a/gtk/a11y/gtkwindowaccessible.c
+++ b/gtk/a11y/gtkwindowaccessible.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]