gui.gui_driver
gui 域包·驱动面(gui.ct 拆分阶段二⑤;2026-09-27 拆分规划)
内容:rt_window_loop 双循环(真窗+headless d 循环)+ rt_nokey 缺省键 + 入口 装配(rt_run/rt_run_kb/rt_run_d/rt_run_kb_d/rt_run_src/rt_run_kb_src/ rt_run_anchor)+ 入口与测试驱动(test/test_sk/Driver/d_* 全族)+ 输入辅助 (char_str/热重载探针/杂项)+ GUI-15 on:after 定时事件。 无 use 行:扁平视图名字解析全局;消费=门面 use gui.gui_driver.{test, d_frame, d_click, rt_run_kb_src}(锚例;其余 pub 符号照旧经 gui.{...} 请求)。
pub struct
struct Driver
| Field | Type |
|---|---|
var t |
GuiTree |
var rects |
List[I32] |
var hits |
List[I32] |
var hinst |
List[I32] |
var hov |
I32 |
var actn |
I32 |
var w |
I32 |
var h |
I32 |
var bt |
GuiTree |
var brects |
List[I32] |
var bhits |
List[I32] |
var bhinst |
List[I32] |
var bnd |
fn(List[Str]) -> Void |
pub fn
| Signature | Returns | Description |
|---|---|---|
rt_run(t: GuiTree, title: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
— |
rt_run_kb(t: GuiTree, title: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void, key: fn(I32) -> Void) |
I32 |
— |
rt_run_d(t: GuiTree, src: Str, title: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
d 变体:热重载路径 = 清单 gui.entry 烘焙值(J18;缺省 "app.ctml") |
rt_run_kb_d(t: GuiTree, src: Str, title: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void, key: fn(I32) -> Void) |
I32 |
— |
d_click(t: Box[Driver], name: Str) |
Str |
— |
d_hover(t: Box[Driver], name: Str) |
I32 |
交互态注入口(§2.1 headless):名→命中节点(d_btn_index 按钮面);"" 清除 |
d_active(t: Box[Driver], on: I32) |
I32 |
— |
d_ime_set(text: Str) |
I32 |
P-M3:headless 组词注入(test 驱动面;渲染即断言,零真窗) |
d_focus(t: Box[Driver]) |
I32 |
— |
d_blur(t: Box[Driver]) |
I32 |
— |
d_clip(t: Box[Driver], s: Str) |
I32 |
剪贴板注入口(headless 直控缓冲;真窗路径 rt_input_key 粘贴前自系统同步) |
d_mod(t: Box[Driver], on: I32) |
I32 |
修饰键注入口(headless;真窗 gui_mod_ctrl 回落 IsKeyDown) |
d_alt(t: Box[Driver], on: I32) |
I32 |
alt 修饰键注入口(headless;词跳/删词验收) |
d_tick(t: Box[Driver], ms: I32) |
I32 |
tick 注入(§2.7 headless):设定确定性时钟;光标闪烁等 tick 消费者激活 |
d_frames() |
I32 |
— |
gui_font_register(path: Str) |
I32 |
字体族注册(§2.8 P2):路径验载成功返回族 id(1..8,0=默认族),失败 -1; 样式侧 font_family: <id 数字>;combo 编码 = id*10000+字重 |
gui_hotkey(combo: Str, action: Str) |
I32 |
— |
d_send_char(t: Box[Driver], ch: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
headless 编辑管线注入口:注入→poll→焦点 input 编辑管线路由;消费返 0,未消费返原码 (与窗口循环同一管线;s33 键消费边界夹具依赖此语义) |
d_send_key(t: Box[Driver], k: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
— |
d_click_text(t: Box[Driver], x: I32, y: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
文本位置点击(headless):与窗口循环同一 rt_click_text 路径——连击阶梯 (词/行/全选)唯一断言口(d_click_xy 是按钮命中面,不含文本点击语义) |
d_drag(t: Box[Driver], x1: I32, y: I32, x2: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
拖拽(headless):override 鼠标位,武装+首发,再拖至终点触发;清覆盖 |
d_dragv(t: Box[Driver], x: I32, y1: I32, y2: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
垂直拖拽(headless):x 固定,y1→y2;两帧口径与 d_drag 同源(GUI-17 分隔条) |
d_drop(t: Box[Driver], paths: List[Str], bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
文件拖入(headless):paths 填 C 槽后直触 rt_drop_fire(真窗经 evt=6 分发; GUI-20 测试缝) |
d_dblclick(t: Box[Driver], name: Str) |
Str |
双击(headless):两击同位注入;返回元素 on:dblclick 处理头名(夹具 act 自 分发,与 d_click 同模式;真窗单双击聚类在循环 gui_click_kind) |
d_rclick(t: Box[Driver], x: I32, y: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
右键位置点击(headless):evt5 注入;与循环同路径开/关菜单 |
d_click_xy(t: Box[Driver], x: I32, y: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
位置点击(headless):注入 xy 点击→真实命中路径(后向最优先)+焦点转移+ev_fire ——遮罩吃穿透/卡片不透等位置语义的唯一断言口(d_click 按名绕过命中面) |
d_press_key(t: Box[Driver], k: I32) |
I32 |
— |
d_frame(t: Box[Driver], bind: fn(List[Str]) -> Void) |
I32 |
— |
d_render(t: Box[Driver]) |
I32 |
W2:零闭包重绘——Driver 持 bind(test/test_sk 构造时存),消 body 内 每帧转发闭包(|buf| __gui_bind_X(buf, m) 实现细节不再泄漏到用户面); d_frame 两参形保留兼容(存量夹具/README 驱动面不动) |
d_click_inst(t: Box[Driver], name: Str, inst: I32) |
Str |
注入字符事件(type 3),返回字符码(应用键钩子自行编辑模型) SL-8c-4④:实例分发按压——each 行按钮的驱动面(rt_hit_name "名:下标" 契约的镜像;按名+实例定矩形,补 d_click 单实例几何缺口) |
d_type_char(t: Box[Driver], k: I32) |
I32 |
— |
d_expect_text(t: Box[Driver], want: Str) |
I32 |
— |
d_cmd_count() |
I32 |
命令缓冲诊断访问器(自断言钩子/夹具排查用;type: 1=TEXT 2=RECT) |
d_cmd_type(i: I32) |
I32 |
— |
d_cmd_text_len(i: I32) |
I32 |
— |
d_cmd_text_byte(i: I32, j: I32) |
I32 |
— |
d_cmd_x100(i: I32) |
I32 |
几何(×100 整数域;黄金帧差分/夹具布局断言用) |
d_cmd_y100(i: I32) |
I32 |
— |
d_cmd_w100(i: I32) |
I32 |
— |
d_cmd_h100(i: I32) |
I32 |
— |
d_cmd_bg_r(i: I32) |
I32 |
颜色读回(RECT 命令背景色 0-255;交互态/主题折叠断言用) |
d_cmd_bg_g(i: I32) |
I32 |
— |
d_cmd_bg_b(i: I32) |
I32 |
— |
d_cmd_bg_a(i: I32) |
I32 |
— |
open_link(url: Str) |
I32 |
GUI-23:链接动作面——应用 on:click 内调 open_link;headless 槽记录, d_open_url 断言回收(真窗直 raylib OpenURL) |
d_open_url() |
Str |
— |
win_op(op: I32) |
I32 |
GUI-24:窗口操作面——1=fullscreen 2=maximize 3=minimize 4=restore 5=undecorated 6=bordered(headless 记录槽,真窗 raylib 生效;图标待图像管线) |
d_win_op_last() |
I32 |
— |
win_icon(path: Str) |
I32 |
窗口图标(headless 记录槽,真窗 LoadImage+SetWindowIcon) |
d_win_icon_last() |
Str |
— |
d_close_req(t: Box[Driver], bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
GUI-24 headless 驱动:模拟关闭请求——根有 on:close 则 fire(拦截语义, 脚本继续即「未退出」)返回 1;无声明 panic(真窗此时会退出) |
d_draw(t: Box[Driver], bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
GUI-25 headless 驱动:手动触发绘制帧(清点槽→同步盒→fire on:draw) |
d_px_n() |
I32 |
— |
d_px_at(i: I32, comp: I32) |
I32 |
— |
d_scroll(t: Box[Driver], delta: I32) |
I32 |
GUI-21 headless 驱动:滚动偏移累计(与真窗滚轮同槽) |
d_scroll_off() |
I32 |
— |
scroll_off() |
I32 |
应用面:当前滚动偏移(bind 组装可见窗口行消费) |
canvas_px(x: I32, y: I32, r: I32, g: I32, b: I32) |
I32 |
绘制原语(应用 on:draw 回调内调;坐标相对 canvas 盒) |
d_expect_absent(t: Box[Driver], want: Str) |
I32 |
负断言:want 不出现在任何 TEXT 命令(when 隐藏面) |
test(src: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void, key: fn(I32) -> Void, script: fn(Box[Driver], fn(Str, List[Str]) -> Void, fn(I32) -> Void) -> Void) |
I32 |
— |
test_sk(t: GuiTree, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void, key: fn(I32) -> Void, script: fn(Box[Driver], fn(Str, List[Str]) -> Void, fn(I32) -> Void) -> Void) |
I32 |
SL-7β2:骨架直通测试入口——树已由编译期解析(gui_sk_load)给出,不再经 gt_parse;其余口径与 test 完全一致(d_* 驱动断言族全可用) |
rt_run_src(src: Str, title: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
— |
rt_run_kb_src(src: Str, title: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void, key: fn(I32) -> Void) |
I32 |
— |
rt_run_anchor(title: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
d 变体:默认锚 = 清单 gui.entry 烘焙值(J18;缺省 "app.ctml")+ 热重载环 (60 帧内容比对,变更原址重解析) |
rt_run_kb_anchor(title: Str, w: I32, h: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void, key: fn(I32) -> Void) |
I32 |
— |
char_str(k: I32) |
Str |
字符码 → 单字符 Str(TextInput/type 3 事件;utf8_enc 透传) |
d_touch_press(t: Box[Driver], x: I32, y: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
— |
d_touch_release(t: Box[Driver], x: I32, y: I32, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
— |
d_touch_frame(t: Box[Driver], bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
`` | — |
d_ax_dump(t: Box[Driver]) |
Str |
— |
gui_board_open(title: Str, src: Str, x: I32, y: I32, w: I32, h: I32) |
I32 |
GUI-32 v1:浮板窗管器(单浮板;标量态驻 C)。gui_board_open 入请求队列; 循环 take→解析 src 为浮板 GuiTree→每帧 emit+指令平移 blit+板框直绘; 点击路由=板框内走浮板树(标题栏拖/关闭盒),板外走主树。 v1 边界:单浮板(多板=v2 C 数组扩展)/键闭包与滚轮主窗专用/热重载不涉浮板。 |
d_board_frame(t: Box[Driver], bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
`` | GUI-32 v1:浮板帧驱动(循环与 headless 共源)——pump 请求→独立 layout emit 浮板树(bh-24 内容区)→指令平移 blit 到(bx,by+24)→板 rects 收集 (区间型 2 命令)→标题栏/关闭盒浮条。bt 驻 Driver(循环局部持久)。 |
d_board_click(t: Box[Driver], x: I32, y: I32) |
Str |
浮板点击路由(headless+循环共享):0=板外(走主树)/1=板体(浮板树命中→fire) /2=标题栏(拖拽臂)/3=关闭盒。返回 fire 的动作名(空=未 fire) |
d_board_drag_to(t: Box[Driver], x: I32, y: I32) |
I32 |
浮板拖拽跟随(headless):拖拽中则落位 |
d_cmd_text_fg_r(i: I32) |
I32 |
TEXT fg 探针(富含色断言;pub extern 带参 E2020 怪相在册——包装 fn 绕行) |
d_cmd_text_fg_g(i: I32) |
I32 |
— |
d_cmd_text_fg_b(i: I32) |
I32 |
— |
d_async_drain(t: Box[Driver], bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
`` | headless 驱动面(d_frame 无 act 参——fixture 帧循环显式驱动) |
gui_async_post(s: Str) |
I32 |
spawn 任务投递入口(Str→char* 借用编组;Send 纪律 E3010 守卫) |
gui_async_on(action: Str) |
I32 |
异步动作注册(单 action;队列件=载荷) |
rt_after_pump(t: GuiTree, bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
到期泵:due 节点拆防即 fire(一次性);隐灶(seen 过期)不 fire |
d_after_pump(t: Box[Driver], bind: fn(List[Str]) -> Void, act: fn(Str, List[Str]) -> Void) |
I32 |
headless 泵(d_tick 注入时钟推进后由断言脚本显式调) |
ev_suffix_i(name: Str) |
I32 |
— |