Files
zdwm/docs/min_core_draft/wm_layout.h
Zedhugh Chen 329943ab3e 完善最小核心架构设计和数据结构简化
主要变更:

- 数据结构简化
  - 合并窗口元数据到 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,完善实现骨架
2026-03-11 05:28:39 +08:00

66 lines
1.8 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "wm_types.h"
typedef struct wm_layout_window_ref_t {
wm_window_id_t window_id;
wm_window_geometry_mode_t geometry_mode;
} wm_layout_window_ref_t;
typedef struct wm_layout_ctx_t {
wm_output_id_t output_id;
wm_workspace_id_t workspace_id;
wm_window_id_t focused_window_id;
wm_rect_t workarea;
const wm_layout_window_ref_t *windows;
size_t window_count;
} wm_layout_ctx_t;
typedef struct wm_layout_item_t {
wm_window_id_t window_id;
wm_rect_t rect;
} wm_layout_item_t;
typedef struct wm_layout_result_t {
wm_layout_item_t *items;
size_t item_count;
size_t item_capacity;
} wm_layout_result_t;
typedef bool (*wm_layout_fn)(const wm_layout_ctx_t *ctx,
wm_layout_result_t *out);
typedef struct wm_layout_slot_t {
wm_layout_id_t id;
/*
* 布局标识符,用于:
* - 状态栏显示(应简短,如 "T", "M", "F"
* - 日志输出
* - 配置引用
*
* 推荐使用 1-2 个字符的简短标识符。
*/
const char *name;
wm_layout_fn fn;
} wm_layout_slot_t;
typedef struct wm_layout_registry_t {
wm_layout_slot_t *slots;
size_t slot_count;
size_t slot_capacity;
} wm_layout_registry_t;
void wm_layout_result_init(wm_layout_result_t *result);
void wm_layout_result_reset(wm_layout_result_t *result);
void wm_layout_result_shutdown(wm_layout_result_t *result);
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);
bool wm_layout_register(wm_layout_registry_t *registry, wm_layout_id_t id,
wm_layout_fn fn);
wm_layout_fn wm_layout_lookup(const wm_layout_registry_t *registry,
wm_layout_id_t id);