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.
This commit is contained in:
Matthias Clasen
2020-10-24 15:23:12 -04:00
parent 274f9ad919
commit bba6d604f0

View File

@@ -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);