主要变更: - 数据结构简化 - 合并窗口元数据到 wm_window_t(删除 wm_window_meta.h) - 合并工作区名称到 wm_workspace_t(删除 wm_workspace_desc.h) - 简化布局标识符,只保留 name 字段 - 删除 window_map,采用直接索引+线性查找 - 架构设计完善 - 确定 window→workspace→output 固定归属关系 - 制定 ID 分配策略(半静态实体直接索引,动态实体线性查找) - 确定显示器热插拔策略(检测到变化时重启 WM) - 添加工作区配置示例和多种配置方式 - 新增模块 - wm_policy_config.h:策略配置开关 - wm_service.h:核心外服务注册和事件订阅 - WM_EVENT_ROUTING.org:事件路由详细文档 - WORKSPACE_CONFIG_EXAMPLES.org:工作区配置示例 - MINIMAL_CORE_WITH_EXTENSIONS.org:设计对比文档 - config_system.org:配置系统设计 - 文档完善 - 大幅扩展 README.org,补充 ID 分配、热插拔、配置集成等说明 - 更新 WM_COMMAND_RULES.org,补充命令规则细节 - 更新 WM_POLICY_APPLY_COMMAND_SKELETON.org,完善实现骨架
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include "wm_state.h"
|
|
|
|
typedef enum wm_service_event_type_t {
|
|
WM_SERVICE_EVENT_NONE,
|
|
WM_SERVICE_EVENT_RUNTIME_STARTED,
|
|
WM_SERVICE_EVENT_RUNTIME_STOPPING,
|
|
WM_SERVICE_EVENT_RENDER_OUTPUT,
|
|
} wm_service_event_type_t;
|
|
|
|
typedef struct wm_service_event_t {
|
|
wm_service_event_type_t type;
|
|
union {
|
|
struct {
|
|
wm_output_id_t output_id;
|
|
} render_output;
|
|
} as;
|
|
} wm_service_event_t;
|
|
|
|
typedef struct wm_service_t wm_service_t;
|
|
|
|
typedef struct wm_service_api_t {
|
|
bool (*init)(wm_service_t *service);
|
|
void (*handle_event)(wm_service_t *service, const wm_service_event_t *event,
|
|
const wm_state_t *state);
|
|
void (*shutdown)(wm_service_t *service);
|
|
} wm_service_api_t;
|
|
|
|
struct wm_service_t {
|
|
const wm_service_api_t *api;
|
|
void *impl;
|
|
};
|
|
|
|
typedef struct wm_service_registry_t {
|
|
wm_service_t *items;
|
|
size_t count;
|
|
size_t capacity;
|
|
} wm_service_registry_t;
|
|
|
|
void wm_service_registry_init(wm_service_registry_t *registry);
|
|
void wm_service_registry_shutdown(wm_service_registry_t *registry);
|
|
|
|
bool wm_service_registry_register(wm_service_registry_t *registry,
|
|
wm_service_t service);
|