core: 定义按键和鼠标事件
This commit is contained in:
@@ -33,14 +33,22 @@ typedef bool (*wm_layout_fn)(const wm_layout_ctx_t *ctx,
|
||||
typedef struct wm_layout_slot_t {
|
||||
wm_layout_id_t id;
|
||||
/*
|
||||
* 布局标识符,用于:
|
||||
* - 状态栏显示(应简短,如 "T", "M", "F")
|
||||
* - 日志输出
|
||||
* 布局稳定名称,用于:
|
||||
* - 配置引用
|
||||
* - 日志输出
|
||||
* - 调试输出
|
||||
*
|
||||
* 推荐使用可读名字,如 "tile"、"monocle"、"floating"。
|
||||
*/
|
||||
const char *name;
|
||||
/*
|
||||
* 布局符号,用于:
|
||||
* - 状态栏显示(应简短,如 "T", "M", "F")
|
||||
* - 紧凑场景下的快速识别
|
||||
*
|
||||
* 推荐使用 1-2 个字符的简短标识符。
|
||||
*/
|
||||
const char *name;
|
||||
const char *symbol;
|
||||
wm_layout_fn fn;
|
||||
} wm_layout_slot_t;
|
||||
|
||||
@@ -58,8 +66,18 @@ bool wm_layout_result_push(wm_layout_result_t *result, wm_layout_item_t item);
|
||||
|
||||
void wm_layout_registry_init(wm_layout_registry_t *registry);
|
||||
void wm_layout_registry_shutdown(wm_layout_registry_t *registry);
|
||||
size_t wm_layout_registry_count(const wm_layout_registry_t *registry);
|
||||
const wm_layout_slot_t *wm_layout_registry_at(
|
||||
const wm_layout_registry_t *registry, size_t index);
|
||||
|
||||
bool wm_layout_register(wm_layout_registry_t *registry, wm_layout_id_t id,
|
||||
wm_layout_fn fn);
|
||||
wm_layout_id_t wm_layout_register(wm_layout_registry_t *registry,
|
||||
const char *name, const char *symbol,
|
||||
wm_layout_fn fn);
|
||||
/*
|
||||
* layout registry 只允许在 bootstrap / 初始化阶段注册。
|
||||
* 运行时布局集合保持固定,只允许切换 workspace 当前选中的 layout_id。
|
||||
*/
|
||||
wm_layout_fn wm_layout_lookup(const wm_layout_registry_t *registry,
|
||||
wm_layout_id_t id);
|
||||
const wm_layout_slot_t *wm_layout_slot_get(const wm_layout_registry_t *registry,
|
||||
wm_layout_id_t id);
|
||||
|
||||
Reference in New Issue
Block a user