pub fn update_if_active(
        &mut self,
        update_factory: impl FnOnce() -> TreeUpdate,
    ) -> Option<QueuedEvents> {
        match &self.state {
            State::Inactive { .. } => None,
            State::Placeholder(context) => {
                let is_window_focused = context.read_tree().state().is_host_focused();
                let tree = Tree::new(update_factory(), is_window_focused);
                *context.tree.write().unwrap() = tree;
                context.is_placeholder.store(false, Ordering::SeqCst);
                let result = context
                    .read_tree()
                    .state()
                    .focus_id()
                    .map(|id| QueuedEvents(vec![focus_event(context, id)]));
                self.state = State::Active(Arc::clone(context));
                result
            }
            State::Active(context) => {
                let mut handler = AdapterChangeHandler::new(context);
                let mut tree = context.tree.write().unwrap();
                tree.update_and_process_changes(update_factory(), &mut handler);
                handler.enqueue_selection_changes(&tree);
                Some(QueuedEvents(handler.queue))
            }
        }
    }
If and only if the tree has been initialized, call the provided function
and apply the resulting update. Note: If the caller's implementation of
[`ActivationHandler::request_initial_tree`] initially returned `None`,
the [`TreeUpdate`] returned by the provided function must contain
a full tree.

If a [`QueuedEvents`] instance is returned, the caller must call
[`QueuedEvents::raise`] on it.

This method may be safely called on any thread, but refer to
[`QueuedEvents::raise`] for restrictions on the context in which
it should be called.
platforms/windows/src/adapter.rs