initialTreeUpdate
Creates the initial tree update when accessibility information is first requested by the OS The initial tree only contains basic window details. These are updated when frameTreeUpdate runs. Note: This callback can occur on a non-gui thread.
Parameters
- instance:?*anyopaque
- ?*anyopaque
Source
Implementation
pub fn initialTreeUpdate(instance: ?*anyopaque) callconv(.c) ?*TreeUpdate {
var self: *AccessKit = @ptrCast(@alignCast(instance));
const io = dvui.io;
self.mutex.lockUncancelable(io);
defer self.mutex.unlock(io);
const root = nodeNew(Role.window.asU8()) orelse @panic("null");
const tree = treeNew(0) orelse @panic("null");
const result = treeUpdateWithCapacityAndFocus(1, 0);
treeUpdateSetTree(result, tree);
treeUpdatePushNode(result, 0, root);
self.status = .starting;
// Refresh so that the full tree is sent next frame.
const window: *dvui.Window = @alignCast(@fieldParentPtr("accesskit", self));
dvui.refresh(window, @src(), null);
return result;
}