引入 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 路径同步更新
54 lines
1.0 KiB
C
54 lines
1.0 KiB
C
#pragma once
|
|
|
|
#include <cairo.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <zdwm/action.h>
|
|
#include <zdwm/bar.h>
|
|
#include <zdwm/types.h>
|
|
|
|
#include "bar/text.h"
|
|
#include "bar/types.h"
|
|
#include "base/color.h"
|
|
#include "common/listeners.h"
|
|
|
|
typedef struct bar_output_t {
|
|
cairo_t *cr;
|
|
zdwm_window_id_t window_id;
|
|
zdwm_output_id_t output_id;
|
|
int32_t width;
|
|
int32_t height;
|
|
bar_side_t left;
|
|
bar_side_t right;
|
|
zdwm_bar_item_t center;
|
|
} bar_output_t;
|
|
|
|
typedef struct bar_palette_t {
|
|
color_t bg;
|
|
} bar_palette_t;
|
|
|
|
typedef struct bar_t {
|
|
bar_output_t *bars;
|
|
size_t count;
|
|
|
|
bool visible;
|
|
int timerfd;
|
|
|
|
zdwm_bar_config_t config;
|
|
bar_palette_t palette;
|
|
text_context_t *ctx;
|
|
} bar_t;
|
|
|
|
void bar_init(bar_t *bar, listeners_t *listeners);
|
|
void bar_cleanup(bar_t *bar);
|
|
void bar_update(bar_t *bar);
|
|
bool bar_draw(bar_t *bar);
|
|
|
|
typedef struct bar_click_info_t {
|
|
zdwm_window_id_t window;
|
|
int32_t x;
|
|
zdwm_modifier_mask_t modifiers;
|
|
zdwm_button_t button;
|
|
} bar_click_info_t;
|
|
bool bar_click(bar_t *bar, bar_click_info_t info, zdwm_action_t *action);
|