- reader: app.c/shelf.c/reader.c 全套UI; 新增 reader_conf(reader.conf)/settings(App设置页)/reader_ipc(音量翻页IPC响应); app.json加volume_page - launcher: keys.c meow_volpage_*门 + util.c app_id→fd映射(HELLO记fd/断开清) + app_launcher.c 前台三处接线(进入sink/按键路径volpage_key/离开clear) → 前台声明volume_page的App音量键→MSG_KEY_PAGEUP/PAGEDOWN翻页(非阅读器前台音量照旧) - sdk: meow_select.c 底部面板28 + meow_ui_dialog.c 对话框按钮胶囊(h/2) + test_meow_ui_select.c修采样 - meowpanel: /api/net/policy·/api/power/policy 加防自锁+policy默认关两条护栏(panel.policy_enabled默认0) - 文档: MEOW_APP_SDK.md §12.6 + meowpanel README端点表 0warning;宿主测试全过;二进制留批量批次未入库
78 lines
2.6 KiB
C
78 lines
2.6 KiB
C
/* app.c — os.meow.reader 应用装配层:main + 初始化 + 事件分发。
|
||
*
|
||
* 职责(SDK_VIEW_FRAMEWORK_DESIGN.md §B.2):main 只做 init/建页/跑事件循环/清理;把
|
||
* meow_ui_run 的平铺输入回调(key/tap/swipe/tick/touch)路由到当前活动页(shelf/reader)。
|
||
* 页面切换走 meow_view_page_push/pop(on_enter/on_leave 唯一入口)。
|
||
*/
|
||
#include "reader_internal.h"
|
||
#include "meow_ui_internal.h" /* 阅读页 blit 需要 back_buf 访问器(决策见报告) */
|
||
#include "app/reader_ipc.h"
|
||
#include <signal.h>
|
||
|
||
static meow_view *g_shelf_view;
|
||
static meow_view *g_reader_view;
|
||
static meow_view *g_settings_view;
|
||
|
||
static void on_sigterm(int s) { (void)s; meow_ui_request_exit(); }
|
||
|
||
static void app_on_key(int keycode, int is_down) { (void)keycode; (void)is_down; }
|
||
|
||
static void app_on_tap(int x, int y)
|
||
{
|
||
if (settings_is_active()) { settings_on_tap(x, y); return; }
|
||
if (reader_is_active()) { reader_on_tap(x, y); return; }
|
||
shelf_on_tap(x, y);
|
||
}
|
||
|
||
static void app_on_swipe(int dir, int dx, int dy)
|
||
{
|
||
(void)dy; (void)dx;
|
||
if (settings_is_active()) { return; } /* 设置页滑动不翻页 */
|
||
if (reader_is_active()) { reader_on_swipe(dir, dx, dy); return; }
|
||
if (shelf_is_active()) { shelf_on_swipe(dir, dx, dy); return; }
|
||
if (dir == MEOW_SWIPE_LEFT) { meow_ui_request_exit(); }
|
||
}
|
||
|
||
static void app_on_tick(void)
|
||
{
|
||
uint64_t now = meow_ui_time_ms();
|
||
if (reader_is_active()) { reader_on_tick(now); return; }
|
||
}
|
||
|
||
static void app_on_touch_down(int x, int y)
|
||
{
|
||
if (reader_is_active()) { reader_on_touch_down(x, y); return; }
|
||
}
|
||
static void app_on_touch_move(int x, int y)
|
||
{
|
||
if (reader_is_active()) { reader_on_touch_move(x, y); return; }
|
||
}
|
||
|
||
int main(void)
|
||
{
|
||
meow_log(MEOW_LOG_INFO, "start");
|
||
meow_ui_opts o = { 480, 720 };
|
||
if (meow_ui_init(&o) != 0) { meow_log(MEOW_LOG_ERROR, "init failed"); return 1; }
|
||
meow_theme_add_listener(NULL);
|
||
signal(SIGTERM, on_sigterm);
|
||
|
||
g_shelf_view = shelf_view_create();
|
||
g_reader_view = reader_view_create();
|
||
g_settings_view = settings_view_create();
|
||
|
||
meow_view_page_push(ACT_SHELF);
|
||
reader_ipc_start(); /* E:系统翻页信号接收(后台线程,best-effort) */
|
||
|
||
meow_ui_events ev = { app_on_key, app_on_tap, app_on_swipe, app_on_tick,
|
||
NULL, app_on_touch_down, app_on_touch_move };
|
||
meow_ui_run(&ev);
|
||
|
||
reader_ipc_stop();
|
||
meow_view_free(g_settings_view);
|
||
meow_view_free(g_reader_view);
|
||
meow_view_free(g_shelf_view);
|
||
meow_ui_shutdown();
|
||
meow_log(MEOW_LOG_INFO, "exit");
|
||
return 0;
|
||
}
|