GNOME Bugzilla – Bug 261995
Cannot GOK UI grab to composer area
Last modified: 2005-01-12 04:25:50 UTC
Please fill in this template when reporting a bug, unless you know what you are doing. Description of Problem: Steps to reproduce the problem: 1. Start evolution with a11y enabled 2. start GOK 3. try UI grab Actual Results: No ui about the composer area Expected Results: should be able to UI to the composer, so that user can compose mail with GOK How often does this happen? always Additional Information:
The bug init from http://bugzilla.gnome.org/show_bug.cgi?id=145082 And at last found this is not a gnome bug, so file it here
Index: a11y/html.c =================================================================== RCS file: /export/src/cvs/gtkhtml/a11y/html.c,v retrieving revision 1.4 diff -u -r1.4 html.c --- a11y/html.c 2003/09/29 03:00:20 1.4 +++ a11y/html.c 2004/07/27 08:01:23 @@ -113,6 +113,14 @@ ATK_OBJECT_CLASS (parent_class)->initialize (obj, data); } +static G_CONST_RETURN gchar* +html_a11y_get_name (AtkObject *obj) +{ + G_CONST_RETURN gchar *name; + + return "htmltree"; +} + static void html_a11y_class_init (HTMLA11YClass *klass) { @@ -127,6 +135,7 @@ atk_class->ref_state_set = html_a11y_ref_state_set; atk_class->get_n_children = html_a11y_get_n_children; atk_class->ref_child = html_a11y_ref_child; + atk_class->get_name = html_a11y_get_name; gobject_class->finalize = html_a11y_finalize; } @@ -136,6 +145,7 @@ { } + static HTMLObject * get_parent_html (AtkObject *accessible) { @@ -200,6 +210,8 @@ atk_state_set_add_state (state_set, ATK_STATE_VISIBLE); atk_state_set_add_state (state_set, ATK_STATE_ENABLED); + atk_state_set_add_state (state_set, ATK_STATE_SHOWING); + atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE); /* printf ("html_a11y_ref_state_set resolves to %p\n", state_set); */ @@ -303,6 +315,7 @@ atk_object_initialize (accessible, html_obj); accessible->role = role; + accessible->role = ATK_ROLE_HTML_CONTAINER; return accessible; } Index: a11y/object.c =================================================================== RCS file: /export/src/cvs/gtkhtml/a11y/object.c,v retrieving revision 1.7 diff -u -r1.7 object.c --- a11y/object.c 2004/05/26 02:32:07 1.7 +++ a11y/object.c 2004/07/27 08:01:23 @@ -35,6 +35,115 @@ static GtkAccessibleClass *parent_class = NULL; +static gint +get_n_actions (AtkAction *action) +{ + return 1; +} + +static G_CONST_RETURN gchar* +get_description (AtkAction *action, + gint i) +{ + if (i == 0) + return "activate"; + + return NULL; +} + +static G_CONST_RETURN gchar* +action_get_name (AtkAction *action, gint i) +{ + if (i == 0) + return "activate"; + + return NULL; +} + + +static uint action_idle_handler = 0; +static gboolean +idle_do_action (gpointer data) +{ + GtkHTMLA11Y * a11y; + GtkWidget *widget; + + action_idle_handler = 0; + g_print ("idle do action got called\n"); + + a11y = GTK_HTML_A11Y (data); + widget = GTK_ACCESSIBLE (a11y)->widget; + if (widget == NULL) { + g_print (" widget null!\n"); + /* + * State is defunct + */ + return FALSE; + } + + if (!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget)) { + g_print (" ! sensitive or visible dwidget null!\n"); + return FALSE; + } + + g_print ("now activate the widget!\n"); + gtk_widget_grab_focus (widget); + + return FALSE; +} + +static gboolean +do_action (AtkAction * action, gint i) +{ + GtkHTMLA11Y * a11y; + GtkWidget *widget; + gboolean return_value = TRUE; + + a11y = GTK_HTML_A11Y (action); + widget = GTK_ACCESSIBLE (action)->widget; + + if (widget == NULL) { + g_print ("widget is null\n"); + /* + * State is defunct + */ + return FALSE; + } + + if (!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget)) + return FALSE; + + g_print ("goto switch\n"); + + switch (i) + { + case 0: + g_print ("idle handler is %d", action_idle_handler); + + if (action_idle_handler) + return_value = FALSE; + else + action_idle_handler = g_idle_add (idle_do_action, a11y); + break; + default: + return_value = FALSE; + break; + } + return return_value; +} + +static void +atk_action_interface_init (AtkActionIface *iface) +{ + g_return_if_fail (iface != NULL); + + iface->do_action = do_action; + iface->get_n_actions = get_n_actions; + iface->get_description = get_description; + iface->get_name = action_get_name; +} + + GType gtk_html_a11y_get_type (void) { @@ -54,6 +163,12 @@ NULL /* value table */ }; + static const GInterfaceInfo atk_action_info = { + (GInterfaceInitFunc) atk_action_interface_init, + (GInterfaceFinalizeFunc) NULL, + NULL + }; + /* * Figure out the size of the class and instance * we are deriving from @@ -69,6 +184,9 @@ tinfo.instance_size = query.instance_size; type = g_type_register_static (derived_atk_type, "GtkHTMLA11Y", &tinfo, 0); + + g_type_add_interface_static (type, ATK_TYPE_ACTION, &atk_action_info); + } return type; @@ -100,7 +218,7 @@ if (clue) n_children = html_object_get_n_children (GTK_HTML_A11Y_GTKHTML (accessible)->engine->clue); - /* printf ("gtk_html_a11y_get_n_children resolves to %d\n", n_children); */ + printf ("gtk_html_a11y_get_n_children resolves to %d\n", n_children); return n_children; } @@ -110,6 +228,7 @@ { HTMLObject *child; AtkObject *accessible_child = NULL; + if (GTK_HTML_A11Y_GTKHTML (accessible)->engine->clue) { child = html_object_get_child (GTK_HTML_A11Y_GTKHTML (accessible)->engine->clue, index); @@ -120,11 +239,19 @@ } } - /* printf ("gtk_html_a11y_ref_child %d resolves to %p\n", index, accessible_child); */ + printf ("gtk_html_a11y_ref_child %d resolves to %p\n", index, accessible_child); return accessible_child; } +static G_CONST_RETURN gchar* +gtk_html_a11y_get_name (AtkObject *obj) +{ + G_CONST_RETURN gchar *name; + + return "html container"; +} + static void gtk_html_a11y_class_init (GtkHTMLA11YClass *klass) { @@ -136,6 +263,7 @@ atk_class->initialize = gtk_html_a11y_initialize; atk_class->get_n_children = gtk_html_a11y_get_n_children; atk_class->ref_child = gtk_html_a11y_ref_child; + atk_class->get_name = gtk_html_a11y_get_name; gobject_class->finalize = gtk_html_a11y_finalize; } @@ -214,6 +342,8 @@ atk_object_initialize (accessible, widget); accessible->role = ATK_ROLE_HTML_CONTAINER; + accessible->role = ATK_ROLE_PANEL; + g_signal_connect_after(widget, "grab_focus", G_CALLBACK (gtk_html_a11y_grab_focus_cb), NULL); Index: a11y/object.h =================================================================== RCS file: /export/src/cvs/gtkhtml/a11y/object.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 object.h --- a11y/object.h 2003/09/26 06:38:00 1.1.1.1 +++ a11y/object.h 2004/07/27 08:01:23 @@ -43,8 +43,6 @@ struct _GtkHTMLA11Y { GtkAccessible parent; - - AtkObject *tree; }; GType gtk_html_a11y_get_type (void);
Created attachment 44001 [details] [review] patch for review
Hi York: bugzilla.ximian.com seems to be messed up today, so I cannot enter the comments below in the bug report. Sorry about that - but please review them. I don't really understand why you chose to deal with this bug in the way you did, and am concerned that the patch is not correct. Thanks! - Bill York: Please explain the intent of the patch above. It looks to me as though it changes some things that should not be changed, for instance it changes a ROLE from HTML_CONTAINER to PANEL - that may break gnopernicus, etc. It is not clear to me that the patch is taking the correct approach. Adding the name "htmltree" seems OK, but I would make it "HTML tree" instead - also it should be localized, i.e. _("HTML tree"). Likewise "html container" should be _("HTML container"). All accessible names and descriptions should be localized! Adding SENSITIVE is OK, but why do you need to add 'SHOWING'? Shouldn't this state be automatically set for objects that have had gtk_widget_show() called? I don't know why your widget isn't getting this state "automatically". As I said this change to object.c can't be right: accessible->role = ATK_ROLE_HTML_CONTAINER; + accessible->role = ATK_ROLE_PANEL; + since you are overwriting a role here. Why did you remove the 'tree' member from _GtkHTMLAlly? I don't understand why you have added the 'AtkAction' interface to the HTML container - I don't think it's needed. AtkEditableText, plus a working AtkComponent::grabFocus method, should be enough. - Bill
The patch in attachment is newer to the one pasted above. Sorry for the confusion. However, most questions you mentioned are still valid for the patch in attachment.
The newer patch only do : 1) Add a name to the gtkhtml widget, I will made them localizable per your comments 2) Add a action interface of grab focus to the gtkhtml widget, So that GOK UI grab can find and grab to compose area. The implementation require very little code as you see in my patch, so I do not choose impement AtkEditable Text interface. 3) Change the role from ATK_ROLE_HTML_CONTAINER to ATK_ROLE_PANEL GOK will not Grab To the widget if the role is ATK_ROLE_HTML_CONTAINER, so I change the role to ATK_ROLE_PANEL. I will check if it will break gnopernicus behaviour. The 'tree' member of _GtkHTMLAlly is actually not used at all. The a11y tree is actually attached to htmla11y object by g_object_data_set. left it here will confuse people
*** This bug has been marked as a duplicate of 270088 ***