Report ATK_STATE_SHOWING only when all parents are visible
Bug #509650. Checks if all the predecesors (the parent widget, his parent, etc) are visible. Only reports ATK_STATE_SHOWING when all parents are visible. Signed-off-by: Li Yuan <li.yuan@sun.com>
This commit is contained in:

committed by
Li Yuan

parent
a96bf76db3
commit
f22239c4aa
@ -106,6 +106,7 @@ static void gail_widget_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
static GtkWidget* gail_widget_find_viewport (GtkWidget *widget);
|
||||
static gboolean gail_widget_on_screen (GtkWidget *widget);
|
||||
static gboolean gail_widget_all_parents_visible(GtkWidget *widget);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GailWidget, gail_widget, GTK_TYPE_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
|
||||
@ -518,8 +519,8 @@ gail_widget_ref_state_set (AtkObject *accessible)
|
||||
if (GTK_WIDGET_VISIBLE (widget))
|
||||
{
|
||||
atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
|
||||
if (gail_widget_on_screen (widget) &&
|
||||
GTK_WIDGET_MAPPED (widget))
|
||||
if (gail_widget_on_screen (widget) && GTK_WIDGET_MAPPED (widget) &&
|
||||
gail_widget_all_parents_visible (widget))
|
||||
{
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
|
||||
}
|
||||
@ -1079,3 +1080,30 @@ static gboolean gail_widget_on_screen (GtkWidget *widget)
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* gail_widget_all_parents_visible:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Checks if all the predecesors (the parent widget, his parent, etc) are visible
|
||||
* Used to check properly the SHOWING state.
|
||||
*
|
||||
* Return value: TRUE if all the parent hierarchy is visible, FALSE otherwise
|
||||
**/
|
||||
static gboolean gail_widget_all_parents_visible (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *iter_parent = NULL;
|
||||
gboolean result = TRUE;
|
||||
|
||||
for (iter_parent = gtk_widget_get_parent (widget); iter_parent;
|
||||
iter_parent = gtk_widget_get_parent (iter_parent))
|
||||
{
|
||||
if (!GTK_WIDGET_VISIBLE (iter_parent))
|
||||
{
|
||||
result = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user