Skip to main content

Module devtools

Module devtools 

Source
Expand description

The devtools panel, drawn by the core into any app’s frame.

Turned on by Core::set_devtools — or by KUI_DEVTOOLS in the environment, which the windowed runners read before the first frame (Core::devtools_from_env) — the panel sits beside the host’s tree in the main window (left, right, bottom; a handle on the pane’s inner edge resizes it), in a window of its own (window), or nowhere with its chords still live (off). It shows what the runtime is doing while the app runs: a header with the window’s title, the frame counter and an icon strip (the theme base, the accent, native menus, the placement), and three tabs —

  • facts: the latency graph; the status block — what the runtime believes right now, each row read from the door it comes from; and the key legend a host declared (Core::set_devtools_legend);
  • events: every UiEvent handed to the host from any window, as a virtual list whose rows open into the payload as data, with a filter, a pause and a follow toggle — plus every warning the core raised and the panel’s own notes;
  • tree: the main window’s last frame (Core::nodes), collapsible, filterable, with a picker that finds the node under the pointer from the app itself, and an inspector for the selected one.

The chords are Ctrl+Shift+<letter>, a family no app keymap should use while the panel is on: T cycles the base (the app’s own → light → dark), A the accent, M the menus (the platform’s own → native → drawn), D moves the panel (left → right → bottom → window → off; the header has a button per placement too), N the tab, C clears the stream, I moves the keyboard into the panel and back out, P picks a node, and Escape leaves the picker. The I chord alone is the app’s to respell (Core::set_devtools_key: f12, mod+shift+d, any Accel spelling), since it is the one an app names in its own help — the others are the panel’s, reached once the keyboard is in.

How it is in the frame. Docked, the main window’s begin_frame opens an app container under the root, keyed so the host’s children are named as if it were not there; the host’s configure_root is split between the two — layout and paint to the container, everything addressed to the root; Ui::finish closes the container and opens the dock as the root’s next child, under OriginId::DEVTOOLS. handle_input acts on the chords before routing and on every event of that origin before returning, and logs what it does return. Everything the panel declares in the main window is under Key::ROOT.str("kui-devtools"). State is the session’s, so a second window can draw the same panel from the same stream.

Enums§

Dock
Where the panel sits. The header has a button per placement, and Ctrl+Shift+D walks them in Dock::ALL’s order.
Tab
The panel’s tabs.

Constants§

BOTTOM_MIN_H
DEVTOOLS_KEY
The label of the node everything the panel declares in the main window is under, so key_of(DEVTOOLS_KEY) finds it — and a tree reader that wants the app alone skips its subtree.
DEVTOOLS_WINDOW
The name of the panel’s own window, when it has one: what Core::windows lists and Ui::window_name answers there.
DOCK_BOTTOM_H
Height of the bottom dock, logical px.
DOCK_SIDE_W
Width of the side dock, logical px.
SIDE_MIN_W
The smallest a docked pane can be — dragged, or squeezed by the window — and the least it leaves the app while the window allows.
STREAM_CAP
How many stream entries are kept.
WINDOW_SIZE
The size the popped-out window opens at.

Functions§

fmt_value
A Value as one line of data: {kind: click, n: 3}.