sdk(M7.0a): 视图事件接线 + IconButton + 主题色板导出/注入(launcher 重写基座前置)

M7 launcher 整体 MD3 重写的 SDK 基座补全(只动 patch_v2/sdk/):
- 缺口#7 meow_view 事件接线:meow_view_dispatch_event 接入 meow_ui_run 主循环
  (§6.4 分流之上,TAP/KEY/SWIPE/LONG_PRESS 先经 view 路由、命中即消费、未命中回落
  on_* —— 无 view 树/未命中完全向后兼容);meow_view_add_child 在父已进入时挂子视图
  立即进入(递归 children 修正);meow_view_sub_push/pop 标注废弃(设计定案 b 不做页内
  子导航栈)。
- 缺口#2 IconButton:meow_iconbtn_create —— sb_icons 位图 + 圆形命中 + 按压/按住态
  (实时,同 meow_btn)+ owner/enabled 闸门;电源菜单/播放控制/锁屏通用件。
- 缺口#6 SDK 半主题收口:meow_theme_export/meow_theme_inject(§8.1.5 色板导出/注入),
  launcher s_ui_theme() 将据此变读 SDK 的薄壳(launcher 侧改动不在此批)。
- 文档:MEOW_APP_SDK.md 补 meow_iconbtn_create + meow_theme_export/inject 说明。
- 验证:新增 test_meow_ui_iconbtn / test_meow_ui_theme_export / test_meow_ui_view_event
  全 PASS;全量 SDK 宿主回归(widgets/dispatch/box/anim/scroll/listvirt/str/ime/pinyin/
  overlay/notif/input_keys/p1p2p3/umbrella/ft)全 PASS;交叉 -Wall -Wextra 0 warning。

meow_ui.a md5: be24214e24faadba63577f3a98c2c9d1 -> 7fc83f7731cadb2f91df1c3ed7d3814f
This commit is contained in:
AskaEth committed 2026-09-02 16:50:40 +08:00
1 parent e67cc50afa
commit a8c51be1fc
12 files changed
+595 -11

No files matched your search

+12
View File
@@ -26,6 +26,7 @@
#include "meow_ui_sys.h"
#include "meow_ui_vol.h"
#include "meow_ui_media.h"
#include "meow_ui_view.h" /* M7.0a 缺口#7:把 meow_view_dispatch_event 接入 meow_ui_run */
#include <stdio.h>
#include <stdlib.h>
@@ -714,8 +715,14 @@ void meow_ui_run(const meow_ui_events *ev)
/* §6.1 触摸分流:③ 系统全局(IME/状态栏…已在上面消费) → ② App 全局控件
* (命中返回 1=消费,否则落到 ① active Activity 页面控件)。 */
if (meow_ui_global_hit(e.a, e.b)) continue;
/* M7.0a 缺口#7:meow_view 事件路由(§A.7)——有活动页 view 子树且其 on_event
* 命中即消费(不再落 App on_tap);无 view 树/未命中返回 0 → 回落 on_tap 原路径。 */
if (meow_view_dispatch_event(MEOW_EV_TAP, e.a, e.b)) continue;
if (g_events_set && g_events.on_tap) g_events.on_tap(e.a, e.b);
} else if (e.type == MEOW_EV_KEY) {
/* M7.0a 缺口#7:先进 view 路由,命中即消费;否则回落 App on_key(语义不变——
* 音量/媒体系统键已在输入线程消化,这里只决定 App/页面是否收到语义事件)。 */
if (meow_view_dispatch_event(MEOW_EV_KEY, e.a, e.b)) continue;
if (g_events_set && g_events.on_key) g_events.on_key(e.a, e.b);
} else if (e.type == MEOW_EV_SWIPE) {
if (in_startup) continue; /* 启动残留被当左缘滑动:丢弃,防进入即返回 */
@@ -725,6 +732,9 @@ void meow_ui_run(const meow_ui_events *ev)
/* 拼音 IME 候选栏横滑翻页(英文模式 handle_event 返回 0 → 沿用既有行为)。 */
if (meow_ime_active() && meow_ime_handle_event(&e)) continue;
meow_ui_gesture_end(); /* §6.4:抬手(滑动)边沿,释放手势捕获 */
/* M7.0a 缺口#7:view 路由先于 App 窗口的 on_swipe 与默认返回手势——页 view
* 可消费滑动(页内返回/翻页/横幅);命中即跳过下面对 on_swipe/默认退出的分发。 */
if (meow_view_dispatch_event(MEOW_EV_SWIPE, e.a, e.b)) continue;
/* A-0 全局左缘返回(方案A):
* - APP 注册 on_swipe → APP 接管,自行决定(meow_ui_request_exit / 页内返回);
* - APP 未注册 on_swipe 且非全屏(sb_active)→ SDK 默认退出 app(返回=退出);
@@ -783,6 +793,8 @@ void meow_ui_run(const meow_ui_events *ev)
/* 拼音 IME 打开:长按退格清空字段(英文模式 handle_event 返回 0 → 走既有长按回调)。 */
if (meow_ime_active() && meow_ime_handle_event(&e)) continue;
meow_ui_gesture_end(); /* §6.4:长按已触发,其抬手不再 TAP/SWIPE——顺手释放捕获 */
/* M7.0a 缺口#7:view 路由先于 §6.3 通用长按回调(页 view 可消费长按)。 */
if (meow_view_dispatch_event(MEOW_EV_LONG_PRESS, e.a, e.b)) continue;
if (g_long_press_cb) g_long_press_cb(e.a, e.b);
}
}