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:
@@ -4,8 +4,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/memory.h"
|
||||
#include "core/backend.h"
|
||||
#include "core/types.h"
|
||||
#include "interface/backend.h"
|
||||
#include "interface/types.h"
|
||||
|
||||
static inline int32_t right(rect_t a) { return a.x + a.width; }
|
||||
static inline int32_t bottom(rect_t a) { return a.y + a.height; }
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "core/backend.h"
|
||||
#include "core/types.h"
|
||||
#include "interface/backend.h"
|
||||
|
||||
backend_detect_t *
|
||||
output_remove_duplication(const output_info_t *output, const size_t count);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "core/backend.h"
|
||||
#include "interface/backend.h"
|
||||
|
||||
#include <cairo-xcb.h>
|
||||
#include <cairo.h>
|
||||
@@ -25,11 +25,7 @@
|
||||
#include "base/log.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory.h"
|
||||
#include "base/window_list.h"
|
||||
#include "core/event.h"
|
||||
#include "core/plan.h"
|
||||
#include "core/types.h"
|
||||
#include "core/window.h"
|
||||
#include "common/window.h"
|
||||
#include "internal.h"
|
||||
|
||||
typedef struct atom_item_t {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <xcb/xproto.h>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "core/types.h"
|
||||
#include "interface/types.h"
|
||||
|
||||
typedef struct modifier_map_t {
|
||||
modifier_bit_t modifier;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <stdint.h>
|
||||
#include <xcb/xproto.h>
|
||||
|
||||
#include "core/types.h"
|
||||
#include "interface/types.h"
|
||||
|
||||
modifier_mask_t modifiers_xcb_to_zdwm(uint16_t mask);
|
||||
uint16_t modifiers_zdwm_to_xcb(modifier_mask_t mask);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "core/event.h"
|
||||
#include "common/event.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
@@ -12,9 +12,8 @@
|
||||
#include "backend/x11/common.h"
|
||||
#include "backend/x11/window.h"
|
||||
#include "base/memory.h"
|
||||
#include "core/backend.h"
|
||||
#include "core/types.h"
|
||||
#include "core/window.h"
|
||||
#include "interface/backend.h"
|
||||
#include "interface/event.h"
|
||||
#include "internal.h"
|
||||
|
||||
static window_state_t *derive_window_states(
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include <xcb/xcb_keysyms.h>
|
||||
#include <xcb/xproto.h>
|
||||
|
||||
#include "base/window_list.h"
|
||||
#include "core/event.h"
|
||||
#include "common/window.h"
|
||||
#include "interface/event.h"
|
||||
|
||||
#define EWMH_ATOMS(X) \
|
||||
X(_NET_WM_NAME) \
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "backend/x11/cursor.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory.h"
|
||||
#include "core/backend.h"
|
||||
#include "core/types.h"
|
||||
#include "internal.h"
|
||||
|
||||
static char *window_get_text_property(
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <xcb/xproto.h>
|
||||
|
||||
#include "base/app.h"
|
||||
#include "core/backend.h"
|
||||
#include "interface/backend.h"
|
||||
#include "internal.h"
|
||||
|
||||
typedef struct atoms_t atoms_t;
|
||||
|
||||
Reference in New Issue
Block a user