feat(layouts): 实现 fair/fullscreen/maximize 内置布局

This commit is contained in:
2026-04-27 18:38:49 +08:00
parent 10fa3740a8
commit 7413d7439a
13 changed files with 164 additions and 16 deletions

View File

@@ -18,8 +18,9 @@ extern "C" {
typedef struct zdwm_config_builder_t zdwm_config_builder_t;
typedef struct zdwm_builtin_layouts_t {
zdwm_layout_fn tile;
zdwm_layout_fn monocle;
zdwm_layout_fn fair;
zdwm_layout_fn fullscreen;
zdwm_layout_fn maximize;
} zdwm_builtin_layouts_t;
typedef struct zdwm_api_t {

View File

@@ -14,6 +14,7 @@ extern "C" {
typedef struct zdwm_layout_ctx_t {
zdwm_workspace_id_t workspace_id;
zdwm_window_id_t focused_window_id;
zdwm_rect_t output_geometry;
zdwm_rect_t workarea;
const zdwm_window_id_t *window_ids;
size_t window_count;
@@ -30,6 +31,11 @@ typedef struct zdwm_layout_result_t {
size_t item_capacity;
} zdwm_layout_result_t;
/**
* @brief 自动布局算法
*
* @return out 有变化返回 true 否则返回 true
*/
typedef bool (*zdwm_layout_fn)(
const zdwm_layout_ctx_t *ctx,
zdwm_layout_result_t *out