sdk: 事件分发形式化(§6.4)—— 统一命中/捕获/消费/层间隔离/焦点
根治「焦点/事件穿透」一类反复 bug。此前命中/捕获/消费/层间隔离各处 ad-hoc; 现上收为单一仲裁者(meow_ui_input.c),公共 API 只追加、不删改既有签名。 分发模型: - 触摸沿 z 序自顶向下命中(meow_draw_hit_topdown,owner==active+enable 过滤); - 命中即消费;模态层永远先审(meow_ui_modal_begin/end/active/depth); - down 捕获(meow_ui_gesture_begin/owner/end):命中目标捕获手势直到 up,防滑出误触下层; - 模态存在时下层完全收不到事件——hit_topdown 恒返回模态哨兵(背板消费,不透传); - meow_ui_run 在 TOUCH_DOWN 自动 begin、TAP/SWIPE/LONG_PRESS/NOTIF_PULL 自动 end。 焦点模型: - 唯一持有者(meow_ui_focus_acquire/release/owner/tap); - 点非 focus 区域→释放并通知(meow_ui_focus_tap,list 焦点残留根治); - 滚动容器(list/listview)tap_at 命中行自动 acquire,点外由 run 的 focus_tap 释放; - lost 回调(meow_ui_focus_set_lost_cb)通知转移。 迁移(行为修复,正常交互语义不变): - dialog/sheet → meow_ui_modal_begin/end(模态期下层收不到;叠黑由既有整帧快照+卡片仅重绘保证); - list/listview tap → meow_ui_focus_acquire; - 注入/叠加让位(overlay_input_suppressed)与模态层隔离互补,语义不变。 验证:新穿透矩阵 test_meow_ui_dispatch(M1 模态点下层不触发 / M2 弹层叠开两层层隔离 / M3 捕获手势滑出不误触 / M4 list 焦点点外释放)ALL PASS; 全量回归 widgets/ime_fix/pinyin/overlay_suppress/notif_gesture/sdk_fixes/sb_collapse/ p1p2p3_repro/box/anim/scroll/sdk_input_keys 全 PASS;交叉 -Wall -Wextra 0 warning。 meow_ui.a 新 md5:a9fcfb6eeb07ddbdd48039df4f8f18ce(主会话统一重链,本仓未重链 App)
This commit is contained in:
1 parent
c3abc3fee4
commit
54d2791f48
8 files changed
+428
-3
No files matched your search
@@ -898,6 +898,8 @@ int meow_list_tap_at(meow_widget *w, int x, int y)
|
||||
int idx = meow_list_hit_index(w, x, y);
|
||||
if (idx < 0) return -1;
|
||||
meow_list_set_selected(w, idx);
|
||||
/* §6.4:列表成为唯一焦点——点外由 meow_ui_focus_tap 统一释放(list 焦点残留根治)。 */
|
||||
meow_ui_focus_acquire((void *)w);
|
||||
if (w->tap_cb) w->tap_cb(idx, w->tap_ctx);
|
||||
return idx;
|
||||
}
|
||||
@@ -1163,6 +1165,7 @@ int meow_listview_tap_at(meow_widget *w, int x, int y)
|
||||
if (idx < 0) return -1;
|
||||
int op = meow_listview_hit_op(w, x, y);
|
||||
meow_listview_set_sel(w, idx);
|
||||
meow_ui_focus_acquire((void *)w); /* §6.4:列表成为唯一焦点(点外由 focus_tap 释放) */
|
||||
if (w->lv_tap_cb) w->lv_tap_cb(idx, op, w->lv_tap_ctx);
|
||||
return idx;
|
||||
}
|
||||
@@ -1191,7 +1194,8 @@ int meow_btn_pressed(meow_widget *w)
|
||||
void meow_slider_set(meow_widget *w, int val)
|
||||
{
|
||||
if (!w || w->type != W_SLIDER) return;
|
||||
if (val < w->min) val = w->min; if (val > w->max) val = w->max;
|
||||
if (val < w->min) val = w->min;
|
||||
if (val > w->max) val = w->max;
|
||||
if (val == w->val) return;
|
||||
w->val = val;
|
||||
meow_gfx_mark_dirty(w->x, w->y, w->w, w->h); /* 滑块/轨道随值变化:标脏 */
|
||||
|
||||
Reference in new issue
Block a user