Index: object.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/object.c,v
retrieving revision 1.2
diff -u -r1.2 object.c
--- object.c	1 Nov 2002 15:34:27 -0000	1.2
+++ object.c	19 Jun 2003 08:56:38 -0000
@@ -146,6 +146,51 @@
 {
 }
 
+static AtkObject *
+gtk_html_a11y_get_focus_object (GtkWidget * widget)
+{
+	GtkHTML * html;
+	HTMLObject * htmlobj = NULL;
+        AtkObject *obj = NULL;
+
+	html = GTK_HTML(widget);
+	if (html->engine && html->engine->cursor)
+		htmlobj = html->engine->cursor->object;
+	if (htmlobj)
+		obj = html_utils_get_accessible (htmlobj, NULL);
+
+	return obj;
+}
+
+static void
+gtk_html_a11y_grab_focus_cb(GtkWidget * widget)
+{
+        AtkObject *focus_object, *obj;
+
+
+	 focus_object = gtk_html_a11y_get_focus_object (widget);
+        obj = gtk_widget_get_accessible (widget);
+        g_object_set_data (obj, "gail-focus-object", focus_object);
+        atk_focus_tracker_notify (focus_object);
+
+}
+
+static void
+gtk_html_a11y_cursor_move_cb(GtkWidget *widget,  GtkDirectionType dir_type, GtkHTMLCursorSkipType skip)
+{
+        AtkObject *focus_object, *obj;
+	static AtkObject * prev_object = NULL;
+
+	focus_object = gtk_html_a11y_get_focus_object (widget);
+       obj = gtk_widget_get_accessible (widget);
+	
+	if (prev_object != focus_object) {
+		prev_object = focus_object;
+        	g_object_set_data (obj, "gail-focus-object", focus_object);
+        	atk_focus_tracker_notify (focus_object);
+	}
+}
+
 AtkObject* 
 gtk_html_a11y_new (GtkWidget *widget)
 {
@@ -160,6 +205,12 @@
 	atk_object_initialize (accessible, widget);
 
 	accessible->role = ATK_ROLE_HTML_CONTAINER;
+	g_signal_connect_after(widget, "grab_focus", 
+			G_CALLBACK (gtk_html_a11y_grab_focus_cb),
+			NULL);
+	g_signal_connect_after(widget, "cursor_move",
+			G_CALLBACK(gtk_html_a11y_cursor_move_cb),
+			NULL);
 
 	/* printf ("created new gtkhtml accessible object\n"); */
 
Index: utils.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/utils.c,v
retrieving revision 1.2
diff -u -r1.2 utils.c
--- utils.c	1 Nov 2002 15:34:27 -0000	1.2
+++ utils.c	19 Jun 2003 08:56:39 -0000
@@ -67,7 +67,8 @@
 	case HTML_TYPE_TEXTINPUT:
 	case HTML_TYPE_BUTTON:
 	case HTML_TYPE_CHECKBOX:
-		accessible = gtk_widget_get_accessible (HTML_EMBEDDED (o)->widget);
+		if (HTML_EMBEDDED (o)-> widget)
+			accessible = gtk_widget_get_accessible (HTML_EMBEDDED (o)->widget);
 		break;
 	case HTML_TYPE_TEXTSLAVE: /* ignore */
 		break;
@@ -88,6 +89,8 @@
 html_utils_get_accessible (HTMLObject *o, AtkObject *parent)
 {
 	AtkObject *accessible;
+
+	if (!o) return NULL;
 
 	accessible = html_object_get_data (o, ACCESSIBLE_ID);
 
