sdk: full-sync M7.0a/b (theme view input gfx 等, 真实功能非FT)

This commit is contained in:
AskaEth committed 2026-09-03 06:51:44 +08:00
1 parent a70cdbc0f7
commit a1687486bc
7 files changed
+86 -8

No files matched your search

+27
View File
@@ -37,6 +37,12 @@ static char g_background[64] = ""; /* display.background(black
static meow_theme_listener g_listeners[8];
static int g_nlisteners = 0;
/* §8.1.5 色板注入:一份自定义板覆写当前生效主题(src==NULL 恢复内建)。
* 覆写优先于 settings 解析(随 meow_theme_reload() 重读 settings 后仍生效,与 meow_ui_set_style
* 的「程序化覆写不清 settings」语义一致)。 */
static meow_theme g_inject;
static int g_inject_set = 0;
/* ---- 读 /usr/data/meow/settings.conf 的 key=value(兼容 "key = value" 带空格形式)----
* 与 launcher meow_settings_import 同款解析:按 '=' 切分,key/value 各自去首尾空白,
* 精确匹配 key(避免 display.theme 误匹配 display.theme_mode)。返回 0=命中,-1=未命中。 */
@@ -295,6 +301,7 @@ static void broadcast(void)
/* 当前「style×mode」主题:style=0/1(MD3/MIUIX),dark=0(light)/1(dark)。 */
static const meow_theme *theme_current(int style, int dark)
{
if (g_inject_set) return &g_inject; /* §8.1.5 注入板优先 */
if (style < MEOW_STYLE_MD3) style = MEOW_STYLE_MD3;
if (style > MEOW_STYLE_MIUIX) style = MEOW_STYLE_MIUIX;
return &g_theme[style][dark ? 1 : 0];
@@ -339,6 +346,26 @@ meow_theme meow_theme_defaults(meow_theme_mode m)
return g_theme[MEOW_STYLE_MD3][resolve_mode(m) == MEOW_THEME_DARK ? 1 : 0];
}
/* ---- §8.1.5 色板导出/注入(单一权威桥)----
* 导出:把当前「style×mode」解析生效的完整权威主题拷给调用方(不取指针以防调用方误改内部表)。
* 注入:用一份自定义板覆写当前生效主题;NULL 恢复内建。二者都触发 load(g_loaded==0 时先读
* settings.conf),使宿主无 settings 文件(单测/脱机)也可靠。 */
void meow_theme_export(meow_theme *out)
{
if (!out) return;
const meow_theme *t = meow_theme_get(); /* 解析 g_mode(AUTO→明/暗)+ g_style + 背景覆写 */
*out = *t;
}
void meow_theme_inject(const meow_theme *src)
{
if (!g_loaded) { load_settings(); g_loaded = 1; }
if (!src) { g_inject_set = 0; broadcast(); return; }
g_inject = *src;
g_inject_set = 1;
broadcast(); /* 通知 App/状态栏/控件下一帧用新注入板重绘 */
}
/* ---- §8.1.2 顶级主题风格族(minimal)----
* meow_ui_style() 返回当前 ui.style(读取走 load_settings,随 meow_theme_reload() 重读,
* 故 launcher 改 settings.conf 后经 sb_sdk_refresh→theme_reload 即跟手)。