Re: [evolution-patches] gal, accessibility,focused objects should have a state of ATK_STATE_FOCUSED,55249



JP Rosevear wrote:

On Mon, 2004-03-29 at 07:29, Yuedong Du wrote:
Hi Mike and all,

The bug cause gnopernicus cannot read mail in gnome2.6. This is because in gnopernicus > 0.71,
the focus object must have state FOCUS, or it will not be read.

So the fix is just to add the state. Also add some sanity check code,

______________________________________________________________________
Index: gal-a11y-e-cell-text.c
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/gal-a11y-e-cell-text.c,v
retrieving revision 1.4
diff -u -r1.4 gal-a11y-e-cell-text.c
--- gal-a11y-e-cell-text.c	2 Dec 2003 07:20:04 -0000	1.4
+++ gal-a11y-e-cell-text.c	29 Mar 2004 12:24:56 -0000
@@ -107,9 +107,12 @@
ect_get_caret_offset (AtkText *text)
{
	GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
-	ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+	ECellText *ect = NULL;
	gint start, end;

+	g_return_val_if_fail (gaec && gaec->cell_view && gaec->cell_view->ecell && E_IS_CELL_TEXT (gaec->cell_view->ecell), -1);
+	ect = E_CELL_TEXT (gaec->cell_view->ecell);
+
	if (e_cell_text_get_selection (gaec->cell_view,
				       gaec->view_col, gaec->row,
				       &start, &end)) {
Index: gal-a11y-e-table-item.c
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/gal-a11y-e-table-item.c,v
retrieving revision 1.9
diff -u -r1.9 gal-a11y-e-table-item.c
--- gal-a11y-e-table-item.c	2 Dec 2003 08:25:17 -0000	1.9
+++ gal-a11y-e-table-item.c	29 Mar 2004 12:24:58 -0000
@@ -1035,8 +1035,10 @@
			   int index_in_parent)
{
	GalA11yETableItem *a11y;
+	AtkObject *accessible;
	int n;

+	g_return_val_if_fail (item && item->cols >= 0 && item->rows >= 0, NULL);
	a11y = g_object_new (gal_a11y_e_table_item_get_type (), NULL);

	atk_object_initialize (ATK_OBJECT (a11y), item);
@@ -1044,7 +1046,9 @@
	GET_PRIVATE (a11y)->parent = parent;
	GET_PRIVATE (a11y)->index_in_parent = index_in_parent;

-	g_return_val_if_fail (item->cols >= 0 && item->rows >= 0, NULL);
+
+	accessible  = ATK_OBJECT(a11y);
+	accessible->role = ATK_ROLE_TREE_TABLE;
	/* Initialize cell data. */
	n = item->cols * item->rows;
	GET_PRIVATE (a11y)->cols = item->cols;
@@ -1187,10 +1191,12 @@
	g_signal_emit_by_name (a11y, "selection_changed");

        cell = atk_table_ref_at (ATK_TABLE (a11y), row, col);
-        if (ATK_IS_OBJECT (cell))
-                g_signal_emit_by_name  (a11y,
-                                        "active-descendant-changed",
-                                        cell);
+	if (cell != NULL) {
+        	if (ATK_IS_OBJECT (cell)) {
+			gal_a11y_e_cell_add_state(cell, ATK_STATE_FOCUSED, FALSE);
+			atk_focus_tracker_notify (cell);
+		}
+	}
}

Looks basically fine - why would the be NULL here?  and if it could be,
shouldn't the if (cell != NULL) check be prior to the ATK_IS_OBJECT
check?

-JP
Only when something unexpected happens, cell could be NULL, so it maybe OK to put a sanity
check here.

I am a little confused, the (cell !=NULL) check IS before the ATK_IS_OBJECT check in my patch.
Do I misunderstand something?

Thanks
York






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