+
+static void
+spi_atk_tidy_windows (void)
+{
+ AtkObject *root;
+ gint n_children;
+ gint i;
+
+ root = atk_get_root ();
+ n_children = atk_object_get_n_accessible_children (root);
+ for (i = 0; i < n_children; i++)
+ {
+ AtkObject *child;
+ AtkStateSet *stateset;
+ CORBA_any any;
+ const gchar *name;
+
+ child = atk_object_ref_accessible_child (root, i);
+ stateset = atk_object_ref_state_set (child);
+
+ name = atk_object_get_name (child);
+ spi_init_any_string (&any, (char**) &name);
+ if (atk_state_set_contains_state (stateset, ATK_STATE_ACTIVE))
+ {
+ spi_atk_emit_eventv (G_OBJECT (child), 0, 0, &any, "window:deactivate");
+ }
+ g_free (stateset);
+
+ spi_atk_emit_eventv (G_OBJECT (child), 0, 0, &any, "window:destroy");
+ g_object_unref (child);
+ }
+}
+
+static void
+reinit_register_vars (void)
+{
+ registry = CORBA_OBJECT_NIL;
+ device_event_controller = CORBA_OBJECT_NIL;
+ this_app = NULL;
+}
+