ATK in Gnome CVS



Hi folks:

I have added the new module "atk" to Gnome CVS.  Of course I have not
applied the GTK+ patch that hooks into it yet...

I attach the patch in case someone wants to have a go right away.

Be advised that though we hope this version of ATK is "nearly frozen",
we are still incorporating/discussing some changes proposed by Owen
and issues that we have recently uncovered while implementing this API
on behalf of the GTK+ widgets (in another, optional module called GAEL
which we will be putting in community CVS shortly).

Best regards,

Bill

--------------
Bill Haneman
Gnome Accessibility / Batik SVG Toolkit
Sun Microsystems Ireland
Index: gtk+/configure.in
===================================================================
RCS file: /cvs/gnome/gtk+/configure.in,v
retrieving revision 1.203
diff -u -p -r1.203 configure.in
--- gtk+/configure.in	2001/04/09 17:47:15	1.203
+++ gtk+/configure.in	2001/04/25 13:03:07
@@ -610,6 +610,30 @@ AC_CHECK_LIB(pango, pango_context_new, :
 CFLAGS="$saved_cflags"
 LDFLAGS="$saved_ldflags"
 
+# Check for Accessibility Toolkit flags
+
+ATK_PACKAGES=atk
+AC_MSG_CHECKING(ATK flags)
+if $PKG_CONFIG --exists $ATK_PACKAGES ; then
+        ATK_CFLAGS=`$PKG_CONFIG --cflags $ATK_PACKAGES`
+        ATK_LIBS=`$PKG_CONFIG --libs $ATK_PACKAGES`
+
+        AC_MSG_RESULT($ATK_CFLAGS $ATK_LIBS)
+else
+        AC_MSG_ERROR([
+*** Accessibility Toolkit not found. Accessibility Toolkit is required
+*** to build GTK+.
+])
+fi
+
+AC_SUBST(ATK_CFLAGS)
+AC_SUBST(ATK_LIBS)
+
+AC_CHECK_LIB(atk, atk_object_get_type, : , AC_MSG_ERROR([
+*** Cannot link to Accessibility Toolkit. Accessibility Toolkit is required
+*** to build GTK+]), $ATK_LIBS $GLIB_LIBS)
+
+
 AC_SUBST(x_cflags)
 AC_SUBST(x_includes)
 AC_SUBST(x_ldflags)
Index: gtk+/demos/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/demos/Makefile.am,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile.am
--- gtk+/demos/Makefile.am	2001/02/03 01:09:37	1.11
+++ gtk+/demos/Makefile.am	2001/04/25 13:03:08
@@ -10,6 +10,7 @@ INCLUDES = @STRIP_BEGIN@ \
 	@GTK_DEBUG_FLAGS@				\
 	@GTK_XIM_FLAGS@					\
 	@GTK_LOCALE_FLAGS@				\
+	@ATK_CFLAGS@					\
 	@PANGO_CFLAGS@					\
 	@GLIB_CFLAGS@					\
 	@more_cflags@					\
@@ -27,6 +28,7 @@ LDADDS = @STRIP_BEGIN@ 					\
 	@more_ldflags@					\
 	@more_libs@					\
 	@GDK_WLIBS@					\
+	@ATK_LIBS@					\
 	@PANGO_LIBS@					\
 	@GLIB_LIBS@					\
 	@GTK_LIBS_EXTRA@				\
Index: gtk+/demos/gtk-demo/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/demos/gtk-demo/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- gtk+/demos/gtk-demo/Makefile.am	2001/02/20 01:37:27	1.6
+++ gtk+/demos/gtk-demo/Makefile.am	2001/04/25 13:03:08
@@ -22,6 +22,7 @@ INCLUDES = @STRIP_BEGIN@ \
 	@GTK_DEBUG_FLAGS@				\
 	@GTK_XIM_FLAGS@					\
 	@GTK_LOCALE_FLAGS@				\
+	@ATK_CFLAGS@					\
 	@PANGO_CFLAGS@					\
 	@GLIB_CFLAGS@					\
 	@more_cflags@					\
@@ -39,6 +40,7 @@ LDADDS = @STRIP_BEGIN@ 					\
 	@more_ldflags@					\
 	@more_libs@					\
 	@GDK_WLIBS@					\
+	@ATK_LIBS@					\
 	@PANGO_LIBS@					\
 	@GLIB_LIBS@					\
 	@GTK_LIBS_EXTRA@				\
Index: gtk+/docs/reference/gdk-pixbuf/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/docs/reference/gdk-pixbuf/Makefile.am,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile.am
--- gtk+/docs/reference/gdk-pixbuf/Makefile.am	2001/04/04 07:20:02	1.25
+++ gtk+/docs/reference/gdk-pixbuf/Makefile.am	2001/04/25 13:03:08
@@ -67,6 +67,7 @@ GTKDOC_LIBS = @STRIP_BEGIN@ 				\
 	@more_ldflags@					\
 	@more_libs@					\
 	@GDK_WLIBS@					\
+	@ATK_LIBS@					\
 	@PANGO_LIBS@					\
 	@GLIB_LIBS@					\
 	@GTK_LIBS_EXTRA@				\
Index: gtk+/docs/reference/gtk/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/docs/reference/gtk/Makefile.am,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile.am
--- gtk+/docs/reference/gtk/Makefile.am	2001/04/04 07:20:05	1.13
+++ gtk+/docs/reference/gtk/Makefile.am	2001/04/25 13:03:08
@@ -71,6 +71,7 @@ GTKDOC_CFLAGS = @STRIP_BEGIN@ 				\
 	@GTK_DEBUG_FLAGS@				\
 	@GTK_XIM_FLAGS@					\
 	@GTK_LOCALE_FLAGS@				\
+	@ATK_CFLAGS@					\
 	@PANGO_CFLAGS@					\
 	@GLIB_CFLAGS@					\
 	@more_cflags@					\
@@ -83,6 +84,7 @@ GTKDOC_LIBS = @STRIP_BEGIN@ 				\
 	@more_ldflags@					\
 	@more_libs@					\
 	@GDK_WLIBS@					\
+	@ATK_LIBS@					\
 	@PANGO_LIBS@					\
 	@GLIB_LIBS@					\
 	@GTK_LIBS_EXTRA@				\
Index: gtk+/gtk/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/Makefile.am,v
retrieving revision 1.163
diff -u -p -r1.163 Makefile.am
--- gtk+/gtk/Makefile.am	2001/04/03 18:48:41	1.163
+++ gtk+/gtk/Makefile.am	2001/04/25 13:03:12
@@ -19,6 +19,7 @@ INCLUDES = @STRIP_BEGIN@ \
 	@GTK_DEBUG_FLAGS@				\
 	@GTK_XIM_FLAGS@					\
 	@GTK_LOCALE_FLAGS@				\
+	@ATK_CFLAGS@					\
 	@PANGO_CFLAGS@					\
 	@GLIB_CFLAGS@					\
 	@more_cflags@					\
@@ -35,6 +36,7 @@ LDFLAGS = @STRIP_BEGIN@ \
 	-export-dynamic						\
 	-rpath @prefix@/lib					\
 	@LIBTOOL_EXPORT_OPTIONS@				\
+	@ATK_LIBS@						\
 	@PANGO_LIBS@						\
 	@GLIB_DEPLIBS@ 						\
 	@more_ldflags@						\
@@ -52,6 +54,7 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
 	gtk.h			\
 	gtkaccelgroup.h		\
 	gtkaccellabel.h		\
+	gtkaccessible.h		\
 	gtkadjustment.h		\
 	gtkalignment.h		\
 	gtkarg.h		\
@@ -210,6 +213,7 @@ gtk_private_h_sources = @STRIP_BEGIN@ \
 gtk_c_sources = @STRIP_BEGIN@   \
 	gtkaccelgroup.c		\
 	gtkaccellabel.c		\
+	gtkaccessible.c		\
 	gtkadjustment.c		\
 	gtkalignment.c		\
 	gtkarg.c		\
@@ -506,6 +510,7 @@ LDADDS = @STRIP_BEGIN@ \
 	@more_ldflags@					\
 	@more_libs@					\
 	@GDK_WLIBS@					\
+	@ATK_LIBS@					\
 	@PANGO_LIBS@					\
 	@GLIB_LIBS@					\
 	@GTK_LIBS_EXTRA@				\
Index: gtk+/gtk/gtk.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtk.h,v
retrieving revision 1.49
diff -u -p -r1.49 gtk.h
--- gtk+/gtk/gtk.h	2001/04/01 07:32:39	1.49
+++ gtk+/gtk/gtk.h	2001/04/25 13:03:12
@@ -31,6 +31,7 @@
 #include <gdk/gdk.h>
 #include <gtk/gtkaccelgroup.h>
 #include <gtk/gtkaccellabel.h>
+#include <gtk/gtkaccessible.h>
 #include <gtk/gtkadjustment.h>
 #include <gtk/gtkalignment.h>
 #include <gtk/gtkarg.h>
Index: gtk+/gtk/gtkwidget.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.c,v
retrieving revision 1.210
diff -u -p -r1.210 gtkwidget.c
--- gtk+/gtk/gtkwidget.c	2001/04/03 13:18:00	1.210
+++ gtk+/gtk/gtkwidget.c	2001/04/25 13:03:17
@@ -44,8 +44,8 @@
 #include "gobject/gvaluecollector.h"
 #include "gdk/gdkkeysyms.h"
 #include "gtkintl.h"
+#include "gtkaccessible.h"
 
-
 #define WIDGET_CLASS(w)	 GTK_WIDGET_GET_CLASS (w)
 #define	INIT_PATH_SIZE	(512)
 
@@ -203,7 +203,11 @@ static gboolean gtk_widget_real_mnemonic
 static void		 gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info);
 
 static void  gtk_widget_do_uposition (GtkWidget *widget);
-     
+
+static AtkObject*        gtk_widget_real_get_accessible   (GtkWidget *widget);
+static void              gtk_widget_accessible_interface_init (AtkObjectIface *iface);
+static AtkObject *       gtk_widget_ref_accessible (GObject *obj);
+
 static gpointer         parent_class = NULL;
 static guint            widget_signals[LAST_SIGNAL] = { 0 };
 
@@ -226,6 +230,7 @@ static GQuark quark_shape_info = 0;
 static GQuark quark_colormap = 0;
 static GQuark quark_pango_context = 0;
 static GQuark quark_rc_style = 0;
+static GQuark quark_accessible_object = 0;
 
 
 /*****************************************
@@ -255,7 +260,19 @@ gtk_widget_get_type (void)
 	(GtkClassInitFunc) NULL,
       };
       
+      static const GInterfaceInfo accessibility_info =
+      {
+        (GInterfaceInitFunc) gtk_widget_accessible_interface_init,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL /* interface data */
+      };
+
+ 
       widget_type = gtk_type_unique (GTK_TYPE_OBJECT, &widget_info);
+
+      g_type_add_interface_static (widget_type, ATK_TYPE_OBJECT_IFACE,
+                                   &accessibility_info) ;
+
     }
   
   return widget_type;
@@ -337,6 +354,9 @@ gtk_widget_class_init (GtkWidgetClass *k
   klass->drag_drop = NULL;
   klass->drag_data_received = NULL;
 
+  /* Accessibility support */
+  klass->get_accessible = gtk_widget_real_get_accessible;
+
   klass->no_expose_event = NULL;
 
   quark_property_parser = g_quark_from_static_string ("gtk-rc-property-parser");
@@ -349,6 +369,7 @@ gtk_widget_class_init (GtkWidgetClass *k
   quark_colormap = g_quark_from_static_string ("gtk-colormap");
   quark_pango_context = g_quark_from_static_string ("gtk-pango-context");
   quark_rc_style = g_quark_from_static_string ("gtk-rc-style");
+  quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object");
 
   style_property_spec_pool = g_param_spec_pool_new (FALSE);
 
@@ -4947,6 +4968,7 @@ gtk_widget_finalize (GObject *object)
   gint *events;
   GdkExtensionMode *mode;
   GtkStyle *saved_style;
+  GtkAccessible *accessible;
   
   gtk_grab_remove (widget);
   gtk_selection_remove_all (widget);
@@ -4976,6 +4998,10 @@ gtk_widget_finalize (GObject *object)
   if (mode)
     g_free (mode);
 
+  accessible = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_accessible_object);
+  if (accessible)
+    g_object_unref (G_OBJECT (accessible));
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -5677,3 +5703,61 @@ gtk_requisition_free (GtkRequisition *re
   g_free (requisition);
 }
 
+AtkObject* gtk_widget_get_accessible (GtkWidget *widget)
+{
+  GtkWidgetClass *klass;
+
+  g_return_val_if_fail (widget != NULL, NULL);
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+  klass = GTK_WIDGET_GET_CLASS (widget);
+
+  g_return_val_if_fail (klass->get_accessible != NULL, NULL);
+
+  return klass->get_accessible(widget);
+}
+
+AtkObject* gtk_widget_real_get_accessible (GtkWidget *widget)
+{
+  AtkObject* accessible;
+
+  accessible = g_object_get_qdata (GTK_OBJECT (widget), 
+                                   quark_accessible_object);
+  if (!accessible)
+  {
+    AtkObjectFactory *factory;
+    AtkRegistry *default_registry;
+
+    default_registry = atk_get_default_registry ();
+    factory = atk_registry_get_factory (default_registry, 
+                                        GTK_OBJECT_TYPE (widget));
+    accessible =
+      atk_object_factory_create_accessible (factory,
+                                               G_OBJECT(widget));
+    g_object_set_qdata (GTK_OBJECT (widget), 
+                        quark_accessible_object,
+                        accessible);
+  }
+  return accessible;
+}
+
+/*
+ * Initialize a AtkObjectIface instance's virtual pointers as
+ * appropriate to this implementor's class (GtkWidget).
+ */
+static void
+gtk_widget_accessible_interface_init (AtkObjectIface *iface)
+{
+  iface->ref_accessible = gtk_widget_ref_accessible;
+}
+
+static AtkObject*
+gtk_widget_ref_accessible(GObject *obj)
+{
+  AtkObject *accessible;
+
+  accessible = gtk_widget_get_accessible ((GtkWidget *)obj);
+  if (accessible)
+    g_object_ref (G_OBJECT (accessible));
+  return accessible;
+}
Index: gtk+/gtk/gtkwidget.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.h,v
retrieving revision 1.106
diff -u -p -r1.106 gtkwidget.h
--- gtk+/gtk/gtkwidget.h	2001/04/02 03:47:25	1.106
+++ gtk+/gtk/gtkwidget.h	2001/04/25 13:03:18
@@ -32,8 +32,8 @@
 #include <gtk/gtkobject.h>
 #include <gtk/gtkadjustment.h>
 #include <gtk/gtkstyle.h>
+#include <atk/atkobject.h>
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -235,7 +235,7 @@ struct _GtkWidgetClass
    * Implementation of this signal is optional.
    */
   guint set_scroll_adjustments_signal;
-  
+
   /* basics */
   void (* show)		       (GtkWidget        *widget);
   void (* show_all)            (GtkWidget        *widget);
@@ -381,6 +381,11 @@ struct _GtkWidgetClass
   /* Signals used only for keybindings */
   void (* popup_menu)              (GtkWidget          *widget);
   
+  
+  /* accessibility support 
+   */
+  AtkObject*   (* get_accessible)  (GtkWidget          *widget);
+
   /* Padding for future expansion */
   GtkFunction pad1;
   GtkFunction pad2;
@@ -535,6 +540,10 @@ GtkWidget*   gtk_widget_get_ancestor	(Gt
 					 GtkType	widget_type);
 GdkColormap* gtk_widget_get_colormap	(GtkWidget	*widget);
 GdkVisual*   gtk_widget_get_visual	(GtkWidget	*widget);
+
+
+/* Accessibility support */
+AtkObject*       gtk_widget_get_accessible               (GtkWidget          *widget);
 
 /* The following functions must not be called on an already
  * realized widget. Because it is possible that somebody
Index: gtk+/tests/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/tests/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- gtk+/tests/Makefile.am	2001/04/03 18:48:46	1.6
+++ gtk+/tests/Makefile.am	2001/04/25 13:03:18
@@ -8,6 +8,7 @@ INCLUDES = @STRIP_BEGIN@ \
 	@GTK_XIM_FLAGS@					\
 	@GTK_LOCALE_FLAGS@				\
 	@PANGO_CFLAGS@					\
+	@ATK_CFLAGS@					\
 	@GLIB_CFLAGS@					\
 	@more_cflags@					\
 @STRIP_END@
@@ -25,6 +26,7 @@ LDADDS = @STRIP_BEGIN@ 					\
 	@more_libs@					\
 	@GDK_WLIBS@					\
 	@PANGO_LIBS@					\
+	@ATK_LIBS@					\
 	@GLIB_LIBS@					\
 	@GTK_LIBS_EXTRA@				\
 	-lm						\


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