[gtk/matthiasc/atspi-child] window: Maintain accessible HIDDEN state



commit bba6d604f02a6b42a894e83542f548bfafa937be
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 24 15:23:12 2020 -0400

    window: Maintain accessible HIDDEN state
    
    We want to use the HIDDEN state to control when
    things get added and removed from the accessible
    tree, so ensure that we a) set HIDDEN to true
    initially for windows, and b) we update HIDDEN
    when a window is shown or hidden.
    
    The second part is handled by gtk_widget_hide
    for other widgets, but hiding a window does not
    always go through that code path.

 gtk/gtkwindow.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 3f59e4e02c..ed20087a29 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1554,6 +1554,11 @@ gtk_window_constructed (GObject *object)
   gtk_widget_add_controller (GTK_WIDGET (object), GTK_EVENT_CONTROLLER (priv->click_gesture));
 
   g_list_store_append (toplevel_list, window);
+
+  gtk_accessible_update_state (GTK_ACCESSIBLE (window),
+                               GTK_ACCESSIBLE_STATE_HIDDEN, TRUE,
+                               -1);
+
   g_object_unref (window);
 }
 
@@ -7190,11 +7195,16 @@ gtk_window_destroy (GtkWindow *window)
     return;
 
   g_object_ref (window);
+
   gtk_tooltip_unset_surface (GTK_NATIVE (window));
 
+  gtk_window_hide (GTK_WIDGET (window));
+  gtk_accessible_update_state (GTK_ACCESSIBLE (window),
+                               GTK_ACCESSIBLE_STATE_HIDDEN, TRUE,
+                               -1);
+
   g_list_store_remove (toplevel_list, i);
 
-  gtk_window_hide (GTK_WIDGET (window));
   gtk_widget_unrealize (GTK_WIDGET (window));
 
   g_object_unref (window);


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