summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/other/gail/gailwidget.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/modules/other/gail/gailwidget.c b/modules/other/gail/gailwidget.c
index 3d0eed88b1..9493fc4eb2 100644
--- a/modules/other/gail/gailwidget.c
+++ b/modules/other/gail/gailwidget.c
@@ -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;
+}