refactor: 从 core 中抽出跨模块契约建立 interface/common 模块分层

引入 interface/(零实现声明层)与 common/(共享 ADT 操作层),把跨模块
契约从 core 实现里抽出来,依赖方向回到单向(base ← interface ← common ←
各实现层)。docs/module-layering.org 记录完整方案与判定标准。

interface/(纯类型与多态接口声明,零 .c):
- types.h / event.h / backend.h 从 core 移入
- effect.h 新建(effect_t 从 plan.h 抽出)

common/(多实现层共用的自包含操作,.h + .c):
- event.{h,c}:event_reset / event_cleanup
- listeners.{h,c}:listeners 维护(add / cleanup);notify 留 core
- window.{h,c}:window_list + layer_props/metadata cleanup + window_classify_layer
- workspace.{h,c}:workspace_desc(从 wm_desc.h 拆出,改真实函数)

window 相关整理:
- window_layer_type_t 上浮 interface/types.h(common 的 classify 需要)
- window_classify_layer 移 common/window
- window_info_t 独立成 core/window_info.h(state/command 共享,不寄生)
- 删除 wm_desc.h,base/window_list 并入 common/window

全项目 include 路径同步更新
This commit is contained in:
2026-06-25 03:00:30 +08:00
parent e1113c0052
commit 079f41ce8a
57 changed files with 686 additions and 657 deletions

View File

@@ -20,7 +20,6 @@
#include "base/macros.h"
#include "base/memory.h"
#include "base/time.h"
#include "core/listeners.h"
static zdwm_bar_item_t *bar_add_item(
zdwm_output_id_t output_id,

View File

@@ -10,7 +10,7 @@
#include "bar/text.h"
#include "bar/types.h"
#include "base/color.h"
#include "core/listeners.h"
#include "common/listeners.h"
typedef struct bar_output_t {
cairo_t *cr;

View File

@@ -9,7 +9,7 @@
#include <zdwm/types.h>
#include "base/memory.h"
#include "core/listeners.h"
#include "common/listeners.h"
typedef struct bar_binding_state_t {
zdwm_binding_mode_notify_t mode;

View File

@@ -3,7 +3,7 @@
#include <stdint.h>
#include <zdwm/bar.h>
#include "core/listeners.h"
#include "common/listeners.h"
typedef struct bar_binding_config_t {
bool show_default;

View File

@@ -8,7 +8,7 @@
#include "base/array.h"
#include "base/memory.h"
#include "core/listeners.h"
#include "common/listeners.h"
typedef struct bar_windows_state_t {
zdwm_output_id_t output_id;

View File

@@ -3,7 +3,7 @@
#include <stdint.h>
#include <zdwm/bar.h>
#include "core/listeners.h"
#include "common/listeners.h"
typedef struct bar_windows_config_t {
uint32_t cell_padding;

View File

@@ -10,7 +10,7 @@
#include "base/array.h"
#include "base/memory.h"
#include "core/listeners.h"
#include "common/listeners.h"
typedef struct bar_workspace_t {
zdwm_workspace_t info;

View File

@@ -3,7 +3,7 @@
#include <stdint.h>
#include <zdwm/bar.h>
#include "core/listeners.h"
#include "common/listeners.h"
typedef struct bar_workspace_config_t {
uint32_t cell_padding;